@reqvire-org/ads 0.3.53 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -94
- package/dist/a11y.mjs +108 -29
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +140 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +15 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +146 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +164 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +6 -6
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +222 -79
- package/dist/boundaries.mjs +137 -40
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +34 -13
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +66 -0
- package/dist/check.mjs +756 -196
- package/dist/cli.mjs +203 -100
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +2 -2
- package/dist/config.mjs +308 -163
- package/dist/construction-styles.cjs +10 -0
- package/dist/contracts.d.mts +9 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +7 -5
- package/dist/font-rules.mjs +2 -2
- package/dist/fonts-generated.mjs +4 -2
- package/dist/foundation-views.mjs +238 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +198 -0
- package/dist/icons.mjs +80 -33
- package/dist/image-attributes.mjs +109 -36
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +128 -68
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +300 -127
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +91 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +978 -343
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +701 -219
- package/dist/mcp/preview-watch.mjs +465 -161
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +6 -6
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2436 -570
- package/dist/mcp/showcase-host.mjs +176 -39
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/preview-bun.mjs +493 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +10 -0
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +70 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
- package/dist/render-audit.mjs +828 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +768 -359
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +424 -159
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +18 -0
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +55 -0
- package/dist/showcase/foundation-view.mjs +252 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1062 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +152 -144
- package/dist/skills/ads-designer/references/accessibility.md +14 -11
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +34 -30
- package/dist/skills/ads-designer/references/branding.md +98 -10
- package/dist/skills/ads-designer/references/captures.md +31 -31
- package/dist/skills/ads-designer/references/cli.md +21 -20
- package/dist/skills/ads-designer/references/contracts.md +63 -29
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +71 -52
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +58 -51
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/performance.md +3 -2
- package/dist/skills/ads-designer/references/review.md +42 -38
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +17 -19
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -71
- package/dist/skills/ads-designer/references/workflows.md +19 -37
- package/dist/skills/ads-import/SKILL.md +43 -328
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +34 -30
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +31 -31
- package/dist/skills/ads-import/references/cli.md +21 -20
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +63 -29
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +71 -52
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +58 -51
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +42 -38
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +17 -19
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -71
- package/dist/skills/ads-import/references/workflows.md +19 -37
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +54 -346
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +34 -30
- package/dist/skills/ads-port/references/captures.md +31 -31
- package/dist/skills/ads-port/references/cli.md +21 -20
- package/dist/skills/ads-port/references/contracts.md +63 -29
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +71 -52
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +58 -51
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +8 -7
- package/dist/skills/ads-port/references/review.md +42 -38
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +17 -19
- package/dist/skills/ads-port/references/validation.md +83 -71
- package/dist/skills/ads-port/references/workflows.md +19 -37
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +266 -128
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +24 -19
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +54 -52
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/index.ts +5 -8
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +24 -19
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +73 -27
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +133 -60
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +60 -19
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +270 -89
- package/dist/units.mjs +215 -180
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +121 -38
- package/dist/validation-inputs.mjs +187 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +100 -89
- package/docs/ARCHITECTURE.md +353 -159
- package/docs/BEHAVIORS.md +33 -28
- package/docs/CACHING.md +55 -11
- package/docs/CHANGELOG.md +358 -17
- package/docs/COMPARISON.md +1 -1
- package/docs/CONTRACTS.md +22 -29
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +313 -292
- package/docs/MCP.md +261 -439
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +42 -34
- package/dist/browser-audit.mjs +0 -424
- package/dist/contract-migration.mjs +0 -110
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -48
- package/dist/mcp/draft-exports.mjs +0 -40
- package/dist/mcp/edit-preparation.mjs +0 -115
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -88
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -415
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -411
- package/dist/skills/ads-break-ui/references/captures.md +0 -160
- package/dist/skills/ads-break-ui/references/contracts.md +0 -284
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -178
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -154
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -96
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -162
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -83
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -388
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -411
- package/dist/skills/ads-motion/references/captures.md +0 -160
- package/dist/skills/ads-motion/references/contracts.md +0 -284
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -178
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -154
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -96
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -162
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -83
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -5
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/design-values.mjs
CHANGED
|
@@ -9,80 +9,165 @@ import { findingSeverity } from "./finding-rules.mjs";
|
|
|
9
9
|
const colorCache = new Map();
|
|
10
10
|
export function isColorKeyword(value) {
|
|
11
11
|
if (!/^[a-z]+$/i.test(value) || /^(?:currentcolor|transparent|none|inherit|initial|unset|revert)$/i.test(value)) return false;
|
|
12
|
-
const key=value.toLowerCase();
|
|
13
|
-
if(!colorCache.has(key))colorCache.set(key
|
|
12
|
+
const key = value.toLowerCase();
|
|
13
|
+
if (!colorCache.has(key)) colorCache.set(key, !!lexer.matchType("color", key).matched);
|
|
14
14
|
return colorCache.get(key);
|
|
15
15
|
}
|
|
16
|
-
const refs = value => {
|
|
17
|
-
const names=[];
|
|
18
|
-
valueParser(value).walk(
|
|
16
|
+
const refs = (value) => {
|
|
17
|
+
const names = [];
|
|
18
|
+
valueParser(value).walk((node) => {
|
|
19
|
+
if (node.type === "function" && node.value === "var") {
|
|
20
|
+
const name = node.nodes.find((child) => child.type === "word")?.value;
|
|
21
|
+
if (name?.startsWith("--")) names.push(name);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
19
24
|
return names;
|
|
20
25
|
};
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
const maxDesignVariants = 256;
|
|
28
|
+
const variantLimit = `More than ${maxDesignVariants} distinct style alternatives; split this template into smaller source-resolvable styles.`;
|
|
29
|
+
|
|
30
|
+
/** Resolve every alternative or return an explicit incomplete result. Never execute project code. */
|
|
23
31
|
export function createDesignValues(program, options) {
|
|
24
|
-
const values=createSourceValues(program,options);
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
const values = createSourceValues(program, options, { completeReturns: true });
|
|
33
|
+
return async (expression) => {
|
|
34
|
+
const strings = new Set();
|
|
35
|
+
let reason;
|
|
36
|
+
async function collect(input, context) {
|
|
37
|
+
if (reason) return;
|
|
38
|
+
const value = await values.resolve(input, context);
|
|
39
|
+
if (value.kind === "union") {
|
|
40
|
+
for (const item of value.values) {
|
|
41
|
+
await collect(item, values.next(context));
|
|
42
|
+
if (reason) break;
|
|
43
|
+
}
|
|
44
|
+
} else if (value.kind === "literal" && ["string", "number"].includes(typeof value.value)) {
|
|
45
|
+
strings.add(String(value.value));
|
|
46
|
+
if (strings.size > maxDesignVariants) reason = variantLimit;
|
|
47
|
+
} else reason = value.reason ?? "A style alternative is not a source-resolvable string or number.";
|
|
48
|
+
}
|
|
49
|
+
await collect(reference(expression), values.state());
|
|
50
|
+
return { values: [...strings], reason: reason ?? (strings.size ? undefined : "No style alternative could be established from source.") };
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Bound the Cartesian product without silently dropping branches or unknown fragments. */
|
|
55
|
+
export async function designTemplateVariants(template, resolve) {
|
|
56
|
+
if (!template.templateSpans) return { texts: [template.text] };
|
|
57
|
+
let prefixes = new Set([template.head.text]);
|
|
58
|
+
for (const span of template.templateSpans) {
|
|
59
|
+
const parts = await resolve(span.expression);
|
|
60
|
+
if (parts.reason) return { texts: [], reason: parts.reason, node: span.expression };
|
|
61
|
+
const next = new Set();
|
|
62
|
+
for (const prefix of prefixes) for (const value of parts.values) {
|
|
63
|
+
next.add(prefix + value + span.literal.text);
|
|
64
|
+
if (next.size > maxDesignVariants) return { texts: [], reason: variantLimit, node: span.expression };
|
|
65
|
+
}
|
|
66
|
+
prefixes = next;
|
|
30
67
|
}
|
|
31
|
-
return
|
|
68
|
+
return { texts: [...prefixes] };
|
|
32
69
|
}
|
|
33
70
|
|
|
34
71
|
/** Variable names cannot conceal the typography/layering role of their consumer. */
|
|
35
72
|
export function inspectDesignAliases(styles, options, report) {
|
|
36
|
-
const declarations
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
73
|
+
const declarations = [],
|
|
74
|
+
roles = new Map(),
|
|
75
|
+
protectedProperties = new Set(["font-family", "font-weight", "z-index"]);
|
|
76
|
+
const add = (name, role) => {
|
|
77
|
+
if (!roles.has(name)) roles.set(name, new Set());
|
|
78
|
+
const before = roles.get(name).size;
|
|
79
|
+
roles.get(name).add(role);
|
|
80
|
+
return roles.get(name).size !== before;
|
|
81
|
+
};
|
|
82
|
+
for (const entry of styles) {
|
|
83
|
+
if (isInside(path.join(options.dsRoot, options.config.tokenDir), entry.file)) continue;
|
|
84
|
+
entry.css.walkDecls((decl) => {
|
|
85
|
+
if (decl.parent.type === "atrule" && decl.parent.name.toLowerCase() === "property") return;
|
|
86
|
+
declarations.push({ ...entry, decl });
|
|
87
|
+
if (protectedProperties.has(decl.prop)) for (const name of refs(decl.value)) add(name, decl.prop);
|
|
44
88
|
});
|
|
45
89
|
}
|
|
46
90
|
// A finite fixed point includes all alias/fallback branches and imported helper styles.
|
|
47
|
-
let changed=true;
|
|
48
|
-
while(changed)
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
91
|
+
let changed = true;
|
|
92
|
+
while (changed) {
|
|
93
|
+
changed = false;
|
|
94
|
+
for (const { decl } of declarations)
|
|
95
|
+
for (const role of roles.get(decl.prop) ?? []) for (const name of refs(decl.value)) changed = add(name, role) || changed;
|
|
96
|
+
}
|
|
97
|
+
for (const { file, offset, decl } of declarations) {
|
|
98
|
+
const selected = protectedProperties.has(decl.prop) ? new Set([decl.prop]) : roles.get(decl.prop);
|
|
99
|
+
if (!selected) continue;
|
|
100
|
+
const nodes = valueParser(decl.value).nodes.filter((node) => !["space", "comment"].includes(node.type));
|
|
101
|
+
function allowed(nodes) {
|
|
102
|
+
nodes = nodes.filter((node) => !["space", "comment"].includes(node.type));
|
|
103
|
+
if (nodes.length !== 1) return false;
|
|
104
|
+
const [node] = nodes;
|
|
105
|
+
if (node.type === "word") return /^(?:inherit|initial|unset|revert(?:-layer)?|auto)$/.test(node.value);
|
|
106
|
+
if (node.type !== "function" || node.value !== "var" || node.unclosed) return false;
|
|
107
|
+
const parts = node.nodes.filter((node) => !["space", "comment"].includes(node.type));
|
|
108
|
+
return (
|
|
109
|
+
parts[0]?.type === "word" &&
|
|
110
|
+
/^--[\w-]+$/.test(parts[0].value) &&
|
|
111
|
+
(parts.length === 1 || (parts[1]?.type === "div" && parts[1].value === "," && allowed(parts.slice(2))))
|
|
112
|
+
);
|
|
61
113
|
}
|
|
62
|
-
const valid=allowed(nodes);
|
|
63
|
-
if(!valid)
|
|
114
|
+
const valid = allowed(nodes);
|
|
115
|
+
if (!valid)
|
|
116
|
+
report(
|
|
117
|
+
file,
|
|
118
|
+
"design-value-source",
|
|
119
|
+
`${decl.prop} reaches ${[...selected].sort().join("/")}. Map it to shared Data with a token reference; a private variable or raw fallback cannot introduce independent typography/layering values.`,
|
|
120
|
+
offset.line + decl.source.start.line - 1,
|
|
121
|
+
decl.source.start.column,
|
|
122
|
+
{ guidanceUri: "ads://guides/tokens" },
|
|
123
|
+
);
|
|
64
124
|
}
|
|
65
125
|
}
|
|
66
126
|
|
|
67
|
-
const canonical=
|
|
127
|
+
const canonical = (value) => {
|
|
128
|
+
try {
|
|
129
|
+
return generate(parse(value, { context: "value" }));
|
|
130
|
+
} catch {
|
|
131
|
+
return value.trim();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
68
134
|
// A token's family: its shared prefix (--space-, --radius-) or, for a fixed name, the name itself.
|
|
69
|
-
const prefixes=[...tokenContract.naming.prefixes].sort((a,b)=>b.length-a.length);
|
|
70
|
-
const family=name=>prefixes.find(prefix=>name.startsWith(prefix)&&name.length>prefix.length)??name;
|
|
135
|
+
const prefixes = [...tokenContract.naming.prefixes].sort((a, b) => b.length - a.length);
|
|
136
|
+
const family = (name) => prefixes.find((prefix) => name.startsWith(prefix) && name.length > prefix.length) ?? name;
|
|
71
137
|
/** Equal definitions within one family invite review, not an automatic merge of different
|
|
72
138
|
* semantic roles. Equal values in different families (a radius and a spacing step) are scales
|
|
73
139
|
* meeting by design. */
|
|
74
140
|
export function tokenOverlapAdvisories(tokens) {
|
|
75
|
-
const groups=new Map();
|
|
76
|
-
for(const token of tokens) {
|
|
77
|
-
if(token.owner!=="tokens"
|
|
78
|
-
const definitions=token.definitions
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if(
|
|
141
|
+
const groups = new Map();
|
|
142
|
+
for (const token of tokens) {
|
|
143
|
+
if (token.owner !== "tokens" || !token.definitions.length) continue;
|
|
144
|
+
const definitions = token.definitions
|
|
145
|
+
.map(({ scope, theme, value }) => [theme ? `${scope} ${theme}` : scope, canonical(value)])
|
|
146
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
147
|
+
if (
|
|
148
|
+
definitions.every(([, value]) => /^var\(--[\w-]+\)$/.test(value)) ||
|
|
149
|
+
definitions.every(([, value]) => /^(?:0|1|none|auto|inherit|initial|unset|transparent)$/.test(value))
|
|
150
|
+
)
|
|
151
|
+
continue;
|
|
152
|
+
const signature = JSON.stringify([family(token.name), definitions]);
|
|
153
|
+
if (!groups.has(signature)) groups.set(signature, []);
|
|
82
154
|
groups.get(signature).push(token);
|
|
83
155
|
}
|
|
84
|
-
return [...groups.values()]
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
156
|
+
return [...groups.values()]
|
|
157
|
+
.filter((group) => group.length > 1)
|
|
158
|
+
.map((group) => {
|
|
159
|
+
const [first] = group,
|
|
160
|
+
{ file, line, column } = first.definitions[0],
|
|
161
|
+
names = group.map((token) => token.name);
|
|
162
|
+
return {
|
|
163
|
+
rule: "token-overlap-review",
|
|
164
|
+
severity: findingSeverity("token-overlap-review"),
|
|
165
|
+
file,
|
|
166
|
+
line,
|
|
167
|
+
column,
|
|
168
|
+
tokens: names,
|
|
169
|
+
guidanceUri: "ads://guides/tokens",
|
|
170
|
+
message: `Shared Data tokens have identical definitions across their declared theme/condition scopes: ${names.slice(0, 6).join(", ")}${names.length > 6 ? ` and ${names.length - 6} more` : ""}. Review semantic roles and consumers before consolidating. Equal values do not prove equivalent purpose; preserve distinct roles or use an explicit shared alias when appropriate.`,
|
|
171
|
+
};
|
|
172
|
+
});
|
|
88
173
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/** ADS's tools run on Bun; this is the Bun executable running them. */
|
|
4
4
|
export function developmentRuntime() {
|
|
5
|
-
return { name:
|
|
6
|
-
executable: process.execPath, binDir: path.dirname(process.execPath) };
|
|
5
|
+
return { name: "bun", version: process.versions.bun, executable: process.execPath, binDir: path.dirname(process.execPath) };
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
/** `runtime`
|
|
8
|
+
/** `runtime` and `bun` name ADS's own Bun. A project's other interpreters (such as node) keep their meaning. */
|
|
10
9
|
export function developmentExecutable(command) {
|
|
11
|
-
|
|
12
|
-
return command === "runtime" || command === runtime.name ? runtime.executable : command;
|
|
10
|
+
return command === "runtime" || command === "bun" ? process.execPath : command;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export function packageScriptCommand(manager, script) {
|
package/dist/draft-boundary.mjs
CHANGED
|
@@ -7,21 +7,26 @@ export function isDraftFile(file) {
|
|
|
7
7
|
const name = file.replaceAll("\\", "/").split(/[?#]/)[0];
|
|
8
8
|
return name.split("/").includes(DRAFT_DIRECTORY) || name.endsWith(".ads") || /\.ads\.draft(?:\.|$)/.test(path.basename(name));
|
|
9
9
|
}
|
|
10
|
-
export function draftImportViolation(specifier,
|
|
10
|
+
export async function draftImportViolation(specifier,importer,resolve){
|
|
11
11
|
if (isDraftFile(importer)) return false;
|
|
12
|
-
return isDraftFile(specifier) || resolve(specifier,
|
|
12
|
+
return isDraftFile(specifier) || (await resolve(specifier,importer)).some(file=>isDraftFile(file)||existsSync(file)&&isDraftFile(realpathSync(file)));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const isDevelopmentSource = file => /\.ads\.[^/]+$/.test(file.replaceAll("\\", "/").split(/[?#]/)[0]);
|
|
16
|
+
const isPreviewApi = source => /^@reqvire-org\/ads\/preview(?:[/?#]|$)/.test(source);
|
|
17
|
+
|
|
15
18
|
/** Install in application bundlers as well as using the mandatory ADS checks. */
|
|
16
|
-
export function
|
|
17
|
-
return { name: "ads-no-
|
|
19
|
+
export function developmentImportGuard() {
|
|
20
|
+
return { name: "ads-no-development-imports", enforce: "pre",
|
|
18
21
|
async resolveId(source, importer, options) {
|
|
19
22
|
if (!importer) return;
|
|
20
23
|
if (isDraftFile(source)) this.error("Unaccepted ADS drafts cannot be imported. Preview with ads_show_draft, then accept the exact revision.");
|
|
24
|
+
if (isDevelopmentSource(source) || isPreviewApi(source)) this.error("ADS .ads.* scenarios, review helpers, styles and preview tooling cannot enter a production build.");
|
|
21
25
|
const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });
|
|
22
|
-
if (resolved &&
|
|
26
|
+
if (resolved &&( isDraftFile(resolved.id) || existsSync(resolved.id.split("?")[0]) && isDraftFile(realpathSync(resolved.id.split("?")[0])))) this.error("Unaccepted ADS drafts cannot be imported through aliases or symlinks.");
|
|
27
|
+
if (resolved &&( isDevelopmentSource(resolved.id) || existsSync(resolved.id.split("?")[0]) && isDevelopmentSource(realpathSync(resolved.id.split("?")[0])))) this.error("ADS development-only files cannot enter production through aliases or symlinks.");
|
|
23
28
|
return resolved;
|
|
24
29
|
},
|
|
25
|
-
load(id) { if (isDraftFile(id)) this.error("Unaccepted ADS drafts are not production modules."); },
|
|
30
|
+
load(id) { if (isDraftFile(id)) this.error("Unaccepted ADS drafts are not production modules."); if (isDevelopmentSource(id)) this.error("ADS .ads.* files are development-only, not production modules."); },
|
|
26
31
|
};
|
|
27
32
|
}
|
package/dist/evidence.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export function acceptance(scope, passed, established, unverified) {
|
|
|
12
12
|
|
|
13
13
|
export function architectureEvidence(result) {
|
|
14
14
|
return { ...result,
|
|
15
|
-
diagnostics: result.diagnostics.map(diagnostic
|
|
15
|
+
diagnostics: result.diagnostics.map( (diagnostic )=>({...diagnostic,...(["style-token","design-value-source","token-name","token-ownership"].includes(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/tokens"}:{}),...(/^(?:unit-contract|paint-.+|binding-.+|declarative-.+|development-role)$/.test(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/contracts"}:{}),failure:diagnostic.failure??failure("architecture","source-analysis",diagnostic.rule)})),
|
|
16
16
|
acceptance: acceptance("core-architecture", result.ok, result.ok ? ["core-source-guards"] : [], ["project-checks", "compiled-preview", "browser-behavior", "visual-parity", "accessibility-audit"]),
|
|
17
17
|
};
|
|
18
18
|
}
|
package/dist/finding-rules.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export const findingRules = Object.freeze({
|
|
|
7
7
|
// Accessibility: deterministic source and token rules, and axe-core where the audit runs.
|
|
8
8
|
"a11y-axe": "error", "a11y-focus": "error", "a11y-icon-label": "error", "a11y-image-alt": "error", "a11y-reduced-motion": "error",
|
|
9
9
|
// A rendered scenario the audit could not complete after its retries.
|
|
10
|
-
"
|
|
10
|
+
"render-audit": "error",
|
|
11
11
|
"a11y-non-text-contrast": "error", "a11y-target-size": "error", "a11y-text-resize": "error", "a11y-text-spacing": "error",
|
|
12
12
|
// A click handler on a non-control may be reachable through a delegated or wrapping control.
|
|
13
13
|
"a11y-keyboard": "review",
|
|
@@ -18,19 +18,21 @@ export const findingRules = Object.freeze({
|
|
|
18
18
|
// Text and background a component style block pairs itself; a side that names no color token is informational.
|
|
19
19
|
"component-contrast": "error", "component-contrast-unresolved": "info",
|
|
20
20
|
// Brand artwork and brand token values.
|
|
21
|
-
"brand-coverage": "error", "brand-empty": "error", "brand-license": "error", "brand-new-token": "error", "brand-
|
|
21
|
+
"brand-coverage": "error", "brand-empty": "error", "brand-license": "error", "brand-new-token": "error", "brand-readme": "error",
|
|
22
22
|
// Artwork may be used by code ADS cannot trace (a CMS, a server template).
|
|
23
23
|
"brand-unused": "review",
|
|
24
24
|
"control-padding": "error",
|
|
25
|
+
// Explicit artwork/text relationships, not universal artwork geometry.
|
|
26
|
+
"lockup-construction": "error",
|
|
25
27
|
// Widths are fluid on the grid: fixed widths from source, and overflow where the audit renders.
|
|
26
28
|
"layout-fixed-width": "error", "layout-overflow": "error",
|
|
27
29
|
// Whether a declared width must stay fixed, a fluid wrapper does anything, or a part ever sits in
|
|
28
30
|
// a narrow pane takes judgement.
|
|
29
|
-
"layout-declared-width": "review", "layout-
|
|
31
|
+
"layout-declared-width": "review", "layout-overflow-narrow": "review",
|
|
30
32
|
// Rendered at a shape other than the one declared: cropped or stretched.
|
|
31
33
|
"img-shape": "error",
|
|
32
34
|
// What the audit could not measure, by reason; a render whose targets could none be measured is for review.
|
|
33
|
-
"
|
|
35
|
+
"render-audit-skipped": "info", "render-audit-nothing-measured": "review",
|
|
34
36
|
// Images reserve their space and choose how they load; a spread or foreign class cannot be read.
|
|
35
37
|
"img-attributes": "error", "img-attributes-unresolved": "info",
|
|
36
38
|
"asset-image-budget": "error", "asset-font-budget": "error",
|
|
@@ -71,7 +73,7 @@ export function findingSeverity(rule) {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
/** A finding carrying its rule's registered severity. */
|
|
74
|
-
export const classified =
|
|
76
|
+
export const classified = (finding )=>({...finding,severity:findingSeverity(finding.rule)});
|
|
75
77
|
|
|
76
78
|
/** Route findings by class: errors join the blocking diagnostics; review and info items stay
|
|
77
79
|
* nonblocking, review before info. Findings without a severity take their rule's. */
|
package/dist/font-rules.mjs
CHANGED
|
@@ -59,7 +59,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
|
|
|
59
59
|
return {
|
|
60
60
|
/** Reads one style sheet or Linaria template. */
|
|
61
61
|
collect(css, target, offset = { line: 1 }) {
|
|
62
|
-
const source =
|
|
62
|
+
const source = (decl )=>({file:relative(target),line:offset.line+(decl.source?.start.line??1)-1});
|
|
63
63
|
// A Linaria template's own declarations sit at the root of what it parses to.
|
|
64
64
|
const owners = new Set();
|
|
65
65
|
css.walkDecls(/^font(?:-family|-weight)?$/i, decl => { if (decl.parent.type !== "atrule" || !/^font-face$/i.test(decl.parent.name)) owners.add(decl.parent); });
|
|
@@ -78,7 +78,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
findings() {
|
|
81
|
-
const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic &&
|
|
81
|
+
const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic &&( face.auto || face.low <= weight && weight <= face.high));
|
|
82
82
|
if (bodyFamily) { named.add(bodyFamily); inherited.delete(bodyFamily); for (const { weight, where } of pending) note(bodyFamily, weight, where); }
|
|
83
83
|
pending = [];
|
|
84
84
|
for (const [family, uses] of used) for (const [weight, where] of uses) if (!covering(family, weight)) {
|
package/dist/fonts-generated.mjs
CHANGED
|
@@ -10,6 +10,8 @@ import { resolveValue } from "./themes.mjs";
|
|
|
10
10
|
* that preloads another URL downloads the font twice. A plain import is what Vite, Bun and the
|
|
11
11
|
* preview compiler all read as a file's URL. Without such a font nothing is generated. */
|
|
12
12
|
export const generatedFontsFile = "fonts.preload.generated.ts";
|
|
13
|
+
/** The names fonts.preload.generated.ts exports; the generated public barrel re-exports them. */
|
|
14
|
+
export const fontPreloadExports = ["fontPreloadHeader", "fontPreloadTags", "fontPreloads", "preloadFonts"];
|
|
13
15
|
const unquote = value => value.trim().replace(/^["']|["']$/g, "");
|
|
14
16
|
const formats = { woff2: "font/woff2", woff: "font/woff", ttf: "font/ttf", otf: "font/otf" };
|
|
15
17
|
|
|
@@ -27,10 +29,10 @@ export function fontFaces(text) {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/** Whether a unicode-range covers Latin capital A, the subset first text needs. */
|
|
30
|
-
const coversLatin = range => !range || range.split(",").some(part => { const [first, last = first] = part.trim().replace(/^U\+/i, "").split("-").map(item => parseInt(item.replaceAll("?", "0"), 16)); return first <= 0x41 && 0x41 <=
|
|
32
|
+
const coversLatin = range => !range || range.split(",").some(part => { const [first, last = first] = part.trim().replace(/^U\+/i, "").split("-").map(item => parseInt(item.replaceAll("?", "0"), 16)); return first <= 0x41 && 0x41 <=( part.includes("?") ? first + 0xff : last); });
|
|
31
33
|
|
|
32
34
|
/** The face a named family and weight loads for first text: upright, covering Latin and that weight. */
|
|
33
|
-
export const preloadFace = (faces, { family, weight }) => faces.find(face => face.family === family && face.slant === "normal" && coversLatin(face.range) &&
|
|
35
|
+
export const preloadFace = (faces, { family, weight }) => faces.find(face => face.family === family && face.slant === "normal" && coversLatin(face.range) &&( face.auto || face.low <= weight && weight <= face.high));
|
|
34
36
|
|
|
35
37
|
/** The font and weight of the body and of headings, as base.css sets them. */
|
|
36
38
|
function firstTextFonts(text, values) {
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { validTokenSamples } from "./token-samples.mjs";
|
|
4
|
+
import postcss from "postcss";
|
|
5
|
+
import spatial from "./spatial-model.cjs";
|
|
6
|
+
import { inspectSpatial } from "./spatial.mjs";
|
|
7
|
+
|
|
8
|
+
// Definition metadata is project data. Markup, layout and interaction belong to
|
|
9
|
+
// the tool template, shared by the native showcase and MCP preview resource graph.
|
|
10
|
+
export const foundationCatalogFile = "catalog.ads.json";
|
|
11
|
+
const relative = (root, file) => path.relative(root, file).replaceAll("\\", "/");
|
|
12
|
+
const imageTypes = { ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image/webp", ".jpg": "image/jpeg", ".jpeg": "image/jpeg" };
|
|
13
|
+
const defaultSamples = {
|
|
14
|
+
color: ["background-color", "rgb(17, 31, 47)"],
|
|
15
|
+
dimension: ["width", "13.375px"],
|
|
16
|
+
fontFamily: ["font-family", "monospace, serif"],
|
|
17
|
+
shadow: ["box-shadow", "none"],
|
|
18
|
+
duration: ["transition-duration", "137ms"],
|
|
19
|
+
easing: ["transition-timing-function", "linear"],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** What a token's sample shows, from the CSS property it is sampled with. One rule for
|
|
23
|
+
* the server (which splits views into sections) and the view (which draws the sample). */
|
|
24
|
+
export function tokenSampleKind(property = "") {
|
|
25
|
+
if (/^(font-|line-height|letter-spacing)/.test(property)) return "type";
|
|
26
|
+
if (property === "color") return "text";
|
|
27
|
+
if (property.includes("color")) return "color";
|
|
28
|
+
if (/^(animation|transition)-(duration|timing-function)/.test(property)) return "motion";
|
|
29
|
+
if (/^(width|min-width|max-width|inline-size|padding|margin|gap|column-gap|row-gap)/.test(property)) return "length";
|
|
30
|
+
if (/^(height|min-height|max-height|block-size)$/.test(property)) return "height";
|
|
31
|
+
if (property === "column-count" || property === "grid-template-columns") return "columns";
|
|
32
|
+
if (property === "box-shadow") return "shadow";
|
|
33
|
+
if (/radius|border.*width|outline.*width|opacity/.test(property)) return "shape";
|
|
34
|
+
if (property === "z-index") return "layer";
|
|
35
|
+
if (property === "filter") return "effect";
|
|
36
|
+
return "value";
|
|
37
|
+
}
|
|
38
|
+
// Sections in display order. A catalog group is a sidebar group (like a folder above owners);
|
|
39
|
+
// each section of it is one page (like an owner).
|
|
40
|
+
const sections = [
|
|
41
|
+
["color", "Color fills"], ["text", "Text colors"],
|
|
42
|
+
["font-family", "Font families"], ["font-size", "Text sizes"], ["font-weight", "Font weights"], ["line-height", "Line heights"], ["letter-spacing", "Letter spacing"],
|
|
43
|
+
["length", "Dimensions"], ["height", "Heights"], ["columns", "Columns"],
|
|
44
|
+
["shape", "Shape"], ["shadow", "Shadows"], ["layer", "Layers"], ["effect", "Effects"],
|
|
45
|
+
["duration", "Durations"], ["easing", "Easing"], ["value", "Values"],
|
|
46
|
+
];
|
|
47
|
+
export function tokenSection(property = "") {
|
|
48
|
+
const kind = tokenSampleKind(property);
|
|
49
|
+
const key = kind === "type" ? property : kind === "motion" ? (property.endsWith("duration") ? "duration" : "easing") : kind;
|
|
50
|
+
const index = sections.findIndex(([name]) => name === key);
|
|
51
|
+
return { key, title: sections[index]?.[1] ?? "Samples", order: index < 0 ? sections.length : index };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function foundationViews(options, inventory) {
|
|
55
|
+
const { root, dsRoot, config } = options;
|
|
56
|
+
const catalog = path.join(dsRoot, config.tokenDir, foundationCatalogFile);
|
|
57
|
+
const diagnostics = [],
|
|
58
|
+
metadata = new Map(),
|
|
59
|
+
groups = new Map();
|
|
60
|
+
const report = (message) => diagnostics.push({ file: relative(root, catalog), rule: "foundation-catalog", line: 1, column: 1, message });
|
|
61
|
+
if (existsSync(catalog)) {
|
|
62
|
+
try {
|
|
63
|
+
const data = JSON.parse(readFileSync(catalog, "utf8"));
|
|
64
|
+
if (data.schemaVersion !== 1 || !Array.isArray(data.groups) || Object.keys(data).some((key) => !["schemaVersion", "groups"].includes(key)))
|
|
65
|
+
throw new Error("Expected schemaVersion: 1 and groups.");
|
|
66
|
+
for (const group of data.groups) {
|
|
67
|
+
if (
|
|
68
|
+
!/^[\w-]+$/.test(group.id) ||
|
|
69
|
+
typeof group.title !== "string" ||
|
|
70
|
+
!group.title.trim() ||
|
|
71
|
+
groups.has(group.id) ||
|
|
72
|
+
!Array.isArray(group.samples) ||
|
|
73
|
+
(group.samples.length && !validTokenSamples(group.samples)) ||
|
|
74
|
+
Object.keys(group).some((key) => !["id", "title", "samples"].includes(key))
|
|
75
|
+
)
|
|
76
|
+
throw new Error("Each group needs a unique id, title and valid CSS samples; presentation code is not supported.");
|
|
77
|
+
groups.set(group.id, { id: group.id, title: group.title, tokens: [] });
|
|
78
|
+
for (const sample of group.samples) {
|
|
79
|
+
if (metadata.has(sample.token)) throw new Error(`${sample.token} belongs to more than one group.`);
|
|
80
|
+
metadata.set(sample.token, { group: group.id, ...sample });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const names = new Set(inventory.tokens.map((token) => token.name));
|
|
84
|
+
for (const name of metadata.keys()) if (!names.has(name)) report(`Remove metadata for undefined token ${name}.`);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
report(`Invalid foundation metadata: ${error.message}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const token of inventory.tokens) {
|
|
90
|
+
const declared = metadata.get(token.name);
|
|
91
|
+
// Unknown semantics stay a value/dependency readout. Never invent a visual
|
|
92
|
+
// binding from a name; explicit metadata or the shared type supplies it.
|
|
93
|
+
const id = declared?.group ?? "Values";
|
|
94
|
+
if (!groups.has(id)) groups.set(id, { id, title: "Values", tokens: [] });
|
|
95
|
+
const sample = declared ?? (defaultSamples[token.type] && { property: defaultSamples[token.type][0], probe: defaultSamples[token.type][1] });
|
|
96
|
+
groups.get(id).tokens.push({ ...token, ...(sample ? { property: sample.property, probe: sample.probe } : {}) });
|
|
97
|
+
}
|
|
98
|
+
const view = (id, title, tokens, group, order) => ({
|
|
99
|
+
id: `tokens/${id}`,
|
|
100
|
+
// Sections list in display order (fills before text, sizes before weights), not by key.
|
|
101
|
+
...(order === undefined ? {} : { sortKey: `tokens/${id.split("/")[0]}/${String(order).padStart(2, "0")}` }),
|
|
102
|
+
kind: "tokens",
|
|
103
|
+
title,
|
|
104
|
+
...(group ? { group } : {}),
|
|
105
|
+
covers: [],
|
|
106
|
+
tokens: tokens.map((token) => token.name),
|
|
107
|
+
file: tokens[0].definitions[0].file,
|
|
108
|
+
foundation: { schemaVersion: 1, kind: "tokens", title, tokens },
|
|
109
|
+
});
|
|
110
|
+
const views = [...groups.values()]
|
|
111
|
+
.filter((group) => group.tokens.length)
|
|
112
|
+
.flatMap((group) => {
|
|
113
|
+
const tokens = group.tokens.map((token) => ({ ...token, sampleKind: tokenSampleKind(token.property), section: tokenSection(token.property) }));
|
|
114
|
+
const split = new Map();
|
|
115
|
+
for (const token of tokens) {
|
|
116
|
+
if (!split.has(token.section.key)) split.set(token.section.key, []);
|
|
117
|
+
split.get(token.section.key).push(token);
|
|
118
|
+
}
|
|
119
|
+
// One section stays one page; the grid reference belongs with all of its tokens.
|
|
120
|
+
if (split.size < 2 || group.id === "Layout") return [view(group.id, group.title, tokens)];
|
|
121
|
+
return [...split.values()]
|
|
122
|
+
.sort((a, b) => a[0].section.order - b[0].section.order)
|
|
123
|
+
.map((items) => view(`${group.id}/${items[0].section.key}`, items[0].section.title, items, group.title, items[0].section.order));
|
|
124
|
+
});
|
|
125
|
+
try {
|
|
126
|
+
const model = inspectSpatial(options)?.model;
|
|
127
|
+
const grid = views.find((view) => view.id === "tokens/Layout");
|
|
128
|
+
if (model && grid) {
|
|
129
|
+
const examples = [
|
|
130
|
+
...Object.keys(model.gutters).map((mode) => ({
|
|
131
|
+
id: `fluid-${mode}`,
|
|
132
|
+
title: `Fluid · ${mode} gutters`,
|
|
133
|
+
definition: `@ads-layout fluid { gutter: ${mode}; row-gap: ${model.miniUnit}; @ads-cell .a { span: full; } @ads-cell .b { span: 1; } @ads-cell .c { start: 2; span: full; } }`,
|
|
134
|
+
})),
|
|
135
|
+
{ id: "fixed", title: "Fixed tiles · wrapping", definition: `@ads-layout fixed { tile: ${model.scale.at(-1)}; row-gap: ${model.miniUnit}; }` },
|
|
136
|
+
{ id: "flow", title: "Vertical rhythm · natural content height", definition: `@ads-layout flow { row-gap: ${model.scale[2] ?? model.miniUnit}; }` },
|
|
137
|
+
{
|
|
138
|
+
id: "hybrid",
|
|
139
|
+
title: "Hybrid · one fixed track beside fluid tracks",
|
|
140
|
+
definition: `@ads-layout hybrid { columns: 13; fixed-start: ${model.scale.at(-1)}; gutter: wide; row-gap: ${model.miniUnit}; @ads-cell .a { span: 1; } @ads-cell .b { start: 2; span: 12; } }`,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "push",
|
|
144
|
+
title: "Panels · a docked panel pushes the main region",
|
|
145
|
+
definition: `@ads-layout hybrid { columns: 3; fixed-start: ${model.scale.at(-1)}; fixed-end: ${model.scale.at(-1)}; gutter: none; margin: --space-0; @ads-cell .a { span: 1; row: 1; } @ads-cell .b { start: 2; span: 1; row: 1; } @ads-cell .c { start: 3; span: 1; row: 1; } }`,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "cover",
|
|
149
|
+
title: "Panels · a floating panel covers the main region",
|
|
150
|
+
definition: `@ads-layout hybrid { columns: 3; fixed-start: ${model.scale.at(-1)}; fixed-end: ${model.scale.at(-1)}; gutter: none; margin: --space-0; @ads-cell .a { span: 1; row: 1; } @ads-cell .b { start: 2; span: 2; row: 1; } @ads-cell .c { start: 3; span: 1; row: 1; overlay: end; } }`,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "nested",
|
|
154
|
+
title: "Inherited tracks · shared keylines",
|
|
155
|
+
definition: `@ads-layout fluid { gutter: wide; @ads-cell .a { span: full; @ads-layout inherited { gutter: narrow; @ads-cell .b { span: 1; } @ads-cell .c { start: 2; span: full; } } } }`,
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
// Each grid role the spatial definition names, followed through var() to the primitive it
|
|
159
|
+
// uses. Names come from the project's definition; nothing assumes --grid-* or --space-*.
|
|
160
|
+
const definitions = new Map(inventory.tokens.map((token) => [token.name, token.definitions.find((item) => !item.theme && !item.brand) ?? token.definitions[0]]));
|
|
161
|
+
const chain = (name) => {
|
|
162
|
+
const steps = [name];
|
|
163
|
+
for (let current = name; steps.length < 8; ) {
|
|
164
|
+
const next = definitions.get(current)?.value?.trim().match(/^var\(\s*(--[\w-]+)\s*\)$/)?.[1];
|
|
165
|
+
if (!next || steps.includes(next)) break;
|
|
166
|
+
steps.push(next);
|
|
167
|
+
current = next;
|
|
168
|
+
}
|
|
169
|
+
return { chain: steps, value: definitions.get(steps.at(-1))?.value ?? null };
|
|
170
|
+
};
|
|
171
|
+
const roles = [
|
|
172
|
+
{ role: "Mini unit", token: model.miniUnit },
|
|
173
|
+
{ role: "Fine unit", token: model.fineUnit },
|
|
174
|
+
...Object.entries(model.gutters).flatMap(([mode, gutter]) => [
|
|
175
|
+
{ role: `Gutter · ${mode} · start`, token: gutter.start },
|
|
176
|
+
{ role: `Gutter · ${mode} · end`, token: gutter.end },
|
|
177
|
+
]),
|
|
178
|
+
...model.breakpoints.map((point) => ({ role: `Outer margin · ${point.name}`, token: point.margin })),
|
|
179
|
+
...(model.maxWidth ? [{ role: "Maximum width", token: model.maxWidth }] : []),
|
|
180
|
+
].map((item) => ({ ...item, ...chain(item.token) }));
|
|
181
|
+
// Each token in a chain links to the view that shows it.
|
|
182
|
+
const viewOf = new Map(views.flatMap((view) => view.tokens.map((name) => [name, view.id])));
|
|
183
|
+
for (const role of roles) role.links = Object.fromEntries(role.chain.filter((name) => viewOf.has(name)).map((name) => [name, viewOf.get(name)]));
|
|
184
|
+
grid.foundation.spatial = {
|
|
185
|
+
roles,
|
|
186
|
+
miniUnit: model.miniUnit,
|
|
187
|
+
fineUnit: model.fineUnit,
|
|
188
|
+
scale: model.scale,
|
|
189
|
+
ratios: model.ratios,
|
|
190
|
+
breakpoints: model.breakpoints,
|
|
191
|
+
examples: examples.map((example) => ({
|
|
192
|
+
...example,
|
|
193
|
+
css: spatial.expandSpatialStyles(postcss.parse(`.ads-grid-example-${example.id} { ${example.definition} }`), model).toString(),
|
|
194
|
+
})),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
} catch (error) {
|
|
198
|
+
report(error.message);
|
|
199
|
+
}
|
|
200
|
+
const directory = path.join(dsRoot, "assets/brand");
|
|
201
|
+
// Subfolders such as pictograms/ are brand artwork too: the brand checks
|
|
202
|
+
// walk them, so the view shows them under their relative names.
|
|
203
|
+
const brandFiles = (folder, prefix = "") => {
|
|
204
|
+
const stat = lstatSync(folder, { throwIfNoEntry: false });
|
|
205
|
+
if (!stat || stat.isSymbolicLink() || !stat.isDirectory()) return [];
|
|
206
|
+
return readdirSync(folder, { withFileTypes: true })
|
|
207
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
208
|
+
.flatMap((entry) => {
|
|
209
|
+
const name = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
210
|
+
if (entry.isSymbolicLink()) return [];
|
|
211
|
+
return entry.isDirectory() ? brandFiles(path.join(folder, entry.name), name) : entry.isFile() ? [name] : [];
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const artwork = brandFiles(directory).flatMap((name) => {
|
|
215
|
+
const file = path.join(directory, name),
|
|
216
|
+
type = imageTypes[path.extname(name).toLowerCase()];
|
|
217
|
+
if (!type || lstatSync(file).size > 1024 * 1024) return [];
|
|
218
|
+
return [
|
|
219
|
+
{
|
|
220
|
+
name,
|
|
221
|
+
file: relative(root, file),
|
|
222
|
+
src: `data:${type};base64,${readFileSync(file).toString("base64")}`,
|
|
223
|
+
appIcon: path.resolve(dsRoot, config.assets.iconSource ?? ".") === file,
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
});
|
|
227
|
+
if (artwork.length)
|
|
228
|
+
views.unshift({
|
|
229
|
+
id: "brand/Assets",
|
|
230
|
+
kind: "brand",
|
|
231
|
+
title: "Brand assets",
|
|
232
|
+
covers: [],
|
|
233
|
+
tokens: [],
|
|
234
|
+
file: artwork[0].file,
|
|
235
|
+
foundation: { schemaVersion: 1, kind: "brand", title: "Brand assets", artwork },
|
|
236
|
+
});
|
|
237
|
+
return { views: views.map((view) => ({ ...view, artifact: `.ds/scenarios/${view.id}/index.html` })), diagnostics };
|
|
238
|
+
}
|