@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/foundation.mjs
CHANGED
|
@@ -8,22 +8,29 @@ const cssWide = /^(?:inherit|initial|unset|revert|revert-layer)$/i;
|
|
|
8
8
|
// A theme or brand scope ([data-theme], [data-brand="name"]) anchors like the root: either
|
|
9
9
|
// can apply to the whole document or to one section of it (base.css paints a themed section).
|
|
10
10
|
function rootAnchor(nodes) {
|
|
11
|
-
return nodes.some(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
return nodes.some(
|
|
12
|
+
(node) =>
|
|
13
|
+
(node.type === "tag" && !node.namespace && node.value.toLowerCase() === "html") ||
|
|
14
|
+
(node.type === "attribute" && ["data-theme", "data-brand"].includes(node.attribute) && (!node.operator || node.operator === "=")) ||
|
|
15
|
+
(node.type === "pseudo" && node.value.toLowerCase() === ":root") ||
|
|
16
|
+
(node.type === "pseudo" &&
|
|
17
|
+
/^:(?:is|where)$/i.test(node.value) &&
|
|
18
|
+
node.nodes.length &&
|
|
19
|
+
node.nodes.every((selector) => !selector.nodes.some((node) => node.type === "combinator") && rootAnchor(selector.nodes))),
|
|
20
|
+
);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
// Token definitions sit on the root or one brand anchor, never on a descendant: theme values
|
|
18
24
|
// are per-theme halves, resolved by the generated themes.generated.css.
|
|
19
|
-
const anchoredDefinition = nodes => !nodes.some(node => node.type === "combinator") && rootAnchor(nodes);
|
|
25
|
+
const anchoredDefinition = (nodes) => !nodes.some((node) => node.type === "combinator") && rootAnchor(nodes);
|
|
20
26
|
|
|
21
27
|
function rootCompound(node) {
|
|
22
28
|
for (let current = node; current.parent; current = current.parent) {
|
|
23
29
|
const parent = current.parent;
|
|
24
30
|
if (parent.type !== "selector") continue;
|
|
25
31
|
const index = parent.nodes.indexOf(current);
|
|
26
|
-
let start = index,
|
|
32
|
+
let start = index,
|
|
33
|
+
end = index + 1;
|
|
27
34
|
while (start && parent.nodes[start - 1].type !== "combinator") --start;
|
|
28
35
|
while (end < parent.nodes.length && parent.nodes[end].type !== "combinator") ++end;
|
|
29
36
|
// A negative/relational argument cannot establish root context, but an
|
|
@@ -37,77 +44,90 @@ function rootCompound(node) {
|
|
|
37
44
|
/** Global defaults may address native elements and explicit document themes, not UI owners. */
|
|
38
45
|
// The one relational document rule: a modal dialog locks the page scroll behind it, keeping the
|
|
39
46
|
// scrollbar's space (html { scrollbar-gutter: stable }) so nothing shifts.
|
|
40
|
-
const modalLock = selector => selector.replace(/\s+/g, "").toLowerCase() === "html:has(:modal)";
|
|
41
|
-
const modalLockDeclaration = (selector, property, value) =>
|
|
42
|
-
|
|
47
|
+
const modalLock = (selector) => selector.replace(/\s+/g, "").toLowerCase() === "html:has(:modal)";
|
|
48
|
+
const modalLockDeclaration = (selector, property, value) =>
|
|
49
|
+
modalLock(selector)
|
|
50
|
+
? property === "overflow" && value === "hidden"
|
|
51
|
+
: selector.trim().toLowerCase() === "html" && property === "scrollbar-gutter" && value === "stable";
|
|
43
52
|
|
|
44
53
|
export function foundationSelector(selector, { definitions = false } = {}) {
|
|
45
54
|
if (modalLock(selector) && !definitions) return null;
|
|
46
55
|
try {
|
|
47
56
|
let violation = false;
|
|
48
|
-
selectorParser(root => {
|
|
49
|
-
if (definitions && root.nodes.some(selector => !anchoredDefinition(selector.nodes))) violation = true;
|
|
50
|
-
root.walk(node => {
|
|
57
|
+
selectorParser((root) => {
|
|
58
|
+
if (definitions && root.nodes.some((selector) => !anchoredDefinition(selector.nodes))) violation = true;
|
|
59
|
+
root.walk((node) => {
|
|
51
60
|
if (["class", "id"].includes(node.type) && !rootCompound(node)) violation = true;
|
|
52
61
|
if (node.type === "tag" && node.value.includes("-")) violation = true;
|
|
53
62
|
if (node.type === "attribute" && /^(?:class|id|style|data-.+|aria-.+)$/i.test(node.attribute) && !rootCompound(node)) violation = true;
|
|
54
63
|
if (node.type === "pseudo" && node.value.toLowerCase() === ":has") violation = true;
|
|
55
64
|
if (node.type === "combinator") {
|
|
56
65
|
const before = node.parent.nodes.slice(0, node.parent.nodes.indexOf(node));
|
|
57
|
-
if (before.some(node => node.type === "combinator") || !rootAnchor(before)) violation = true;
|
|
66
|
+
if (before.some((node) => node.type === "combinator") || !rootAnchor(before)) violation = true;
|
|
58
67
|
}
|
|
59
68
|
});
|
|
60
69
|
}).processSync(selector);
|
|
61
|
-
return violation
|
|
62
|
-
|
|
70
|
+
return violation
|
|
71
|
+
? "Foundation defaults address native elements or explicit document-root themes. Component/pattern hooks, contextual layout and relational state selectors belong to their Linaria owner."
|
|
72
|
+
: null;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return `Invalid foundation selector: ${error.message}`;
|
|
75
|
+
}
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
function subjects(nodes) {
|
|
66
79
|
let variants = [[]];
|
|
67
80
|
for (const node of nodes) {
|
|
68
81
|
if (node.type === "pseudo" && /^:(?:where|is)$/i.test(node.value)) {
|
|
69
|
-
variants = variants.flatMap(prefix => node.nodes.flatMap(selector => subjects(selector.nodes).map(subject => [...prefix, ...subject])));
|
|
70
|
-
} else variants.forEach(subject => subject.push(node));
|
|
82
|
+
variants = variants.flatMap((prefix) => node.nodes.flatMap((selector) => subjects(selector.nodes).map((subject) => [...prefix, ...subject])));
|
|
83
|
+
} else variants.forEach((subject) => subject.push(node));
|
|
71
84
|
}
|
|
72
85
|
return variants;
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
function reducedMotion(rule) {
|
|
76
89
|
for (let parent = rule.parent; parent; parent = parent.parent) {
|
|
77
|
-
if (parent.type === "atrule" && parent.name.toLowerCase() === "media"
|
|
78
|
-
|
|
90
|
+
if (parent.type === "atrule" && parent.name.toLowerCase() === "media" && /^\(\s*prefers-reduced-motion\s*:\s*reduce\s*\)$/i.test(parent.params.trim()))
|
|
91
|
+
return true;
|
|
79
92
|
}
|
|
80
93
|
return false;
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
function reset(property, value, nodes) {
|
|
84
97
|
const words = value.toLowerCase().split(/\s+/);
|
|
85
|
-
if (/^(?:margin|padding)(?:-(?:top|right|bottom|left|block|inline)(?:-(?:start|end))?)?$/.test(property))
|
|
86
|
-
|
|
98
|
+
if (/^(?:margin|padding)(?:-(?:top|right|bottom|left|block|inline)(?:-(?:start|end))?)?$/.test(property))
|
|
99
|
+
return words.every((word) => word === "0") || cssWide.test(value);
|
|
100
|
+
const tag = nodes.find((node) => node.type === "tag")?.value.toLowerCase();
|
|
87
101
|
if (property === "font-weight" && /^(?:bolder|lighter)$/.test(value)) return ["b", "strong"].includes(tag);
|
|
88
102
|
if (policy.reset[property]) return policy.reset[property].includes(value.toLowerCase()) || cssWide.test(value);
|
|
89
|
-
if (policy.replacedElements.includes(tag) && policy.replacedReset[property])
|
|
103
|
+
if (policy.replacedElements.includes(tag) && policy.replacedReset[property])
|
|
104
|
+
return policy.replacedReset[property].includes(value.toLowerCase()) || cssWide.test(value);
|
|
90
105
|
return tag === "textarea" && property === "resize" && /^(?:vertical|inherit|initial|unset|revert(?:-layer)?)$/.test(value);
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
function roleAllows(rule, nodes, property, value) {
|
|
94
|
-
const pseudos = nodes.filter(node => node.type === "pseudo");
|
|
95
|
-
const tag = nodes.find(node => node.type === "tag")?.value.toLowerCase();
|
|
96
|
-
const universal = nodes.every(node => node.type === "universal" || node.type === "pseudo" || node.type === "comment");
|
|
97
|
-
if (universal && pseudos.some(node => node.value === ":focus-visible") && pseudos.every(node => node.value === ":focus-visible"))
|
|
98
|
-
|
|
99
|
-
if (universal && pseudos.
|
|
109
|
+
const pseudos = nodes.filter((node) => node.type === "pseudo");
|
|
110
|
+
const tag = nodes.find((node) => node.type === "tag")?.value.toLowerCase();
|
|
111
|
+
const universal = nodes.every((node) => node.type === "universal" || node.type === "pseudo" || node.type === "comment");
|
|
112
|
+
if (universal && pseudos.some((node) => node.value === ":focus-visible") && pseudos.every((node) => node.value === ":focus-visible"))
|
|
113
|
+
return policy.focus.includes(property) && !/^(?:none|0)$/.test(value);
|
|
114
|
+
if (universal && pseudos.some((node) => node.value === "::selection") && pseudos.every((node) => node.value === "::selection"))
|
|
115
|
+
return policy.selection.includes(property);
|
|
116
|
+
if (universal && pseudos.every((node) => ["::before", "::after"].includes(node.value)) && reducedMotion(rule)) {
|
|
100
117
|
if (policy.reducedMotion.includes(property)) return property !== "scroll-behavior" || value === "auto";
|
|
101
118
|
if (["animation", "transition"].includes(property) && value === "none") return true;
|
|
102
119
|
}
|
|
103
|
-
const document = (rootAnchor(nodes) || tag === "body") && pseudos.every(node => [":root", ":not"].includes(node.value));
|
|
120
|
+
const document = (rootAnchor(nodes) || tag === "body") && pseudos.every((node) => [":root", ":not"].includes(node.value));
|
|
104
121
|
if (document && policy.document.includes(property)) return true;
|
|
105
|
-
const documentScrollbar =
|
|
106
|
-
|
|
122
|
+
const documentScrollbar =
|
|
123
|
+
(rootAnchor(nodes) || tag === "body") &&
|
|
124
|
+
pseudos.some((node) => /^::-webkit-scrollbar(?:-thumb|-track)?$/.test(node.value)) &&
|
|
125
|
+
pseudos.every((node) => node.value === ":root" || /^::-webkit-scrollbar(?:-thumb|-track)?$/.test(node.value) || node.value === ":hover");
|
|
107
126
|
if (documentScrollbar) return policy.scrollbar.includes(property);
|
|
108
|
-
if (pseudos.some(node => node.value === "::placeholder") && pseudos.every(node => node.value === "::placeholder"))
|
|
109
|
-
|
|
110
|
-
if (pseudos.some(node =>
|
|
127
|
+
if (pseudos.some((node) => node.value === "::placeholder") && pseudos.every((node) => node.value === "::placeholder"))
|
|
128
|
+
return property === "color" || (property === "opacity" && value === "1");
|
|
129
|
+
if (pseudos.some((node) => ![":root", ":not", "::before", "::after"].includes(node.value))) return false;
|
|
130
|
+
if (pseudos.some((node) => node.value === ":not") && !rootAnchor(nodes)) return false;
|
|
111
131
|
return reset(property, value, nodes);
|
|
112
132
|
}
|
|
113
133
|
|
|
@@ -117,14 +137,18 @@ export function foundationDeclaration(rule, declaration) {
|
|
|
117
137
|
if (modalLock(rule.selector)) return "html:has(:modal) only locks the page scroll behind a modal dialog: overflow: hidden.";
|
|
118
138
|
try {
|
|
119
139
|
const selectors = selectorParser().astSync(rule.selector);
|
|
120
|
-
const property = declaration.prop.toLowerCase(),
|
|
140
|
+
const property = declaration.prop.toLowerCase(),
|
|
141
|
+
value = declaration.value.trim();
|
|
121
142
|
for (const selector of selectors.nodes) {
|
|
122
|
-
const lastCombinator = selector.nodes.findLastIndex(node => node.type === "combinator");
|
|
143
|
+
const lastCombinator = selector.nodes.findLastIndex((node) => node.type === "combinator");
|
|
123
144
|
for (let nodes of subjects(selector.nodes.slice(lastCombinator + 1))) {
|
|
124
|
-
nodes = nodes.slice(nodes.findLastIndex(node => node.type === "combinator") + 1);
|
|
125
|
-
if (!roleAllows(rule, nodes, property, value))
|
|
145
|
+
nodes = nodes.slice(nodes.findLastIndex((node) => node.type === "combinator") + 1);
|
|
146
|
+
if (!roleAllows(rule, nodes, property, value))
|
|
147
|
+
return "base.css permits document-root/body typography and canvas defaults, limited native normalization, global focus indicators and reduced-motion rules. Put control skins, layout and state styling in their Linaria owner.";
|
|
126
148
|
}
|
|
127
149
|
}
|
|
128
150
|
return null;
|
|
129
|
-
} catch (error) {
|
|
151
|
+
} catch (error) {
|
|
152
|
+
return `Invalid foundation declaration context: ${error.message}`;
|
|
153
|
+
}
|
|
130
154
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { mapAsync } from "./analysis/queries.mjs";
|
|
1
2
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
import ts from "
|
|
4
|
+
import ts from "./analysis/syntax.mjs";
|
|
4
5
|
import { isInside, sourceFiles } from "./config.mjs";
|
|
5
6
|
import { foundationFiles } from "./token-policy.mjs";
|
|
6
7
|
import { fontPreloadExports, generatedFontsFile } from "./fonts-generated.mjs";
|
|
@@ -18,23 +19,31 @@ import { fontPreloadExports, generatedFontsFile } from "./fonts-generated.mjs";
|
|
|
18
19
|
// changes, `ads assets` writes them on demand, draft previews and acceptance candidates
|
|
19
20
|
// regenerate them, and `ads check` only verifies them.
|
|
20
21
|
|
|
21
|
-
export const isExportsFile = file => /\.ads\.exports\.[cm]?ts$/.test(file);
|
|
22
|
-
const slash = value => value.replaceAll("\\", "/");
|
|
22
|
+
export const isExportsFile = (file) => /\.ads\.exports\.[cm]?ts$/.test(file);
|
|
23
|
+
const slash = (value) => value.replaceAll("\\", "/");
|
|
23
24
|
export const barrelHeader = "// Generated by ADS from each owner's .ads.exports.ts; do not edit. Declare an owner's public names in its exports file.\n";
|
|
24
25
|
const stylesHeader = "/* Generated by ADS from the token sheets present in the token folder, in foundation order; do not edit. */\n";
|
|
25
26
|
|
|
26
27
|
/** Both generated entries with the exports files each one collects, in path order. */
|
|
27
28
|
export function barrelEntries({ dsRoot, config }) {
|
|
28
|
-
const review = path.join(dsRoot, "review"),
|
|
29
|
+
const review = path.join(dsRoot, "review"),
|
|
30
|
+
files = sourceFiles(dsRoot).filter(isExportsFile);
|
|
29
31
|
return [
|
|
30
32
|
// Importing the public barrel loads the foundation styles first.
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
+
{
|
|
34
|
+
kind: "public",
|
|
35
|
+
file: path.join(dsRoot, config.publicEntry),
|
|
36
|
+
styles: path.join(dsRoot, config.stylesEntry),
|
|
37
|
+
fonts: path.join(dsRoot, config.tokenDir, generatedFontsFile),
|
|
38
|
+
sources: files.filter((file) => !isInside(review, file)),
|
|
39
|
+
},
|
|
40
|
+
{ kind: "review", file: path.join(dsRoot, config.reviewEntry), sources: files.filter((file) => isInside(review, file)) },
|
|
33
41
|
];
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
const specifier = (from, file, keepExtension = false) => {
|
|
37
|
-
const relative = slash(path.relative(path.dirname(from), file)),
|
|
45
|
+
const relative = slash(path.relative(path.dirname(from), file)),
|
|
46
|
+
bare = keepExtension ? relative : relative.replace(/\.[cm]?ts$/, "");
|
|
38
47
|
return bare.startsWith(".") ? bare : `./${bare}`;
|
|
39
48
|
};
|
|
40
49
|
|
|
@@ -44,13 +53,23 @@ const specifier = (from, file, keepExtension = false) => {
|
|
|
44
53
|
* source, so a product build never reaches an exports file. Statements an exports file may not
|
|
45
54
|
* hold are left out; `ads check` reports them on that file. An entry without names stays a module.
|
|
46
55
|
*/
|
|
47
|
-
export function barrelText(entry) {
|
|
56
|
+
export async function barrelText(entry) {
|
|
48
57
|
const lines = [];
|
|
49
58
|
for (const source of entry.sources) {
|
|
50
|
-
const ast = ts.createSourceFile(source, readFileSync(source, "utf8"), ts.ScriptTarget.Latest, true);
|
|
59
|
+
const ast = await ts.createSourceFile(source, readFileSync(source, "utf8"), ts.ScriptTarget.Latest, true);
|
|
51
60
|
for (const statement of ast.statements) {
|
|
52
|
-
if (
|
|
53
|
-
|
|
61
|
+
if (
|
|
62
|
+
!ts.isExportDeclaration(statement) ||
|
|
63
|
+
!statement.exportClause ||
|
|
64
|
+
!ts.isNamedExports(statement.exportClause) ||
|
|
65
|
+
!statement.moduleSpecifier ||
|
|
66
|
+
!ts.isStringLiteralLike(statement.moduleSpecifier) ||
|
|
67
|
+
!statement.moduleSpecifier.text.startsWith(".")
|
|
68
|
+
)
|
|
69
|
+
continue;
|
|
70
|
+
const names = statement.exportClause.elements.map(
|
|
71
|
+
(element) => `${element.isTypeOnly ? "type " : ""}${element.propertyName ? `${element.propertyName.text} as ` : ""}${element.name.text}`,
|
|
72
|
+
);
|
|
54
73
|
const target = specifier(entry.file, path.resolve(path.dirname(source), statement.moduleSpecifier.text), true);
|
|
55
74
|
lines.push(`export ${statement.isTypeOnly ? "type " : ""}{ ${names.join(", ")} } from "${target}";\n`);
|
|
56
75
|
}
|
|
@@ -63,25 +82,29 @@ export function barrelText(entry) {
|
|
|
63
82
|
/** The foundation styles entry: an @import per canonical token sheet that exists. */
|
|
64
83
|
export function stylesEntryFile({ dsRoot, config }) {
|
|
65
84
|
const file = path.join(dsRoot, config.stylesEntry);
|
|
66
|
-
const sheets = foundationFiles.map(name => path.join(dsRoot, config.tokenDir, name)).filter(sheet => existsSync(sheet));
|
|
67
|
-
return { file, text: stylesHeader + sheets.map(sheet => `@import "${specifier(file, sheet, true)}";\n`).join("") };
|
|
85
|
+
const sheets = foundationFiles.map((name) => path.join(dsRoot, config.tokenDir, name)).filter((sheet) => existsSync(sheet));
|
|
86
|
+
return { file, text: stylesHeader + sheets.map((sheet) => `@import "${specifier(file, sheet, true)}";\n`).join("") };
|
|
68
87
|
}
|
|
69
88
|
|
|
70
89
|
/** Every generated entry as it should be, for writing or for overlaying a candidate project. */
|
|
71
|
-
export function generatedEntries(options) {
|
|
72
|
-
return [stylesEntryFile(options), ...barrelEntries(options)
|
|
90
|
+
export async function generatedEntries(options) {
|
|
91
|
+
return [stylesEntryFile(options), ...(await mapAsync(barrelEntries(options), async (entry) => ({ file: entry.file, text: await barrelText(entry) })))];
|
|
73
92
|
}
|
|
74
93
|
|
|
75
94
|
/** Writes stale generated entries atomically and reports which changed. */
|
|
76
|
-
export function writeGeneratedEntries(options) {
|
|
95
|
+
export async function writeGeneratedEntries(options) {
|
|
77
96
|
const files = [];
|
|
78
|
-
for (const { file, text } of generatedEntries(options)) {
|
|
97
|
+
for (const { file, text } of await generatedEntries(options)) {
|
|
79
98
|
const current = existsSync(file) ? readFileSync(file, "utf8") : null;
|
|
80
99
|
if (current !== text) {
|
|
81
100
|
mkdirSync(path.dirname(file), { recursive: true });
|
|
82
101
|
const staging = `${file}.ads-generated.tmp`;
|
|
83
|
-
try {
|
|
84
|
-
|
|
102
|
+
try {
|
|
103
|
+
writeFileSync(staging, text);
|
|
104
|
+
renameSync(staging, file);
|
|
105
|
+
} finally {
|
|
106
|
+
rmSync(staging, { force: true });
|
|
107
|
+
}
|
|
85
108
|
}
|
|
86
109
|
files.push({ file, text, changed: current !== text });
|
|
87
110
|
}
|
|
@@ -89,13 +112,29 @@ export function writeGeneratedEntries(options) {
|
|
|
89
112
|
}
|
|
90
113
|
|
|
91
114
|
/** The names one exports file declares, or the reasons it is not a plain exports file. */
|
|
92
|
-
export function exportsDeclarations(file, text
|
|
93
|
-
|
|
115
|
+
export async function exportsDeclarations(file, text) {
|
|
116
|
+
if (text === undefined) text = readFileSync(file, "utf8");
|
|
117
|
+
const ast = await ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true),
|
|
118
|
+
names = [],
|
|
119
|
+
targets = [],
|
|
120
|
+
problems = [];
|
|
94
121
|
for (const statement of ast.statements) {
|
|
95
122
|
const line = ast.getLineAndCharacterOfPosition(statement.getStart(ast)).line + 1;
|
|
96
|
-
if (!ts.isExportDeclaration(statement) || !statement.moduleSpecifier || !ts.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
97
|
-
|
|
98
|
-
|
|
123
|
+
if (!ts.isExportDeclaration(statement) || !statement.moduleSpecifier || !ts.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
124
|
+
problems.push({
|
|
125
|
+
line,
|
|
126
|
+
message: 'An exports file holds only `export { … } from "./module"` and `export type { … } from "./module"` re-exports of its owner\'s source.',
|
|
127
|
+
});
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (!statement.exportClause || !ts.isNamedExports(statement.exportClause)) {
|
|
131
|
+
problems.push({ line, message: "Name each public export: `export *` hides an owner's API from review." });
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!statement.moduleSpecifier.text.startsWith(".")) {
|
|
135
|
+
problems.push({ line, message: "Re-export the owner's own modules by relative path." });
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
99
138
|
targets.push({ line, specifier: statement.moduleSpecifier.text });
|
|
100
139
|
for (const element of statement.exportClause.elements) names.push({ name: element.name.text, line });
|
|
101
140
|
}
|
|
@@ -103,26 +142,54 @@ export function exportsDeclarations(file, text = readFileSync(file, "utf8")) {
|
|
|
103
142
|
}
|
|
104
143
|
|
|
105
144
|
/** Freshness of every generated entry; plain exports files, owner-local targets and unique public names. */
|
|
106
|
-
export function generatedEntryDiagnostics(options, inventory) {
|
|
107
|
-
const { root } = options,
|
|
108
|
-
|
|
145
|
+
export async function generatedEntryDiagnostics(options, inventory) {
|
|
146
|
+
const { root } = options,
|
|
147
|
+
diagnostics = [],
|
|
148
|
+
relative = (file) => slash(path.relative(root, file));
|
|
149
|
+
for (const { file, text } of await generatedEntries(options)) {
|
|
109
150
|
const current = existsSync(file) ? readFileSync(file, "utf8") : null;
|
|
110
|
-
if (current !== text)
|
|
151
|
+
if (current !== text)
|
|
152
|
+
diagnostics.push({
|
|
153
|
+
rule: "generated-entry",
|
|
154
|
+
file: relative(file),
|
|
155
|
+
line: 1,
|
|
156
|
+
column: 1,
|
|
157
|
+
message: `${path.basename(file)} is generated by ADS (${file.endsWith(".css") ? "from the token sheets" : "from .ads.exports.ts files"}) and is ${current === null ? "missing" : "stale or edited by hand"}. Run ads assets, or let the showcase/MCP server rewrite it.`,
|
|
158
|
+
});
|
|
111
159
|
}
|
|
112
160
|
for (const entry of barrelEntries(options)) {
|
|
113
161
|
const seen = new Map();
|
|
114
162
|
for (const source of entry.sources) {
|
|
115
|
-
const owner = inventory.owner(inventory.relative(relative(source))),
|
|
116
|
-
|
|
163
|
+
const owner = inventory.owner(inventory.relative(relative(source))),
|
|
164
|
+
{ names, targets, problems } = await exportsDeclarations(source);
|
|
165
|
+
for (const problem of problems)
|
|
166
|
+
diagnostics.push({ rule: "exports-file", file: relative(source), line: problem.line, column: 1, message: problem.message });
|
|
117
167
|
for (const target of targets) {
|
|
118
168
|
const base = path.resolve(path.dirname(source), target.specifier);
|
|
119
|
-
const resolved = ["", ".ts", ".tsx", ".mts", ".js", ".jsx", "/index.ts", "/index.tsx"]
|
|
169
|
+
const resolved = ["", ".ts", ".tsx", ".mts", ".js", ".jsx", "/index.ts", "/index.tsx"]
|
|
170
|
+
.map((extension) => base + extension)
|
|
171
|
+
.find((file) => existsSync(file) && statSync(file).isFile() && !isExportsFile(file));
|
|
120
172
|
const targetOwner = resolved && inventory.owner(inventory.relative(relative(resolved)));
|
|
121
|
-
if (!resolved)
|
|
122
|
-
|
|
173
|
+
if (!resolved)
|
|
174
|
+
diagnostics.push({ rule: "exports-file", file: relative(source), line: target.line, column: 1, message: `Cannot resolve ${target.specifier}.` });
|
|
175
|
+
else if (targetOwner !== owner)
|
|
176
|
+
diagnostics.push({
|
|
177
|
+
rule: "exports-file",
|
|
178
|
+
file: relative(source),
|
|
179
|
+
line: target.line,
|
|
180
|
+
column: 1,
|
|
181
|
+
message: `${owner}'s exports file can re-export only its own source; ${target.specifier} belongs to ${targetOwner ?? "no owner"}.`,
|
|
182
|
+
});
|
|
123
183
|
}
|
|
124
184
|
for (const { name, line } of names) {
|
|
125
|
-
if (seen.has(name))
|
|
185
|
+
if (seen.has(name))
|
|
186
|
+
diagnostics.push({
|
|
187
|
+
rule: "barrel-duplicate",
|
|
188
|
+
file: relative(source),
|
|
189
|
+
line,
|
|
190
|
+
column: 1,
|
|
191
|
+
message: `${name} is already exported by ${seen.get(name)}; public names must be unique across owners.`,
|
|
192
|
+
});
|
|
126
193
|
else seen.set(name, relative(source));
|
|
127
194
|
}
|
|
128
195
|
}
|
package/dist/icons.mjs
CHANGED
|
@@ -13,7 +13,10 @@ const relative = (root, file) => path.relative(root, file).replaceAll("\\", "/")
|
|
|
13
13
|
function files(directory) {
|
|
14
14
|
const stat = lstatSync(directory, { throwIfNoEntry: false });
|
|
15
15
|
if (!stat || stat.isSymbolicLink() || !stat.isDirectory()) return [];
|
|
16
|
-
return readdirSync(directory, { withFileTypes: true })
|
|
16
|
+
return readdirSync(directory, { withFileTypes: true })
|
|
17
|
+
.filter((entry) => entry.isFile())
|
|
18
|
+
.map((entry) => entry.name)
|
|
19
|
+
.sort();
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
/** The folders the Icons view reads; their files' changes refresh it. */
|
|
@@ -21,87 +24,131 @@ export function iconInputs({ dsRoot, config }) {
|
|
|
21
24
|
const glyphs = config.assets.glyphs;
|
|
22
25
|
if (!glyphs) return [];
|
|
23
26
|
const directories = [path.join(dsRoot, glyphs.source), path.join(dsRoot, "assets/logos")];
|
|
24
|
-
return [...directories, ...directories.flatMap(directory => files(directory).map(name => path.join(directory, name)))];
|
|
27
|
+
return [...directories, ...directories.flatMap((directory) => files(directory).map((name) => path.join(directory, name)))];
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
/** Each --icon-* token resolved to pixels through var() chains; unresolvable sizes are left out. */
|
|
28
|
-
function iconSizes(options) {
|
|
31
|
+
async function iconSizes(options, inventory) {
|
|
29
32
|
let tokens;
|
|
30
|
-
try {
|
|
33
|
+
try {
|
|
34
|
+
tokens = (inventory ?? await inspectTokens(options.root, options)).tokens;
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
31
38
|
const values = new Map();
|
|
32
39
|
for (const token of tokens) {
|
|
33
40
|
const definitions = token.definitions ?? [];
|
|
34
|
-
const plain =
|
|
41
|
+
const plain =
|
|
42
|
+
definitions.find((item) => !item.theme && !item.brand && !item.conditional && item.scope === ":root") ??
|
|
43
|
+
definitions.find((item) => !item.theme && !item.brand) ??
|
|
44
|
+
definitions[0];
|
|
35
45
|
if (plain) values.set(token.name, plain.value);
|
|
36
46
|
}
|
|
37
47
|
const resolve = (value, depth = 0) => {
|
|
38
48
|
if (depth > 12) return null;
|
|
39
|
-
const match = String(value)
|
|
49
|
+
const match = String(value)
|
|
50
|
+
.trim()
|
|
51
|
+
.match(/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/);
|
|
40
52
|
if (match) return values.has(match[1]) ? resolve(values.get(match[1]), depth + 1) : match[2] ? resolve(match[2], depth + 1) : null;
|
|
41
|
-
const length = String(value)
|
|
53
|
+
const length = String(value)
|
|
54
|
+
.trim()
|
|
55
|
+
.match(/^(-?\d*\.?\d+)(px|rem)$/i);
|
|
42
56
|
if (!length) return null;
|
|
43
57
|
const px = Number(length[1]) * (length[2].toLowerCase() === "rem" ? 16 : 1);
|
|
44
58
|
return px > 0 ? Math.round(px * 100) / 100 : null;
|
|
45
59
|
};
|
|
46
|
-
return [...values.keys()]
|
|
47
|
-
.
|
|
60
|
+
return [...values.keys()]
|
|
61
|
+
.filter((name) => /^--icon-[\w-]+$/.test(name))
|
|
62
|
+
.map((token) => ({ token, px: resolve(values.get(token)) }))
|
|
63
|
+
.filter((size) => size.px !== null)
|
|
48
64
|
.sort((a, b) => a.px - b.px || a.token.localeCompare(b.token));
|
|
49
65
|
}
|
|
50
66
|
|
|
51
67
|
/** The size the project's Icon draws beside text: the first --icon-* its own sources (beside the glyph module) use, else the smallest of 16 px or more. */
|
|
52
68
|
function textSize({ dsRoot, config }, sizes) {
|
|
53
|
-
const output = path.join(dsRoot, config.assets.glyphs.output),
|
|
69
|
+
const output = path.join(dsRoot, config.assets.glyphs.output),
|
|
70
|
+
folder = path.dirname(output);
|
|
54
71
|
for (const name of files(folder)) {
|
|
55
72
|
const file = path.join(folder, name);
|
|
56
73
|
if (file === output || !/\.[cm]?[jt]sx?$/.test(name) || isTestFile(name) || /\.ads\.(?:scenario|fixture)\.[jt]sx?$/.test(name)) continue;
|
|
57
74
|
for (const match of readFileSync(file, "utf8").matchAll(/var\(\s*(--icon-[\w-]+)/g)) {
|
|
58
|
-
const size = sizes.find(item => item.token === match[1]);
|
|
75
|
+
const size = sizes.find((item) => item.token === match[1]);
|
|
59
76
|
if (size) return size;
|
|
60
77
|
}
|
|
61
78
|
}
|
|
62
|
-
return sizes.find(size => size.px >= 16) ?? sizes.at(-1) ?? null;
|
|
79
|
+
return sizes.find((size) => size.px >= 16) ?? sizes.at(-1) ?? null;
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
function parseBox(box) {
|
|
66
83
|
const numbers = box?.split(/[\s,]+/).map(Number);
|
|
67
|
-
return numbers?.length === 4 && numbers.every(Number.isFinite) && numbers[2] > 0 && numbers[3] > 0
|
|
84
|
+
return numbers?.length === 4 && numbers.every(Number.isFinite) && numbers[2] > 0 && numbers[3] > 0
|
|
85
|
+
? { x: numbers[0], y: numbers[1], width: numbers[2], height: numbers[3] }
|
|
86
|
+
: null;
|
|
68
87
|
}
|
|
69
88
|
|
|
70
89
|
/** The glyph set, its aliases, icon sizes, per-glyph findings and other products' logos for the showcase's Icons view. */
|
|
71
|
-
export function iconSet(options) {
|
|
90
|
+
export async function iconSet(options, tokenInventory) {
|
|
72
91
|
const { root, dsRoot, config } = options;
|
|
73
92
|
const glyphs = config.assets.glyphs;
|
|
74
93
|
if (!glyphs) return { configured: false };
|
|
75
94
|
const directory = path.join(dsRoot, glyphs.source);
|
|
76
95
|
const findings = [];
|
|
77
|
-
const names = files(directory)
|
|
96
|
+
const names = files(directory)
|
|
97
|
+
.filter((name) => name.toLowerCase().endsWith(".svg"))
|
|
98
|
+
.map((name) => name.slice(0, -4));
|
|
78
99
|
const { aliases } = glyphAliases(directory, names);
|
|
79
100
|
const attributes = glyphs.attributes ?? {};
|
|
80
|
-
const set = files(directory)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
const set = files(directory)
|
|
102
|
+
.filter((name) => name.toLowerCase().endsWith(".svg"))
|
|
103
|
+
.map((name) => {
|
|
104
|
+
const file = path.join(directory, name),
|
|
105
|
+
text = readFileSync(file, "utf8"),
|
|
106
|
+
viewBox = glyphViewBox(text);
|
|
107
|
+
return {
|
|
108
|
+
name: name.slice(0, -4),
|
|
109
|
+
file: relative(root, file),
|
|
110
|
+
viewBox,
|
|
111
|
+
grid: parseBox(viewBox),
|
|
112
|
+
svg: glyphMarkup(text, attributes),
|
|
113
|
+
aliases: [],
|
|
114
|
+
findings: [],
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
.filter((glyph) => !Object.hasOwn(aliases, glyph.name));
|
|
118
|
+
const byName = new Map(set.map((glyph) => [glyph.name, glyph]));
|
|
85
119
|
// Alias problems come with the glyph check's findings below.
|
|
86
120
|
for (const [alias, target] of Object.entries(aliases).sort(([a], [b]) => a.localeCompare(b))) byName.get(target)?.aliases.push(alias);
|
|
87
|
-
const byFile = new Map(set.map(glyph => [glyph.file, glyph]));
|
|
121
|
+
const byFile = new Map(set.map((glyph) => [glyph.file, glyph]));
|
|
88
122
|
for (const { rule, severity, file, message } of inspectGlyphs(options)) {
|
|
89
123
|
const finding = { rule, severity: severity ?? "error", file, message };
|
|
90
124
|
(byFile.get(file)?.findings ?? findings).push(finding);
|
|
91
125
|
}
|
|
92
|
-
const boxes = [...new Set(set.map(glyph => glyph.viewBox).filter(Boolean))];
|
|
93
|
-
const sizes = iconSizes(options);
|
|
126
|
+
const boxes = [...new Set(set.map((glyph) => glyph.viewBox).filter(Boolean))];
|
|
127
|
+
const sizes = await iconSizes(options, tokenInventory);
|
|
94
128
|
const logoDirectory = path.join(dsRoot, "assets/logos");
|
|
95
|
-
const logos = files(logoDirectory)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
const logos = files(logoDirectory)
|
|
130
|
+
.filter((name) => Object.hasOwn(logoTypes, path.extname(name).toLowerCase()))
|
|
131
|
+
.flatMap((name) => {
|
|
132
|
+
const file = path.join(logoDirectory, name);
|
|
133
|
+
if (statSync(file).size > logoBytes) return [{ name: path.basename(name, path.extname(name)), file: relative(root, file), tooLarge: true }];
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
name: path.basename(name, path.extname(name)),
|
|
137
|
+
file: relative(root, file),
|
|
138
|
+
src: `data:${logoTypes[path.extname(name).toLowerCase()]};base64,${readFileSync(file).toString("base64")}`,
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
});
|
|
100
142
|
return {
|
|
101
|
-
configured: true,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
configured: true,
|
|
144
|
+
source: relative(root, directory),
|
|
145
|
+
grid: boxes.length === 1 ? parseBox(boxes[0]) : null,
|
|
146
|
+
mixed: boxes.length > 1,
|
|
147
|
+
aliasCount: Object.keys(aliases).length,
|
|
148
|
+
sizes,
|
|
149
|
+
textSize: textSize(options, sizes),
|
|
150
|
+
glyphs: set,
|
|
151
|
+
findings,
|
|
105
152
|
logos: existsSync(logoDirectory) ? { source: relative(root, logoDirectory), files: logos } : null,
|
|
106
153
|
};
|
|
107
154
|
}
|