@reqvire-org/ads 0.3.53 → 0.4.2
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 +114 -94
- package/dist/a11y.mjs +108 -29
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +140 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +15 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +146 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +164 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +6 -6
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +222 -79
- package/dist/boundaries.mjs +137 -40
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +34 -13
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +66 -0
- package/dist/check.mjs +756 -196
- package/dist/cli.mjs +203 -100
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +2 -2
- package/dist/config.mjs +308 -163
- package/dist/construction-styles.cjs +10 -0
- package/dist/contracts.d.mts +9 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +7 -5
- package/dist/font-rules.mjs +2 -2
- package/dist/fonts-generated.mjs +4 -2
- package/dist/foundation-views.mjs +238 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +198 -0
- package/dist/icons.mjs +80 -33
- package/dist/image-attributes.mjs +109 -36
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +128 -68
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +300 -127
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +91 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +978 -343
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +701 -219
- package/dist/mcp/preview-watch.mjs +465 -161
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +6 -6
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2436 -570
- package/dist/mcp/showcase-host.mjs +176 -39
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/preview-bun.mjs +493 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +10 -0
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +70 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
- package/dist/render-audit.mjs +828 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +768 -359
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +424 -159
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +18 -0
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +55 -0
- package/dist/showcase/foundation-view.mjs +252 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1062 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +152 -144
- package/dist/skills/ads-designer/references/accessibility.md +14 -11
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +34 -30
- package/dist/skills/ads-designer/references/branding.md +98 -10
- package/dist/skills/ads-designer/references/captures.md +31 -31
- package/dist/skills/ads-designer/references/cli.md +21 -20
- package/dist/skills/ads-designer/references/contracts.md +63 -29
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +71 -52
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +58 -51
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/performance.md +3 -2
- package/dist/skills/ads-designer/references/review.md +42 -38
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +17 -19
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -71
- package/dist/skills/ads-designer/references/workflows.md +19 -37
- package/dist/skills/ads-import/SKILL.md +43 -328
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +34 -30
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +31 -31
- package/dist/skills/ads-import/references/cli.md +21 -20
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +63 -29
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +71 -52
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +58 -51
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +42 -38
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +17 -19
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -71
- package/dist/skills/ads-import/references/workflows.md +19 -37
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +54 -346
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +34 -30
- package/dist/skills/ads-port/references/captures.md +31 -31
- package/dist/skills/ads-port/references/cli.md +21 -20
- package/dist/skills/ads-port/references/contracts.md +63 -29
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +71 -52
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +58 -51
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +8 -7
- package/dist/skills/ads-port/references/review.md +42 -38
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +17 -19
- package/dist/skills/ads-port/references/validation.md +83 -71
- package/dist/skills/ads-port/references/workflows.md +19 -37
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +266 -128
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +24 -19
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +54 -52
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/index.ts +5 -8
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +24 -19
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +73 -27
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +133 -60
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +60 -19
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +270 -89
- package/dist/units.mjs +215 -180
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +121 -38
- package/dist/validation-inputs.mjs +187 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +100 -89
- package/docs/ARCHITECTURE.md +353 -159
- package/docs/BEHAVIORS.md +33 -28
- package/docs/CACHING.md +55 -11
- package/docs/CHANGELOG.md +358 -17
- package/docs/COMPARISON.md +1 -1
- package/docs/CONTRACTS.md +22 -29
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +313 -292
- package/docs/MCP.md +261 -439
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +42 -34
- package/dist/browser-audit.mjs +0 -424
- package/dist/contract-migration.mjs +0 -110
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -48
- package/dist/mcp/draft-exports.mjs +0 -40
- package/dist/mcp/edit-preparation.mjs +0 -115
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -88
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -415
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -411
- package/dist/skills/ads-break-ui/references/captures.md +0 -160
- package/dist/skills/ads-break-ui/references/contracts.md +0 -284
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -178
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -154
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -96
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -162
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -83
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -388
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -411
- package/dist/skills/ads-motion/references/captures.md +0 -160
- package/dist/skills/ads-motion/references/contracts.md +0 -284
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -178
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -154
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -96
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -162
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -83
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -5
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { analyze } from "./analysis/service.mjs";
|
|
2
3
|
import { readFileSync } from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { loadConfig } from "./config.mjs";
|
|
6
|
+
|
|
5
7
|
import { enterMemoryBudget } from "./resource-limits.mjs";
|
|
6
8
|
import { assertBunRuntime } from "./runtime-requirements.mjs";
|
|
7
9
|
|
|
8
10
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
9
11
|
const help = `ADS ${pkg.version} — tooling for a project's local design system
|
|
10
12
|
|
|
11
|
-
Usage: ads
|
|
12
|
-
ads init [options] Run inside your project
|
|
13
|
+
Usage: ads init [options] Run inside your project
|
|
13
14
|
ads <command> [directory] [--json]
|
|
14
15
|
|
|
15
|
-
create <directory> Create a project from this version's starter, then init it
|
|
16
16
|
init Set up ADS in the current project (requires package.json)
|
|
17
17
|
check [directory] Check tokens, ownership, imports, and showcase coverage
|
|
18
18
|
compile [directory] Build ADS previews with Bun (--watch for incremental previews)
|
|
19
|
-
validate [dir]
|
|
20
|
-
|
|
21
|
-
both run the browser audit unless its browserAudit is false
|
|
19
|
+
validate [dir] The project gate: ads check, acceptance.scripts and validation.scripts,
|
|
20
|
+
and every behavior test and render audit the change set reaches
|
|
22
21
|
behaviors [dir] Inspect behavior contracts and current verification evidence
|
|
23
22
|
verify [directory] Run registered behavior checks (--unit and --check select)
|
|
24
23
|
audit [directory] Run axe-core, non-text contrast, layout shift and overflow checks in each rendered
|
|
@@ -28,24 +27,23 @@ Usage: ads create <directory> --framework react|preact New design-system proje
|
|
|
28
27
|
--format dtcg prints them as W3C Design Tokens JSON;
|
|
29
28
|
--theme <name> exports that theme's values (default: the first)
|
|
30
29
|
--brand <name> exports that brand's values (default: the first)
|
|
31
|
-
assets [directory] Generate configured brand assets, glyphs, themes.generated.css and .ts
|
|
32
|
-
|
|
30
|
+
assets [directory] Generate configured brand assets, glyphs, themes.generated.css and .ts,
|
|
31
|
+
the styles entry, and the public/review barrels from .ads.exports.ts files
|
|
33
32
|
mcp [directory] Serve stdio MCP tools/Apps and the local showcase website
|
|
34
33
|
showcase [directory] Serve the built-in MCP client website (no stdio connection)
|
|
35
34
|
|
|
36
35
|
--help Show this help
|
|
37
36
|
--version Show the tool version
|
|
38
|
-
--framework name
|
|
39
|
-
--
|
|
40
|
-
--tool-package spec
|
|
41
|
-
--package-manager pm Create/init: npm or bun (create default npm; init detects it)
|
|
37
|
+
--framework name Init: react or preact (required until saved in config)
|
|
38
|
+
--include-starter Init: also add the starter's example design system and app files the project lacks
|
|
39
|
+
--tool-package spec Init: tool version or local tarball for devDependency
|
|
42
40
|
--port number MCP/showcase only: loopback website port (default: automatic)
|
|
43
41
|
--no-showcase MCP only: disable the local website
|
|
44
42
|
--mutations MCP only: enable guarded ADS source editing
|
|
45
43
|
--unit id Verify only: select one discovered behavior contract owner
|
|
46
44
|
--check id Verify only: select a registered check (repeatable)
|
|
47
45
|
--scenario id Audit only: select a discovered scenario (repeatable)
|
|
48
|
-
--changed Validate only:
|
|
46
|
+
--changed Validate only: what changed since the last successful full validation
|
|
49
47
|
--fresh Check/validate: execute batch checks without task-cache reads
|
|
50
48
|
|
|
51
49
|
External components and examples are imported using the ADS skills.
|
|
@@ -53,54 +51,58 @@ No component library or example catalogue is bundled.
|
|
|
53
51
|
`;
|
|
54
52
|
|
|
55
53
|
async function main(args) {
|
|
56
|
-
if (!args.length || args.includes("--help")) {
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
if (!args.length || args.includes("--help")) {
|
|
55
|
+
process.stdout.write(help);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (args.length === 1 && args[0] === "--version") {
|
|
59
|
+
console.log(pkg.version);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
assertBunRuntime();
|
|
59
63
|
let json = false;
|
|
60
64
|
let toolPackage;
|
|
61
|
-
let
|
|
65
|
+
let includeStarter = false;
|
|
62
66
|
let framework;
|
|
63
|
-
let name;
|
|
64
67
|
let format, theme;
|
|
65
68
|
let brand;
|
|
66
69
|
let port;
|
|
67
70
|
let unit;
|
|
68
|
-
const selectedChecks = [],
|
|
71
|
+
const selectedChecks = [],
|
|
72
|
+
selectedScenarios = [];
|
|
69
73
|
let showcase = true;
|
|
70
74
|
let mutations = false;
|
|
71
|
-
let changed = false,
|
|
75
|
+
let changed = false,
|
|
76
|
+
watched = false,
|
|
77
|
+
fresh = false;
|
|
72
78
|
const positional = [];
|
|
73
79
|
for (let index = 0; index < args.length; index++) {
|
|
74
80
|
const argument = args[index];
|
|
75
81
|
if (argument === "--json") json = true;
|
|
76
|
-
else if(argument === "--watch") watched = true;
|
|
82
|
+
else if (argument === "--watch") watched = true;
|
|
77
83
|
else if (argument === "--changed") changed = true;
|
|
78
84
|
else if (argument === "--fresh") fresh = true;
|
|
79
|
-
else if (argument === "--policy") {if(policy!==undefined || !["acceptance","validation"].includes(args[index+1]))throw new Error("--policy requires acceptance or validation.");policy=args[++index];}
|
|
80
85
|
else if (argument === "--no-showcase") showcase = false;
|
|
81
86
|
else if (argument === "--mutations") mutations = true;
|
|
82
87
|
else if (argument === "--unit" || argument === "--check") {
|
|
83
88
|
const value = args[++index];
|
|
84
89
|
if (!value || value.startsWith("-")) throw new Error(`${argument} needs a discovered unit/check ID.`);
|
|
85
|
-
if (argument === "--unit") {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
if (argument === "--unit") {
|
|
91
|
+
if (unit) throw new Error("Specify one --unit.");
|
|
92
|
+
unit = value;
|
|
93
|
+
} else selectedChecks.push(value);
|
|
94
|
+
} else if (argument === "--scenario") {
|
|
89
95
|
const value = args[++index];
|
|
90
96
|
if (!value || value.startsWith("-")) throw new Error("--scenario needs a discovered scenario ID.");
|
|
91
97
|
selectedScenarios.push(value);
|
|
92
|
-
}
|
|
93
|
-
else if (argument === "--port") {
|
|
98
|
+
} else if (argument === "--port") {
|
|
94
99
|
const value = args[++index];
|
|
95
100
|
if (port !== undefined || !/^\d+$/.test(value ?? "") || Number(value) > 65535) throw new Error("--port requires one port between 0 and 65535.");
|
|
96
101
|
port = Number(value);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
} else if (argument === "--tool-package") {
|
|
103
|
+
if (toolPackage !== undefined || !args[index + 1] || args[index + 1].startsWith("-"))
|
|
104
|
+
throw new Error("Specify one tool version or local tarball after --tool-package.");
|
|
100
105
|
toolPackage = args[++index];
|
|
101
|
-
} else if (argument === "--package-manager") {
|
|
102
|
-
if (packageManager !== undefined || !args[index + 1] || args[index + 1].startsWith("-")) throw new Error("Specify one package manager after --package-manager: npm or bun.");
|
|
103
|
-
packageManager = args[++index];
|
|
104
106
|
} else if (argument === "--theme") {
|
|
105
107
|
if (theme !== undefined || !args[index + 1] || args[index + 1].startsWith("--")) throw new Error("Specify --theme <name>.");
|
|
106
108
|
theme = args[++index];
|
|
@@ -110,109 +112,210 @@ async function main(args) {
|
|
|
110
112
|
} else if (argument === "--format") {
|
|
111
113
|
if (format !== undefined || args[index + 1] !== "dtcg") throw new Error("Specify --format dtcg (the W3C Design Tokens format).");
|
|
112
114
|
format = args[++index];
|
|
113
|
-
} else if (argument === "--
|
|
114
|
-
if (
|
|
115
|
-
|
|
115
|
+
} else if (argument === "--include-starter") {
|
|
116
|
+
if (includeStarter) throw new Error("Specify --include-starter once.");
|
|
117
|
+
includeStarter = true;
|
|
116
118
|
} else if (argument === "--framework") {
|
|
117
|
-
if (framework !== undefined || !args[index + 1] || args[index + 1].startsWith("-"))
|
|
119
|
+
if (framework !== undefined || !args[index + 1] || args[index + 1].startsWith("-"))
|
|
120
|
+
throw new Error("Specify one framework after --framework: react or preact.");
|
|
118
121
|
framework = args[++index];
|
|
119
|
-
} else if (argument.startsWith("-")) throw new Error(
|
|
122
|
+
} else if (argument.startsWith("-")) throw new Error(`Unknown option ${argument}. Run ads --help.`);
|
|
120
123
|
else positional.push(argument);
|
|
121
124
|
}
|
|
122
125
|
if (positional.length > 2) throw new Error("Extra argument. Run ads --help.");
|
|
123
126
|
const [command, directory] = positional;
|
|
124
|
-
if(command!=="init"
|
|
125
|
-
const exitCode=await enterMemoryBudget(loadConfig(path.resolve(directory??process.cwd())).config,args);
|
|
126
|
-
if(exitCode!==null){
|
|
127
|
+
if (command !== "init") {
|
|
128
|
+
const exitCode = await enterMemoryBudget(loadConfig(path.resolve(directory ?? process.cwd())).config, args);
|
|
129
|
+
if (exitCode !== null) {
|
|
130
|
+
process.exitCode = exitCode;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const { generateBrandAssets, initProject } = await import("./index.mjs");
|
|
135
|
+
if (watched && command !== "compile") throw new Error("--watch is supported only by compile.");
|
|
136
|
+
if (fresh && !["check", "validate"].includes(command)) throw new Error("--fresh is supported only by check/validate.");
|
|
137
|
+
if (command === "compile") {
|
|
138
|
+
const { compilePreviews } = await import("./bun-compiler.mjs");
|
|
139
|
+
await compilePreviews(path.resolve(directory ?? process.cwd()), { watched });
|
|
140
|
+
return;
|
|
127
141
|
}
|
|
128
|
-
const { generateBrandAssets, generateLintConfig, initProject, inspectTokens } = await import("./index.mjs");
|
|
129
|
-
if(watched&&command!=="compile")throw new Error("--watch is supported only by compile.");
|
|
130
|
-
if(fresh && !["check","validate"].includes(command))throw new Error("--fresh is supported only by check/validate.");
|
|
131
|
-
if(command==="compile"){const {compilePreviews}=await import("./bun-compiler.mjs");await compilePreviews(path.resolve(directory??process.cwd()),{watched});return;}
|
|
132
|
-
if (policy!==undefined && command!=="validate")throw new Error("--policy is supported only by validate.");
|
|
133
142
|
if (changed && command !== "validate") throw new Error("--changed is supported only by validate.");
|
|
134
143
|
if ((port !== undefined || !showcase) && !["mcp", "showcase"].includes(command)) throw new Error("Website options are supported only by mcp/showcase.");
|
|
135
144
|
if (!showcase && command !== "mcp") throw new Error("--no-showcase is supported only by mcp.");
|
|
136
145
|
if (mutations && command !== "mcp") throw new Error("--mutations is supported only by mcp.");
|
|
137
|
-
const setup = command === "init"
|
|
138
|
-
if (toolPackage !== undefined && !setup) throw new Error("--tool-package is supported only by
|
|
139
|
-
if (
|
|
140
|
-
if (
|
|
141
|
-
if (name !== undefined && command !== "create") throw new Error("--name is supported only by create.");
|
|
146
|
+
const setup = command === "init";
|
|
147
|
+
if (toolPackage !== undefined && !setup) throw new Error("--tool-package is supported only by init.");
|
|
148
|
+
if (framework !== undefined && !setup) throw new Error("--framework is supported only by init.");
|
|
149
|
+
if (includeStarter && !setup) throw new Error("--include-starter is supported only by init.");
|
|
142
150
|
if (format !== undefined && command !== "tokens") throw new Error("--format is supported only by tokens.");
|
|
143
151
|
if (theme !== undefined && format !== "dtcg" && command !== "audit") throw new Error("--theme is supported only by tokens --format dtcg and audit.");
|
|
144
152
|
if (brand !== undefined && format !== "dtcg" && command !== "audit") throw new Error("--brand is supported only by tokens --format dtcg and audit.");
|
|
145
153
|
if (selectedScenarios.length && command !== "audit") throw new Error("--scenario is supported only by audit.");
|
|
146
|
-
if (command === "create" && !directory) throw new Error("Name the new project's folder: ads create <directory> --framework react|preact.");
|
|
147
154
|
if (command === "init" && directory) throw new Error("Run ads init inside the project, without a directory argument.");
|
|
148
155
|
if ((unit || selectedChecks.length) && command !== "verify") throw new Error("--unit and --check are supported only by verify.");
|
|
149
156
|
const target = path.resolve(directory ?? process.cwd());
|
|
150
157
|
if (command === "mcp" || command === "showcase") {
|
|
151
158
|
if (json) throw new Error("--json is not supported by mcp/showcase; mcp reserves stdout for JSON-RPC.");
|
|
152
159
|
const { startAdsMcp } = await import("./mcp/server.mjs");
|
|
153
|
-
await startAdsMcp(target, { stdio: command === "mcp", showcase, port, mutations, prewarm:true });
|
|
160
|
+
await startAdsMcp(target, { stdio: command === "mcp", showcase, port, mutations, prewarm: true });
|
|
154
161
|
return;
|
|
155
162
|
}
|
|
156
163
|
let result;
|
|
157
|
-
if (command === "
|
|
158
|
-
else if (command === "
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
if (command === "init") result = await initProject(target, { toolPackage, framework, includeStarter });
|
|
165
|
+
else if (command === "check") {
|
|
166
|
+
const { checkCandidate } = await import("./validation-checks.mjs");
|
|
167
|
+
result = await checkCandidate(target, undefined, target, { fresh });
|
|
168
|
+
} else if (command === "validate") {
|
|
169
|
+
const { createValidationController } = await import("./validation.mjs");
|
|
170
|
+
const validation = createValidationController(target);
|
|
171
|
+
const abort = async () => {
|
|
172
|
+
void (await validation.close());
|
|
173
|
+
};
|
|
174
|
+
process.once("SIGINT", abort);
|
|
175
|
+
process.once("SIGTERM", abort);
|
|
176
|
+
try {
|
|
177
|
+
result = await validation.run({ scope: changed ? "changed" : "all", fresh });
|
|
178
|
+
} finally {
|
|
179
|
+
process.removeListener("SIGINT", abort);
|
|
180
|
+
process.removeListener("SIGTERM", abort);
|
|
181
|
+
await validation.close();
|
|
182
|
+
}
|
|
183
|
+
} else if (command === "behaviors") {
|
|
184
|
+
result = await analyze(target, "behavior-status");
|
|
185
|
+
} else if (command === "verify") {
|
|
186
|
+
const { createVerificationController } = await import("./verification.mjs");
|
|
187
|
+
const verification = createVerificationController(target);
|
|
188
|
+
try {
|
|
189
|
+
result = await verification.run({ ...(unit ? { unit } : {}), ...(selectedChecks.length ? { checks: selectedChecks } : {}) });
|
|
190
|
+
} finally {
|
|
191
|
+
await verification.close();
|
|
192
|
+
}
|
|
193
|
+
} else if (command === "audit") {
|
|
194
|
+
const { runRenderAudit } = await import("./render-audit.mjs");
|
|
195
|
+
const controller = new AbortController(),
|
|
196
|
+
abort = () => controller.abort();
|
|
197
|
+
process.once("SIGINT", abort);
|
|
198
|
+
process.once("SIGTERM", abort);
|
|
173
199
|
try {
|
|
174
200
|
const { renderStoppingRules, routeFindings } = await import("./finding-rules.mjs");
|
|
175
201
|
// Policy errors do not stop the render: they are reported with the audit's and fail it the same.
|
|
176
202
|
const { checkCandidate } = await import("./validation-checks.mjs");
|
|
177
203
|
const core = await checkCandidate(target, controller.signal);
|
|
178
|
-
const stopping = core.diagnostics.filter(item => renderStoppingRules.has(item.rule));
|
|
179
|
-
if (stopping.length)
|
|
180
|
-
|
|
204
|
+
const stopping = core.diagnostics.filter((item) => renderStoppingRules.has(item.rule));
|
|
205
|
+
if (stopping.length)
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Project validation failed; nothing can be rendered. ${stopping
|
|
208
|
+
.slice(0, 5)
|
|
209
|
+
.map((item) => `${item.file ?? ""}:${item.line ?? 1}: ${item.rule}: ${item.message}`)
|
|
210
|
+
.join(" ")}`,
|
|
211
|
+
);
|
|
212
|
+
const audit = await runRenderAudit(target, {
|
|
213
|
+
scenarios: selectedScenarios,
|
|
214
|
+
themes: theme ? [theme] : undefined,
|
|
215
|
+
brands: brand ? [brand] : undefined,
|
|
216
|
+
signal: controller.signal,
|
|
217
|
+
});
|
|
181
218
|
// a11y-axe findings are errors, as in validation; any review-class finding stays nonblocking.
|
|
182
219
|
const routed = routeFindings(core.diagnostics, audit.findings);
|
|
183
|
-
result = {
|
|
220
|
+
result = {
|
|
221
|
+
...audit,
|
|
222
|
+
ok: !routed.diagnostics.length,
|
|
223
|
+
staticErrors: core.diagnostics.length,
|
|
224
|
+
findings: routed.advisories,
|
|
225
|
+
diagnostics: routed.diagnostics,
|
|
226
|
+
};
|
|
227
|
+
} finally {
|
|
228
|
+
process.removeListener("SIGINT", abort);
|
|
229
|
+
process.removeListener("SIGTERM", abort);
|
|
184
230
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
else if (command === "
|
|
190
|
-
else if (command === "
|
|
191
|
-
|
|
231
|
+
} else if (command === "tokens" && format === "dtcg") {
|
|
232
|
+
const { exportTokensDtcg } = await import("./token-export.mjs");
|
|
233
|
+
console.log(JSON.stringify(await exportTokensDtcg(target, { theme, brand }, await analyze(target, "tokens")), null, 2));
|
|
234
|
+
return;
|
|
235
|
+
} else if (command === "tokens") result = await analyze(target, "tokens");
|
|
236
|
+
else if (command === "assets") {
|
|
237
|
+
const { refreshThemesCssAsync } = await import("./themes-watch.mjs");
|
|
238
|
+
const { writeGeneratedEntries } = await import("./generated-entries.mjs");
|
|
239
|
+
const themes = await refreshThemesCssAsync(target),
|
|
240
|
+
barrels = (await writeGeneratedEntries(loadConfig(target))).files.map(({ file, changed }) => ({ file, written: changed }));
|
|
241
|
+
result = {
|
|
242
|
+
...(await generateBrandAssets(target)),
|
|
243
|
+
barrels,
|
|
244
|
+
themes: { file: themes.file, written: themes.files[0]?.written ?? false, ...(themes.skipped ? { skipped: themes.skipped } : {}) },
|
|
245
|
+
...(themes.files[1]
|
|
246
|
+
? {
|
|
247
|
+
palette: { file: themes.files[1].file, written: themes.files[1].written },
|
|
248
|
+
...(themes.files[2] ? { fontPreloads: { file: themes.files[2].file, written: themes.files[2].written } } : {}),
|
|
249
|
+
}
|
|
250
|
+
: {}),
|
|
251
|
+
};
|
|
252
|
+
} else throw new Error(`Unknown command: ${command}. Run ads --help.`);
|
|
192
253
|
// Bun ends a piped stdout at its buffer unless the write is awaited.
|
|
193
|
-
if (json) await new Promise(resolve => process.stdout.write(`${JSON.stringify(result, null, 2)}\n`, resolve));
|
|
194
|
-
else if (command === "
|
|
195
|
-
|
|
254
|
+
if (json) await new Promise((resolve) => process.stdout.write(`${JSON.stringify(result, null, 2)}\n`, resolve));
|
|
255
|
+
else if (command === "init")
|
|
256
|
+
console.log(
|
|
257
|
+
`Initialized ${target}\nFramework: ${result.framework}\nAdded ${result.toolDependency.name} (${result.toolDependency.spec}) as a development dependency.\nRun ${result.packageManager} install and ${result.packageManager} run build; the build runs ADS checks and generates configured brand assets automatically.`,
|
|
258
|
+
);
|
|
196
259
|
else if (command === "assets") {
|
|
197
|
-
console.log(
|
|
260
|
+
console.log(
|
|
261
|
+
result.skipped ? "No assets.iconSource configured; brand generation skipped." : `Generated ${result.files.length} brand assets in ${result.directory}.`,
|
|
262
|
+
);
|
|
198
263
|
const themesFile = path.relative(process.cwd(), result.themes.file) || result.themes.file;
|
|
199
|
-
console.log(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
else if (
|
|
264
|
+
console.log(
|
|
265
|
+
result.themes.skipped
|
|
266
|
+
? `Skipped ${themesFile}: the token sheets still use the old theme form.`
|
|
267
|
+
: `${result.themes.written ? "Wrote" : "Unchanged"} ${themesFile}.`,
|
|
268
|
+
);
|
|
269
|
+
if (result.palette)
|
|
270
|
+
console.log(`${result.palette.written ? "Wrote" : "Unchanged"} ${path.relative(process.cwd(), result.palette.file) || result.palette.file}.`);
|
|
271
|
+
for (const barrel of result.barrels) console.log(`${barrel.written ? "Wrote" : "Unchanged"} ${path.relative(process.cwd(), barrel.file) || barrel.file}.`);
|
|
272
|
+
if (result.fontPreloads)
|
|
273
|
+
console.log(
|
|
274
|
+
`${result.fontPreloads.written ? "Wrote" : "Unchanged"} ${path.relative(process.cwd(), result.fontPreloads.file) || result.fontPreloads.file}.`,
|
|
275
|
+
);
|
|
276
|
+
} else if (command === "behaviors") console.log(JSON.stringify(result, null, 2));
|
|
277
|
+
else if (command === "audit") {
|
|
278
|
+
const { findingCounts } = await import("./finding-rules.mjs");
|
|
279
|
+
console.log(
|
|
280
|
+
`ADS accessibility audit (${result.engine}): ${findingCounts(result.diagnostics.length, result.findings.filter((finding) => finding.severity === "review").length)}, ${result.incomplete ?? 0} that axe could not decide across ${result.scenarios} scenarios × ${result.themes.length} themes (${result.themes.join(", ")})${result.brands ? ` × ${result.brands.length} brands (${result.brands.join(", ")})` : ""}.`,
|
|
281
|
+
);
|
|
282
|
+
if (result.coverage) {
|
|
283
|
+
const skipped = Object.entries(result.coverage.skipped);
|
|
284
|
+
console.log(
|
|
285
|
+
`Covered: ${result.coverage.renders} renders, ${result.coverage.overlaysOpened} overlays opened, ${result.coverage.controlsMeasured} controls hovered and focused; ${skipped.length ? `skipped ${skipped.map(([reason, entry]) => `${reason} ${entry.count}`).join(", ")}` : "nothing skipped"}.`,
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
if (result.retries)
|
|
289
|
+
console.log(
|
|
290
|
+
`Retried ${result.retries.length} render${result.retries.length === 1 ? "" : "s"} that then passed: ${result.retries.map((retry) => `${retry.scenario} [${[retry.theme, retry.brand].filter(Boolean).join(", ")}] in ${retry.attempts} attempts`).join("; ")}.`,
|
|
291
|
+
);
|
|
292
|
+
for (const finding of result.findings)
|
|
293
|
+
console.error(`${finding.file}:${finding.line}:${finding.column} [${finding.severity}:${finding.rule}] ${finding.message}`);
|
|
294
|
+
} else if (command === "verify") {
|
|
295
|
+
for (const item of result.results) console.log(`${item.unit}#${item.check}: ${item.status} (${item.profile})`);
|
|
296
|
+
} else if (command === "validate") {
|
|
297
|
+
console.log(`ADS validation ${result.ok ? "passed" : "failed"}: ${result.scope}${result.fallback ? ` (${result.fallback})` : ""}`);
|
|
298
|
+
for (const check of result.checks)
|
|
299
|
+
console.log(`${check.name}: ${check.skipped ? "skipped" : check.passed ? "passed" : "failed"}${check.reason ? ` (${check.reason})` : ""}`);
|
|
300
|
+
} else if (command === "tokens") {
|
|
301
|
+
for (const token of result.tokens)
|
|
302
|
+
console.log(
|
|
303
|
+
`${token.name}${token.type ? ` (${token.type})` : ""}: ${token.definitions.map((entry) => `${entry.scope}${entry.theme ? ` (${entry.theme})` : ""}: ${entry.value}`).join("; ")}`,
|
|
304
|
+
);
|
|
305
|
+
} else if (command === "check") {
|
|
306
|
+
const { findingCounts } = await import("./finding-rules.mjs");
|
|
307
|
+
console.log(
|
|
308
|
+
`ADS check ${result.ok ? "passed" : "failed"}: ${target} (${findingCounts(result.diagnostics?.length ?? 0, (result.advisories ?? []).filter((advisory) => advisory.severity === "review").length)})`,
|
|
309
|
+
);
|
|
310
|
+
} else if (result.ok) console.log(`ADS check passed: ${target}`);
|
|
212
311
|
if (!json && result.diagnostics?.length) {
|
|
213
|
-
for (const diagnostic of result.diagnostics)
|
|
312
|
+
for (const diagnostic of result.diagnostics)
|
|
313
|
+
console.error(`${diagnostic.file}:${diagnostic.line}:${diagnostic.column} [error:${diagnostic.rule}] ${diagnostic.message}`);
|
|
214
314
|
}
|
|
215
|
-
if (!json)
|
|
315
|
+
if (!json)
|
|
316
|
+
for (const advisory of result.advisories ?? [])
|
|
317
|
+
if (advisory.severity !== "info")
|
|
318
|
+
console.error(`${advisory.file}:${advisory.line}:${advisory.column} [${advisory.severity ?? "review"}:${advisory.rule}] ${advisory.message}`);
|
|
216
319
|
if (result.ok === false || result.diagnostics?.length) process.exitCode = 1;
|
|
217
320
|
}
|
|
218
321
|
|
package/dist/color-values.mjs
CHANGED
|
@@ -13,8 +13,8 @@ const systemColors = new Set(["accentcolor", "accentcolortext", "activetext", "b
|
|
|
13
13
|
const colorFunctions = new Set(["rgb", "rgba", "hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "color", "color-mix", "light-dark", "contrast-color", "device-cmyk"]);
|
|
14
14
|
|
|
15
15
|
const multiply = (matrix, [a, b, c]) => matrix.map(row => row[0] * a + row[1] * b + row[2] * c);
|
|
16
|
-
const fromSrgbGamma = value => { const abs = Math.abs(value); return abs <= 0.04045 ? value / 12.92 : Math.sign(value) *
|
|
17
|
-
const toSrgbGamma = value => { const abs = Math.abs(value); return abs > 0.0031308 ? Math.sign(value) *
|
|
16
|
+
const fromSrgbGamma = value => { const abs = Math.abs(value); return abs <= 0.04045 ? value / 12.92 : Math.sign(value) * ((abs+0.055)/1.055) ** 2.4; };
|
|
17
|
+
const toSrgbGamma = value => { const abs = Math.abs(value); return abs > 0.0031308 ? Math.sign(value) *( 1.055 * abs **( 1 / 2.4) - 0.055) : 12.92 * value; };
|
|
18
18
|
|
|
19
19
|
const linearSrgbToXyz = [[506752 / 1228815, 87881 / 245763, 12673 / 70218], [87098 / 409605, 175762 / 245763, 12673 / 175545], [7918 / 409605, 87881 / 737289, 1001167 / 1053270]];
|
|
20
20
|
const xyzToLinearSrgb = [[12831 / 3959, -329 / 214, -1974 / 3959], [-851781 / 878810, 1648619 / 878810, 36519 / 878810], [705 / 12673, -2585 / 12673, 705 / 667]];
|
|
@@ -29,10 +29,10 @@ const kappa = 24389 / 27, epsilon = 216 / 24389;
|
|
|
29
29
|
|
|
30
30
|
// RGB spaces: transfer function to linear light and the linear-to-XYZ matrix (D65 unless noted).
|
|
31
31
|
const invert = matrix => {
|
|
32
|
-
const [[a, b, c], [d, e, f], [g, h, i]] = matrix, det = a *
|
|
32
|
+
const [[a, b, c], [d, e, f], [g, h, i]] = matrix, det = a *( e * i - f * h) - b *( d * i - f * g) + c *( d * h - e * g);
|
|
33
33
|
return [[e * i - f * h, c * h - b * i, b * f - c * e], [f * g - d * i, a * i - c * g, c * d - a * f], [d * h - e * g, b * g - a * h, a * e - b * d]].map(row => row.map(value => value / det));
|
|
34
34
|
};
|
|
35
|
-
const rgbSpace = (toLinear, fromLinear, toXyz, d50 = false) =>
|
|
35
|
+
const rgbSpace = (toLinear, fromLinear, toXyz, d50 = false) =>( { toLinear, fromLinear, toXyz, fromXyz: invert(toXyz), d50 });
|
|
36
36
|
const identity = value => value;
|
|
37
37
|
const a98 = 563 / 256;
|
|
38
38
|
const rec2020 = { alpha: 1.09929682680944, beta: 0.018053968510807 };
|
|
@@ -40,12 +40,12 @@ const rgbSpaces = {
|
|
|
40
40
|
srgb: { toLinear: fromSrgbGamma, fromLinear: toSrgbGamma, toXyz: linearSrgbToXyz, fromXyz: xyzToLinearSrgb, d50: false },
|
|
41
41
|
"srgb-linear": { toLinear: identity, fromLinear: identity, toXyz: linearSrgbToXyz, fromXyz: xyzToLinearSrgb, d50: false },
|
|
42
42
|
"display-p3": rgbSpace(fromSrgbGamma, toSrgbGamma, [[608311 / 1250200, 189793 / 714400, 198249 / 1000160], [35783 / 156275, 247089 / 357200, 198249 / 2500400], [0, 32229 / 714400, 5220557 / 5000800]]),
|
|
43
|
-
"a98-rgb": rgbSpace(value => Math.sign(value) * Math.abs(value) ** a98, value => Math.sign(value) * Math.abs(value) **
|
|
43
|
+
"a98-rgb": rgbSpace(value => Math.sign(value) * Math.abs(value) ** a98, value => Math.sign(value) * Math.abs(value) **( 1 / a98),
|
|
44
44
|
[[573536 / 994567, 263643 / 1420810, 187206 / 994567], [591459 / 1989134, 6239551 / 9945670, 374412 / 4972835], [53769 / 1989134, 351524 / 4972835, 4929758 / 4972835]]),
|
|
45
|
-
"prophoto-rgb": rgbSpace(value => Math.abs(value) <= 16 / 512 ? value / 16 : Math.sign(value) * Math.abs(value) ** 1.8, value => Math.abs(value) >= 1 / 512 ? Math.sign(value) * Math.abs(value) **
|
|
45
|
+
"prophoto-rgb": rgbSpace(value => Math.abs(value) <= 16 / 512 ? value / 16 : Math.sign(value) * Math.abs(value) ** 1.8, value => Math.abs(value) >= 1 / 512 ? Math.sign(value) * Math.abs(value) **( 1 / 1.8) : 16 * value,
|
|
46
46
|
[[0.7977666449006423, 0.13518129740053308, 0.0313477341283922], [0.2880748288194013, 0.711835234241873, 0.00008993693872564], [0, 0, 0.8251046025104602]], true),
|
|
47
|
-
rec2020: rgbSpace(value => Math.abs(value) < rec2020.beta * 4.5 ? value / 4.5 : Math.sign(value) *
|
|
48
|
-
value => Math.abs(value) > rec2020.beta ? Math.sign(value) *
|
|
47
|
+
rec2020: rgbSpace(value => Math.abs(value) < rec2020.beta * 4.5 ? value / 4.5 : Math.sign(value) * ((Math.abs(value)+rec2020.alpha-1) / rec2020.alpha) **( 1 / 0.45),
|
|
48
|
+
value => Math.abs(value) > rec2020.beta ? Math.sign(value) * (rec2020.alpha*Math.abs(value)**0.45-(rec2020.alpha-1)):4.5*value,
|
|
49
49
|
[[63426534 / 99577255, 20160776 / 139408157, 47086771 / 278816314], [26158966 / 99577255, 472592308 / 697040785, 8267143 / 139408157], [0, 19567812 / 697040785, 295819943 / 278816314]]),
|
|
50
50
|
};
|
|
51
51
|
const xyzSpaces = { xyz: false, "xyz-d65": false, "xyz-d50": true };
|
|
@@ -65,7 +65,7 @@ function srgbToHsl([r, g, b]) {
|
|
|
65
65
|
let h = Number.NaN, s = 0;
|
|
66
66
|
if (d !== 0) {
|
|
67
67
|
s = l === 0 || l === 1 ? 0 : (max - l) / Math.min(l, 1 - l);
|
|
68
|
-
h = max === r ? (g - b) / d +
|
|
68
|
+
h = max === r ? (g - b) / d +( g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
|
69
69
|
h *= 60;
|
|
70
70
|
}
|
|
71
71
|
if (s < 0) { h += 180; s = Math.abs(s); }
|
|
@@ -73,8 +73,8 @@ function srgbToHsl([r, g, b]) {
|
|
|
73
73
|
return [Math.abs(s) < 1e-5 ? Number.NaN : h, s, l];
|
|
74
74
|
}
|
|
75
75
|
function hwbToSrgb([h, w, b]) {
|
|
76
|
-
if (w + b >= 1) { const gray = w /
|
|
77
|
-
return hslToSrgb([h, 1, 0.5]).map(value => value *
|
|
76
|
+
if (w + b >= 1) { const gray = w /( w + b); return [gray, gray, gray]; }
|
|
77
|
+
return hslToSrgb([h, 1, 0.5]).map(value => value *( 1 - w - b) + w);
|
|
78
78
|
}
|
|
79
79
|
function srgbToHwb(rgb) {
|
|
80
80
|
const [h] = srgbToHsl(rgb), w = Math.min(...rgb), b = 1 - Math.max(...rgb);
|
|
@@ -86,7 +86,7 @@ const labToXyzD50 = ([l, a, b]) => {
|
|
|
86
86
|
};
|
|
87
87
|
const xyzD50ToLab = xyz => {
|
|
88
88
|
const [f0, f1, f2] = xyz.map((value, index) => value / d50White[index]).map(value => value > epsilon ? Math.cbrt(value) : (kappa * value + 16) / 116);
|
|
89
|
-
return [116 * f1 - 16, 500 *
|
|
89
|
+
return [116 * f1 - 16, 500 *( f0 - f1), 200 *( f1 - f2)];
|
|
90
90
|
};
|
|
91
91
|
const toPolar = ([l, a, b], threshold) => { const c = Math.hypot(a, b); let h = Math.atan2(b, a) * 180 / Math.PI; if (h < 0) h += 360; return [l, c, c < threshold ? Number.NaN : h]; };
|
|
92
92
|
const fromPolar = ([l, c, h]) => [l, zero(c) * Math.cos(radians(zero(h))), zero(c) * Math.sin(radians(zero(h)))];
|
|
@@ -155,7 +155,7 @@ function channel(node, percent, { hue = false, allowNumber = true, allowPercent
|
|
|
155
155
|
if (node.value.toLowerCase() === "none") return Number.NaN;
|
|
156
156
|
if (hue) { const degrees = angle(node.value); if (degrees === null) throw new SyntaxError("hue"); return degrees; }
|
|
157
157
|
const parsed = numeric(node.value);
|
|
158
|
-
if (!parsed ||
|
|
158
|
+
if (!parsed ||( parsed.percent ? !allowPercent : !allowNumber)) throw new SyntaxError("channel");
|
|
159
159
|
return parsed.percent ? parsed.value / 100 * percent : parsed.value;
|
|
160
160
|
}
|
|
161
161
|
const alphaChannel = node => node ? channel(node, 1) : 1;
|
|
@@ -206,7 +206,7 @@ function parseFunction(node, options) {
|
|
|
206
206
|
if (name === "hsl" || name === "hsla" || name === "hwb") {
|
|
207
207
|
const { values, alpha, legacy } = channels(node, 3, name !== "hwb");
|
|
208
208
|
const h = channel(values[0], 0, { hue: true }), [a, b] = values.slice(1).map(part => channel(part, 100, { allowNumber: !legacy }) / 100);
|
|
209
|
-
const hue = Number.isNaN(h) ? h :
|
|
209
|
+
const hue = Number.isNaN(h) ? h : ((h%360)+360) % 360;
|
|
210
210
|
return { space: name === "hwb" ? "hwb" : "hsl", coords: [hue, Number.isNaN(a) ? a : name === "hwb" ? a : clamp(a, 0, 1), Number.isNaN(b) ? b : name === "hwb" ? b : clamp(b, 0, 1)], alpha: clamp(alphaChannel(alpha), 0, 1) };
|
|
211
211
|
}
|
|
212
212
|
if (name === "lab" || name === "oklab") {
|
|
@@ -217,7 +217,7 @@ function parseFunction(node, options) {
|
|
|
217
217
|
if (name === "lch" || name === "oklch") {
|
|
218
218
|
const { values, alpha } = channels(node, 3, false), ok = name === "oklch";
|
|
219
219
|
const l = channel(values[0], ok ? 1 : 100), c = channel(values[1], ok ? 0.4 : 150), h = channel(values[2], 0, { hue: true });
|
|
220
|
-
return { space: name, coords: [Number.isNaN(l) ? l : clamp(l, 0, ok ? 1 : 100), Number.isNaN(c) ? c : Math.max(0, c), Number.isNaN(h) ? h :
|
|
220
|
+
return { space: name, coords: [Number.isNaN(l) ? l : clamp(l, 0, ok ? 1 : 100), Number.isNaN(c) ? c : Math.max(0, c), Number.isNaN(h) ? h : ((h%360)+360) % 360], alpha: clamp(alphaChannel(alpha), 0, 1) };
|
|
221
221
|
}
|
|
222
222
|
if (name === "color") {
|
|
223
223
|
const parts = meaningful(node.nodes);
|
|
@@ -252,7 +252,7 @@ function parseMix(node, options) {
|
|
|
252
252
|
const percentNode = group.find(part => part.type === "word" && part.value.endsWith("%")), rest = group.filter(part => part !== percentNode);
|
|
253
253
|
if (rest.length !== 1 || group.length > 2) throw new SyntaxError("color-mix item");
|
|
254
254
|
const percent = percentNode ? numeric(percentNode.value) : null;
|
|
255
|
-
if (percentNode &&
|
|
255
|
+
if (percentNode &&( !percent?.percent || percent.value < 0 || percent.value > 100)) throw new SyntaxError("color-mix percentage");
|
|
256
256
|
return { color: parseNode(rest[0], options), percent: percent?.value ?? null };
|
|
257
257
|
});
|
|
258
258
|
let [p1, p2] = items.map(item => item.percent);
|
|
@@ -262,14 +262,14 @@ function parseMix(node, options) {
|
|
|
262
262
|
const sum = p1 + p2;
|
|
263
263
|
if (sum === 0) throw new SyntaxError("color-mix percentages sum to zero");
|
|
264
264
|
const multiplier = Math.min(1, sum / 100), t = p2 / sum;
|
|
265
|
-
const [a, b] = items.map(({ color }) =>
|
|
265
|
+
const [a, b] = items.map(({ color }) =>( { coords: [...convert(color, space)], alpha: color.alpha }));
|
|
266
266
|
// A component missing in one color takes the other's.
|
|
267
267
|
for (let index = 0; index < 3; index++) {
|
|
268
268
|
if (Number.isNaN(a.coords[index])) a.coords[index] = b.coords[index];
|
|
269
269
|
else if (Number.isNaN(b.coords[index])) b.coords[index] = a.coords[index];
|
|
270
270
|
}
|
|
271
271
|
if (Number.isNaN(a.alpha)) a.alpha = b.alpha; else if (Number.isNaN(b.alpha)) b.alpha = a.alpha;
|
|
272
|
-
const alpha1 = zero(a.alpha), alpha2 = zero(b.alpha), alpha = alpha1 *
|
|
272
|
+
const alpha1 = zero(a.alpha), alpha2 = zero(b.alpha), alpha = alpha1 *( 1 - t) + alpha2 * t;
|
|
273
273
|
const hue = polar.has(space) ? hueIndex(space) : -1;
|
|
274
274
|
const coords = [0, 1, 2].map(index => {
|
|
275
275
|
let [c1, c2] = [a.coords[index], b.coords[index]];
|
|
@@ -280,9 +280,9 @@ function parseMix(node, options) {
|
|
|
280
280
|
else if (method === "longer") { if (delta > 0 && delta < 180) c1 += 360; else if (delta > -180 && delta <= 0) c2 += 360; }
|
|
281
281
|
else if (method === "increasing") { if (delta < 0) c2 += 360; }
|
|
282
282
|
else if (delta > 0) c1 += 360;
|
|
283
|
-
return ((c1 *
|
|
283
|
+
return ((c1 *( 1 - t) + c2 * t) % 360 + 360) % 360;
|
|
284
284
|
}
|
|
285
|
-
const mixed = c1 * alpha1 *
|
|
285
|
+
const mixed = c1 * alpha1 *( 1 - t) + c2 * alpha2 * t;
|
|
286
286
|
return alpha === 0 ? mixed : mixed / alpha;
|
|
287
287
|
});
|
|
288
288
|
return { space, coords, alpha: alpha * multiplier };
|
|
@@ -310,7 +310,7 @@ export function parseCssColor(value, { scheme } = {}) {
|
|
|
310
310
|
const nodes = meaningful(valueParser(String(value).trim()).nodes);
|
|
311
311
|
if (nodes.length !== 1) return null;
|
|
312
312
|
const [node] = nodes;
|
|
313
|
-
const colorish = node.type === "function" ? colorFunctions.has(node.value.toLowerCase()) : node.type === "word" &&
|
|
313
|
+
const colorish = node.type === "function" ? colorFunctions.has(node.value.toLowerCase()) : node.type === "word" &&( node.value.startsWith("#") || node.value.toLowerCase() in named || ["transparent", "currentcolor"].includes(node.value.toLowerCase()) || systemColors.has(node.value.toLowerCase()));
|
|
314
314
|
if (!colorish) return null;
|
|
315
315
|
try { return { color: parseNode(node, { scheme }) }; }
|
|
316
316
|
catch (error) {
|
|
@@ -88,7 +88,7 @@ export function createComponentContrast(tokens, themes, brands) {
|
|
|
88
88
|
const front = paint(text, container), back = paint(fill, container);
|
|
89
89
|
if (!front || !back || front.keyword || back.keyword || front.name && front.name === back.name) return;
|
|
90
90
|
if (container.nodes?.some(node => node.type === "rule" && nativeParts.test(node.selector))) return;
|
|
91
|
-
const line = offset.line + text.source.start.line - 1, column = text.source.start.column +
|
|
91
|
+
const line = offset.line + text.source.start.line - 1, column = text.source.start.column +( text.source.start.line === 1 ? offset.column - 1 : 0);
|
|
92
92
|
if (front.unresolved || back.unresolved) {
|
|
93
93
|
const key = JSON.stringify([file, line]);
|
|
94
94
|
if (!unresolved.has(key)) unresolved.set(key, { rule: "component-contrast-unresolved", severity: findingSeverity("component-contrast-unresolved"), file, line, column, guidanceUri: guidance,
|
|
@@ -123,7 +123,7 @@ export function createComponentContrast(tokens, themes, brands) {
|
|
|
123
123
|
if (findings.has(key)) return;
|
|
124
124
|
const worst = Math.min(...failing.map(item => item.ratio));
|
|
125
125
|
findings.set(key, { rule: "component-contrast", severity: findingSeverity("component-contrast"), file, line, column, tokens: [foreground, background], ratio: Number(worst.toFixed(2)),
|
|
126
|
-
contexts: failing.map(({ theme, brand, ratio }) =>
|
|
126
|
+
contexts: failing.map(({ theme, brand, ratio }) =>( { theme, ...(brand === undefined ? {} : { brand }), ratio: Number(ratio.toFixed(2)) })), selector: selectorChain(container).join(" ") || "&", guidanceUri: guidance,
|
|
127
127
|
message: `${file}:${line} sets color: var(${foreground}) on ${fill.prop}: var(${background}), ${failing.map(item => `${item.ratio.toFixed(2)}:1 in ${item.label}`).join(", ")}; text needs 4.5:1 (WCAG 1.4.3). ${suggestion(background, names)}` });
|
|
128
128
|
}
|
|
129
129
|
|