@reqvire-org/ads 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -86
- package/dist/a11y.mjs +108 -29
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +140 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +15 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +146 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +164 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +5 -5
- 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 +135 -38
- 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 +40 -57
- package/dist/check.mjs +749 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +2 -2
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +7 -5
- package/dist/font-rules.mjs +2 -2
- package/dist/fonts-generated.mjs +2 -2
- package/dist/foundation-views.mjs +238 -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 +109 -36
- 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 +901 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +670 -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 +2402 -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/preview-bun.mjs +493 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +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 +2 -2
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
- package/dist/render-audit.mjs +828 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +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 +18 -0
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +55 -0
- package/dist/showcase/foundation-view.mjs +252 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1062 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +130 -119
- package/dist/skills/ads-designer/references/accessibility.md +12 -13
- 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 +98 -10
- 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/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 +54 -343
- 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 +266 -128
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +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/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/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 +208 -98
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +187 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +90 -79
- package/docs/ARCHITECTURE.md +294 -136
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +52 -17
- package/docs/CHANGELOG.md +309 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +270 -258
- package/docs/MCP.md +181 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +42 -34
- package/dist/browser-audit.mjs +0 -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/layout-widths.mjs
CHANGED
|
@@ -2,21 +2,9 @@ import valueParser from "postcss-value-parser";
|
|
|
2
2
|
import { contextValues } from "./themes.mjs";
|
|
3
3
|
import { findingSeverity } from "./finding-rules.mjs";
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* any length unit, or by arithmetic. Every value is read as what it resolves to in the smallest
|
|
9
|
-
* and the largest container, so max(100%, 280px) is fixed at 280px, and min(100%, 280px) is not.
|
|
10
|
-
* A maximum cannot force overflow, so max-width and max-inline-size are not read at all, except
|
|
11
|
-
* that a fluid one in the same rule lets a width shrink.
|
|
12
|
-
* What the source cannot settle (a variable with no definition) passes; the audit renders it.
|
|
13
|
-
* Tokens named by layout.widthTokens pass when used plainly, and fixed ones are listed for review,
|
|
14
|
-
* as are the fixed widths of owners matched by layout.fixedWidthUnits, which is where overlays
|
|
15
|
-
* such as dialogs, menus, popovers and tooltips are declared: ADS knows a unit's layer, not
|
|
16
|
-
* whether it floats. */
|
|
17
|
-
|
|
18
|
-
/** The largest plain size a part may have: see the Layout section of the guide for the evidence. */
|
|
19
|
-
export const smallPartLimitPx = 96;
|
|
5
|
+
/** Resolve sizing expressions against shared sizing roles and the spatial bound.
|
|
6
|
+
* Responsive/intrinsic sizing and compiler-validated tracks remain supported;
|
|
7
|
+
* fixed sizing is a semantic role decision, never a universal pixel threshold. */
|
|
20
8
|
const widthProperties = new Set(["width", "min-width", "inline-size", "min-inline-size", "flex-basis", "flex", "grid-template-columns"]);
|
|
21
9
|
const fluidUnits = /^(?:%|fr|[sld]?v(?:w|h|i|b|min|max)|cq(?:w|h|i|b|min|max))$/i;
|
|
22
10
|
/** Lengths in px. A font-relative one is estimated at the rule's font-size, or 16 px. It is still fixed. */
|
|
@@ -24,40 +12,53 @@ const absoluteUnits = { px: 1, pt: 4 / 3, pc: 16, in: 96, cm: 96 / 2.54, mm: 96
|
|
|
24
12
|
/** Per px of the element's font size, as estimates. */
|
|
25
13
|
const fontUnits = { em: 1, ic: 1, ch: 0.5, ex: 0.5, cap: 0.7, lh: 1.5 };
|
|
26
14
|
const keywords = /^(?:auto|none|min-content|max-content|fit-content|stretch|inherit|initial|unset|revert|revert-layer|content|subgrid)$/i;
|
|
27
|
-
const fluid = { low: 0, high: Infinity },
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const fluid = { low: 0, high: Infinity },
|
|
16
|
+
neutral = { neutral: true },
|
|
17
|
+
unknown = { unknown: true };
|
|
18
|
+
const isLength = (part) => part.low !== undefined;
|
|
19
|
+
const fixedAt = (px) => ({ low: px, high: px });
|
|
30
20
|
|
|
31
21
|
/** A regular expression for a token or path glob: * within a path segment, ** across them. */
|
|
32
22
|
export function globPattern(glob) {
|
|
33
|
-
const literal = text => text.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
34
|
-
return new RegExp(
|
|
23
|
+
const literal = (text) => text.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
24
|
+
return new RegExp(
|
|
25
|
+
`^${glob
|
|
26
|
+
.split("**")
|
|
27
|
+
.map((part) => part.split("*").map(literal).join("[^/]*"))
|
|
28
|
+
.join(".*")}$`,
|
|
29
|
+
);
|
|
35
30
|
}
|
|
36
|
-
export const globMatcher = globs => {
|
|
31
|
+
export const globMatcher = (globs) => {
|
|
32
|
+
const patterns = globs.map(globPattern);
|
|
33
|
+
return (name) => patterns.some((pattern) => pattern.test(name));
|
|
34
|
+
};
|
|
37
35
|
|
|
38
|
-
const meaningful = nodes => nodes.filter(node => !["space", "comment"].includes(node.type));
|
|
36
|
+
const meaningful = (nodes) => nodes.filter((node) => !["space", "comment"].includes(node.type));
|
|
39
37
|
function splitArguments(nodes) {
|
|
40
38
|
const parts = [[]];
|
|
41
|
-
for (const node of nodes) {
|
|
39
|
+
for (const node of nodes) {
|
|
40
|
+
if (node.type === "div" && node.value === ",") parts.push([]);
|
|
41
|
+
else parts.at(-1).push(node);
|
|
42
|
+
}
|
|
42
43
|
return parts;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export function createLayoutWidths(tokens, { themes, layout }) {
|
|
46
|
+
export function createLayoutWidths(tokens, { themes, layout }, spatial) {
|
|
46
47
|
const values = contextValues(tokens, { theme: themes[0].name, themes });
|
|
47
48
|
const widthToken = globMatcher(layout.widthTokens);
|
|
48
49
|
const declaredUses = new Map();
|
|
49
50
|
|
|
50
51
|
function variable(node, scope) {
|
|
51
52
|
const [name, fallback = []] = splitArguments(node.nodes).map(meaningful);
|
|
52
|
-
const token = name?.find(child => child.type === "word")?.value;
|
|
53
|
+
const token = name?.find((child) => child.type === "word")?.value;
|
|
53
54
|
if (!token?.startsWith("--")) return unknown;
|
|
54
55
|
if (scope.seen.has(token)) return unknown;
|
|
55
56
|
const seen = new Set([...scope.seen, token]);
|
|
56
57
|
// Component variables declared in the same template are read through, so a width cannot hide in one.
|
|
57
58
|
const local = scope.locals.get(token);
|
|
58
59
|
if (local) {
|
|
59
|
-
const results = local.map(value => sequence(valueParser(value).nodes, { ...scope, seen })).filter(isLength);
|
|
60
|
-
return results.length ? results.reduce((worst, result) => result.low > worst.low ? result : worst) : unknown;
|
|
60
|
+
const results = local.map((value) => sequence(valueParser(value).nodes, { ...scope, seen })).filter(isLength);
|
|
61
|
+
return results.length ? results.reduce((worst, result) => (result.low > worst.low ? result : worst)) : unknown;
|
|
61
62
|
}
|
|
62
63
|
const value = values.get(token)?.value;
|
|
63
64
|
if (value === undefined) return fallback.length ? sequence(fallback, { ...scope, seen }) : unknown;
|
|
@@ -72,7 +73,8 @@ export function createLayoutWidths(tokens, { themes, layout }) {
|
|
|
72
73
|
if (node.type === "word") {
|
|
73
74
|
const parsed = valueParser.unit(node.value);
|
|
74
75
|
if (!parsed) return keywords.test(node.value) ? neutral : unknown;
|
|
75
|
-
const number = Number(parsed.number),
|
|
76
|
+
const number = Number(parsed.number),
|
|
77
|
+
unit = parsed.unit.toLowerCase();
|
|
76
78
|
if (!unit) return number === 0 ? fixedAt(0) : { number };
|
|
77
79
|
if (number === 0) return fixedAt(0);
|
|
78
80
|
if (fluidUnits.test(unit)) return fluid;
|
|
@@ -84,53 +86,78 @@ export function createLayoutWidths(tokens, { themes, layout }) {
|
|
|
84
86
|
if (name === "var") return variable(node, scope);
|
|
85
87
|
if (name === "calc" || name === "") return calculation(node.nodes, scope);
|
|
86
88
|
if (name === "fit-content") return neutral;
|
|
87
|
-
if (name === "min") return smallest(splitArguments(node.nodes).map(part => sequence(part, scope)));
|
|
88
|
-
if (name === "max") return largest(splitArguments(node.nodes).map(part => sequence(part, scope)));
|
|
89
|
+
if (name === "min") return smallest(splitArguments(node.nodes).map((part) => sequence(part, scope)));
|
|
90
|
+
if (name === "max") return largest(splitArguments(node.nodes).map((part) => sequence(part, scope)));
|
|
89
91
|
if (name !== "clamp") return unknown;
|
|
90
|
-
const [floor, preferred, ceiling] = splitArguments(node.nodes).map(part => sequence(part, scope));
|
|
91
|
-
const value = floor?.neutral
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const [floor, preferred, ceiling] = splitArguments(node.nodes).map((part) => sequence(part, scope));
|
|
93
|
+
const value = floor?.neutral
|
|
94
|
+
? ceiling?.neutral || !ceiling
|
|
95
|
+
? (preferred ?? unknown)
|
|
96
|
+
: smallest([preferred, ceiling])
|
|
97
|
+
// A preferred value that cannot be read still leaves the floor: it cannot shrink below that.
|
|
98
|
+
: isLength(floor) && !isLength(preferred ?? unknown)
|
|
99
|
+
? { low: floor.low, high: Infinity }
|
|
100
|
+
: largest([floor, !ceiling || ceiling.neutral ? preferred : smallest([preferred, ceiling])]);
|
|
95
101
|
// A resizable part: every value is a declared width, each listed for review.
|
|
96
102
|
return floor?.declared && preferred?.declared && ceiling?.declared ? { ...(isLength(value) ? value : neutral), declared: "clamp" } : value;
|
|
97
103
|
}
|
|
98
104
|
/** min(): a part that reaches zero lets the whole shrink, whatever the others are. */
|
|
99
105
|
function smallest(parts) {
|
|
100
|
-
const lengths = parts.filter(isLength),
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const lengths = parts.filter(isLength),
|
|
107
|
+
open = lengths.length !== parts.length;
|
|
108
|
+
if (!lengths.length || (open && !lengths.some((part) => part.low === 0))) return unknown;
|
|
109
|
+
return { low: Math.min(...lengths.map((part) => part.low)), high: open ? Infinity : Math.min(...lengths.map((part) => part.high)) };
|
|
103
110
|
}
|
|
104
111
|
/** max(): it cannot shrink below any part, so a part that cannot be read leaves it unread. */
|
|
105
112
|
function largest(parts) {
|
|
106
113
|
if (!parts.every(isLength)) return unknown;
|
|
107
|
-
return { low: Math.max(...parts.map(part => part.low)), high: Math.max(...parts.map(part => part.high)) };
|
|
114
|
+
return { low: Math.max(...parts.map((part) => part.low)), high: Math.max(...parts.map((part) => part.high)) };
|
|
108
115
|
}
|
|
109
116
|
function sequence(nodes, scope) {
|
|
110
117
|
const items = meaningful(nodes);
|
|
111
118
|
return items.length === 1 ? measure(items[0], scope) : unknown;
|
|
112
119
|
}
|
|
113
120
|
const scaled = (length, factor) => {
|
|
114
|
-
const [low, high] = [length.low, length.high].map(size => factor === 0 ? 0 : size * factor);
|
|
121
|
+
const [low, high] = [length.low, length.high].map((size) => (factor === 0 ? 0 : size * factor));
|
|
115
122
|
return factor < 0 ? { low: high, high: low } : { low, high };
|
|
116
123
|
};
|
|
117
124
|
/** calc(): evaluated at both ends, so 100% - 200px reaches zero and 100% + 200px does not. */
|
|
118
125
|
function calculation(nodes, scope) {
|
|
119
|
-
const operands = [],
|
|
126
|
+
const operands = [],
|
|
127
|
+
operators = [];
|
|
120
128
|
for (const item of meaningful(nodes)) {
|
|
121
|
-
if (item.type === "div" && item.value === "/") {
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
if (item.type === "div" && item.value === "/") {
|
|
130
|
+
operators.push("/");
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (item.type !== "word") {
|
|
134
|
+
operands.push(measure(item, scope));
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (["+", "-"].includes(item.value)) {
|
|
138
|
+
operators.push(item.value);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
124
141
|
// valueParser keeps * and calc()'s / in a word, spaced or not.
|
|
125
|
-
for (const part of item.value.split(/([*/])/).filter(Boolean)) {
|
|
142
|
+
for (const part of item.value.split(/([*/])/).filter(Boolean)) {
|
|
143
|
+
if (part === "*" || part === "/") operators.push(part);
|
|
144
|
+
else operands.push(measure({ type: "word", value: part }, scope));
|
|
145
|
+
}
|
|
126
146
|
}
|
|
127
|
-
if (operands.length !== operators.length + 1 || operands.some(operand => !isLength(operand) && operand.number === undefined)) return unknown;
|
|
147
|
+
if (operands.length !== operators.length + 1 || operands.some((operand) => !isLength(operand) && operand.number === undefined)) return unknown;
|
|
128
148
|
// Multiplication and division bind first.
|
|
129
|
-
const terms = [operands[0]],
|
|
149
|
+
const terms = [operands[0]],
|
|
150
|
+
signs = [];
|
|
130
151
|
operators.forEach((operator, index) => {
|
|
131
152
|
const next = operands[index + 1];
|
|
132
|
-
if (operator !== "*" && operator !== "/") {
|
|
133
|
-
|
|
153
|
+
if (operator !== "*" && operator !== "/") {
|
|
154
|
+
terms.push(next);
|
|
155
|
+
signs.push(operator);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const last = terms.pop(),
|
|
159
|
+
length = isLength(last) ? last : next,
|
|
160
|
+
factor = isLength(last) ? next.number : last.number;
|
|
134
161
|
if (!isLength(length)) terms.push({ number: operator === "*" ? last.number * next.number : last.number / next.number });
|
|
135
162
|
else if (factor === undefined) terms.push(unknown);
|
|
136
163
|
else terms.push(scaled(length, operator === "*" ? factor : 1 / factor));
|
|
@@ -138,7 +165,13 @@ export function createLayoutWidths(tokens, { themes, layout }) {
|
|
|
138
165
|
if (!terms.every(isLength)) return unknown;
|
|
139
166
|
let { low, high } = terms[0];
|
|
140
167
|
terms.slice(1).forEach((term, index) => {
|
|
141
|
-
if (signs[index] === "+") {
|
|
168
|
+
if (signs[index] === "+") {
|
|
169
|
+
low += term.low;
|
|
170
|
+
high += term.high;
|
|
171
|
+
} else {
|
|
172
|
+
low -= term.high;
|
|
173
|
+
high -= term.low;
|
|
174
|
+
}
|
|
142
175
|
});
|
|
143
176
|
return { low: Math.max(low, 0), high: Math.max(high, 0) };
|
|
144
177
|
}
|
|
@@ -160,56 +193,101 @@ export function createLayoutWidths(tokens, { themes, layout }) {
|
|
|
160
193
|
return sizes;
|
|
161
194
|
}
|
|
162
195
|
/** What a width that can give way looks like, in the terms of the property it is set on. */
|
|
163
|
-
const fix = (property, value, px) =>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
196
|
+
const fix = (property, value, px) =>
|
|
197
|
+
property === "grid-template-columns"
|
|
198
|
+
? `a track of minmax(0, ${px}px)`
|
|
199
|
+
: property === "flex" || property === "flex-basis"
|
|
200
|
+
? `flex: 1 1 ${px}px`
|
|
201
|
+
: `${property}: min(100%, ${value})`;
|
|
202
|
+
const sizingRoles = new Set(spatial ? [...spatial.scale, spatial.miniUnit, spatial.fineUnit] : []);
|
|
203
|
+
function supportedSizing(value, scope, seen = new Set()) {
|
|
204
|
+
const names = [];
|
|
205
|
+
valueParser(value).walk(node => {
|
|
206
|
+
if (node.type === "function" && node.value === "var") {
|
|
207
|
+
const name = node.nodes.find(item => item.type === "word")?.value;
|
|
208
|
+
if (name) names.push(name);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return names.length > 0 && names.every(name => {
|
|
212
|
+
if (seen.has(name)) return false;
|
|
213
|
+
if (sizingRoles.has(name) || (!spatial && /^--space-\d+$/.test(name)) || /^--(?:icon-(?:xs|sm|md|lg|xl)|control-height-(?:sm|md|lg))$/.test(name)) return true;
|
|
214
|
+
const definitions = scope.locals.get(name) ?? [values.get(name)?.value];
|
|
215
|
+
return definitions.every(text => text !== undefined && supportedSizing(text, scope, new Set([...seen, name])));
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function verdict(result, property, value, scope) {
|
|
219
|
+
if (!isLength(result) || result.declared || result.low === 0) return null;
|
|
220
|
+
if (result.low > 0 && result.low <= (spatial?.maxWidthPx ?? Infinity) && supportedSizing(value, scope)) return null;
|
|
221
|
+
const px = Math.round(result.low);
|
|
222
|
+
return { error: result.low > (spatial?.maxWidthPx ?? Infinity)
|
|
223
|
+
? `a fixed minimum beyond the spatial maximum of ${spatial.maxWidthPx}px`
|
|
224
|
+
: "a fixed minimum without a shared sizing role", fix: fix(property, value, px) };
|
|
172
225
|
}
|
|
173
226
|
function judge(property, value, scope) {
|
|
174
227
|
const nodes = valueParser(value).nodes;
|
|
175
228
|
if (property === "grid-template-columns") {
|
|
176
|
-
for (const track of tracks(nodes, scope)) {
|
|
229
|
+
for (const track of tracks(nodes, scope)) {
|
|
230
|
+
const found = verdict(track, property, value, scope);
|
|
231
|
+
if (found?.error) return { ...found, error: `a track ${found.error}` };
|
|
232
|
+
}
|
|
177
233
|
return null;
|
|
178
234
|
}
|
|
179
235
|
if (property === "flex") {
|
|
180
236
|
const parts = meaningful(nodes);
|
|
181
237
|
if (parts.length < 2) return null;
|
|
182
|
-
const basis = parts.at(-1),
|
|
183
|
-
|
|
238
|
+
const basis = parts.at(-1),
|
|
239
|
+
shrink = parts.length === 3 ? Number(parts[1].value) : 1;
|
|
240
|
+
return Number(parts[0].value) > 0 && shrink > 0 ? null : verdict(measure(basis, scope), property, value, scope);
|
|
184
241
|
}
|
|
185
|
-
return verdict(sequence(nodes, scope), property, value);
|
|
242
|
+
return verdict(sequence(nodes, scope), property, value, scope);
|
|
186
243
|
}
|
|
187
244
|
|
|
188
245
|
return {
|
|
189
|
-
/**
|
|
190
|
-
inspect(css, file, offset
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
246
|
+
/** Fixed sizing findings for one parsed style sheet or Linaria template. */
|
|
247
|
+
inspect(css, file, offset) {
|
|
248
|
+
if (offset === undefined) offset = { line: 1, column: 1 };
|
|
249
|
+
const findings = [],
|
|
250
|
+
locals = new Map();
|
|
251
|
+
css.walkDecls(/^--/, (decl) => {
|
|
252
|
+
locals.set(decl.prop, [...(locals.get(decl.prop) ?? []), decl.value]);
|
|
253
|
+
});
|
|
254
|
+
css.walkDecls((decl) => {
|
|
194
255
|
const property = decl.prop.toLowerCase();
|
|
195
|
-
|
|
256
|
+
// Tracks emitted from @ads-layout were validated by the spatial compiler,
|
|
257
|
+
// including fixed panel tracks leaving fluid space at every tier.
|
|
258
|
+
if (decl.adsSpatial || !widthProperties.has(property) || decl.value.includes("__ds_expression__")) return;
|
|
196
259
|
// ch and em follow a font size set in the same rule, read through its token; an em font size is taken against 16 px.
|
|
197
|
-
const fontSize = decl.parent.nodes.findLast(sibling => sibling.type === "decl" && sibling.prop.toLowerCase() === "font-size");
|
|
260
|
+
const fontSize = decl.parent.nodes.findLast((sibling) => sibling.type === "decl" && sibling.prop.toLowerCase() === "font-size");
|
|
198
261
|
const font = fontSize && sequence(valueParser(fontSize.value).nodes, { seen: new Set(), locals });
|
|
199
262
|
const fontPx = font?.low !== undefined && font.low === font.high && font.low > 0 ? font.low : undefined;
|
|
200
|
-
const declared = new Set(),
|
|
263
|
+
const declared = new Set(),
|
|
264
|
+
scope = { seen: new Set(), locals, declared, fontPx },
|
|
265
|
+
found = judge(property, decl.value, scope);
|
|
201
266
|
for (const token of declared) declaredUses.set(token, (declaredUses.get(token) ?? 0) + 1);
|
|
202
267
|
if (!found) return;
|
|
203
268
|
// width: 280px with max-width: 100% in the same rule is min(100%, 280px).
|
|
204
|
-
if (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
269
|
+
if (
|
|
270
|
+
found.error &&
|
|
271
|
+
/^(?:width|inline-size)$/.test(property) &&
|
|
272
|
+
decl.parent.nodes.some(
|
|
273
|
+
(sibling) =>
|
|
274
|
+
sibling.type === "decl" && /^max-(?:width|inline-size)$/i.test(sibling.prop) && sequence(valueParser(sibling.value).nodes, scope).low === 0,
|
|
275
|
+
)
|
|
276
|
+
)
|
|
209
277
|
return;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
278
|
+
const line = offset.line + decl.source.start.line - 1,
|
|
279
|
+
column = decl.source.start.column + (decl.source.start.line === 1 ? offset.column - 1 : 0);
|
|
280
|
+
findings.push({
|
|
281
|
+
rule: "layout-fixed-width",
|
|
282
|
+
severity: findingSeverity("layout-fixed-width"),
|
|
283
|
+
file,
|
|
284
|
+
line,
|
|
285
|
+
column,
|
|
286
|
+
property,
|
|
287
|
+
value: decl.value,
|
|
288
|
+
guidanceUri: "ads://guides/tokens",
|
|
289
|
+
message: `${file}:${line} sets ${property}: ${decl.value}, ${found.error}. Use a fixed size from spatial.ads.json's scale, a control/icon size role, a declared layout.widthTokens role, or responsive sizing such as ${found.fix}. Panels and fixed grid tracks can use @ads-layout hybrid/fixed.`,
|
|
290
|
+
});
|
|
213
291
|
});
|
|
214
292
|
return findings;
|
|
215
293
|
},
|
|
@@ -222,15 +300,32 @@ export function createLayoutWidths(tokens, { themes, layout }) {
|
|
|
222
300
|
if (!widthToken(token.name)) continue;
|
|
223
301
|
const value = values.get(token.name)?.value;
|
|
224
302
|
const result = value === undefined ? unknown : sequence(valueParser(value).nodes, { seen: new Set([token.name]), locals: new Map() });
|
|
225
|
-
if (!isLength(result) || result.low <=
|
|
226
|
-
const definition = token.definitions[0],
|
|
227
|
-
|
|
228
|
-
|
|
303
|
+
if (!isLength(result) || result.low <= 0) continue;
|
|
304
|
+
const definition = token.definitions[0],
|
|
305
|
+
uses = declaredUses.get(token.name) ?? 0;
|
|
306
|
+
findings.push({
|
|
307
|
+
rule: "layout-declared-width",
|
|
308
|
+
severity: findingSeverity("layout-declared-width"),
|
|
309
|
+
file: definition.file,
|
|
310
|
+
line: definition.line,
|
|
311
|
+
column: definition.column,
|
|
312
|
+
tokens: [token.name],
|
|
313
|
+
guidanceUri: "ads://guides/tokens",
|
|
314
|
+
message: `${token.name} is ${value}, declared in layout.widthTokens: it cannot shrink below about ${Math.round(result.low)}px. ${uses ? `${uses} width declaration${uses === 1 ? " uses" : "s use"} it. Confirm it must stay fixed.` : "No width uses it, and a maximum needs no declaration: remove it from layout.widthTokens."}`,
|
|
315
|
+
});
|
|
229
316
|
}
|
|
230
317
|
const owners = new Map();
|
|
231
318
|
for (const finding of ownerFindings) owners.set(finding.file, [...(owners.get(finding.file) ?? []), finding]);
|
|
232
|
-
for (const [file, list] of owners)
|
|
233
|
-
|
|
319
|
+
for (const [file, list] of owners)
|
|
320
|
+
findings.push({
|
|
321
|
+
rule: "layout-declared-width",
|
|
322
|
+
severity: findingSeverity("layout-declared-width"),
|
|
323
|
+
file,
|
|
324
|
+
line: list[0].line,
|
|
325
|
+
column: list[0].column,
|
|
326
|
+
guidanceUri: "ads://guides/tokens",
|
|
327
|
+
message: `${file} is in layout.fixedWidthUnits, so its widths are not checked: ${list.map((finding) => `${finding.property}: ${finding.value} (line ${finding.line})`).join(", ")}. Confirm it floats above the layout.`,
|
|
328
|
+
});
|
|
234
329
|
return findings;
|
|
235
330
|
},
|
|
236
331
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const { createHash } = require("node:crypto");
|
|
2
2
|
const postcss = require("postcss");
|
|
3
|
+
const { expandConstructionStyles } = require("../construction-styles.cjs");
|
|
4
|
+
const { spatialForFile } = require("./spatial-inputs.cjs");
|
|
3
5
|
|
|
4
6
|
/** Stylis must not tokenize an unevaluated custom-property value as ordinary CSS.
|
|
5
7
|
* Keep the project's atomizer, selectors and priorities; restore opaque values
|
|
@@ -8,6 +10,11 @@ module.exports = function preserveCustomProperties(Processor) {
|
|
|
8
10
|
return class PreservedCustomProperties extends Processor {
|
|
9
11
|
extractRules(valueCache, cssText, loc) {
|
|
10
12
|
const source = postcss.parse(cssText);
|
|
13
|
+
if (cssText.includes("@ads-")) {
|
|
14
|
+
const hasSpatial = /@ads-(?:layout|cell|at)\b/.test(cssText);
|
|
15
|
+
expandConstructionStyles(source, hasSpatial ? spatialForFile(this.context.filename, valueCache)?.model : null, {deferPlacement:true});
|
|
16
|
+
cssText = source.toString();
|
|
17
|
+
} else require("../spatial-css.cjs").inspectSpatialCss(source,{deferPlacement:true});
|
|
11
18
|
const registrations = [];
|
|
12
19
|
const layerOrder=[];
|
|
13
20
|
// Moving a registration must not change which named layer was first seen.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
const { AsyncLocalStorage } = require("node:async_hooks");
|
|
4
|
+
const { spatialFromInputs, isSpatialSheet } = require("../spatial-inputs.cjs");
|
|
5
|
+
const { timeStage } = require("../stage-timing.cjs");
|
|
6
|
+
|
|
7
|
+
const scope = new AsyncLocalStorage();
|
|
8
|
+
const transforms = new WeakMap();
|
|
9
|
+
const optionalText = file => {
|
|
10
|
+
try { return fs.readFileSync(file, "utf8"); }
|
|
11
|
+
catch (error) { if (["ENOENT", "ENOTDIR"].includes(error.code)) return null; throw error; }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Filesystem boundary for a build, never for analysis. Re-capture for each build. */
|
|
15
|
+
function captureSpatial(options) {
|
|
16
|
+
return timeStage("spatial-inputs", () => capture(options));
|
|
17
|
+
}
|
|
18
|
+
function capture(options) {
|
|
19
|
+
const directory = path.join(options.dsRoot, options.config.tokenDir);
|
|
20
|
+
const file = path.join(directory, "spatial.ads.json"), text = optionalText(file);
|
|
21
|
+
if (text === null) return null;
|
|
22
|
+
const sheets = fs.readdirSync(directory, { withFileTypes: true }).filter(entry => entry.isFile() && isSpatialSheet(entry.name))
|
|
23
|
+
.map(entry => path.join(directory, entry.name)).sort().map(file => ({ file, text: fs.readFileSync(file, "utf8") }));
|
|
24
|
+
return spatialFromInputs({ file, text }, sheets);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** ADS preview supplies one lazy capture for its entire build, including evaluated templates. */
|
|
28
|
+
function withSpatialInputs(read, run) { return scope.run(read, run); }
|
|
29
|
+
|
|
30
|
+
function spatialForFile(file, valueCache) {
|
|
31
|
+
const supplied = scope.getStore();
|
|
32
|
+
if (supplied) return supplied(file);
|
|
33
|
+
// The standalone Linaria tag resolver has no build lifecycle. Its value cache
|
|
34
|
+
// scopes one extraction: reuse within it, re-read on the next transform.
|
|
35
|
+
let state = transforms.get(valueCache);
|
|
36
|
+
if (!state) transforms.set(valueCache, state = { directories: new Map(), models: new Map() });
|
|
37
|
+
const visited = [];
|
|
38
|
+
let options;
|
|
39
|
+
for (let directory = path.dirname(file);; directory = path.dirname(directory)) {
|
|
40
|
+
if (state.directories.has(directory)) { options = state.directories.get(directory); break; }
|
|
41
|
+
visited.push(directory);
|
|
42
|
+
const text = optionalText(path.join(directory, "ds.config.json"));
|
|
43
|
+
if (text !== null) {
|
|
44
|
+
const data = JSON.parse(text);
|
|
45
|
+
options = { dsRoot: path.resolve(directory, data.dsDir ?? "design-system"), config: { tokenDir: "tokens" } };
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (directory === path.dirname(directory)) break;
|
|
49
|
+
}
|
|
50
|
+
for (const directory of visited) state.directories.set(directory, options);
|
|
51
|
+
if (!options) return null;
|
|
52
|
+
if (!state.models.has(options.dsRoot)) state.models.set(options.dsRoot, captureSpatial(options));
|
|
53
|
+
return state.models.get(options.dsRoot);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = { captureSpatial, spatialForFile, withSpatialInputs };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import lockup from "./lockup-model.cjs";
|
|
2
|
+
import ts from "./analysis/syntax.mjs";
|
|
3
|
+
|
|
4
|
+
export function recordLockups(css) {
|
|
5
|
+
const result = [];
|
|
6
|
+
css.walkAtRules("ads-lockup", node => {
|
|
7
|
+
const selectors = [];
|
|
8
|
+
for (let parent = node.parent; parent && parent.type !== "root"; parent = parent.parent)
|
|
9
|
+
if (parent.type === "rule") selectors.unshift(parent.selector);
|
|
10
|
+
result.push({ ...lockup.readLockup(node), selectors });
|
|
11
|
+
});
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Bind through the shared captured-source composition model, without another walk/parser. */
|
|
16
|
+
export async function checkLockupTargets(item, facts, { select, matches, alwaysMatches, descendants, attributes, report }) {
|
|
17
|
+
for (const fact of facts) for (const declaration of fact.lockups) {
|
|
18
|
+
const targets = select(item, declaration.selectors);
|
|
19
|
+
if (!targets.length) report(item.opening, "A lockup selector cannot be bound to owned markup; use a class or data hook.", "lockup-construction");
|
|
20
|
+
for (const target of targets) {
|
|
21
|
+
for (const role of ["artwork", "text"]) {
|
|
22
|
+
const children = target.children.filter(child => child.native && matches(child, declaration[role]));
|
|
23
|
+
if (children.length !== 1 || !alwaysMatches(children[0], declaration[role])) {
|
|
24
|
+
report(target.opening, `${declaration[role]} must identify one owned direct ${role} child in every class alternative.`, "lockup-construction");
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (role === "text") {
|
|
28
|
+
const group = children[0];
|
|
29
|
+
if (!group.children.length || (group.node.children ?? []).some(child => ts.isJsxText(child) ? child.text.trim() :
|
|
30
|
+
!ts.isJsxElement(child) && !ts.isJsxSelfClosingElement(child) && !(ts.isJsxExpression(child) && !child.expression)))
|
|
31
|
+
report(group.opening, "Wrap each lockup text run in an owned span so font-metric trimming can align the letters, not an anonymous flex line box.", "lockup-construction");
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
for (const child of [children[0], ...descendants(children[0])]) {
|
|
35
|
+
if (child.opening.tagName.getText() !== "svg") continue;
|
|
36
|
+
const ratio = await attributes(child, "preserveAspectRatio");
|
|
37
|
+
const preserves = value => value.kind === "union" ? value.values.every(preserves) : value.kind === "literal" &&
|
|
38
|
+
(value.value === undefined || value.value === null || typeof value.value === "string" && !/\bnone\b/.test(value.value));
|
|
39
|
+
if (!preserves(ratio)) report(child.opening, "Lockup SVG artwork must preserve its aspect ratio; preserveAspectRatio cannot be none or unresolved.", "lockup-construction");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const postcss = require("postcss");
|
|
2
|
+
|
|
3
|
+
const hook = /^\.[a-zA-Z_][\w-]*$|^\[data-[\w-]+=["'][\w-]+["']\]$/;
|
|
4
|
+
function fail(node, message) {
|
|
5
|
+
const error = new Error(`ADS lockup: ${message}`);
|
|
6
|
+
Object.assign(error, { rule: "lockup-construction", line: node.source?.start?.line, column: node.source?.start?.column });
|
|
7
|
+
throw error;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Pure syntax/expansion shared by checks and Linaria. No asset reads or geometry guesses. */
|
|
11
|
+
function readLockup(node) {
|
|
12
|
+
if (node.params.trim()) fail(node, "@ads-lockup takes artwork, text and size declarations, without a mode.");
|
|
13
|
+
const props = {};
|
|
14
|
+
for (const child of node.nodes ?? []) {
|
|
15
|
+
if (child.type === "comment") continue;
|
|
16
|
+
if (child.type !== "decl" || !["artwork", "text", "size"].includes(child.prop) || child.important || Object.hasOwn(props, child.prop))
|
|
17
|
+
fail(child, "Use one artwork hook, one text hook and one size token in @ads-lockup.");
|
|
18
|
+
props[child.prop] = child.value.trim();
|
|
19
|
+
}
|
|
20
|
+
if (!hook.test(props.artwork ?? "") || !hook.test(props.text ?? "") || props.artwork === props.text)
|
|
21
|
+
fail(node, "artwork and text must name distinct direct-child class or data hooks.");
|
|
22
|
+
if (!/^--[\w-]+$/.test(props.size ?? "")) fail(node, "size must name a shared size token, for example --icon-sm.");
|
|
23
|
+
return props;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function expandLockupStyles(css) {
|
|
27
|
+
css.walkAtRules("ads-lockup", node => {
|
|
28
|
+
const props = readLockup(node);
|
|
29
|
+
for (let parent = node.parent; parent; parent = parent.parent)
|
|
30
|
+
if (parent.type === "atrule" && (parent.name.startsWith("ads-") || /keyframes$/i.test(parent.name)))
|
|
31
|
+
fail(node, "Declare the lockup on its own element, outside another construction or keyframes.");
|
|
32
|
+
if (node.parent.nodes.filter(child => child.type === "atrule" && child.name === "ads-lockup").length > 1)
|
|
33
|
+
fail(node, "Declare one lockup per element.");
|
|
34
|
+
const output = postcss.root();
|
|
35
|
+
const append = (parent, declarations) => {
|
|
36
|
+
for (const [prop, value] of Object.entries(declarations))
|
|
37
|
+
parent.append(postcss.decl({ prop, value, source: node.source, adsLockup: true }));
|
|
38
|
+
};
|
|
39
|
+
const child = (selector, declarations) => {
|
|
40
|
+
const rule = postcss.rule({ selector, source: node.source });
|
|
41
|
+
append(rule, declarations); output.append(rule);
|
|
42
|
+
};
|
|
43
|
+
append(output, { display: "inline-flex", "flex-direction": "row", "align-items": "center" });
|
|
44
|
+
// A wrapper may contain theme variants or an owned artwork component. Size
|
|
45
|
+
// replaced elements by height and their intrinsic ratio, never by a square.
|
|
46
|
+
child(`& > ${props.artwork}`, {
|
|
47
|
+
"block-size": `var(${props.size})`, "inline-size": "auto", "flex": "0 0 auto",
|
|
48
|
+
"align-self": "center", "margin-block": "0", "position": "static",
|
|
49
|
+
"object-fit": "contain", "aspect-ratio": "auto",
|
|
50
|
+
});
|
|
51
|
+
for (const tag of ["img", "svg"]) child(`& > ${props.artwork} ${tag}`, {
|
|
52
|
+
"block-size": `var(${props.size})`, "inline-size": "auto", "object-fit": "contain", "aspect-ratio": "auto",
|
|
53
|
+
});
|
|
54
|
+
child(`& > ${props.text}`, { display: "inline-flex", "align-items": "baseline", "align-self": "center" });
|
|
55
|
+
// Flex alignment alone centers line boxes, which include font leading.
|
|
56
|
+
// Trim the owned text runs, not the artwork: its intrinsic dimensions and
|
|
57
|
+
// internal drawing stay unchanged. Older browsers retain box centering.
|
|
58
|
+
child(`& > ${props.text} > *`, { display: "block", "text-box-trim": "trim-both", "text-box-edge": "cap alphabetic" });
|
|
59
|
+
node.replaceWith(output.nodes);
|
|
60
|
+
});
|
|
61
|
+
return css;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = { readLockup, expandLockupStyles };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Bundled MCP App
|
|
1
|
+
# Bundled showcase and MCP App notices
|
|
2
2
|
|
|
3
3
|
## @modelcontextprotocol/ext-apps
|
|
4
4
|
|
|
@@ -784,3 +784,53 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
784
784
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
785
785
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
786
786
|
SOFTWARE.
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
## preact
|
|
790
|
+
|
|
791
|
+
The MIT License (MIT)
|
|
792
|
+
|
|
793
|
+
Copyright (c) 2015-present Jason Miller
|
|
794
|
+
|
|
795
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
796
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
797
|
+
in the Software without restriction, including without limitation the rights
|
|
798
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
799
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
800
|
+
furnished to do so, subject to the following conditions:
|
|
801
|
+
|
|
802
|
+
The above copyright notice and this permission notice shall be included in all
|
|
803
|
+
copies or substantial portions of the Software.
|
|
804
|
+
|
|
805
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
806
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
807
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
808
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
809
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
810
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
811
|
+
SOFTWARE.
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
## @linaria/atomic
|
|
815
|
+
|
|
816
|
+
MIT License
|
|
817
|
+
|
|
818
|
+
Copyright (c) 2017 Callstack
|
|
819
|
+
|
|
820
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
821
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
822
|
+
in the Software without restriction, including without limitation the rights
|
|
823
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
824
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
825
|
+
furnished to do so, subject to the following conditions:
|
|
826
|
+
|
|
827
|
+
The above copyright notice and this permission notice shall be included in all
|
|
828
|
+
copies or substantial portions of the Software.
|
|
829
|
+
|
|
830
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
831
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
832
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
833
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
834
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
835
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
836
|
+
SOFTWARE.
|