@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/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,23 @@ 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
|
+
"pictogram-catalog": "error", "pictogram-source": "error", "pictogram-render": "error",
|
|
25
|
+
"pictogram-unresolved": "review",
|
|
24
26
|
"control-padding": "error",
|
|
27
|
+
// Explicit artwork/text relationships, not universal artwork geometry.
|
|
28
|
+
"lockup-construction": "error",
|
|
25
29
|
// Widths are fluid on the grid: fixed widths from source, and overflow where the audit renders.
|
|
26
30
|
"layout-fixed-width": "error", "layout-overflow": "error",
|
|
27
31
|
// Whether a declared width must stay fixed, a fluid wrapper does anything, or a part ever sits in
|
|
28
32
|
// a narrow pane takes judgement.
|
|
29
|
-
"layout-declared-width": "review", "layout-
|
|
33
|
+
"layout-declared-width": "review", "layout-overflow-narrow": "review",
|
|
30
34
|
// Rendered at a shape other than the one declared: cropped or stretched.
|
|
31
35
|
"img-shape": "error",
|
|
32
36
|
// What the audit could not measure, by reason; a render whose targets could none be measured is for review.
|
|
33
|
-
"
|
|
37
|
+
"render-audit-skipped": "info", "render-audit-nothing-measured": "review",
|
|
34
38
|
// Images reserve their space and choose how they load; a spread or foreign class cannot be read.
|
|
35
39
|
"img-attributes": "error", "img-attributes-unresolved": "info",
|
|
36
40
|
"asset-image-budget": "error", "asset-font-budget": "error",
|
|
@@ -71,7 +75,7 @@ export function findingSeverity(rule) {
|
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
/** A finding carrying its rule's registered severity. */
|
|
74
|
-
export const classified =
|
|
78
|
+
export const classified = (finding )=>({...finding,severity:findingSeverity(finding.rule)});
|
|
75
79
|
|
|
76
80
|
/** Route findings by class: errors join the blocking diagnostics; review and info items stay
|
|
77
81
|
* nonblocking, review before info. Findings without a severity take their rule's. */
|
package/dist/font-rules.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
1
|
import path from "node:path";
|
|
3
|
-
import postcss from "postcss";
|
|
4
2
|
import valueParser from "postcss-value-parser";
|
|
5
3
|
import { contextValues } from "./themes.mjs";
|
|
6
4
|
import { findingSeverity } from "./finding-rules.mjs";
|
|
7
|
-
import {
|
|
5
|
+
import { fontFacesFromCss, preloadFace } from "./fonts-generated.mjs";
|
|
6
|
+
import { optionalSourceText, sourceCss, memoProgram } from "./analysis/helpers.mjs";
|
|
8
7
|
|
|
9
8
|
/** Fonts a project declares in tokens/fonts.css, against the weights its CSS uses. Without a declared
|
|
10
9
|
* face it finds nothing: a system font stack has no files and no faces to fake.
|
|
@@ -14,26 +13,32 @@ const unquote = value => value.trim().replace(/^["']|["']$/g, "");
|
|
|
14
13
|
const keyword = { normal: 400, bold: 700 };
|
|
15
14
|
const weightOf = value => { const number = Number(value); return Number.isFinite(number) && number >= 1 && number <= 1000 ? number : keyword[value?.toLowerCase()]; };
|
|
16
15
|
|
|
17
|
-
function declaredFaces(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
function declaredFaces(css) {
|
|
17
|
+
return memoProgram(css, "font-declared-faces", () => {
|
|
18
|
+
const faces = [];
|
|
19
|
+
css.walkAtRules(/^font-face$/i, rule => {
|
|
20
|
+
const read = name => rule.nodes.find(node => node.type === "decl" && node.prop.toLowerCase() === name)?.value;
|
|
21
|
+
const url = /url\(\s*["']?([^"')]+)["']?\s*\)/i.exec(read("src") ?? "")?.[1], weight = read("font-weight")?.trim().toLowerCase();
|
|
22
|
+
const parts = weight && weight !== "auto" ? weight.split(/\s+/).map(weightOf) : null;
|
|
23
|
+
faces.push({ family: unquote(read("font-family") ?? ""), url, low: parts?.[0], high: parts?.[1] ?? parts?.[0], auto: !parts, display: read("font-display")?.trim().toLowerCase(), italic: /italic|oblique/i.test(read("font-style") ?? ""), ranged: !!read("unicode-range"), line: rule.source.start.line });
|
|
24
|
+
});
|
|
25
|
+
return Object.freeze(faces.map(Object.freeze));
|
|
24
26
|
});
|
|
25
|
-
return faces;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export function createFontRules({ root, dsRoot, config }, tokens) {
|
|
29
30
|
const file = path.join(dsRoot, config.tokenDir, "fonts.css");
|
|
30
|
-
let faces = [];
|
|
31
|
-
try {
|
|
31
|
+
let faces = [], sheet = [];
|
|
32
|
+
try {
|
|
33
|
+
if (optionalSourceText(file) !== null) {
|
|
34
|
+
const css = sourceCss(file);
|
|
35
|
+
faces = declaredFaces(css);
|
|
36
|
+
sheet = fontFacesFromCss(css);
|
|
37
|
+
}
|
|
38
|
+
} catch { /* The core CSS syntax diagnostic owns a malformed sheet. */ }
|
|
32
39
|
const relative = target => path.relative(root, target).replaceAll("\\", "/");
|
|
33
40
|
// A named preload that fonts.css cannot satisfy is an error, so a typo cannot silently lose it.
|
|
34
41
|
const preloadFindings = () => (config.assets.preloadFonts ?? []).flatMap(entry => {
|
|
35
|
-
let sheet = [];
|
|
36
|
-
try { if (existsSync(file)) sheet = fontFaces(readFileSync(file, "utf8")); } catch { /* The core CSS syntax diagnostic owns a malformed sheet. */ }
|
|
37
42
|
if (preloadFace(sheet, entry)) return [];
|
|
38
43
|
const known = sheet.some(face => face.family === entry.family);
|
|
39
44
|
return [{ rule: "font-preload-config", severity: findingSeverity("font-preload-config"), file: "ds.config.json", line: 1, column: 1, guidanceUri: "ads://guides/performance",
|
|
@@ -59,7 +64,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
|
|
|
59
64
|
return {
|
|
60
65
|
/** Reads one style sheet or Linaria template. */
|
|
61
66
|
collect(css, target, offset = { line: 1 }) {
|
|
62
|
-
const source =
|
|
67
|
+
const source = (decl )=>({file:relative(target),line:offset.line+(decl.source?.start.line??1)-1});
|
|
63
68
|
// A Linaria template's own declarations sit at the root of what it parses to.
|
|
64
69
|
const owners = new Set();
|
|
65
70
|
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 +83,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
|
|
|
78
83
|
}
|
|
79
84
|
},
|
|
80
85
|
findings() {
|
|
81
|
-
const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic &&
|
|
86
|
+
const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic &&( face.auto || face.low <= weight && weight <= face.high));
|
|
82
87
|
if (bodyFamily) { named.add(bodyFamily); inherited.delete(bodyFamily); for (const { weight, where } of pending) note(bodyFamily, weight, where); }
|
|
83
88
|
pending = [];
|
|
84
89
|
for (const [family, uses] of used) for (const [weight, where] of uses) if (!covering(family, weight)) {
|
package/dist/fonts-generated.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import postcss from "postcss";
|
|
4
3
|
import { resolveValue } from "./themes.mjs";
|
|
4
|
+
import { optionalSourceText, sourceCss, memoProgram } from "./analysis/helpers.mjs";
|
|
5
5
|
|
|
6
6
|
/** fonts.preload.generated.ts names the font files the first text uses: assets.preloadFonts when the
|
|
7
7
|
* project lists them, otherwise read from the sheets: the first family in base.css's body font-family
|
|
@@ -16,29 +16,36 @@ const unquote = value => value.trim().replace(/^["']|["']$/g, "");
|
|
|
16
16
|
const formats = { woff2: "font/woff2", woff: "font/woff", ttf: "font/ttf", otf: "font/otf" };
|
|
17
17
|
|
|
18
18
|
export function fontFaces(text) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
19
|
+
return fontFacesFromCss(postcss.parse(text));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Share read-only CSS facts with validation; selection still depends on current config/tokens. */
|
|
23
|
+
export function fontFacesFromCss(css) {
|
|
24
|
+
return memoProgram(css, "font-preload-faces", () => {
|
|
25
|
+
const faces = [];
|
|
26
|
+
css.walkAtRules(/^font-face$/i, rule => {
|
|
27
|
+
const value = name => rule.nodes.find(node => node.type === "decl" && node.prop.toLowerCase() === name)?.value;
|
|
28
|
+
const url = /url\(\s*["']?([^"')]+)["']?\s*\)/i.exec(value("src") ?? "")?.[1];
|
|
29
|
+
if (!url || /^data:/i.test(url)) return;
|
|
30
|
+
const auto = !value("font-weight") || /^auto$/i.test(value("font-weight").trim());
|
|
31
|
+
const [low, high = low] = (auto ? "400" : value("font-weight")).replace(/\bnormal\b/, "400").replace(/\bbold\b/, "700").trim().split(/\s+/).map(Number);
|
|
32
|
+
faces.push({ family: unquote(value("font-family") ?? ""), url, auto, low, high, slant: (value("font-style") ?? "normal").trim().toLowerCase(), range: value("unicode-range") });
|
|
33
|
+
});
|
|
34
|
+
return Object.freeze(faces.map(Object.freeze));
|
|
27
35
|
});
|
|
28
|
-
return faces;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
/** Whether a unicode-range covers Latin capital A, the subset first text needs. */
|
|
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 <=
|
|
39
|
+
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); });
|
|
33
40
|
|
|
34
41
|
/** The face a named family and weight loads for first text: upright, covering Latin and that weight. */
|
|
35
|
-
export const preloadFace = (faces, { family, weight }) => faces.find(face => face.family === family && face.slant === "normal" && coversLatin(face.range) &&
|
|
42
|
+
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));
|
|
36
43
|
|
|
37
44
|
/** The font and weight of the body and of headings, as base.css sets them. */
|
|
38
|
-
function firstTextFonts(
|
|
45
|
+
function firstTextFonts(css, values) {
|
|
39
46
|
const read = pattern => {
|
|
40
47
|
const found = {};
|
|
41
|
-
|
|
48
|
+
css.walkRules(rule => {
|
|
42
49
|
if (!rule.selector.split(",").some(item => pattern.test(item.trim()))) return;
|
|
43
50
|
for (const node of rule.nodes) if (node.type === "decl" && ["font-family", "font-weight"].includes(node.prop.toLowerCase())) found[node.prop.toLowerCase()] = node.value;
|
|
44
51
|
});
|
|
@@ -55,9 +62,9 @@ function firstTextFonts(text, values) {
|
|
|
55
62
|
export function fontPreloadText({ dsRoot, config }, values) {
|
|
56
63
|
const directory = path.join(dsRoot, config.tokenDir), fontsFile = path.join(directory, "fonts.css"), baseFile = path.join(directory, "base.css");
|
|
57
64
|
const named = config.assets.preloadFonts;
|
|
58
|
-
if (
|
|
65
|
+
if (optionalSourceText(fontsFile) === null || !named && optionalSourceText(baseFile) === null) return null;
|
|
59
66
|
let faces, uses;
|
|
60
|
-
try { faces =
|
|
67
|
+
try { faces = fontFacesFromCss(sourceCss(fontsFile)); uses = named ? [] : firstTextFonts(sourceCss(baseFile), values); }
|
|
61
68
|
catch { return null; /* The core CSS syntax diagnostic owns malformed sheets. */ }
|
|
62
69
|
const urls = new Set();
|
|
63
70
|
// Named in the config: exactly these, and font-preload-config reports one fonts.css does not have.
|
|
@@ -0,0 +1,242 @@
|
|
|
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
|
+
import { pictogramViews } from "./pictograms.mjs";
|
|
8
|
+
|
|
9
|
+
// Definition metadata is project data. Markup, layout and interaction belong to
|
|
10
|
+
// the tool template, shared by the native showcase and MCP preview resource graph.
|
|
11
|
+
export const foundationCatalogFile = "catalog.ads.json";
|
|
12
|
+
const relative = (root, file) => path.relative(root, file).replaceAll("\\", "/");
|
|
13
|
+
const imageTypes = { ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image/webp", ".jpg": "image/jpeg", ".jpeg": "image/jpeg" };
|
|
14
|
+
const defaultSamples = {
|
|
15
|
+
color: ["background-color", "rgb(17, 31, 47)"],
|
|
16
|
+
dimension: ["width", "13.375px"],
|
|
17
|
+
fontFamily: ["font-family", "monospace, serif"],
|
|
18
|
+
shadow: ["box-shadow", "none"],
|
|
19
|
+
duration: ["transition-duration", "137ms"],
|
|
20
|
+
easing: ["transition-timing-function", "linear"],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** What a token's sample shows, from the CSS property it is sampled with. One rule for
|
|
24
|
+
* the server (which splits views into sections) and the view (which draws the sample). */
|
|
25
|
+
export function tokenSampleKind(property = "") {
|
|
26
|
+
if (/^(font-|line-height|letter-spacing)/.test(property)) return "type";
|
|
27
|
+
if (property === "color") return "text";
|
|
28
|
+
if (property.includes("color")) return "color";
|
|
29
|
+
if (/^(animation|transition)-(duration|timing-function)/.test(property)) return "motion";
|
|
30
|
+
if (/^(width|min-width|max-width|inline-size|padding|margin|gap|column-gap|row-gap)/.test(property)) return "length";
|
|
31
|
+
if (/^(height|min-height|max-height|block-size)$/.test(property)) return "height";
|
|
32
|
+
if (property === "column-count" || property === "grid-template-columns") return "columns";
|
|
33
|
+
if (property === "box-shadow") return "shadow";
|
|
34
|
+
if (/radius|border.*width|outline.*width|opacity/.test(property)) return "shape";
|
|
35
|
+
if (property === "z-index") return "layer";
|
|
36
|
+
if (property === "filter") return "effect";
|
|
37
|
+
return "value";
|
|
38
|
+
}
|
|
39
|
+
// Sections in display order. A catalog group is a sidebar group (like a folder above owners);
|
|
40
|
+
// each section of it is one page (like an owner).
|
|
41
|
+
const sections = [
|
|
42
|
+
["color", "Color fills"], ["text", "Text colors"],
|
|
43
|
+
["font-family", "Font families"], ["font-size", "Text sizes"], ["font-weight", "Font weights"], ["line-height", "Line heights"], ["letter-spacing", "Letter spacing"],
|
|
44
|
+
["length", "Dimensions"], ["height", "Heights"], ["columns", "Columns"],
|
|
45
|
+
["shape", "Shape"], ["shadow", "Shadows"], ["layer", "Layers"], ["effect", "Effects"],
|
|
46
|
+
["duration", "Durations"], ["easing", "Easing"], ["value", "Values"],
|
|
47
|
+
];
|
|
48
|
+
export function tokenSection(property = "") {
|
|
49
|
+
const kind = tokenSampleKind(property);
|
|
50
|
+
const key = kind === "type" ? property : kind === "motion" ? (property.endsWith("duration") ? "duration" : "easing") : kind;
|
|
51
|
+
const index = sections.findIndex(([name]) => name === key);
|
|
52
|
+
return { key, title: sections[index]?.[1] ?? "Samples", order: index < 0 ? sections.length : index };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function foundationViews(options, inventory) {
|
|
56
|
+
const { root, dsRoot, config } = options;
|
|
57
|
+
const catalog = path.join(dsRoot, config.tokenDir, foundationCatalogFile);
|
|
58
|
+
const diagnostics = [],
|
|
59
|
+
metadata = new Map(),
|
|
60
|
+
groups = new Map();
|
|
61
|
+
const report = (message) => diagnostics.push({ file: relative(root, catalog), rule: "foundation-catalog", line: 1, column: 1, message });
|
|
62
|
+
if (existsSync(catalog)) {
|
|
63
|
+
try {
|
|
64
|
+
const data = JSON.parse(readFileSync(catalog, "utf8"));
|
|
65
|
+
if (data.schemaVersion !== 1 || !Array.isArray(data.groups) || Object.keys(data).some((key) => !["schemaVersion", "groups"].includes(key)))
|
|
66
|
+
throw new Error("Expected schemaVersion: 1 and groups.");
|
|
67
|
+
for (const group of data.groups) {
|
|
68
|
+
if (
|
|
69
|
+
!/^[\w-]+$/.test(group.id) ||
|
|
70
|
+
typeof group.title !== "string" ||
|
|
71
|
+
!group.title.trim() ||
|
|
72
|
+
groups.has(group.id) ||
|
|
73
|
+
!Array.isArray(group.samples) ||
|
|
74
|
+
(group.samples.length && !validTokenSamples(group.samples)) ||
|
|
75
|
+
Object.keys(group).some((key) => !["id", "title", "samples"].includes(key))
|
|
76
|
+
)
|
|
77
|
+
throw new Error("Each group needs a unique id, title and valid CSS samples; presentation code is not supported.");
|
|
78
|
+
groups.set(group.id, { id: group.id, title: group.title, tokens: [] });
|
|
79
|
+
for (const sample of group.samples) {
|
|
80
|
+
if (metadata.has(sample.token)) throw new Error(`${sample.token} belongs to more than one group.`);
|
|
81
|
+
metadata.set(sample.token, { group: group.id, ...sample });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const names = new Set(inventory.tokens.map((token) => token.name));
|
|
85
|
+
for (const name of metadata.keys()) if (!names.has(name)) report(`Remove metadata for undefined token ${name}.`);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
report(`Invalid foundation metadata: ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const token of inventory.tokens) {
|
|
91
|
+
const declared = metadata.get(token.name);
|
|
92
|
+
// Unknown semantics stay a value/dependency readout. Never invent a visual
|
|
93
|
+
// binding from a name; explicit metadata or the shared type supplies it.
|
|
94
|
+
const id = declared?.group ?? "Values";
|
|
95
|
+
if (!groups.has(id)) groups.set(id, { id, title: "Values", tokens: [] });
|
|
96
|
+
const sample = declared ?? (defaultSamples[token.type] && { property: defaultSamples[token.type][0], probe: defaultSamples[token.type][1] });
|
|
97
|
+
groups.get(id).tokens.push({ ...token, ...(sample ? { property: sample.property, probe: sample.probe } : {}) });
|
|
98
|
+
}
|
|
99
|
+
const view = (id, title, tokens, group, order) => ({
|
|
100
|
+
id: `tokens/${id}`,
|
|
101
|
+
// Sections list in display order (fills before text, sizes before weights), not by key.
|
|
102
|
+
...(order === undefined ? {} : { sortKey: `tokens/${id.split("/")[0]}/${String(order).padStart(2, "0")}` }),
|
|
103
|
+
kind: "tokens",
|
|
104
|
+
title,
|
|
105
|
+
...(group ? { group } : {}),
|
|
106
|
+
covers: [],
|
|
107
|
+
tokens: tokens.map((token) => token.name),
|
|
108
|
+
file: tokens[0].definitions[0].file,
|
|
109
|
+
foundation: { schemaVersion: 1, kind: "tokens", title, tokens },
|
|
110
|
+
});
|
|
111
|
+
const views = [...groups.values()]
|
|
112
|
+
.filter((group) => group.tokens.length)
|
|
113
|
+
.flatMap((group) => {
|
|
114
|
+
const tokens = group.tokens.map((token) => ({ ...token, sampleKind: tokenSampleKind(token.property), section: tokenSection(token.property) }));
|
|
115
|
+
const split = new Map();
|
|
116
|
+
for (const token of tokens) {
|
|
117
|
+
if (!split.has(token.section.key)) split.set(token.section.key, []);
|
|
118
|
+
split.get(token.section.key).push(token);
|
|
119
|
+
}
|
|
120
|
+
// One section stays one page; the grid reference belongs with all of its tokens.
|
|
121
|
+
if (split.size < 2 || group.id === "Layout") return [view(group.id, group.title, tokens)];
|
|
122
|
+
return [...split.values()]
|
|
123
|
+
.sort((a, b) => a[0].section.order - b[0].section.order)
|
|
124
|
+
.map((items) => view(`${group.id}/${items[0].section.key}`, items[0].section.title, items, group.title, items[0].section.order));
|
|
125
|
+
});
|
|
126
|
+
try {
|
|
127
|
+
const model = inspectSpatial(options)?.model;
|
|
128
|
+
const grid = views.find((view) => view.id === "tokens/Layout");
|
|
129
|
+
if (model && grid) {
|
|
130
|
+
const examples = [
|
|
131
|
+
...Object.keys(model.gutters).map((mode) => ({
|
|
132
|
+
id: `fluid-${mode}`,
|
|
133
|
+
title: `Fluid · ${mode} gutters`,
|
|
134
|
+
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; } }`,
|
|
135
|
+
})),
|
|
136
|
+
{ id: "fixed", title: "Fixed tiles · wrapping", definition: `@ads-layout fixed { tile: ${model.scale.at(-1)}; row-gap: ${model.miniUnit}; }` },
|
|
137
|
+
{ id: "flow", title: "Vertical rhythm · natural content height", definition: `@ads-layout flow { row-gap: ${model.scale[2] ?? model.miniUnit}; }` },
|
|
138
|
+
{
|
|
139
|
+
id: "hybrid",
|
|
140
|
+
title: "Hybrid · one fixed track beside fluid tracks",
|
|
141
|
+
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; } }`,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "push",
|
|
145
|
+
title: "Panels · a docked panel pushes the main region",
|
|
146
|
+
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; } }`,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "cover",
|
|
150
|
+
title: "Panels · a floating panel covers the main region",
|
|
151
|
+
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; } }`,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "nested",
|
|
155
|
+
title: "Inherited tracks · shared keylines",
|
|
156
|
+
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; } } } }`,
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
// Each grid role the spatial definition names, followed through var() to the primitive it
|
|
160
|
+
// uses. Names come from the project's definition; nothing assumes --grid-* or --space-*.
|
|
161
|
+
const definitions = new Map(inventory.tokens.map((token) => [token.name, token.definitions.find((item) => !item.theme && !item.brand) ?? token.definitions[0]]));
|
|
162
|
+
const chain = (name) => {
|
|
163
|
+
const steps = [name];
|
|
164
|
+
for (let current = name; steps.length < 8; ) {
|
|
165
|
+
const next = definitions.get(current)?.value?.trim().match(/^var\(\s*(--[\w-]+)\s*\)$/)?.[1];
|
|
166
|
+
if (!next || steps.includes(next)) break;
|
|
167
|
+
steps.push(next);
|
|
168
|
+
current = next;
|
|
169
|
+
}
|
|
170
|
+
return { chain: steps, value: definitions.get(steps.at(-1))?.value ?? null };
|
|
171
|
+
};
|
|
172
|
+
const roles = [
|
|
173
|
+
{ role: "Mini unit", token: model.miniUnit },
|
|
174
|
+
{ role: "Fine unit", token: model.fineUnit },
|
|
175
|
+
...Object.entries(model.gutters).flatMap(([mode, gutter]) => [
|
|
176
|
+
{ role: `Gutter · ${mode} · start`, token: gutter.start },
|
|
177
|
+
{ role: `Gutter · ${mode} · end`, token: gutter.end },
|
|
178
|
+
]),
|
|
179
|
+
...model.breakpoints.map((point) => ({ role: `Outer margin · ${point.name}`, token: point.margin })),
|
|
180
|
+
...(model.maxWidth ? [{ role: "Maximum width", token: model.maxWidth }] : []),
|
|
181
|
+
].map((item) => ({ ...item, ...chain(item.token) }));
|
|
182
|
+
// Each token in a chain links to the view that shows it.
|
|
183
|
+
const viewOf = new Map(views.flatMap((view) => view.tokens.map((name) => [name, view.id])));
|
|
184
|
+
for (const role of roles) role.links = Object.fromEntries(role.chain.filter((name) => viewOf.has(name)).map((name) => [name, viewOf.get(name)]));
|
|
185
|
+
grid.foundation.spatial = {
|
|
186
|
+
roles,
|
|
187
|
+
miniUnit: model.miniUnit,
|
|
188
|
+
fineUnit: model.fineUnit,
|
|
189
|
+
scale: model.scale,
|
|
190
|
+
ratios: model.ratios,
|
|
191
|
+
breakpoints: model.breakpoints,
|
|
192
|
+
examples: examples.map((example) => ({
|
|
193
|
+
...example,
|
|
194
|
+
css: spatial.expandSpatialStyles(postcss.parse(`.ads-grid-example-${example.id} { ${example.definition} }`), model).toString(),
|
|
195
|
+
})),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
report(error.message);
|
|
200
|
+
}
|
|
201
|
+
const directory = path.join(dsRoot, "assets/brand");
|
|
202
|
+
// Brand subfolders remain visible under their relative names. Catalogued
|
|
203
|
+
// pictograms have their own owner and gallery, outside assets/brand/.
|
|
204
|
+
const brandFiles = (folder, prefix = "") => {
|
|
205
|
+
const stat = lstatSync(folder, { throwIfNoEntry: false });
|
|
206
|
+
if (!stat || stat.isSymbolicLink() || !stat.isDirectory()) return [];
|
|
207
|
+
return readdirSync(folder, { withFileTypes: true })
|
|
208
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
209
|
+
.flatMap((entry) => {
|
|
210
|
+
const name = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
211
|
+
if (entry.isSymbolicLink()) return [];
|
|
212
|
+
return entry.isDirectory() ? brandFiles(path.join(folder, entry.name), name) : entry.isFile() ? [name] : [];
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
const artwork = brandFiles(directory).flatMap((name) => {
|
|
216
|
+
const file = path.join(directory, name),
|
|
217
|
+
type = imageTypes[path.extname(name).toLowerCase()];
|
|
218
|
+
if (!type || lstatSync(file).size > 1024 * 1024) return [];
|
|
219
|
+
return [
|
|
220
|
+
{
|
|
221
|
+
name,
|
|
222
|
+
file: relative(root, file),
|
|
223
|
+
src: `data:${type};base64,${readFileSync(file).toString("base64")}`,
|
|
224
|
+
appIcon: path.resolve(dsRoot, config.assets.iconSource ?? ".") === file,
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
});
|
|
228
|
+
if (artwork.length)
|
|
229
|
+
views.unshift({
|
|
230
|
+
id: "brand/Assets",
|
|
231
|
+
kind: "brand",
|
|
232
|
+
title: "Brand assets",
|
|
233
|
+
covers: [],
|
|
234
|
+
tokens: [],
|
|
235
|
+
file: artwork[0].file,
|
|
236
|
+
foundation: { schemaVersion: 1, kind: "brand", title: "Brand assets", artwork },
|
|
237
|
+
});
|
|
238
|
+
const pictograms = pictogramViews(options);
|
|
239
|
+
views.push(...pictograms.views);
|
|
240
|
+
diagnostics.push(...pictograms.diagnostics);
|
|
241
|
+
return { views: views.map((view) => ({ ...view, artifact: `.ds/scenarios/${view.id}/index.html` })), diagnostics };
|
|
242
|
+
}
|