@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/brand-assets.mjs
CHANGED
|
@@ -20,16 +20,29 @@ export function brandSourceDiagnostic({ root, dsRoot, config }) {
|
|
|
20
20
|
// A finished image is a master only when it is square and big enough for the largest icon.
|
|
21
21
|
const size = imageSize(readFileSync(file));
|
|
22
22
|
if (size && size.width === size.height && size.width >= 512) return null;
|
|
23
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
rule: "asset-source",
|
|
25
|
+
file: relative,
|
|
26
|
+
line: 1,
|
|
27
|
+
column: 1,
|
|
28
|
+
message: `assets.iconSource ${size ? `is ${size.width}×${size.height}; it` : "is not a readable PNG, JPEG or WebP; it"} must be a square image of at least 512×512, or an SVG.`,
|
|
29
|
+
};
|
|
24
30
|
}
|
|
25
31
|
if (valid && /<svg\b[\s\S]*<\/svg\s*>|<svg\b[^>]*\/>/i.test(readFileSync(file, "utf8"))) return null;
|
|
26
|
-
return {
|
|
32
|
+
return {
|
|
33
|
+
rule: "asset-source",
|
|
34
|
+
file: relative,
|
|
35
|
+
line: 1,
|
|
36
|
+
column: 1,
|
|
37
|
+
message: "assets.iconSource must be an existing SVG master inside assets/brand/, without symlinked paths.",
|
|
38
|
+
};
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
function assertOutput(root, file, { directory = false } = {}) {
|
|
30
42
|
for (let current = file; isInside(root, current); current = path.dirname(current)) {
|
|
31
43
|
const stat = lstatSync(current, { throwIfNoEntry: false });
|
|
32
|
-
if (stat && (stat.isSymbolicLink() || (current === file && !directory ? !stat.isFile() : !stat.isDirectory())))
|
|
44
|
+
if (stat && (stat.isSymbolicLink() || (current === file && !directory ? !stat.isFile() : !stat.isDirectory())))
|
|
45
|
+
throw new Error(`Invalid generated asset path: ${current}`);
|
|
33
46
|
if (current === root) break;
|
|
34
47
|
}
|
|
35
48
|
}
|
|
@@ -54,7 +67,7 @@ function ico(entries) {
|
|
|
54
67
|
return result;
|
|
55
68
|
}
|
|
56
69
|
|
|
57
|
-
const sha256 = bytes => createHash("sha256").update(bytes).digest("hex");
|
|
70
|
+
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
58
71
|
// Bump when rendering changes, so committed outputs are regenerated.
|
|
59
72
|
const renderer = "ads-brand-targets-1";
|
|
60
73
|
/** The committed record of rendered targets: what each output was made from. */
|
|
@@ -67,8 +80,12 @@ function fingerprint(dsRoot, target) {
|
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
function readManifest(dsRoot) {
|
|
70
|
-
try {
|
|
71
|
-
|
|
83
|
+
try {
|
|
84
|
+
const value = JSON.parse(readFileSync(path.join(dsRoot, targetsManifest), "utf8"));
|
|
85
|
+
return value?.outputs && typeof value.outputs === "object" ? value.outputs : {};
|
|
86
|
+
} catch {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
72
89
|
}
|
|
73
90
|
|
|
74
91
|
// PNG-encoded ICNS entries by pixel size (a 1024 image is the 512@2x slot).
|
|
@@ -86,9 +103,9 @@ function icns(entries) {
|
|
|
86
103
|
return Buffer.concat([header, ...chunks]);
|
|
87
104
|
}
|
|
88
105
|
|
|
89
|
-
const sized = target => ["size", "width", "height", "sizes", "background"].some(key => key in target);
|
|
106
|
+
const sized = (target) => ["size", "width", "height", "sizes", "background"].some((key) => key in target);
|
|
90
107
|
/** A copy of the supplied file: the same format, no sizes. */
|
|
91
|
-
export const copiesTarget = target => !sized(target) && path.extname(target.to).toLowerCase() === path.extname(target.from).toLowerCase();
|
|
108
|
+
export const copiesTarget = (target) => !sized(target) && path.extname(target.to).toLowerCase() === path.extname(target.from).toLowerCase();
|
|
92
109
|
|
|
93
110
|
/** Why a raster master cannot make this target: ADS never enlarges a finished image. */
|
|
94
111
|
export function targetUpscale(source, target) {
|
|
@@ -96,8 +113,11 @@ export function targetUpscale(source, target) {
|
|
|
96
113
|
const size = imageSize(source);
|
|
97
114
|
if (!size) return `${target.from} is not a readable PNG, JPEG or WebP.`;
|
|
98
115
|
const sizes = target.sizes ?? [];
|
|
99
|
-
const width = target.width ?? target.size ?? Math.max(...sizes),
|
|
100
|
-
|
|
116
|
+
const width = target.width ?? target.size ?? Math.max(...sizes),
|
|
117
|
+
height = target.height ?? target.size ?? Math.max(...sizes);
|
|
118
|
+
return Math.min(width / size.width, height / size.height) > 1
|
|
119
|
+
? `${target.to} would enlarge ${target.from} (${size.width}×${size.height}) to ${width}×${height}. Supply a larger image or an SVG master.`
|
|
120
|
+
: null;
|
|
101
121
|
}
|
|
102
122
|
|
|
103
123
|
async function renderTarget(sharp, source, target) {
|
|
@@ -108,8 +128,10 @@ async function renderTarget(sharp, source, target) {
|
|
|
108
128
|
const vector = target.from.toLowerCase().endsWith(".svg");
|
|
109
129
|
const background = target.background;
|
|
110
130
|
const png = async (width, height) => {
|
|
111
|
-
let image = sharp(source, vector ? { density: Math.max(72, Math.ceil(Math.max(width, height) * 1.5)) } : {})
|
|
112
|
-
|
|
131
|
+
let image = sharp(source, vector ? { density: Math.max(72, Math.ceil(Math.max(width, height) * 1.5)) } : {}).resize(width, height, {
|
|
132
|
+
fit: "contain",
|
|
133
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
|
134
|
+
});
|
|
113
135
|
if (background) image = image.flatten({ background });
|
|
114
136
|
return image.png().toBuffer();
|
|
115
137
|
};
|
|
@@ -117,23 +139,118 @@ async function renderTarget(sharp, source, target) {
|
|
|
117
139
|
const sizes = [...target.sizes].sort((a, b) => a - b);
|
|
118
140
|
const entries = [];
|
|
119
141
|
for (const size of sizes) entries.push({ size, buffer: await png(size, size) });
|
|
120
|
-
return format === ".ico" ? ico(entries.map(entry => ({ ...entry, size: entry.size === 256 ? 0 : entry.size }))) : icns(entries);
|
|
142
|
+
return format === ".ico" ? ico(entries.map((entry) => ({ ...entry, size: entry.size === 256 ? 0 : entry.size }))) : icns(entries);
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
/** One glyph as the generated module stores it: the configured default attributes fill what the SVG leaves unset. */
|
|
124
146
|
export function glyphMarkup(text, attributes = {}) {
|
|
125
|
-
return text
|
|
147
|
+
return text
|
|
148
|
+
.replace(/<\?xml[\s\S]*?\?>/g, "")
|
|
149
|
+
.trim()
|
|
126
150
|
.replace(/<svg\b([^>]*)>/, (_match, own) => {
|
|
127
|
-
const missing = Object.entries(attributes)
|
|
151
|
+
const missing = Object.entries(attributes)
|
|
152
|
+
.filter(([key]) => !new RegExp(`(?:^|\\s)${key}=`).test(own))
|
|
153
|
+
.map(([key, value]) => ` ${key}="${value}"`)
|
|
154
|
+
.join("");
|
|
128
155
|
return `<svg${missing}${own}>`;
|
|
129
156
|
});
|
|
130
157
|
}
|
|
131
158
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
159
|
+
// Bun's JSON.parse names no position, so a strict scan finds where the text first stops being JSON.
|
|
160
|
+
function jsonErrorPosition(text) {
|
|
161
|
+
let index = 0;
|
|
162
|
+
const fail = () => {
|
|
163
|
+
throw index;
|
|
164
|
+
};
|
|
165
|
+
const space = () => {
|
|
166
|
+
while (/[ \t\n\r]/.test(text[index] ?? "")) index++;
|
|
167
|
+
};
|
|
168
|
+
const literal = (word) => {
|
|
169
|
+
if (text.startsWith(word, index)) index += word.length;
|
|
170
|
+
else fail();
|
|
171
|
+
};
|
|
172
|
+
const string = () => {
|
|
173
|
+
if (text[index] !== '"') fail();
|
|
174
|
+
for (index++; index < text.length; index++) {
|
|
175
|
+
const char = text[index];
|
|
176
|
+
if (char === '"') {
|
|
177
|
+
index++;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (char < " ") fail();
|
|
181
|
+
if (char === "\\") {
|
|
182
|
+
index++;
|
|
183
|
+
if (text[index] === "u") {
|
|
184
|
+
if (!/^[0-9a-fA-F]{4}$/.test(text.slice(index + 1, index + 5))) fail();
|
|
185
|
+
index += 4;
|
|
186
|
+
} else if (!'"\\/bfnrt'.includes(text[index] ?? "x")) fail();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
fail();
|
|
190
|
+
};
|
|
191
|
+
const number = () => {
|
|
192
|
+
const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text.slice(index));
|
|
193
|
+
if (!match) fail();
|
|
194
|
+
index += match[0].length;
|
|
195
|
+
};
|
|
196
|
+
const value = () => {
|
|
197
|
+
space();
|
|
198
|
+
const char = text[index];
|
|
199
|
+
if (char === "{") {
|
|
200
|
+
index++;
|
|
201
|
+
space();
|
|
202
|
+
if (text[index] === "}") {
|
|
203
|
+
index++;
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
for (;;) {
|
|
207
|
+
space();
|
|
208
|
+
string();
|
|
209
|
+
space();
|
|
210
|
+
if (text[index] !== ":") fail();
|
|
211
|
+
index++;
|
|
212
|
+
value();
|
|
213
|
+
space();
|
|
214
|
+
if (text[index] === "}") {
|
|
215
|
+
index++;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (text[index] !== ",") fail();
|
|
219
|
+
index++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (char === "[") {
|
|
223
|
+
index++;
|
|
224
|
+
space();
|
|
225
|
+
if (text[index] === "]") {
|
|
226
|
+
index++;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
for (;;) {
|
|
230
|
+
value();
|
|
231
|
+
space();
|
|
232
|
+
if (text[index] === "]") {
|
|
233
|
+
index++;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (text[index] !== ",") fail();
|
|
237
|
+
index++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (char === '"') return string();
|
|
241
|
+
if (char === "t") return literal("true");
|
|
242
|
+
if (char === "f") return literal("false");
|
|
243
|
+
if (char === "n") return literal("null");
|
|
244
|
+
return number();
|
|
245
|
+
};
|
|
246
|
+
try {
|
|
247
|
+
value();
|
|
248
|
+
space();
|
|
249
|
+
if (index < text.length) fail();
|
|
250
|
+
return { line: 1, column: 1 };
|
|
251
|
+
} catch (position) {
|
|
252
|
+
return typeof position === "number" ? textPosition(text, Math.min(position, text.length)) : { line: 1, column: 1 };
|
|
253
|
+
}
|
|
137
254
|
}
|
|
138
255
|
function textPosition(text, index) {
|
|
139
256
|
const before = text.slice(0, index).split("\n");
|
|
@@ -150,16 +267,22 @@ export function glyphAliases(directory, names) {
|
|
|
150
267
|
if (!existsSync(file)) return { file, aliases: {}, problems: [] };
|
|
151
268
|
const text = readFileSync(file, "utf8");
|
|
152
269
|
let value;
|
|
153
|
-
try {
|
|
154
|
-
|
|
155
|
-
|
|
270
|
+
try {
|
|
271
|
+
value = JSON.parse(text);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
return { file, aliases: {}, problems: [{ ...jsonErrorPosition(text), message: `aliases.json is not valid JSON: ${error.message}` }] };
|
|
274
|
+
}
|
|
275
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.values(value).some((target) => typeof target !== "string")) {
|
|
156
276
|
return { file, aliases: {}, problems: [{ line: 1, column: 1, message: "aliases.json maps alias names to glyph names." }] };
|
|
157
277
|
}
|
|
158
|
-
const glyphs = new Set(names.filter(name => !Object.hasOwn(value, name)));
|
|
159
|
-
const problems = Object.entries(value)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
278
|
+
const glyphs = new Set(names.filter((name) => !Object.hasOwn(value, name)));
|
|
279
|
+
const problems = Object.entries(value)
|
|
280
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
281
|
+
.filter(([, target]) => !glyphs.has(target))
|
|
282
|
+
.map(([alias, target]) => {
|
|
283
|
+
const key = text.search(new RegExp(`${JSON.stringify(alias).replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:`));
|
|
284
|
+
return { ...(key >= 0 ? textPosition(text, key) : { line: 1, column: 1 }), message: `${alias} names a missing glyph ${target}.` };
|
|
285
|
+
});
|
|
163
286
|
return { file, aliases: value, problems };
|
|
164
287
|
}
|
|
165
288
|
|
|
@@ -168,8 +291,14 @@ export function glyphModule({ dsRoot, config }) {
|
|
|
168
291
|
const glyphs = config.assets.glyphs;
|
|
169
292
|
if (!glyphs) return null;
|
|
170
293
|
const directory = path.join(dsRoot, glyphs.source);
|
|
171
|
-
const names = readdirSync(directory)
|
|
172
|
-
|
|
294
|
+
const names = readdirSync(directory)
|
|
295
|
+
.filter((name) => name.endsWith(".svg"))
|
|
296
|
+
.sort()
|
|
297
|
+
.map((name) => name.slice(0, -4));
|
|
298
|
+
const {
|
|
299
|
+
aliases,
|
|
300
|
+
problems: [problem],
|
|
301
|
+
} = glyphAliases(directory, names);
|
|
173
302
|
if (problem) throw new Error(`${path.join(glyphs.source, "aliases.json")}:${problem.line}: ${problem.message}`);
|
|
174
303
|
const attributes = glyphs.attributes ?? {};
|
|
175
304
|
const map = {};
|
|
@@ -177,9 +306,11 @@ export function glyphModule({ dsRoot, config }) {
|
|
|
177
306
|
if (Object.hasOwn(aliases, id)) continue;
|
|
178
307
|
map[id] = glyphMarkup(readFileSync(path.join(directory, `${id}.svg`), "utf8"), attributes);
|
|
179
308
|
}
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
309
|
+
return (
|
|
310
|
+
`// Generated by \`ads assets\` from ${glyphs.source}/. Edit the SVGs, not this file.\n` +
|
|
311
|
+
`export const glyphs = ${JSON.stringify(map, null, 2)} as const;\n` +
|
|
312
|
+
`export const glyphAliases = ${JSON.stringify(aliases, null, 2)} as const;\n`
|
|
313
|
+
);
|
|
183
314
|
}
|
|
184
315
|
|
|
185
316
|
/** Committed outputs that no longer match their masters, settings or rendered bytes. */
|
|
@@ -191,9 +322,15 @@ export function staleBrandOutputs(options) {
|
|
|
191
322
|
const file = path.join(root, target.to);
|
|
192
323
|
const entry = recorded[target.to];
|
|
193
324
|
let reason = null;
|
|
194
|
-
if (!existsSync(path.join(dsRoot, target.from))) {
|
|
325
|
+
if (!existsSync(path.join(dsRoot, target.from))) {
|
|
326
|
+
stale.push({ file: target.to, message: `${target.to} names a missing master ${target.from}.` });
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
195
329
|
const upscale = targetUpscale(readFileSync(path.join(dsRoot, target.from)), target);
|
|
196
|
-
if (upscale) {
|
|
330
|
+
if (upscale) {
|
|
331
|
+
stale.push({ file: target.to, message: upscale });
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
197
334
|
if (!existsSync(file)) reason = "is missing";
|
|
198
335
|
else if (!entry || entry.fingerprint !== fingerprint(dsRoot, target)) reason = `no longer matches ${target.from} or its settings`;
|
|
199
336
|
else if (entry.sha256 !== sha256(readFileSync(file))) reason = "was changed by hand";
|
|
@@ -203,8 +340,13 @@ export function staleBrandOutputs(options) {
|
|
|
203
340
|
if (glyphs) {
|
|
204
341
|
const file = path.join(dsRoot, glyphs.output);
|
|
205
342
|
let expected;
|
|
206
|
-
try {
|
|
207
|
-
|
|
343
|
+
try {
|
|
344
|
+
expected = glyphModule(options);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
stale.push({ file: path.relative(root, file), message: error.message });
|
|
347
|
+
}
|
|
348
|
+
if (expected !== undefined && (!existsSync(file) || readFileSync(file, "utf8") !== expected))
|
|
349
|
+
stale.push({ file: path.relative(root, file).replaceAll("\\", "/"), message: `${glyphs.output} is out of date with ${glyphs.source}/. Run ads assets.` });
|
|
208
350
|
}
|
|
209
351
|
return stale;
|
|
210
352
|
}
|
|
@@ -213,14 +355,18 @@ export function staleBrandOutputs(options) {
|
|
|
213
355
|
async function generateCommitted(options) {
|
|
214
356
|
const { root, dsRoot, config } = options;
|
|
215
357
|
const written = [];
|
|
216
|
-
const recorded = readManifest(dsRoot),
|
|
358
|
+
const recorded = readManifest(dsRoot),
|
|
359
|
+
next = {};
|
|
217
360
|
let sharp;
|
|
218
361
|
for (const target of config.assets.targets) {
|
|
219
362
|
const file = path.join(root, target.to);
|
|
220
363
|
if (!existsSync(path.join(dsRoot, target.from))) throw new Error(`${target.to} names a missing master ${target.from}.`);
|
|
221
364
|
const print = fingerprint(dsRoot, target);
|
|
222
365
|
const entry = recorded[target.to];
|
|
223
|
-
if (entry?.fingerprint === print && existsSync(file) && entry.sha256 === sha256(readFileSync(file))) {
|
|
366
|
+
if (entry?.fingerprint === print && existsSync(file) && entry.sha256 === sha256(readFileSync(file))) {
|
|
367
|
+
next[target.to] = entry;
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
224
370
|
sharp ??= (await import("sharp")).default;
|
|
225
371
|
const bytes = await renderTarget(sharp, readFileSync(path.join(dsRoot, target.from)), target);
|
|
226
372
|
assertOutput(root, file);
|
|
@@ -233,12 +379,23 @@ async function generateCommitted(options) {
|
|
|
233
379
|
if (config.assets.targets.length) {
|
|
234
380
|
const sorted = Object.fromEntries(Object.entries(next).sort(([a], [b]) => a.localeCompare(b)));
|
|
235
381
|
const text = `${JSON.stringify({ schemaVersion: 1, outputs: sorted }, null, 2)}\n`;
|
|
236
|
-
if (!existsSync(manifest) || readFileSync(manifest, "utf8") !== text) {
|
|
237
|
-
|
|
382
|
+
if (!existsSync(manifest) || readFileSync(manifest, "utf8") !== text) {
|
|
383
|
+
writeFileSync(manifest, text);
|
|
384
|
+
written.push(manifest);
|
|
385
|
+
}
|
|
386
|
+
} else if (existsSync(manifest)) {
|
|
387
|
+
rmSync(manifest);
|
|
388
|
+
written.push(manifest);
|
|
389
|
+
}
|
|
238
390
|
const glyphs = glyphModule(options);
|
|
239
391
|
if (glyphs !== null) {
|
|
240
392
|
const file = path.join(dsRoot, config.assets.glyphs.output);
|
|
241
|
-
if (!existsSync(file) || readFileSync(file, "utf8") !== glyphs) {
|
|
393
|
+
if (!existsSync(file) || readFileSync(file, "utf8") !== glyphs) {
|
|
394
|
+
assertOutput(root, file);
|
|
395
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
396
|
+
writeFileSync(file, glyphs);
|
|
397
|
+
written.push(file);
|
|
398
|
+
}
|
|
242
399
|
}
|
|
243
400
|
return written;
|
|
244
401
|
}
|
|
@@ -248,14 +405,20 @@ export async function generateBrandAssets(directory = process.cwd()) {
|
|
|
248
405
|
const { root, dsRoot, config } = options;
|
|
249
406
|
const output = path.join(root, ".ds/assets");
|
|
250
407
|
const committed = await generateCommitted(options);
|
|
251
|
-
if (!config.assets.iconSource)
|
|
408
|
+
if (!config.assets.iconSource)
|
|
409
|
+
return { directory: output, files: [], committed, skipped: !committed.length && !config.assets.targets.length && !config.assets.glyphs };
|
|
252
410
|
const diagnostic = brandSourceDiagnostic(options);
|
|
253
411
|
if (diagnostic) throw new Error(`${diagnostic.file} [${diagnostic.rule}] ${diagnostic.message}`);
|
|
254
412
|
assertOutput(root, output, { directory: true });
|
|
255
413
|
for (const name of brandFiles) {
|
|
256
414
|
assertOutput(root, path.join(output, name));
|
|
257
|
-
for (const mount of [
|
|
258
|
-
|
|
415
|
+
for (const mount of [
|
|
416
|
+
path.join(dsRoot, "assets"),
|
|
417
|
+
path.join(dsRoot, "showcase/public/assets"),
|
|
418
|
+
...config.assets.publicDirs.map((entry) => path.join(root, entry)),
|
|
419
|
+
]) {
|
|
420
|
+
if (lstatSync(path.join(mount, name), { throwIfNoEntry: false }))
|
|
421
|
+
throw new Error(`[asset-collision] ${path.relative(root, mount)}/${name} conflicts with a generated brand asset.`);
|
|
259
422
|
}
|
|
260
423
|
}
|
|
261
424
|
// Load rendering only when the project has selected artwork. Render everything
|
|
@@ -267,7 +430,14 @@ export async function generateBrandAssets(directory = process.cwd()) {
|
|
|
267
430
|
const outputs = new Map(vector ? [["favicon.svg", source]] : []);
|
|
268
431
|
const sizes = [16, 32, 48, 180, 192, 512];
|
|
269
432
|
const rendered = new Map();
|
|
270
|
-
for (const size of sizes)
|
|
433
|
+
for (const size of sizes)
|
|
434
|
+
rendered.set(
|
|
435
|
+
size,
|
|
436
|
+
await sharp(source, vector ? { density: 512 } : {})
|
|
437
|
+
.resize(size, size, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
|
438
|
+
.png()
|
|
439
|
+
.toBuffer(),
|
|
440
|
+
);
|
|
271
441
|
outputs.set("favicon.ico", ico([16, 32, 48].map((size) => ({ size, buffer: rendered.get(size) }))));
|
|
272
442
|
outputs.set("apple-touch-icon.png", rendered.get(180));
|
|
273
443
|
outputs.set("icon-192.png", rendered.get(192));
|
|
@@ -281,6 +451,8 @@ export async function generateBrandAssets(directory = process.cwd()) {
|
|
|
281
451
|
if (outputs.has(name)) renameSync(path.join(staging, name), path.join(output, name));
|
|
282
452
|
else rmSync(path.join(output, name), { force: true });
|
|
283
453
|
}
|
|
284
|
-
} finally {
|
|
454
|
+
} finally {
|
|
455
|
+
rmSync(staging, { recursive: true, force: true });
|
|
456
|
+
}
|
|
285
457
|
return { directory: output, files: [...outputs.keys()].map((name) => path.join(output, name)), committed, skipped: false };
|
|
286
458
|
}
|
package/dist/brands.mjs
CHANGED
|
@@ -10,14 +10,16 @@ import { findingSeverity } from "./finding-rules.mjs";
|
|
|
10
10
|
// defaults.
|
|
11
11
|
|
|
12
12
|
export function validateBrands(brands) {
|
|
13
|
-
if (!Array.isArray(brands) || brands.length > 8)
|
|
13
|
+
if (!Array.isArray(brands) || brands.length > 8)
|
|
14
|
+
throw new Error("brands must list up to 8 brands; the first is the default. An empty list (or none) means a single brand.");
|
|
14
15
|
const names = new Set();
|
|
15
16
|
for (const [index, brand] of brands.entries()) {
|
|
16
17
|
const field = `brands[${index}]`;
|
|
17
18
|
if (!brand || typeof brand !== "object" || Array.isArray(brand)) throw new Error(`${field} must be an object with a name.`);
|
|
18
|
-
const unknown = Object.keys(brand).filter(key => key !== "name");
|
|
19
|
+
const unknown = Object.keys(brand).filter((key) => key !== "name");
|
|
19
20
|
if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
|
|
20
|
-
if (typeof brand.name !== "string" || !/^[a-z][a-z0-9-]{0,31}$/.test(brand.name))
|
|
21
|
+
if (typeof brand.name !== "string" || !/^[a-z][a-z0-9-]{0,31}$/.test(brand.name))
|
|
22
|
+
throw new Error(`${field}.name must be a lowercase name such as "acme" or "partner-co".`);
|
|
21
23
|
if (names.has(brand.name)) throw new Error(`Brand "${brand.name}" is declared twice.`);
|
|
22
24
|
names.add(brand.name);
|
|
23
25
|
}
|
|
@@ -25,57 +27,114 @@ export function validateBrands(brands) {
|
|
|
25
27
|
|
|
26
28
|
const colorLiteral = /^(?:#[\da-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\()/i;
|
|
27
29
|
const ascending = (a, b) => Number(a.match(/\d+$/)[0]) - Number(b.match(/\d+$/)[0]);
|
|
28
|
-
const brandOwn = (token, brand) => token.definitions.filter(definition => !definition.conditional && definition.brand === brand);
|
|
30
|
+
const brandOwn = (token, brand) => token.definitions.filter((definition) => !definition.conditional && definition.brand === brand);
|
|
29
31
|
|
|
30
32
|
/** Brands are declared, re-value only existing tokens, give every half of a themed token they
|
|
31
33
|
* change, re-value tokens that follow the theme only through halves, and re-value whole ramps. */
|
|
32
34
|
export function brandFindings(tokens, brands, themes, { dsDir } = {}) {
|
|
33
|
-
const declared = new Set(brands.map(brand => brand.name));
|
|
34
|
-
const diagnostics = [],
|
|
35
|
-
|
|
35
|
+
const declared = new Set(brands.map((brand) => brand.name));
|
|
36
|
+
const diagnostics = [],
|
|
37
|
+
advisories = [];
|
|
38
|
+
const finding = (rule, at, message, names) =>
|
|
39
|
+
(findingSeverity(rule) === "error" ? diagnostics : advisories).push({
|
|
40
|
+
rule,
|
|
41
|
+
severity: findingSeverity(rule),
|
|
42
|
+
file: at.file,
|
|
43
|
+
line: at.line,
|
|
44
|
+
column: at.column,
|
|
45
|
+
...(names ? { tokens: names } : {}),
|
|
46
|
+
guidanceUri: "ads://guides/tokens",
|
|
47
|
+
message,
|
|
48
|
+
});
|
|
36
49
|
const reported = new Set();
|
|
37
|
-
for (const token of tokens)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
for (const token of tokens)
|
|
51
|
+
for (const definition of token.definitions) {
|
|
52
|
+
if (definition.brand === null || declared.has(definition.brand) || reported.has(`${definition.file}:${definition.line}:${definition.brand}`)) continue;
|
|
53
|
+
reported.add(`${definition.file}:${definition.line}:${definition.brand}`);
|
|
54
|
+
diagnostics.push({
|
|
55
|
+
rule: "brand-undeclared",
|
|
56
|
+
file: definition.file,
|
|
57
|
+
line: definition.line,
|
|
58
|
+
column: definition.column,
|
|
59
|
+
message: `${token.name} is set for brand "${definition.brand}", which ds.config.json does not declare (${declared.size ? `brands: ${[...declared].join(", ")}` : "no brands"}). Declare it or fix the name.`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
42
62
|
if (!brands.length) return { diagnostics, advisories };
|
|
43
63
|
for (const token of tokens) {
|
|
44
64
|
if (baseDefinition(token)) continue;
|
|
45
|
-
const branded = token.definitions.find(definition => !definition.conditional && definition.brand !== null);
|
|
46
|
-
if (branded)
|
|
65
|
+
const branded = token.definitions.find((definition) => !definition.conditional && definition.brand !== null);
|
|
66
|
+
if (branded)
|
|
67
|
+
finding(
|
|
68
|
+
"brand-new-token",
|
|
69
|
+
branded,
|
|
70
|
+
`${token.name} exists only in a brand; brands re-value the default brand's tokens, so define it on :root and change only its value per brand.`,
|
|
71
|
+
[token.name],
|
|
72
|
+
);
|
|
47
73
|
}
|
|
48
74
|
const dependent = themeDependents(tokens);
|
|
49
75
|
const ramps = new Map();
|
|
50
76
|
for (const token of tokens) {
|
|
51
|
-
const match = token.name.match(/^(--[\w-]+?)-(\d+)$/),
|
|
77
|
+
const match = token.name.match(/^(--[\w-]+?)-(\d+)$/),
|
|
78
|
+
base = baseDefinition(token);
|
|
52
79
|
if (!match || !base || !colorLiteral.test(base.value.trim())) continue;
|
|
53
80
|
if (!ramps.has(match[1])) ramps.set(match[1], []);
|
|
54
81
|
ramps.get(match[1]).push(token);
|
|
55
82
|
}
|
|
56
83
|
for (const brand of brands.slice(1)) {
|
|
57
|
-
const own = token => brandOwn(token, brand.name).length > 0;
|
|
84
|
+
const own = (token) => brandOwn(token, brand.name).length > 0;
|
|
58
85
|
if (!tokens.some(own)) {
|
|
59
|
-
if (dsDir)
|
|
86
|
+
if (dsDir)
|
|
87
|
+
finding(
|
|
88
|
+
"brand-empty",
|
|
89
|
+
{ file: dsDir, line: 1, column: 1 },
|
|
90
|
+
`Brand "${brand.name}" is declared but sets no token values; give it values under [data-brand="${brand.name}"] or remove it from ds.config.json.`,
|
|
91
|
+
);
|
|
60
92
|
continue;
|
|
61
93
|
}
|
|
62
94
|
// The generated resolver re-resolves tokens that follow the theme on every brand element, over one brand value.
|
|
63
|
-
for (const token of tokens.filter(token => dependent.has(token.name))) {
|
|
64
|
-
const single = brandOwn(token, brand.name).find(definition => definition.theme === null);
|
|
65
|
-
if (single)
|
|
66
|
-
|
|
95
|
+
for (const token of tokens.filter((token) => dependent.has(token.name))) {
|
|
96
|
+
const single = brandOwn(token, brand.name).find((definition) => definition.theme === null);
|
|
97
|
+
if (single)
|
|
98
|
+
diagnostics.push({
|
|
99
|
+
rule: "brand-theme-value",
|
|
100
|
+
file: single.file,
|
|
101
|
+
line: single.line,
|
|
102
|
+
column: single.column,
|
|
103
|
+
tokens: [token.name],
|
|
104
|
+
message: `Brand "${brand.name}" sets ${token.name} to one value, but ${token.name} follows the theme; give it per-theme halves (${themes.map((theme) => `${token.name}-${theme.name}`).join(", ")}) on :root and under [data-brand="${brand.name}"].`,
|
|
105
|
+
});
|
|
67
106
|
}
|
|
68
|
-
const partial = tokens.filter(
|
|
69
|
-
|
|
107
|
+
const partial = tokens.filter(
|
|
108
|
+
(token) =>
|
|
109
|
+
token.themed &&
|
|
110
|
+
brandOwn(token, brand.name).some((definition) => definition.theme !== null) &&
|
|
111
|
+
themes.some((theme) => !brandOwn(token, brand.name).some((definition) => definition.theme === theme.name)),
|
|
112
|
+
);
|
|
70
113
|
if (partial.length) {
|
|
71
|
-
const names = partial.map(token => token.name),
|
|
72
|
-
|
|
114
|
+
const names = partial.map((token) => token.name),
|
|
115
|
+
missing = themes
|
|
116
|
+
.filter((theme) => partial.some((token) => !brandOwn(token, brand.name).some((definition) => definition.theme === theme.name)))
|
|
117
|
+
.map((theme) => theme.name);
|
|
118
|
+
finding(
|
|
119
|
+
"brand-coverage",
|
|
120
|
+
brandOwn(partial[0], brand.name)[0],
|
|
121
|
+
`Brand "${brand.name}" gives ${nameList(names)} only some of their halves (missing for ${missing.join(", ")}); a brand gives every half of a token it changes, or those themes mix ${brand.name}'s values with the default brand's.`,
|
|
122
|
+
names,
|
|
123
|
+
);
|
|
73
124
|
}
|
|
74
125
|
for (const [ramp, steps] of ramps) {
|
|
75
126
|
const set = steps.filter(own);
|
|
76
127
|
if (!set.length || set.length === steps.length) continue;
|
|
77
|
-
const missing = steps
|
|
78
|
-
|
|
128
|
+
const missing = steps
|
|
129
|
+
.filter((step) => !own(step))
|
|
130
|
+
.map((step) => step.name)
|
|
131
|
+
.sort(ascending);
|
|
132
|
+
finding(
|
|
133
|
+
"brand-coverage",
|
|
134
|
+
brandOwn(set[0], brand.name)[0],
|
|
135
|
+
`Brand "${brand.name}" sets ${set.length} of ${steps.length} ${ramp}-* steps; it also needs ${missing.join(", ")}, or the ramp mixes two brands.`,
|
|
136
|
+
missing,
|
|
137
|
+
);
|
|
79
138
|
}
|
|
80
139
|
}
|
|
81
140
|
return { diagnostics, advisories };
|
package/dist/bun-compiler.mjs
CHANGED
|
@@ -3,30 +3,44 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
import { restoreCompiledPreviews, runScenarioCompiler } from "./scenarios-compiler.mjs";
|
|
4
4
|
import { loadConfig } from "./config.mjs";
|
|
5
5
|
import { withPreviewSession } from "./preview-scope.mjs";
|
|
6
|
-
import { createBunPreviewBuilder } from "./preview-bun.mjs";
|
|
6
|
+
import { createBunPreviewBuilder, previewFrameFiles } from "./preview-bun.mjs";
|
|
7
7
|
import { checkCandidate } from "./validation-checks.mjs";
|
|
8
8
|
import { renderStoppingRules } from "./finding-rules.mjs";
|
|
9
9
|
|
|
10
|
-
const compilerFiles=[
|
|
10
|
+
const compilerFiles = [
|
|
11
|
+
import.meta.filename,
|
|
12
|
+
...previewFrameFiles,
|
|
13
|
+
...["preview-bun.mjs", "preview-imports.mjs", "bun-worker.mjs", "construction-styles.cjs", "lockup-model.cjs", "spatial-model.cjs", "spatial-inputs.cjs", "spatial-contexts.cjs", "spatial-css.cjs", "linaria/spatial-inputs.cjs", "linaria/preserve-values.cjs"].map((file) => fileURLToPath(new URL(file, import.meta.url))),
|
|
14
|
+
];
|
|
11
15
|
|
|
12
|
-
function validator(root){
|
|
13
|
-
return async function validate(){
|
|
14
|
-
const result=await checkCandidate(root);
|
|
15
|
-
if(result.ok)return true;
|
|
16
|
+
function validator(root) {
|
|
17
|
+
return async function validate() {
|
|
18
|
+
const result = await checkCandidate(root);
|
|
19
|
+
if (result.ok) return true;
|
|
16
20
|
// A session the audit started renders despite policy errors and reports them; it records no pass.
|
|
17
|
-
const stopping=
|
|
18
|
-
|
|
21
|
+
const stopping =
|
|
22
|
+
process.env.ADS_PREVIEW_DESPITE_POLICY === "1" ? result.diagnostics.filter((item) => renderStoppingRules.has(item.rule)) : result.diagnostics;
|
|
23
|
+
if (stopping.length) throw Object.assign(new Error("ADS project validation failed."), { diagnostics: stopping });
|
|
19
24
|
return false;
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
/** The same ADS-owned Bun compiler serves MCP, standalone builds and CI. */
|
|
24
|
-
export async function compilePreviews(directory=process.cwd(),{watched=false}={}) {
|
|
25
|
-
const root=path.resolve(directory);
|
|
26
|
-
if(!watched){
|
|
29
|
+
export async function compilePreviews(directory = process.cwd(), { watched = false } = {}) {
|
|
30
|
+
const root = path.resolve(directory);
|
|
31
|
+
if (!watched) {
|
|
32
|
+
const restored = await restoreCompiledPreviews(withPreviewSession(loadConfig(root), process.env.ADS_MCP_BUILD_SESSION), compilerFiles);
|
|
33
|
+
if (restored) return restored;
|
|
34
|
+
}
|
|
27
35
|
// Each root, the project's and every hosted draft's, gets its own validator and Bun builder.
|
|
28
|
-
const main=await runScenarioCompiler(root,projectRoot=>({
|
|
29
|
-
|
|
36
|
+
const main = await runScenarioCompiler(root, (projectRoot) => ({
|
|
37
|
+
watched,
|
|
38
|
+
compilerFiles,
|
|
39
|
+
validate: validator(projectRoot),
|
|
40
|
+
buildGraph: createBunPreviewBuilder(),
|
|
41
|
+
}));
|
|
42
|
+
if (watched) for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, async () => main?.stop());
|
|
30
43
|
return main;
|
|
31
44
|
}
|
|
32
|
-
if(process.argv[1]&&path.resolve(process.argv[1])===fileURLToPath(import.meta.url))
|
|
45
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url))
|
|
46
|
+
await compilePreviews(process.cwd(), { watched: process.argv.includes("--watch") });
|