@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/preview-scope.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
|
-
import { isInside } from "./config.mjs";
|
|
3
|
+
import { isInside, PREVIEW_MANIFEST } from "./config.mjs";
|
|
4
4
|
|
|
5
5
|
/** Logical resource names stay stable; managed builders own physical output. */
|
|
6
6
|
export function withPreviewSession(options, session) {
|
|
7
|
-
if (!
|
|
7
|
+
if (!session) return options;
|
|
8
8
|
if (!/^[\w-]{1,100}$/.test(session)) throw new Error("Invalid preview build session.");
|
|
9
9
|
return { ...options, previewSession: session };
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function previewManifestPath(options) {
|
|
13
|
-
|
|
13
|
+
// Sessions, live feedback and the graph cache redirect it; otherwise it is the one fixed path.
|
|
14
|
+
const configured = path.resolve(options.root, options.previewManifest ?? PREVIEW_MANIFEST);
|
|
14
15
|
return options.previewSession ? path.join(path.dirname(configured), "sessions", options.previewSession, "manifest.json") : configured;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/** Unverified live feedback has its own graph/assets; never accepted artifacts. */
|
|
18
19
|
export function livePreviewOptions(options) {
|
|
19
20
|
const file = path.join(path.dirname(previewManifestPath(options)), "live", "manifest.json");
|
|
20
|
-
return { ...options, previewSession: undefined,
|
|
21
|
+
return { ...options, previewSession: undefined, previewManifest: path.relative(options.root, file) };
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export function previewArtifactPath(options, file) {
|
package/dist/program-cache.mjs
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { currentAnalysis } from "./analysis/context.mjs";
|
|
2
|
+
import { standaloneProgram, closeStandaloneAnalysis } from "./analysis/standalone.mjs";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Candidate checks run in short-lived copies, so only the most recently used caches are kept.
|
|
9
|
-
const caches = new Map(), limit = 8;
|
|
10
|
-
|
|
11
|
-
export function cachedProgram(purpose, rootNames, compilerOptions) {
|
|
12
|
-
const signature = `${purpose}\0${JSON.stringify(compilerOptions)}`;
|
|
13
|
-
let cache = caches.get(signature);
|
|
14
|
-
if (cache) caches.delete(signature);
|
|
15
|
-
else cache = { previous: undefined, sources: new Map() };
|
|
16
|
-
caches.set(signature, cache);
|
|
17
|
-
while (caches.size > limit) caches.delete(caches.keys().next().value);
|
|
18
|
-
const host = ts.createCompilerHost(compilerOptions, true), load = host.getSourceFile.bind(host);
|
|
19
|
-
// New, deleted or changed modules must resolve again; reused trees never keep stale lookups.
|
|
20
|
-
host.hasInvalidatedResolutions = () => true;
|
|
21
|
-
host.getSourceFile = (file, languageVersion, onError, force) => {
|
|
22
|
-
const text = host.readFile(file), mode = JSON.stringify(languageVersion), cached = cache.sources.get(file);
|
|
23
|
-
if (!force && cached && cached.text === text && cached.mode === mode) return cached.source;
|
|
24
|
-
const source = load(file, languageVersion, onError, force);
|
|
25
|
-
if (source) cache.sources.set(file, { text, mode, source }); else cache.sources.delete(file);
|
|
26
|
-
return source;
|
|
27
|
-
};
|
|
28
|
-
const program = ts.createProgram({ rootNames, options: compilerOptions, host, oldProgram: cache.previous });
|
|
29
|
-
cache.previous = program;
|
|
30
|
-
const retained = new Set(program.getSourceFiles().map(file => file.fileName));
|
|
31
|
-
for (const file of cache.sources.keys()) if (!retained.has(file)) cache.sources.delete(file);
|
|
32
|
-
return program;
|
|
4
|
+
/** The native session owns program reuse and source invalidation. */
|
|
5
|
+
export async function cachedProgram(purpose, rootNames, compilerOptions) {
|
|
6
|
+
const analysis = currentAnalysis();
|
|
7
|
+
if (analysis?.provideProgram) return analysis.provideProgram(purpose, rootNames, compilerOptions);
|
|
8
|
+
return standaloneProgram(purpose, rootNames, compilerOptions);
|
|
33
9
|
}
|
|
34
|
-
|
|
35
|
-
/** Forget every retained program, for tests and configuration changes. */
|
|
36
|
-
export function clearProgramCache() { caches.clear(); }
|
|
10
|
+
export const clearProgramCache = closeStandaloneAnalysis;
|
|
@@ -15,7 +15,7 @@ function noticeName(name) {
|
|
|
15
15
|
|
|
16
16
|
function isProjectNotice(file) {
|
|
17
17
|
if (!file.includes("/")) return noticeName(file);
|
|
18
|
-
return /^(?:(?:docs|doc)\/)?licenses\/.+$/i.test(file) &&
|
|
18
|
+
return /^(?:(?:docs|doc)\/)?licenses\/.+$/i.test(file) &&( textExtension.test(file) || noticeName(path.posix.basename(file)));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** Recognize documentation ownership even before a new guide exists. */
|
package/dist/public-api.mjs
CHANGED
|
@@ -1,82 +1,120 @@
|
|
|
1
|
+
import { eachChild } from "./analysis/queries.mjs";
|
|
1
2
|
import path from "node:path";
|
|
2
|
-
import ts from "
|
|
3
|
+
import ts from "./analysis/syntax.mjs";
|
|
3
4
|
import { isDevelopmentFile, isInside, isReviewFile } from "./config.mjs";
|
|
4
5
|
import { uiOperation } from "./ui-framework.mjs";
|
|
5
6
|
import { projectCompilerOptions } from "./boundaries.mjs";
|
|
6
7
|
import { cachedProgram } from "./program-cache.mjs";
|
|
8
|
+
import { memoProgram } from "./analysis/helpers.mjs";
|
|
7
9
|
|
|
8
10
|
const resolvedCallables = new WeakMap();
|
|
9
11
|
|
|
10
12
|
// The syntax guard omits libraries and dependency types. Resolve an ambiguous
|
|
11
13
|
// public value lazily against the project's actual types, without importing it.
|
|
12
14
|
// Keep the result with this immutable program so repeated discovery shares it.
|
|
13
|
-
function resolvedCallable(program, options, name) {
|
|
15
|
+
async function resolvedCallable(program, options, name) {
|
|
14
16
|
if (!resolvedCallables.has(program)) {
|
|
15
17
|
const { dsRoot, config } = options;
|
|
16
18
|
const entryFile = path.join(dsRoot, config.publicEntry);
|
|
17
|
-
const compiler = projectCompilerOptions(options);
|
|
18
|
-
const semantic = cachedProgram(`public-api:${options.root}`, [entryFile], {
|
|
19
|
-
...compiler,
|
|
19
|
+
const compiler = await projectCompilerOptions(options);
|
|
20
|
+
const semantic = await cachedProgram(`public-api:${options.root}`, [entryFile], {
|
|
21
|
+
...compiler,
|
|
22
|
+
allowJs: true,
|
|
20
23
|
paths: { ...compiler.paths, [config.publicAlias]: [entryFile] },
|
|
21
24
|
types: compiler.types ?? [],
|
|
22
25
|
});
|
|
23
26
|
const checker = semantic.getTypeChecker();
|
|
24
|
-
const entry = semantic.getSourceFile(entryFile);
|
|
25
|
-
const module = entry && checker.getSymbolAtLocation(entry);
|
|
27
|
+
const entry = await semantic.getSourceFile(entryFile);
|
|
28
|
+
const module = entry && (await checker.getSymbolAtLocation(entry));
|
|
26
29
|
const callables = new Map();
|
|
27
|
-
for (const exported of module ? checker.getExportsOfModule(module) : []) {
|
|
28
|
-
const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;
|
|
30
|
+
for (const exported of module ? await checker.getExportsOfModule(module) : []) {
|
|
31
|
+
const symbol = exported.flags & ts.SymbolFlags.Alias ? await checker.getAliasedSymbol(exported) : exported;
|
|
29
32
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
30
33
|
if (!declaration || !(symbol.flags & ts.SymbolFlags.Value)) continue;
|
|
31
|
-
const type = checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
32
|
-
callables.set(exported.name, !!(type.getCallSignatures().length || type.getConstructSignatures().length));
|
|
34
|
+
const type = await checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
35
|
+
callables.set(exported.name, !!((await type.getCallSignatures()).length || (await type.getConstructSignatures()).length));
|
|
33
36
|
}
|
|
34
37
|
resolvedCallables.set(program, callables);
|
|
35
38
|
}
|
|
36
39
|
return resolvedCallables.get(program).get(name) ?? false;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
export function publicApi(program, options) {
|
|
42
|
+
export async function publicApi(program, options) {
|
|
43
|
+
return entryApi(program, options, options.config.publicEntry, false);
|
|
44
|
+
}
|
|
40
45
|
|
|
41
46
|
/** A separate development API: never part of the product catalogue or exports. */
|
|
42
|
-
export function reviewApi(program, options) {
|
|
47
|
+
export async function reviewApi(program, options) {
|
|
48
|
+
return entryApi(program, options, options.config.reviewEntry, true);
|
|
49
|
+
}
|
|
43
50
|
|
|
44
|
-
export function scenarioApi(program, options) {
|
|
51
|
+
export async function scenarioApi(program, options) {
|
|
52
|
+
return [...(await publicApi(program, options)), ...(await reviewApi(program, options))];
|
|
53
|
+
}
|
|
45
54
|
|
|
46
|
-
function entryApi(program, options, entryFile, review) {
|
|
55
|
+
async function entryApi(program, options, entryFile, review) {
|
|
56
|
+
const key = JSON.stringify(["entry-api", options.root, options.dsRoot, options.config.publicAlias, options.config.publicEntry, entryFile, review]);
|
|
57
|
+
return (await memoProgram(program, key, async () => discoverEntryApi(program, options, entryFile, review))).map((item) => ({ ...item }));
|
|
58
|
+
}
|
|
59
|
+
async function discoverEntryApi(program, options, entryFile, review) {
|
|
47
60
|
const checker = program.getTypeChecker();
|
|
48
|
-
const entry = program.getSourceFile(path.join(options.dsRoot, entryFile));
|
|
49
|
-
const module = entry && checker.getSymbolAtLocation(entry);
|
|
61
|
+
const entry = await program.getSourceFile(path.join(options.dsRoot, entryFile));
|
|
62
|
+
const module = entry && (await checker.getSymbolAtLocation(entry));
|
|
50
63
|
const items = [];
|
|
51
|
-
for (const exported of module ? checker.getExportsOfModule(module) : []) {
|
|
64
|
+
for (const exported of module ? await checker.getExportsOfModule(module) : []) {
|
|
52
65
|
let symbol = exported;
|
|
53
|
-
if (symbol.flags & ts.SymbolFlags.Alias) symbol = checker.getAliasedSymbol(symbol);
|
|
66
|
+
if (symbol.flags & ts.SymbolFlags.Alias) symbol = await checker.getAliasedSymbol(symbol);
|
|
54
67
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
55
68
|
if (!declaration || !(symbol.flags & ts.SymbolFlags.Value)) continue;
|
|
56
69
|
const file = declaration.getSourceFile().fileName;
|
|
57
70
|
if (review ? !isReviewFile(file, options) : isDevelopmentFile(file, options)) continue;
|
|
58
|
-
const kind = review
|
|
71
|
+
const kind = review
|
|
72
|
+
? "review"
|
|
73
|
+
: isInside(path.join(options.dsRoot, "components"), file)
|
|
74
|
+
? "components"
|
|
75
|
+
: isInside(path.join(options.dsRoot, "patterns"), file)
|
|
76
|
+
? "patterns"
|
|
77
|
+
: isInside(path.join(options.dsRoot, "controllers"), file)
|
|
78
|
+
? "controllers"
|
|
79
|
+
: null;
|
|
59
80
|
if (!kind) continue;
|
|
60
81
|
let renderable = false;
|
|
61
|
-
function visit(node) {
|
|
82
|
+
async function visit(node) {
|
|
83
|
+
if (renderable) return;
|
|
62
84
|
if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) renderable = true;
|
|
63
|
-
if (ts.isCallExpression(node) && ["createElement", "forwardRef", "memo"].includes(uiOperation(node.expression, checker))) renderable = true;
|
|
85
|
+
if (ts.isCallExpression(node) && ["createElement", "forwardRef", "memo"].includes(await uiOperation(node.expression, checker))) renderable = true;
|
|
64
86
|
if (ts.isTaggedTemplateExpression(node)) {
|
|
65
87
|
let tag = node.tag;
|
|
66
88
|
if (ts.isCallExpression(tag)) tag = tag.expression;
|
|
67
89
|
let base = tag;
|
|
68
90
|
while (ts.isPropertyAccessExpression(base)) base = base.expression;
|
|
69
|
-
const symbol = checker.getSymbolAtLocation(base);
|
|
70
|
-
if (
|
|
91
|
+
const symbol = await checker.getSymbolAtLocation(base);
|
|
92
|
+
if (
|
|
93
|
+
symbol?.declarations?.some(
|
|
94
|
+
(item) =>
|
|
95
|
+
(ts.isImportSpecifier(item) &&
|
|
96
|
+
(item.propertyName ?? item.name).text === "styled" &&
|
|
97
|
+
item.parent.parent.parent.moduleSpecifier.text.startsWith("@linaria/")) ||
|
|
98
|
+
(ts.isNamespaceImport(item) &&
|
|
99
|
+
item.parent.parent.moduleSpecifier.text.startsWith("@linaria/") &&
|
|
100
|
+
/^\.styled(?:\.|$)/.test(tag.getText().slice(base.getText().length))),
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
renderable = true;
|
|
71
104
|
}
|
|
72
|
-
|
|
105
|
+
await eachChild(node, visit);
|
|
73
106
|
}
|
|
74
|
-
visit(declaration);
|
|
75
|
-
const type = checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
76
|
-
const behavioral = !!(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
await visit(declaration);
|
|
108
|
+
const type = await checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
109
|
+
const behavioral = !!(
|
|
110
|
+
(await type.getCallSignatures()).length ||
|
|
111
|
+
(await type.getConstructSignatures()).length ||
|
|
112
|
+
(!renderable &&
|
|
113
|
+
!!(type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) &&
|
|
114
|
+
(program.getCompilerOptions().noLib || program.getCompilerOptions().noResolve) &&
|
|
115
|
+
!review &&
|
|
116
|
+
(await resolvedCallable(program, options, exported.name)))
|
|
117
|
+
);
|
|
80
118
|
items.push({ name: exported.name, kind, file, declaration, renderable: kind !== "controllers" && renderable, behavioral });
|
|
81
119
|
}
|
|
82
120
|
return items;
|
package/dist/public-props.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { eachChild, flatMapAsync, someAsync } from "./analysis/queries.mjs";
|
|
2
|
+
import ts from "./analysis/syntax.mjs";
|
|
2
3
|
import { importedUiName } from "./ui-framework.mjs";
|
|
3
4
|
|
|
4
5
|
const visualName = /^(?:background(?:Color)?|color|fill|stroke|(?:\w+)?ColorToken)$/i;
|
|
@@ -7,26 +8,38 @@ function propertyName(node) {
|
|
|
7
8
|
return node && (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) ? node.text : null;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
function stringKeys(node, checker, seen = new Set()) {
|
|
11
|
+
async function stringKeys(node, checker, seen = new Set()) {
|
|
11
12
|
if (!node || seen.has(node)) return [];
|
|
12
13
|
seen.add(node);
|
|
13
14
|
if (ts.isLiteralTypeNode(node) && ts.isStringLiteral(node.literal)) return [node.literal.text];
|
|
14
|
-
if (ts.isUnionTypeNode(node)) return node.types
|
|
15
|
-
if (ts.isTypeReferenceNode(node))
|
|
15
|
+
if (ts.isUnionTypeNode(node)) return flatMapAsync(node.types, async (type) => stringKeys(type, checker, seen));
|
|
16
|
+
if (ts.isTypeReferenceNode(node))
|
|
17
|
+
return flatMapAsync((await checker.getSymbolAtLocation(node.typeName))?.declarations ?? [], async (decl) =>
|
|
18
|
+
ts.isTypeAliasDeclaration(decl) ? await stringKeys(decl.type, checker, seen) : [],
|
|
19
|
+
);
|
|
16
20
|
return [];
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
// Inspect locally declared exported *Props APIs without loading React at runtime.
|
|
20
24
|
// Follow local aliases and inheritance, and distinguish Omit/Pick's actual keys.
|
|
21
|
-
export function inspectPublicProps(source, checker, report, allowedPaintProperties = new Set()) {
|
|
22
|
-
function inspect(node, excluded = new Set(), seen = new Set()) {
|
|
25
|
+
export async function inspectPublicProps(source, checker, report, allowedPaintProperties = new Set()) {
|
|
26
|
+
async function inspect(node, excluded = new Set(), seen = new Set()) {
|
|
23
27
|
if (!node || seen.has(node)) return;
|
|
24
28
|
seen = new Set([...seen, node]);
|
|
25
29
|
if (ts.isPropertySignature(node)) {
|
|
26
30
|
const name = propertyName(node.name);
|
|
27
31
|
if (excluded.has(name)) return;
|
|
28
32
|
if (name === "style") report(node, "public-style-prop", "Public ADS props must omit style. Use semantic props and documented token hooks.");
|
|
29
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
visualName.test(name ?? "") &&
|
|
35
|
+
(await arbitraryString(node.type, new Set())) &&
|
|
36
|
+
!allowedPaintProperties.has(`${node.getSourceFile().fileName}:${node.pos}`)
|
|
37
|
+
)
|
|
38
|
+
report(
|
|
39
|
+
node,
|
|
40
|
+
"visual-prop",
|
|
41
|
+
"Public visual props must use semantic variants, a finite token union or an owner-registered constrained paint-reference contract, not arbitrary strings.",
|
|
42
|
+
);
|
|
30
43
|
return;
|
|
31
44
|
}
|
|
32
45
|
if (ts.isTypeReferenceNode(node) || ts.isExpressionWithTypeArguments(node)) {
|
|
@@ -34,41 +47,45 @@ export function inspectPublicProps(source, checker, report, allowedPaintProperti
|
|
|
34
47
|
const text = ts.isIdentifier(name) ? name.text : null;
|
|
35
48
|
const args = node.typeArguments ?? [];
|
|
36
49
|
if (text === "Omit" && args.length === 2) {
|
|
37
|
-
inspect(args[0], new Set([...excluded, ...stringKeys(args[1], checker)]), seen);
|
|
50
|
+
await inspect(args[0], new Set([...excluded, ...(await stringKeys(args[1], checker))]), seen);
|
|
38
51
|
return;
|
|
39
52
|
}
|
|
40
53
|
if (text === "Pick" && args.length === 2) {
|
|
41
|
-
if (stringKeys(args[1], checker).includes("style") && !excluded.has("style")) inspect(args[0], excluded, seen);
|
|
54
|
+
if ((await stringKeys(args[1], checker)).includes("style") && !excluded.has("style")) await inspect(args[0], excluded, seen);
|
|
42
55
|
return;
|
|
43
56
|
}
|
|
44
|
-
const react = importedUiName(name, checker)?.replace(/^JSX\./, "");
|
|
57
|
+
const react = (await importedUiName(name, checker))?.replace(/^JSX\./, "");
|
|
45
58
|
if (react && /^(?:\w*(?:HTML|SVG)Attributes|DOMAttributes|ComponentProps(?:WithRef|WithoutRef)?)$/.test(react)) {
|
|
46
59
|
if (!excluded.has("style")) report(node, "public-style-prop", 'Public ADS props inherited from React/Preact DOM attributes must omit "style".');
|
|
47
60
|
return;
|
|
48
61
|
}
|
|
49
|
-
for (const decl of checker.getSymbolAtLocation(name)?.declarations ?? []) {
|
|
50
|
-
if (ts.isTypeAliasDeclaration(decl)) inspect(decl.type, excluded, seen);
|
|
51
|
-
if (ts.isInterfaceDeclaration(decl)) inspect(decl, excluded, seen);
|
|
62
|
+
for (const decl of (await checker.getSymbolAtLocation(name))?.declarations ?? []) {
|
|
63
|
+
if (ts.isTypeAliasDeclaration(decl)) await inspect(decl.type, excluded, seen);
|
|
64
|
+
if (ts.isInterfaceDeclaration(decl)) await inspect(decl, excluded, seen);
|
|
52
65
|
}
|
|
53
66
|
return;
|
|
54
67
|
}
|
|
55
|
-
|
|
68
|
+
await eachChild(node, async (child) => inspect(child, excluded, seen));
|
|
56
69
|
}
|
|
57
|
-
function arbitraryString(node, seen) {
|
|
70
|
+
async function arbitraryString(node, seen) {
|
|
58
71
|
if (!node || seen.has(node)) return false;
|
|
59
72
|
seen.add(node);
|
|
60
73
|
if ([ts.SyntaxKind.StringKeyword, ts.SyntaxKind.AnyKeyword, ts.SyntaxKind.UnknownKeyword].includes(node.kind)) return true;
|
|
61
|
-
if (ts.isTemplateLiteralTypeNode(node)) return node.templateSpans
|
|
62
|
-
if (ts.isUnionTypeNode(node)) return node.types
|
|
63
|
-
if (ts.isTypeReferenceNode(node))
|
|
74
|
+
if (ts.isTemplateLiteralTypeNode(node)) return someAsync(node.templateSpans, async (span) => arbitraryString(span.type, seen));
|
|
75
|
+
if (ts.isUnionTypeNode(node)) return someAsync(node.types, async (type) => arbitraryString(type, seen));
|
|
76
|
+
if (ts.isTypeReferenceNode(node))
|
|
77
|
+
return someAsync(
|
|
78
|
+
(await checker.getSymbolAtLocation(node.typeName))?.declarations ?? [],
|
|
79
|
+
async (decl) => ts.isTypeAliasDeclaration(decl) && (await arbitraryString(decl.type, seen)),
|
|
80
|
+
);
|
|
64
81
|
return false;
|
|
65
82
|
}
|
|
66
|
-
const symbol = checker.getSymbolAtLocation(source);
|
|
67
|
-
for (const exported of symbol ? checker.getExportsOfModule(symbol) : []) {
|
|
83
|
+
const symbol = await checker.getSymbolAtLocation(source);
|
|
84
|
+
for (const exported of symbol ? await checker.getExportsOfModule(symbol) : []) {
|
|
68
85
|
if (!exported.name.endsWith("Props")) continue;
|
|
69
86
|
for (const decl of exported.declarations ?? []) {
|
|
70
|
-
if (ts.isTypeAliasDeclaration(decl)) inspect(decl.type);
|
|
71
|
-
if (ts.isInterfaceDeclaration(decl)) inspect(decl);
|
|
87
|
+
if (ts.isTypeAliasDeclaration(decl)) await inspect(decl.type);
|
|
88
|
+
if (ts.isInterfaceDeclaration(decl)) await inspect(decl);
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
91
|
}
|
|
@@ -9,9 +9,9 @@ export async function axeRun({ tags, nodeLimit, include = "#root", rules }) {
|
|
|
9
9
|
const outcome = await window.axe.run({ include: [[include]], exclude: [["#ads-preview-status"]] }, { runOnly, resultTypes: ["violations", "incomplete"], elementRef: false, ancestry: false });
|
|
10
10
|
const clip = (text, size) => typeof text === "string" ? text.replace(/\s+/g, " ").trim().slice(0, size) : "";
|
|
11
11
|
const selector = node => clip(node.target.flat().join(" "), 300), html = node => clip(node.html, 200);
|
|
12
|
-
const group =
|
|
12
|
+
const group = (item )=>({id:item.id,impact:item.impact,tags:item.tags,help:clip(item.help,300),helpUrl:clip(item.helpUrl,300),nodeCount:item.nodes.length});
|
|
13
13
|
// axe's own key for why it could not decide, such as bgGradient or pseudoContent.
|
|
14
14
|
const reason = node => { const check = [...node.any, ...node.all, ...node.none].find(item => item.data?.messageKey) ?? [...node.any, ...node.all, ...node.none][0]; return clip(check?.data?.messageKey ?? check?.id ?? "", 80); };
|
|
15
|
-
return { violations: outcome.violations.map(violation
|
|
16
|
-
incomplete: outcome.incomplete.map(item
|
|
15
|
+
return { violations: outcome.violations.map( (violation )=>({...group(violation),nodes:violation.nodes.slice(0,nodeLimit).map((node)=>({selector:selector(node),html:html(node),summary:clip(node.failureSummary,500)}))})),
|
|
16
|
+
incomplete: outcome.incomplete.map( (item )=>({...group(item),nodes:item.nodes.slice(0,nodeLimit).map((node)=>({selector:selector(node),html:html(node),reason:reason(node)}))}))};
|
|
17
17
|
}
|
|
@@ -18,7 +18,7 @@ export function imageShape({ nodeLimit }) {
|
|
|
18
18
|
};
|
|
19
19
|
const issues = [], counts = { shape: 0 };
|
|
20
20
|
for (const image of root.querySelectorAll("img")) {
|
|
21
|
-
if (!image.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }) ||
|
|
21
|
+
if (!image.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }) ||( image.complete && !image.naturalWidth)) continue;
|
|
22
22
|
const box = image.getBoundingClientRect();
|
|
23
23
|
if (box.width < 8 || box.height < 8) continue;
|
|
24
24
|
const style = getComputedStyle(image), authored = /^(?:auto\s+)?([\d.]+)\s*\/\s*([\d.]+)$/.exec(style.aspectRatio);
|
|
@@ -26,7 +26,7 @@ export function imageShape({ nodeLimit }) {
|
|
|
26
26
|
const explicit = authored && !style.aspectRatio.startsWith("auto") ? Number(authored[1]) / Number(authored[2]) : undefined;
|
|
27
27
|
const width = Number(image.getAttribute("width")), height = Number(image.getAttribute("height"));
|
|
28
28
|
const attributes = width > 0 && height > 0 ? width / height : undefined;
|
|
29
|
-
if (explicit === undefined &&
|
|
29
|
+
if (explicit === undefined &&( attributes === undefined || style.objectFit !== "fill")) continue;
|
|
30
30
|
const declared = explicit ?? attributes, rendered = box.width / box.height;
|
|
31
31
|
// Rounding moves a small box by a pixel or so; 3% and 2 px of height is not rounding.
|
|
32
32
|
if (Math.abs(rendered / declared - 1) <= 0.03 || Math.abs(box.width / declared - box.height) <= 2) continue;
|
|
@@ -24,11 +24,24 @@
|
|
|
24
24
|
export async function layoutOverflow({ nodeLimit, width: expected, container, smallPart }) {
|
|
25
25
|
const root = document.querySelector("#root");
|
|
26
26
|
// A frame, or a time limit for a document that has stopped getting frames.
|
|
27
|
-
const nextFrame = () =>
|
|
27
|
+
const nextFrame = () =>
|
|
28
|
+
new Promise((resolve) => {
|
|
29
|
+
const limit = setTimeout(resolve, 500);
|
|
30
|
+
requestAnimationFrame(() => {
|
|
31
|
+
clearTimeout(limit);
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
28
35
|
// Layout boxes only: a transform, such as a spinner's, is not layout moving.
|
|
29
|
-
const layout = () => {
|
|
36
|
+
const layout = () => {
|
|
37
|
+
let sum = document.documentElement.scrollWidth;
|
|
38
|
+
for (const element of root?.querySelectorAll("*") ?? [])
|
|
39
|
+
if (element.offsetWidth !== undefined) sum = (sum * 31 + element.offsetWidth * 7 + element.offsetLeft) | 0;
|
|
40
|
+
return sum;
|
|
41
|
+
};
|
|
30
42
|
async function settled() {
|
|
31
|
-
let previous,
|
|
43
|
+
let previous,
|
|
44
|
+
quiet = 0;
|
|
32
45
|
for (let count = 0; count < 20 && (quiet < 2 || window.innerWidth !== expected); count++) {
|
|
33
46
|
await nextFrame();
|
|
34
47
|
const current = layout();
|
|
@@ -44,59 +57,109 @@ export async function layoutOverflow({ nodeLimit, width: expected, container, sm
|
|
|
44
57
|
const seen = layout();
|
|
45
58
|
for (let count = 0; count < 12; count++) {
|
|
46
59
|
await nextFrame();
|
|
47
|
-
if (layout() !== seen) {
|
|
60
|
+
if (layout() !== seen) {
|
|
61
|
+
await settled();
|
|
62
|
+
return measure();
|
|
63
|
+
}
|
|
48
64
|
}
|
|
49
65
|
return found;
|
|
50
66
|
function measure() {
|
|
51
|
-
const width = document.documentElement.clientWidth,
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
const width = document.documentElement.clientWidth,
|
|
68
|
+
issues = [],
|
|
69
|
+
counts = { document: 0, viewport: 0, container: 0, clipped: 0 };
|
|
70
|
+
const pane = container ? root.getBoundingClientRect() : { left: 0, right: width },
|
|
71
|
+
edge = container ? "container" : "viewport";
|
|
72
|
+
const selector = (element) => {
|
|
54
73
|
const parts = [];
|
|
55
74
|
for (let node = element; node && node !== root; node = node.parentElement) {
|
|
56
|
-
const siblings = [...node.parentElement.children].filter(child => child.localName === node.localName);
|
|
75
|
+
const siblings = [...node.parentElement.children].filter((child) => child.localName === node.localName);
|
|
57
76
|
parts.unshift(`${node.localName}${siblings.length > 1 ? `:nth-of-type(${siblings.indexOf(node) + 1})` : ""}`);
|
|
58
77
|
}
|
|
59
78
|
return ["#root", ...parts].join(" > ");
|
|
60
79
|
};
|
|
61
|
-
const report = (kind, element, detail) => {
|
|
62
|
-
|
|
80
|
+
const report = (kind, element, detail) => {
|
|
81
|
+
if (counts[kind]++ < nodeLimit)
|
|
82
|
+
issues.push({
|
|
83
|
+
kind,
|
|
84
|
+
selector: element === document.documentElement ? "html" : selector(element).slice(0, 300),
|
|
85
|
+
html: element === document.documentElement ? "" : element.outerHTML.replace(/\s+/g, " ").slice(0, 200),
|
|
86
|
+
...detail,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
if (!container && document.documentElement.scrollWidth > width + 1)
|
|
90
|
+
report("document", document.documentElement, { overflow: document.documentElement.scrollWidth - width });
|
|
63
91
|
const exempt = new Map();
|
|
64
92
|
/** Whether a set width, not content, holds this element open: a length above the small-part limit. */
|
|
65
93
|
function setWide(element) {
|
|
66
94
|
if (!element.computedStyleMap) return true;
|
|
67
|
-
const wide = property => {
|
|
68
|
-
|
|
95
|
+
const wide = (property) => {
|
|
96
|
+
const value = element.computedStyleMap().get(property);
|
|
97
|
+
return value instanceof CSSUnitValue && value.unit === "px" && value.value > smallPart;
|
|
98
|
+
};
|
|
99
|
+
return (
|
|
100
|
+
element.getBoundingClientRect().width > smallPart &&
|
|
101
|
+
element.checkVisibility() &&
|
|
102
|
+
(wide("width") || wide("min-width") || (wide("flex-basis") && getComputedStyle(element).flexShrink === "0"))
|
|
103
|
+
);
|
|
69
104
|
}
|
|
70
|
-
const forced =
|
|
105
|
+
const forced = (element) =>
|
|
106
|
+
!container || setWide(element) || [...element.querySelectorAll("*")].some((inner) => !excluded(inner.parentElement) && setWide(inner));
|
|
71
107
|
// The outermost box as tall as the window is the page or the project's preview frame, not an
|
|
72
108
|
// intended scroller or clip: overflow-y: auto computes overflow-x to auto, and a page that scrolls
|
|
73
109
|
// sideways is what this check is for. A scroller inside it is a real one.
|
|
74
|
-
const frame = element => {
|
|
110
|
+
const frame = (element) => {
|
|
75
111
|
if (Math.abs(element.getBoundingClientRect().height - window.innerHeight) > 1) return false;
|
|
76
|
-
for (let node = element.parentElement; node && node !== root; node = node.parentElement)
|
|
112
|
+
for (let node = element.parentElement; node && node !== root; node = node.parentElement)
|
|
113
|
+
if (/^(?:auto|scroll)$/.test(getComputedStyle(node).overflowX)) return false;
|
|
77
114
|
return true;
|
|
78
115
|
};
|
|
79
116
|
/** Whether an element is inside an intended scroller, a fixed layer or hidden content. */
|
|
80
117
|
function excluded(element) {
|
|
81
118
|
if (!element || element === root) return false;
|
|
82
119
|
if (exempt.has(element)) return exempt.get(element);
|
|
83
|
-
const style = getComputedStyle(element),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
120
|
+
const style = getComputedStyle(element),
|
|
121
|
+
box = element.getBoundingClientRect();
|
|
122
|
+
const value =
|
|
123
|
+
(/^(?:auto|scroll)$/.test(style.overflowX) && !frame(element)) ||
|
|
124
|
+
style.position === "fixed" ||
|
|
125
|
+
(style.clip !== "auto" && style.position === "absolute") ||
|
|
126
|
+
style.clipPath !== "none" ||
|
|
127
|
+
((box.width <= 1 || box.height <= 1) && style.overflow !== "visible") ||
|
|
128
|
+
excluded(element.parentElement);
|
|
129
|
+
exempt.set(element, value);
|
|
130
|
+
return value;
|
|
87
131
|
}
|
|
88
132
|
for (const element of root.querySelectorAll("*")) {
|
|
89
|
-
if (element.closest("#ads-preview-status") || element.closest("svg") && element.localName !== "svg") continue;
|
|
133
|
+
if (element.closest("#ads-preview-status") || (element.closest("svg") && element.localName !== "svg")) continue;
|
|
90
134
|
if (excluded(element.parentElement)) continue;
|
|
91
135
|
const style = getComputedStyle(element);
|
|
92
136
|
if (style.position === "fixed" || !element.checkVisibility({ visibilityProperty: true })) continue;
|
|
93
137
|
const box = element.getBoundingClientRect();
|
|
94
138
|
if (box.width <= 1 || box.height <= 1) continue;
|
|
95
139
|
// A clipping ancestor already reports the content it cuts off, and nothing paints past it.
|
|
96
|
-
const contained = () => {
|
|
140
|
+
const contained = () => {
|
|
141
|
+
for (let node = element.parentElement; node && node !== root; node = node.parentElement)
|
|
142
|
+
if (/^(?:hidden|clip)$/.test(getComputedStyle(node).overflowX) && !frame(node)) return true;
|
|
143
|
+
return false;
|
|
144
|
+
};
|
|
97
145
|
const parent = element.parentElement === root ? pane : element.parentElement.getBoundingClientRect();
|
|
98
|
-
if (
|
|
99
|
-
|
|
146
|
+
if (
|
|
147
|
+
(box.right > pane.right + 1 || box.left < pane.left - 1) &&
|
|
148
|
+
!(parent.right > pane.right + 1 || parent.left < pane.left - 1) &&
|
|
149
|
+
!contained() &&
|
|
150
|
+
forced(element)
|
|
151
|
+
)
|
|
152
|
+
report(edge, element, { overflow: Math.round(Math.max(box.right - pane.right, pane.left - box.left)) });
|
|
153
|
+
if (
|
|
154
|
+
/^(?:hidden|clip)$/.test(style.overflowX) &&
|
|
155
|
+
element.scrollWidth > element.clientWidth + 4 &&
|
|
156
|
+
style.textOverflow !== "ellipsis" &&
|
|
157
|
+
!element.closest('[aria-roledescription="carousel"], [role="application"]') &&
|
|
158
|
+
!/^(?:input|textarea|select)$/.test(element.localName) &&
|
|
159
|
+
style.clip === "auto" &&
|
|
160
|
+
style.clipPath === "none" &&
|
|
161
|
+
forced(element)
|
|
162
|
+
)
|
|
100
163
|
report("clipped", element, { overflow: element.scrollWidth - element.clientWidth });
|
|
101
164
|
}
|
|
102
165
|
return { issues, counts };
|