@reqvire-org/ads 0.4.0 → 0.4.3
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 +115 -87
- package/dist/a11y.mjs +133 -48
- 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 +142 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +22 -0
- package/dist/analysis/module-resolvers.mjs +46 -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 +153 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +179 -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 +219 -77
- package/dist/boundaries.mjs +140 -41
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +28 -14
- 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 +44 -58
- package/dist/check.mjs +754 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +127 -9
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/contrast-composition.mjs +134 -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 +9 -5
- package/dist/font-rules.mjs +22 -17
- package/dist/fonts-generated.mjs +23 -16
- package/dist/foundation-views.mjs +242 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +101 -34
- package/dist/icons.mjs +79 -32
- package/dist/image-attributes.mjs +143 -66
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +122 -41
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +298 -129
- 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 +90 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +903 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +673 -234
- package/dist/mcp/preview-watch.mjs +448 -170
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +5 -5
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2409 -577
- package/dist/mcp/showcase-host.mjs +165 -41
- 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/pictogram-model.mjs +59 -0
- package/dist/pictograms.mjs +52 -0
- package/dist/preview-bun.mjs +494 -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 +8 -34
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +69 -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 +15 -5
- 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/render-audit/pictograms.mjs +88 -0
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +98 -30
- package/dist/render-audit.mjs +838 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/render-composition.mjs +164 -0
- 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 +719 -378
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +421 -157
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +21 -3
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +58 -0
- package/dist/showcase/foundation-view.mjs +255 -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/pictogram-view.mjs +53 -0
- 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 +1064 -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 +143 -120
- package/dist/skills/ads-designer/references/accessibility.md +78 -15
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +30 -27
- package/dist/skills/ads-designer/references/branding.md +101 -24
- package/dist/skills/ads-designer/references/captures.md +25 -0
- package/dist/skills/ads-designer/references/cli.md +21 -24
- package/dist/skills/ads-designer/references/contracts.md +7 -6
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +20 -17
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
- 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/pictograms.md +131 -0
- package/dist/skills/ads-designer/references/review.md +37 -34
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +16 -18
- 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 -75
- package/dist/skills/ads-designer/references/workflows.md +8 -33
- package/dist/skills/ads-import/SKILL.md +43 -325
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +30 -27
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +25 -0
- package/dist/skills/ads-import/references/cli.md +21 -24
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +7 -6
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +20 -17
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +14 -18
- 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 +37 -34
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +16 -18
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -75
- package/dist/skills/ads-import/references/workflows.md +8 -33
- 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 +58 -344
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +30 -27
- package/dist/skills/ads-port/references/captures.md +25 -0
- package/dist/skills/ads-port/references/cli.md +21 -24
- package/dist/skills/ads-port/references/contracts.md +7 -6
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +20 -17
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +14 -18
- 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 +2 -1
- package/dist/skills/ads-port/references/review.md +37 -34
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +16 -18
- package/dist/skills/ads-port/references/validation.md +83 -75
- package/dist/skills/ads-port/references/workflows.md +8 -33
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +270 -129
- 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 +25 -6
- 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 +47 -49
- package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -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/Pictogram/Pictogram.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -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/index.ts +2 -1
- 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/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 -1
- 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 -1
- 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/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 +25 -6
- 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 +70 -25
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +132 -59
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +57 -22
- 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 +251 -104
- package/dist/units.mjs +209 -99
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +191 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +96 -80
- package/docs/ARCHITECTURE.md +368 -137
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +77 -17
- package/docs/CHANGELOG.md +332 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +300 -263
- package/docs/MCP.md +187 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +43 -34
- package/dist/browser-audit.mjs +0 -429
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -50
- 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 -89
- 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 -412
- 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 -412
- package/dist/skills/ads-break-ui/references/captures.md +0 -135
- package/dist/skills/ads-break-ui/references/contracts.md +0 -317
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -194
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
- 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 -97
- 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 -166
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -90
- 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 -385
- 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 -412
- package/dist/skills/ads-motion/references/captures.md +0 -135
- package/dist/skills/ads-motion/references/contracts.md +0 -317
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -194
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
- 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 -97
- 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 -166
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -90
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- 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.ads.contract.ts +0 -6
- 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.contract.ts +0 -6
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
- 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.ads.exports.ts +0 -1
- 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.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
- 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/config.mjs
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { hasProjectConfig } from "./project-boundary.mjs";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
4
|
import { isDraftFile, draftImportViolation } from "./draft-boundary.mjs";
|
|
6
5
|
import { defaultThemes, validateThemes } from "./themes.mjs";
|
|
7
6
|
import { validateBrands } from "./brands.mjs";
|
|
8
7
|
|
|
9
8
|
export const supportedFrameworks = ["react", "preact"];
|
|
10
9
|
|
|
10
|
+
/** The design system's fixed layout inside dsDir, and the alias the app imports it by. ADS generates these entries. */
|
|
11
|
+
export const fixedLayout = {
|
|
12
|
+
publicAlias: "@ds",
|
|
13
|
+
publicEntry: "index.ts",
|
|
14
|
+
reviewEntry: "review/index.ads.review.ts",
|
|
15
|
+
stylesEntry: "styles.css",
|
|
16
|
+
tokenDir: "tokens",
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
export const defaultConfig = {
|
|
12
20
|
schemaVersion: 1,
|
|
13
21
|
framework: null,
|
|
@@ -15,24 +23,39 @@ export const defaultConfig = {
|
|
|
15
23
|
usage: { notifications: [], restrictedImports: [] },
|
|
16
24
|
sourceDir: "src",
|
|
17
25
|
dsDir: "design-system",
|
|
18
|
-
publicAlias: "@ds",
|
|
19
|
-
publicEntry: "index.ts",
|
|
20
|
-
reviewEntry: "review/index.ts",
|
|
21
|
-
stylesEntry: "styles.css",
|
|
22
|
-
tokenDir: "tokens",
|
|
23
26
|
themes: defaultThemes,
|
|
24
27
|
// Optional brand axis beside the themes; empty means one brand.
|
|
25
28
|
brands: [],
|
|
26
29
|
// With no data-theme on the root, the OS color scheme picks the first theme of that scheme.
|
|
27
30
|
followSystemTheme: false,
|
|
28
|
-
assets: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
assets: {
|
|
32
|
+
publicDirs: ["public/assets"],
|
|
33
|
+
generatedPaths: ["dist", "dist-showcase", ".vite", ".ds"],
|
|
34
|
+
generatedFiles: [],
|
|
35
|
+
iconSource: null,
|
|
36
|
+
targets: [],
|
|
37
|
+
glyphs: null,
|
|
38
|
+
imageBudgetKb: null,
|
|
39
|
+
fontBudgetKb: null,
|
|
40
|
+
preloadFonts: null,
|
|
41
|
+
},
|
|
42
|
+
// Draft acceptance runs ads check, these scripts, and the draft owners' own behavior tests and
|
|
43
|
+
// render audit. ads_validate runs ads check, both script lists, and every behavior test and render
|
|
44
|
+
// audit its change set reaches; it has no depth settings.
|
|
45
|
+
acceptance: { scripts: [], behavior: true, audit: true },
|
|
46
|
+
validation: { scripts: [], inputs: [] },
|
|
32
47
|
resources: { memoryLimitMb: null },
|
|
33
48
|
// Width tokens and owners allowed fixed widths; see src/layout-widths.mjs.
|
|
34
49
|
layout: { widthTokens: [], fixedWidthUnits: [] },
|
|
35
|
-
mcp: {
|
|
50
|
+
mcp: {
|
|
51
|
+
showcaseTitle: null,
|
|
52
|
+
mutationCheckTimeoutMs: 60000,
|
|
53
|
+
previewBuildTimeoutMs: 300000,
|
|
54
|
+
auditPages: 4,
|
|
55
|
+
behaviorProfiles: {},
|
|
56
|
+
capture: {},
|
|
57
|
+
resultRetention: { maxRuns: 50, maxAgeDays: 7, maxBytesMb: 256 },
|
|
58
|
+
},
|
|
36
59
|
};
|
|
37
60
|
|
|
38
61
|
export function isInside(parent, file) {
|
|
@@ -53,29 +76,42 @@ function validateBrandTargets(targets, { root, dsRoot }) {
|
|
|
53
76
|
for (const [index, target] of targets.entries()) {
|
|
54
77
|
const field = `assets.targets[${index}]`;
|
|
55
78
|
if (!target || typeof target !== "object" || Array.isArray(target)) throw new Error(`${field} must be an object.`);
|
|
56
|
-
const unknown = Object.keys(target).filter(key => !["from", "to", ...sizeKeys].includes(key));
|
|
79
|
+
const unknown = Object.keys(target).filter((key) => !["from", "to", ...sizeKeys].includes(key));
|
|
57
80
|
if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
|
|
58
81
|
const source = projectPath(dsRoot, target.from, `${field}.from`);
|
|
59
82
|
const sourceFormat = path.extname(source).toLowerCase();
|
|
60
|
-
if (!isInside(path.join(dsRoot, "assets/brand"), source) || !brandFormats.includes(sourceFormat))
|
|
83
|
+
if (!isInside(path.join(dsRoot, "assets/brand"), source) || !brandFormats.includes(sourceFormat))
|
|
84
|
+
throw new Error(`${field}.from must name brand artwork inside the ADS's assets/brand/ folder (${brandFormats.join(", ")}).`);
|
|
61
85
|
const output = projectPath(root, target.to, `${field}.to`);
|
|
62
|
-
if (isInside(path.join(dsRoot, "assets"), output) || isInside(path.join(root, ".ds"), output))
|
|
86
|
+
if (isInside(path.join(dsRoot, "assets"), output) || isInside(path.join(root, ".ds"), output))
|
|
87
|
+
throw new Error(`${field}.to must be outside the ADS assets/ folder and .ds/.`);
|
|
63
88
|
if (outputs.has(output)) throw new Error(`${field}.to repeats an earlier target's output.`);
|
|
64
89
|
outputs.add(output);
|
|
65
90
|
const format = path.extname(output).toLowerCase();
|
|
66
|
-
const sized = sizeKeys.some(key => key in target);
|
|
91
|
+
const sized = sizeKeys.some((key) => key in target);
|
|
67
92
|
// The same format without sizes is a copy of the supplied file.
|
|
68
93
|
if (!sized && format === sourceFormat) continue;
|
|
69
94
|
if (format === ".svg") throw new Error(`${field} copies an SVG master to .svg; it takes no sizes.`);
|
|
70
|
-
if (!renderableFormats.includes(sourceFormat))
|
|
71
|
-
|
|
72
|
-
|
|
95
|
+
if (!renderableFormats.includes(sourceFormat))
|
|
96
|
+
throw new Error(`${field} copies the finished ${sourceFormat} file; give it the same extension and no sizes.`);
|
|
97
|
+
const pixels = (value) => Number.isInteger(value) && value >= 1 && value <= 4096;
|
|
98
|
+
if (target.background !== undefined && (typeof target.background !== "string" || !/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(target.background)))
|
|
99
|
+
throw new Error(`${field}.background must be a #RGB, #RRGGBB or #RRGGBBAA colour on a PNG, ICO or ICNS target.`);
|
|
73
100
|
if (format === ".png") {
|
|
74
|
-
const square = target.size !== undefined,
|
|
75
|
-
|
|
101
|
+
const square = target.size !== undefined,
|
|
102
|
+
rectangle = target.width !== undefined || target.height !== undefined;
|
|
103
|
+
if (square === rectangle || target.sizes !== undefined || (square ? !pixels(target.size) : !pixels(target.width) || !pixels(target.height)))
|
|
104
|
+
throw new Error(`${field} renders a PNG at one size (1–4096) or one width and height.`);
|
|
76
105
|
} else if (format === ".ico" || format === ".icns") {
|
|
77
106
|
const allowed = format === ".ico" ? [16, 24, 32, 48, 64, 128, 256] : iconSizes;
|
|
78
|
-
if (
|
|
107
|
+
if (
|
|
108
|
+
["size", "width", "height"].some((key) => key in target) ||
|
|
109
|
+
!Array.isArray(target.sizes) ||
|
|
110
|
+
!target.sizes.length ||
|
|
111
|
+
new Set(target.sizes).size !== target.sizes.length ||
|
|
112
|
+
target.sizes.some((size) => !allowed.includes(size))
|
|
113
|
+
)
|
|
114
|
+
throw new Error(`${field}.sizes must list distinct ${format.slice(1).toUpperCase()} sizes from ${allowed.join(", ")}.`);
|
|
79
115
|
} else throw new Error(`${field}.to must end in .svg, .png, .ico or .icns, or keep the supplied file's extension.`);
|
|
80
116
|
}
|
|
81
117
|
}
|
|
@@ -83,14 +119,22 @@ function validateBrandTargets(targets, { root, dsRoot }) {
|
|
|
83
119
|
function validateGlyphs(glyphs, { dsRoot }) {
|
|
84
120
|
if (glyphs === null) return;
|
|
85
121
|
if (!glyphs || typeof glyphs !== "object" || Array.isArray(glyphs)) throw new Error("assets.glyphs must be an object or null.");
|
|
86
|
-
const unknown = Object.keys(glyphs).filter(key => !["source", "output", "attributes"].includes(key));
|
|
122
|
+
const unknown = Object.keys(glyphs).filter((key) => !["source", "output", "attributes"].includes(key));
|
|
87
123
|
if (unknown.length) throw new Error(`assets.glyphs has unknown keys: ${unknown.join(", ")}.`);
|
|
88
124
|
const source = projectPath(dsRoot, glyphs.source, "assets.glyphs.source");
|
|
89
|
-
if (!isInside(path.join(dsRoot, "assets"), source) || source === path.join(dsRoot, "assets"))
|
|
125
|
+
if (!isInside(path.join(dsRoot, "assets"), source) || source === path.join(dsRoot, "assets"))
|
|
126
|
+
throw new Error("assets.glyphs.source must be a folder inside the ADS's assets/ folder.");
|
|
90
127
|
const output = projectPath(dsRoot, glyphs.output, "assets.glyphs.output");
|
|
91
|
-
if (isInside(path.join(dsRoot, "assets"), output) || path.extname(output) !== ".ts")
|
|
128
|
+
if (isInside(path.join(dsRoot, "assets"), output) || path.extname(output) !== ".ts")
|
|
129
|
+
throw new Error("assets.glyphs.output must be a .ts module in the ADS, outside assets/.");
|
|
92
130
|
const attributes = glyphs.attributes ?? {};
|
|
93
|
-
if (
|
|
131
|
+
if (
|
|
132
|
+
!attributes ||
|
|
133
|
+
typeof attributes !== "object" ||
|
|
134
|
+
Array.isArray(attributes) ||
|
|
135
|
+
Object.entries(attributes).some(([name, value]) => !/^[a-z][a-z0-9-]*$/.test(name) || typeof value !== "string" || /["<>]/.test(value))
|
|
136
|
+
)
|
|
137
|
+
throw new Error("assets.glyphs.attributes maps SVG attribute names to plain string values.");
|
|
94
138
|
}
|
|
95
139
|
|
|
96
140
|
export function projectPath(root, value, field) {
|
|
@@ -102,70 +146,171 @@ export function projectPath(root, value, field) {
|
|
|
102
146
|
return absolute;
|
|
103
147
|
}
|
|
104
148
|
|
|
149
|
+
/** Where ADS publishes the verified preview graph, relative to the project root. */
|
|
150
|
+
export const PREVIEW_MANIFEST = ".ds/preview/manifest.json";
|
|
151
|
+
|
|
105
152
|
export function loadConfig(directory = process.cwd()) {
|
|
106
153
|
const root = path.resolve(directory);
|
|
107
154
|
const configFile = path.join(root, "ds.config.json");
|
|
108
155
|
const user = existsSync(configFile) ? JSON.parse(readFileSync(configFile, "utf8")) : {};
|
|
109
156
|
if (!user || typeof user !== "object" || Array.isArray(user)) throw new Error("ds.config.json must be an object.");
|
|
110
|
-
if (Object.hasOwn(user, "enforce")) throw new Error("enforce was removed in 0.3.47: ADS findings are errors, review items or info. Remove enforce from ds.config.json.");
|
|
111
157
|
for (const field of Object.keys(user)) {
|
|
112
158
|
if (!(field in defaultConfig)) throw new Error(`Unknown ADS configuration field: ${field}`);
|
|
113
159
|
}
|
|
114
|
-
|
|
115
|
-
for (const field of ["assets", "
|
|
116
|
-
if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field])))
|
|
117
|
-
|
|
160
|
+
|
|
161
|
+
for (const field of ["assets", "mcp", "acceptance", "validation", "usage", "resources", "layout"]) {
|
|
162
|
+
if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field])))
|
|
163
|
+
throw new Error(`${field} must be an object.`);
|
|
164
|
+
for (const key of Object.keys(user[field] ?? {})) {
|
|
165
|
+
if (!(key in defaultConfig[field])) throw new Error(`Unknown ${field} configuration field: ${key}`);
|
|
166
|
+
}
|
|
118
167
|
}
|
|
119
|
-
const config = {
|
|
168
|
+
const config = {
|
|
169
|
+
...defaultConfig,
|
|
170
|
+
...user,
|
|
171
|
+
...fixedLayout,
|
|
172
|
+
assets: { ...defaultConfig.assets, ...user.assets },
|
|
173
|
+
acceptance: { ...defaultConfig.acceptance, ...user.acceptance },
|
|
174
|
+
validation: { ...defaultConfig.validation, ...user.validation },
|
|
175
|
+
mcp: { ...defaultConfig.mcp, ...user.mcp },
|
|
176
|
+
usage: { ...defaultConfig.usage, ...user.usage },
|
|
177
|
+
resources: { ...defaultConfig.resources, ...user.resources },
|
|
178
|
+
layout: { ...defaultConfig.layout, ...user.layout },
|
|
179
|
+
};
|
|
120
180
|
validateThemes(config.themes);
|
|
121
181
|
validateBrands(config.brands);
|
|
122
182
|
if (typeof config.followSystemTheme !== "boolean") throw new Error("followSystemTheme must be true or false.");
|
|
123
183
|
if (config.followSystemTheme) {
|
|
124
184
|
const other = config.themes[0].scheme === "dark" ? "light" : "dark";
|
|
125
|
-
if (!config.themes.some(theme => theme.scheme === other)) throw new Error(`followSystemTheme needs a declared theme with scheme ${other}.`);
|
|
185
|
+
if (!config.themes.some((theme) => theme.scheme === other)) throw new Error(`followSystemTheme needs a declared theme with scheme ${other}.`);
|
|
126
186
|
}
|
|
127
|
-
for (const brand of config.brands)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
187
|
+
for (const brand of config.brands)
|
|
188
|
+
if (config.themes.some((theme) => theme.name === `brand-${brand.name}`))
|
|
189
|
+
throw new Error(`Theme "brand-${brand.name}" and brand "${brand.name}" would share the display switch --display-brand-${brand.name}; rename one.`);
|
|
190
|
+
if (
|
|
191
|
+
config.resources.memoryLimitMb !== null &&
|
|
192
|
+
(!Number.isInteger(config.resources.memoryLimitMb) || config.resources.memoryLimitMb < 64 || config.resources.memoryLimitMb > 1048576)
|
|
193
|
+
)
|
|
194
|
+
throw new Error("resources.memoryLimitMb must be null (automatic) or an integer from 64 to 1048576 MiB.");
|
|
195
|
+
if (
|
|
196
|
+
config.assets.imageBudgetKb !== null &&
|
|
197
|
+
(!Number.isInteger(config.assets.imageBudgetKb) || config.assets.imageBudgetKb < 1 || config.assets.imageBudgetKb > 1048576)
|
|
198
|
+
)
|
|
199
|
+
throw new Error("assets.imageBudgetKb must be null (a limit per format) or a positive whole number of KB for every format.");
|
|
200
|
+
if (
|
|
201
|
+
config.assets.preloadFonts !== null &&
|
|
202
|
+
(!Array.isArray(config.assets.preloadFonts) ||
|
|
203
|
+
config.assets.preloadFonts.some(
|
|
204
|
+
(item) =>
|
|
205
|
+
!item ||
|
|
206
|
+
typeof item !== "object" ||
|
|
207
|
+
Array.isArray(item) ||
|
|
208
|
+
Object.keys(item).some((key) => !["family", "weight"].includes(key)) ||
|
|
209
|
+
typeof item.family !== "string" ||
|
|
210
|
+
!item.family ||
|
|
211
|
+
!Number.isInteger(item.weight) ||
|
|
212
|
+
item.weight < 1 ||
|
|
213
|
+
item.weight > 1000,
|
|
214
|
+
))
|
|
215
|
+
)
|
|
216
|
+
throw new Error('assets.preloadFonts must be null or an array of { "family": "Name", "weight": 400 }.');
|
|
217
|
+
if (
|
|
218
|
+
config.assets.fontBudgetKb !== null &&
|
|
219
|
+
(!Number.isInteger(config.assets.fontBudgetKb) || config.assets.fontBudgetKb < 1 || config.assets.fontBudgetKb > 1048576)
|
|
220
|
+
)
|
|
221
|
+
throw new Error("assets.fontBudgetKb must be null (the default limit) or a positive whole number of KB.");
|
|
222
|
+
if (
|
|
223
|
+
!Array.isArray(config.layout.widthTokens) ||
|
|
224
|
+
config.layout.widthTokens.length > 200 ||
|
|
225
|
+
new Set(config.layout.widthTokens).size !== config.layout.widthTokens.length ||
|
|
226
|
+
config.layout.widthTokens.some((name) => typeof name !== "string" || !/^--[\w-][\w*-]*$/.test(name))
|
|
227
|
+
)
|
|
228
|
+
throw new Error("layout.widthTokens must contain distinct token names or globs such as --panel-*, and cannot name every token.");
|
|
229
|
+
if (
|
|
230
|
+
!Array.isArray(config.layout.fixedWidthUnits) ||
|
|
231
|
+
config.layout.fixedWidthUnits.length > 200 ||
|
|
232
|
+
new Set(config.layout.fixedWidthUnits).size !== config.layout.fixedWidthUnits.length ||
|
|
233
|
+
config.layout.fixedWidthUnits.some(
|
|
234
|
+
(glob) => typeof glob !== "string" || !glob || glob.includes("\\") || glob.startsWith("/") || glob.split("/").includes("..") || !/[^*/]/.test(glob),
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
throw new Error(
|
|
238
|
+
"layout.fixedWidthUnits must contain distinct unit ids or project-relative globs such as components/Overlay/*, and cannot name every unit.",
|
|
239
|
+
);
|
|
240
|
+
if (!Array.isArray(config.usage.notifications) || config.usage.notifications.length > 100)
|
|
241
|
+
throw new Error("usage.notifications must be an array of notification API registrations.");
|
|
135
242
|
const notificationNames = new Set();
|
|
136
243
|
for (const entry of config.usage.notifications) {
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
244
|
+
if (
|
|
245
|
+
!entry ||
|
|
246
|
+
typeof entry !== "object" ||
|
|
247
|
+
Array.isArray(entry) ||
|
|
248
|
+
Object.keys(entry).some((key) => !["api", "host", "rootFiles"].includes(key)) ||
|
|
249
|
+
![entry.api, entry.host].every((name) => typeof name === "string" && /^[A-Za-z_$][\w$]*$/.test(name))
|
|
250
|
+
)
|
|
251
|
+
throw new Error("Each usage.notifications entry requires public api and host export names and rootFiles.");
|
|
252
|
+
if (notificationNames.has(entry.api) || notificationNames.has(entry.host) || entry.api === entry.host)
|
|
253
|
+
throw new Error("Notification API and host registrations must be distinct.");
|
|
254
|
+
notificationNames.add(entry.api);
|
|
255
|
+
notificationNames.add(entry.host);
|
|
256
|
+
if (!Array.isArray(entry.rootFiles) || !entry.rootFiles.length || entry.rootFiles.length > 100 || new Set(entry.rootFiles).size !== entry.rootFiles.length)
|
|
257
|
+
throw new Error("Notification rootFiles must contain distinct project-relative source files.");
|
|
141
258
|
for (const file of entry.rootFiles) {
|
|
142
259
|
projectPath(root, file, "usage.notifications.rootFiles");
|
|
143
|
-
if (
|
|
260
|
+
if (
|
|
261
|
+
!/\.[cm]?[jt]sx?$/.test(file) ||
|
|
262
|
+
file.includes("\\") ||
|
|
263
|
+
file.split("/").some((part) => !part || [".", "..", "node_modules", ".git", ".ds"].includes(part))
|
|
264
|
+
)
|
|
265
|
+
throw new Error("Notification rootFiles must name canonical project-relative source files.");
|
|
144
266
|
}
|
|
145
267
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
268
|
+
if (
|
|
269
|
+
!Array.isArray(config.usage.restrictedImports) ||
|
|
270
|
+
config.usage.restrictedImports.length > 100 ||
|
|
271
|
+
new Set(config.usage.restrictedImports).size !== config.usage.restrictedImports.length ||
|
|
272
|
+
config.usage.restrictedImports.some((name) => typeof name !== "string" || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))
|
|
273
|
+
)
|
|
274
|
+
throw new Error("usage.restrictedImports must contain distinct npm package names.");
|
|
275
|
+
for (const name of ["acceptance", "validation"]) {
|
|
276
|
+
const scripts = config[name].scripts;
|
|
277
|
+
if (
|
|
278
|
+
!Array.isArray(scripts) ||
|
|
279
|
+
scripts.length > 20 ||
|
|
280
|
+
new Set(scripts).size !== scripts.length ||
|
|
281
|
+
scripts.some((script) => typeof script !== "string" || !/^[a-zA-Z0-9][\w:.-]*$/.test(script))
|
|
282
|
+
)
|
|
283
|
+
throw new Error(`${name}.scripts must contain up to 20 unique package script names.`);
|
|
153
284
|
}
|
|
154
|
-
|
|
285
|
+
for (const key of ["behavior", "audit"]) if (typeof config.acceptance[key] !== "boolean") throw new Error(`acceptance.${key} must be true or false.`);
|
|
286
|
+
if (config.validation.scripts.some((script) => config.acceptance.scripts.includes(script)))
|
|
287
|
+
throw new Error("validation.scripts run after acceptance.scripts; list each script once.");
|
|
288
|
+
if (
|
|
289
|
+
!Array.isArray(config.validation.inputs) ||
|
|
290
|
+
config.validation.inputs.length > 200 ||
|
|
291
|
+
new Set(config.validation.inputs).size !== config.validation.inputs.length
|
|
292
|
+
)
|
|
293
|
+
throw new Error("validation.inputs must contain at most 200 unique project-relative files or directories.");
|
|
155
294
|
for (const file of config.validation.inputs) {
|
|
156
|
-
const absolute = projectPath(root,file,"validation.inputs");
|
|
157
|
-
if (
|
|
295
|
+
const absolute = projectPath(root, file, "validation.inputs");
|
|
296
|
+
if (
|
|
297
|
+
absolute === root ||
|
|
298
|
+
path.relative(root, absolute).replaceAll("\\", "/") !== file ||
|
|
299
|
+
file.split("/").some((part) => ["node_modules", ".git", ".ds"].includes(part))
|
|
300
|
+
)
|
|
301
|
+
throw new Error("validation.inputs must name canonical source paths below the project root, excluding dependency and metadata directories.");
|
|
158
302
|
}
|
|
159
303
|
if (config.schemaVersion !== 1) throw new Error(`Unsupported ADS config version: ${config.schemaVersion}`);
|
|
160
304
|
if (user.framework !== undefined && !supportedFrameworks.includes(user.framework)) throw new Error("framework must be react or preact.");
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
305
|
+
if (
|
|
306
|
+
!Array.isArray(config.behaviorLibraries) ||
|
|
307
|
+
config.behaviorLibraries.length > 100 ||
|
|
308
|
+
new Set(config.behaviorLibraries).size !== config.behaviorLibraries.length ||
|
|
309
|
+
config.behaviorLibraries.some((name) => typeof name !== "string" || name.length > 214 || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))
|
|
310
|
+
)
|
|
311
|
+
throw new Error("behaviorLibraries must contain up to 100 unique npm package names, without versions, subpaths or wildcards.");
|
|
165
312
|
const sourceRoot = projectPath(root, config.sourceDir, "sourceDir");
|
|
166
313
|
const dsRoot = projectPath(root, config.dsDir, "dsDir");
|
|
167
|
-
for (const field of ["publicEntry", "reviewEntry", "stylesEntry", "tokenDir"]) projectPath(dsRoot, config[field], field);
|
|
168
|
-
if (!isInside(path.join(dsRoot, "review"), path.resolve(dsRoot, config.reviewEntry)) || path.resolve(dsRoot, config.reviewEntry) === path.join(dsRoot, "review") || !/\.[cm]?[jt]sx?$/.test(config.reviewEntry)) throw new Error("reviewEntry must name a script entry inside the ADS review/ development layer.");
|
|
169
314
|
for (const field of ["publicDirs", "generatedPaths", "generatedFiles"]) {
|
|
170
315
|
if (!Array.isArray(config.assets[field])) throw new Error(`assets.${field} must be an array.`);
|
|
171
316
|
for (const entry of config.assets[field]) {
|
|
@@ -174,75 +319,90 @@ export function loadConfig(directory = process.cwd()) {
|
|
|
174
319
|
if (absolute === base) throw new Error(`assets.${field} must name a path below its root.`);
|
|
175
320
|
}
|
|
176
321
|
}
|
|
177
|
-
if (!Array.isArray(config.oxlint.plugins) || !config.oxlint.rules || typeof config.oxlint.rules !== "object" || Array.isArray(config.oxlint.rules)) {
|
|
178
|
-
throw new Error("oxlint requires plugins (array) and rules (object).");
|
|
179
|
-
}
|
|
180
|
-
if (!Array.isArray(config.oxlint.overrides)) throw new Error("oxlint.overrides must be an array.");
|
|
181
|
-
for (const override of config.oxlint.overrides) {
|
|
182
|
-
if (!override || typeof override !== "object" || Array.isArray(override) || Object.keys(override).some((key) => !["files", "rules"].includes(key))) throw new Error("Each oxlint override requires files and rules only.");
|
|
183
|
-
if (!Array.isArray(override.files) || !override.files.length || override.files.some((file) => typeof file !== "string" || !file.trim() || file.startsWith("!") || path.isAbsolute(file) || file.split(/[\\/]/).includes(".."))) throw new Error("oxlint.overrides.files must contain project-relative paths or globs.");
|
|
184
|
-
if (!override.rules || typeof override.rules !== "object" || Array.isArray(override.rules)) throw new Error("oxlint.overrides.rules must be an object.");
|
|
185
|
-
}
|
|
186
322
|
if (config.assets.iconSource !== null) {
|
|
187
323
|
const source = projectPath(dsRoot, config.assets.iconSource, "assets.iconSource");
|
|
188
|
-
if (!isInside(path.join(dsRoot, "assets/brand"), source) || !renderableFormats.includes(path.extname(source).toLowerCase()))
|
|
324
|
+
if (!isInside(path.join(dsRoot, "assets/brand"), source) || !renderableFormats.includes(path.extname(source).toLowerCase()))
|
|
325
|
+
throw new Error("assets.iconSource must name an SVG, or a square PNG, JPEG or WebP of at least 512 px, inside the ADS's assets/brand/ folder.");
|
|
189
326
|
}
|
|
190
327
|
validateBrandTargets(config.assets.targets, { root, dsRoot });
|
|
191
328
|
validateGlyphs(config.assets.glyphs, { dsRoot });
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
if (config.mcp.showcaseUrl !== null) {
|
|
199
|
-
let url;
|
|
200
|
-
try { url = new URL(config.mcp.showcaseUrl); } catch { throw new Error("mcp.showcaseUrl must be an http(s) URL or null."); }
|
|
201
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) throw new Error("mcp.showcaseUrl must be an http(s) URL without credentials.");
|
|
202
|
-
}
|
|
203
|
-
if (config.mcp.showcaseTitle !== null && (typeof config.mcp.showcaseTitle !== "string" || !config.mcp.showcaseTitle.trim() || config.mcp.showcaseTitle.length > 120)) throw new Error("mcp.showcaseTitle must be a non-empty title of at most 120 characters or null.");
|
|
204
|
-
if (!Array.isArray(config.mcp.apps)) throw new Error("mcp.apps must be an array of built project previews.");
|
|
329
|
+
if (
|
|
330
|
+
config.mcp.showcaseTitle !== null &&
|
|
331
|
+
(typeof config.mcp.showcaseTitle !== "string" || !config.mcp.showcaseTitle.trim() || config.mcp.showcaseTitle.length > 120)
|
|
332
|
+
)
|
|
333
|
+
throw new Error("mcp.showcaseTitle must be a non-empty title of at most 120 characters or null.");
|
|
205
334
|
const capture = config.mcp.capture;
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
335
|
+
if (
|
|
336
|
+
!capture ||
|
|
337
|
+
typeof capture !== "object" ||
|
|
338
|
+
Array.isArray(capture) ||
|
|
339
|
+
Object.keys(capture).some((key) => !["browser", "channel", "timeoutMs"].includes(key)) ||
|
|
340
|
+
!["chromium", "firefox", "webkit"].includes(capture.browser ?? "chromium") ||
|
|
341
|
+
(capture.channel !== undefined &&
|
|
342
|
+
(typeof capture.channel !== "string" || !/^[\w-]{1,60}$/.test(capture.channel) || ![undefined, "chromium"].includes(capture.browser))) ||
|
|
343
|
+
(capture.timeoutMs !== undefined && (!Number.isInteger(capture.timeoutMs) || capture.timeoutMs < 100 || capture.timeoutMs > 300000))
|
|
344
|
+
)
|
|
345
|
+
throw new Error(
|
|
346
|
+
"mcp.capture accepts browser (chromium/firefox/webkit), an optional Chromium channel, and timeoutMs (100–300000). Install Playwright and its browser in the project; ADS installs nothing.",
|
|
347
|
+
);
|
|
348
|
+
if (
|
|
349
|
+
!config.mcp.behaviorProfiles ||
|
|
350
|
+
typeof config.mcp.behaviorProfiles !== "object" ||
|
|
351
|
+
Array.isArray(config.mcp.behaviorProfiles) ||
|
|
352
|
+
Object.keys(config.mcp.behaviorProfiles).length > 20
|
|
353
|
+
)
|
|
354
|
+
throw new Error("mcp.behaviorProfiles must be an object of up to 20 registered execution profiles.");
|
|
211
355
|
for (const [name, profile] of Object.entries(config.mcp.behaviorProfiles)) {
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const watch = config.mcp.previewWatch;
|
|
234
|
-
if (!watch || typeof watch !== "object" || Array.isArray(watch) || Object.keys(watch).some((key) => !["command", "args"].includes(key)) || typeof watch.command !== "string" || !watch.command.trim() || watch.command.includes("\0") || !Array.isArray(watch.args) || watch.args.some((arg) => typeof arg !== "string" || arg.includes("\0"))) throw new Error("mcp.previewWatch requires command (executable) and args (string array), null (native compiler), or false (externally prebuilt previews).");
|
|
235
|
-
}
|
|
236
|
-
if(config.framework&&config.mcp.previewManifest&&config.mcp.previewWatch===null){
|
|
237
|
-
config.mcp.previewWatch={command:"bun",args:[fileURLToPath(new URL("./bun-compiler.mjs",import.meta.url)),"--watch"]};
|
|
238
|
-
}
|
|
239
|
-
const appIds = new Set();
|
|
240
|
-
for (const app of config.mcp.apps) {
|
|
241
|
-
if (!app || typeof app !== "object" || Object.keys(app).some((key) => !["id", "title", "kind", "file", "description"].includes(key)) || !/^[a-z][a-z0-9-]{0,63}$/.test(app.id) || app.id === "tokens" || appIds.has(app.id) || typeof app.title !== "string" || !app.title.trim() || !["components", "patterns", "showcase"].includes(app.kind) || app.description !== undefined && typeof app.description !== "string") throw new Error("Each mcp.apps entry needs a unique id (tokens is reserved), title, kind (components/patterns/showcase), and project-relative HTML file.");
|
|
242
|
-
const file = projectPath(root, app.file, "mcp.apps.file");
|
|
243
|
-
if (path.extname(file) !== ".html") throw new Error("mcp.apps.file must be a built, self-contained HTML file.");
|
|
244
|
-
appIds.add(app.id);
|
|
356
|
+
if (
|
|
357
|
+
!/^[a-zA-Z0-9][\w.-]{0,79}$/.test(name) ||
|
|
358
|
+
!profile ||
|
|
359
|
+
typeof profile !== "object" ||
|
|
360
|
+
Array.isArray(profile) ||
|
|
361
|
+
Object.keys(profile).some((key) => !["command", "args", "timeoutMs", "runner", "framework", "mode"].includes(key)) ||
|
|
362
|
+
typeof profile.command !== "string" ||
|
|
363
|
+
!profile.command.trim() ||
|
|
364
|
+
profile.command.includes("\0") ||
|
|
365
|
+
!Array.isArray(profile.args) ||
|
|
366
|
+
profile.args.some((arg) => typeof arg !== "string" || arg.includes("\0")) ||
|
|
367
|
+
!["protocol", "playwright"].includes(profile.runner ?? "protocol") ||
|
|
368
|
+
(profile.framework !== undefined && profile.framework !== config.framework) ||
|
|
369
|
+
(profile.mode !== undefined && !["browser", "strict", "unit"].includes(profile.mode)) ||
|
|
370
|
+
(profile.timeoutMs !== undefined && (!Number.isInteger(profile.timeoutMs) || profile.timeoutMs < 100 || profile.timeoutMs > 900000))
|
|
371
|
+
)
|
|
372
|
+
throw new Error(
|
|
373
|
+
`Invalid behavior profile ${name}. Use literal executable/args, a protocol or Playwright runner, a matching framework and a timeout from 100 to 900000 ms. Profiles do not install dependencies or receive APIs from an MCP host.`,
|
|
374
|
+
);
|
|
375
|
+
if (profile.mode === "strict" && config.framework !== "react")
|
|
376
|
+
throw new Error(`Behavior profile ${name}: React StrictMode requires framework react; use the configured framework's lifecycle tests instead.`);
|
|
245
377
|
}
|
|
378
|
+
const retention = { ...defaultConfig.mcp.resultRetention, ...config.mcp.resultRetention };
|
|
379
|
+
if (
|
|
380
|
+
!config.mcp.resultRetention ||
|
|
381
|
+
typeof config.mcp.resultRetention !== "object" ||
|
|
382
|
+
Array.isArray(config.mcp.resultRetention) ||
|
|
383
|
+
Object.keys(config.mcp.resultRetention).some((key) => !["maxRuns", "maxAgeDays", "maxBytesMb"].includes(key)) ||
|
|
384
|
+
!Number.isInteger(retention.maxRuns) ||
|
|
385
|
+
retention.maxRuns < 1 ||
|
|
386
|
+
retention.maxRuns > 1000 ||
|
|
387
|
+
!Number.isInteger(retention.maxAgeDays) ||
|
|
388
|
+
retention.maxAgeDays < 1 ||
|
|
389
|
+
retention.maxAgeDays > 365 ||
|
|
390
|
+
!Number.isInteger(retention.maxBytesMb) ||
|
|
391
|
+
retention.maxBytesMb < 8 ||
|
|
392
|
+
retention.maxBytesMb > 16384
|
|
393
|
+
)
|
|
394
|
+
throw new Error("mcp.resultRetention requires maxRuns (1–1000), maxAgeDays (1–365), maxBytesMb (8–16384).");
|
|
395
|
+
config.mcp.resultRetention = retention;
|
|
396
|
+
if (!Number.isInteger(config.mcp.mutationCheckTimeoutMs) || config.mcp.mutationCheckTimeoutMs < 100 || config.mcp.mutationCheckTimeoutMs > 300000)
|
|
397
|
+
throw new Error(
|
|
398
|
+
"mcp.mutationCheckTimeoutMs must be an integer from 100 to 300000. This budget applies to each registered project script, separately from behavior profiles.",
|
|
399
|
+
);
|
|
400
|
+
if (!Number.isInteger(config.mcp.auditPages) || config.mcp.auditPages < 1 || config.mcp.auditPages > 16)
|
|
401
|
+
throw new Error("mcp.auditPages must be an integer from 1 to 16: how many pages the render audit renders at once.");
|
|
402
|
+
if (!Number.isInteger(config.mcp.previewBuildTimeoutMs) || config.mcp.previewBuildTimeoutMs < 1000 || config.mcp.previewBuildTimeoutMs > 3600000)
|
|
403
|
+
throw new Error(
|
|
404
|
+
"mcp.previewBuildTimeoutMs must be an integer from 1000 to 3600000. It is how long a preview waits for its build, including the first build after the MCP server starts.",
|
|
405
|
+
);
|
|
246
406
|
return { root, config, sourceRoot, dsRoot };
|
|
247
407
|
}
|
|
248
408
|
|
|
@@ -271,7 +431,10 @@ export function isContractFile(file) {
|
|
|
271
431
|
|
|
272
432
|
/** The ADS-relative path without `.ads.scenario.*`; a canonical `<Dir>/<Dir>.ads.scenario.*` identifies the directory. */
|
|
273
433
|
export function scenarioIdentity(file, dsRoot) {
|
|
274
|
-
let id = path
|
|
434
|
+
let id = path
|
|
435
|
+
.relative(dsRoot, file)
|
|
436
|
+
.replaceAll("\\", "/")
|
|
437
|
+
.replace(/\.ads\.scenario\.[^.]+$/, "");
|
|
275
438
|
if (adsFileRole(file) === "scenario" && path.posix.basename(id) === path.posix.basename(path.posix.dirname(id))) id = path.posix.dirname(id);
|
|
276
439
|
return id;
|
|
277
440
|
}
|
|
@@ -279,17 +442,16 @@ export function scenarioIdentity(file, dsRoot) {
|
|
|
279
442
|
export function isDevelopmentFile(file, { dsRoot }) {
|
|
280
443
|
if (isDraftFile(file)) return true;
|
|
281
444
|
if (!isInside(dsRoot, file)) return isTestFile(file) || adsFileRole(file) !== null;
|
|
282
|
-
const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
|
|
283
445
|
// An exports file belongs to its owner's layer: production for the public barrel, development under review/.
|
|
284
|
-
return adsFileRole(file) !== null && adsFileRole(file) !== "exports" ||
|
|
446
|
+
return (adsFileRole(file) !== null && (adsFileRole(file) !== "exports" || isInside(path.join(dsRoot, "review"), file))) || isTestFile(file);
|
|
285
447
|
}
|
|
286
448
|
|
|
287
449
|
/** Review implementations may own demo presentation; scenarios/fixtures may not. */
|
|
288
450
|
export function isReviewFile(file, { dsRoot }) {
|
|
289
|
-
return !isDraftFile(file) && isInside(
|
|
451
|
+
return !isDraftFile(file) && isInside(dsRoot, file) && adsFileRole(file) === "review" && !isTestFile(file);
|
|
290
452
|
}
|
|
291
453
|
|
|
292
|
-
const ignored = new Set(["node_modules", "dist", "dist-showcase", "
|
|
454
|
+
const ignored = new Set(["node_modules", "dist", "dist-showcase", ".git", ".vite", ".ds", "coverage"]);
|
|
293
455
|
|
|
294
456
|
export function sourceFiles(root) {
|
|
295
457
|
if (!existsSync(root)) return [];
|
|
@@ -297,23 +459,28 @@ export function sourceFiles(root) {
|
|
|
297
459
|
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
298
460
|
if (ignored.has(entry.name) || entry.isSymbolicLink() || isDraftFile(path.join(root, entry.name))) continue;
|
|
299
461
|
const file = path.join(root, entry.name);
|
|
300
|
-
if (entry.isDirectory()) {
|
|
301
|
-
|
|
462
|
+
if (entry.isDirectory()) {
|
|
463
|
+
if (!hasProjectConfig(file)) files.push(...sourceFiles(file));
|
|
464
|
+
} else if (entry.isFile() && /\.(css|html|[cm]?[jt]sx?)$/.test(entry.name)) files.push(file);
|
|
302
465
|
}
|
|
303
466
|
return files.sort();
|
|
304
467
|
}
|
|
305
468
|
|
|
306
|
-
export function importViolation(specifier, filename, options, resolve) {
|
|
307
|
-
if (draftImportViolation(specifier, filename, resolve ?? ((id, file) => [path.resolve(path.dirname(file), id)]))) return true;
|
|
469
|
+
export async function importViolation(specifier, filename, options, resolve) {
|
|
470
|
+
if (await draftImportViolation(specifier, filename, resolve ?? ((id, file) => [path.resolve(path.dirname(file), id)]))) return true;
|
|
308
471
|
const { root, dsRoot, config } = options;
|
|
309
472
|
// ADS implementation code needs its private imports; the showcase is a consumer.
|
|
310
473
|
if (isInside(dsRoot, filename) && (!isDevelopmentFile(filename, options) || isContractFile(filename))) return false; // Contract symbol ownership is checked without executing imports.
|
|
311
474
|
if (specifier === `${config.publicAlias}/review`) return !isDevelopmentFile(filename, options) && !isTestFile(filename);
|
|
312
475
|
if (specifier.startsWith(`${config.publicAlias}/`)) return true;
|
|
313
476
|
if (specifier === config.publicAlias) return false;
|
|
314
|
-
const imported = resolve
|
|
315
|
-
|
|
316
|
-
: specifier.startsWith(
|
|
477
|
+
const imported = resolve
|
|
478
|
+
? await resolve(specifier, filename)
|
|
479
|
+
: specifier.startsWith(".")
|
|
480
|
+
? [path.resolve(path.dirname(filename), specifier)]
|
|
481
|
+
: specifier.startsWith(`${config.dsDir}/`)
|
|
482
|
+
? [path.resolve(root, specifier)]
|
|
483
|
+
: [];
|
|
317
484
|
return imported.some((file) => {
|
|
318
485
|
if (!isInside(dsRoot, file)) return false;
|
|
319
486
|
// Previews may show the ADS's own artwork and fonts: asset files are data, not implementation.
|
|
@@ -323,7 +490,8 @@ export function importViolation(specifier, filename, options, resolve) {
|
|
|
323
490
|
if (isReviewFile(filename, options)) return false;
|
|
324
491
|
// Owner-local white-box tests may exercise private helpers without making
|
|
325
492
|
// those helpers public API. Scenarios remain public-API consumers.
|
|
326
|
-
if (isTestFile(filename) && isInside(dsRoot, filename) && options.testOwner?.(filename) && options.testOwner(filename) === options.testOwner(file))
|
|
493
|
+
if (isTestFile(filename) && isInside(dsRoot, filename) && options.testOwner?.(filename) && options.testOwner(filename) === options.testOwner(file))
|
|
494
|
+
return false;
|
|
327
495
|
if (isDevelopmentFile(filename, options) && isDevelopmentFile(file, options)) return false;
|
|
328
496
|
if (isTestFile(filename) && (isInside(path.join(dsRoot, "showcase"), file) || isTestFile(file))) return false;
|
|
329
497
|
if (isInside(path.join(dsRoot, "showcase"), filename) && isInside(path.join(dsRoot, "showcase"), file)) return false;
|