@reqvire-org/ads 0.4.7 → 0.5.1
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 +268 -420
- package/dist/accessibility-declarations.mjs +43 -0
- package/dist/active-clock.d.mts +30 -0
- package/dist/active-clock.mjs +26 -17
- package/dist/ads-errors.mjs +3684 -0
- package/dist/ads-view-choices.mjs +17 -0
- package/dist/ads-views.mjs +12 -0
- package/dist/analysis/captured-content.mjs +16 -0
- package/dist/analysis/compiler-options.mjs +3 -7
- package/dist/analysis/context.mjs +14 -20
- package/dist/analysis/controller-gates.mjs +119 -0
- package/dist/analysis/design-usage.mjs +142 -0
- package/dist/analysis/file-tree.mjs +44 -29
- package/dist/analysis/framework-imports.mjs +62 -0
- package/dist/analysis/glyph-macros.mjs +103 -0
- package/dist/analysis/helpers.mjs +119 -91
- package/dist/analysis/impact.mjs +25 -12
- package/dist/analysis/inputs.mjs +19 -13
- package/dist/analysis/mock-check.mjs +99 -0
- package/dist/analysis/module-graph.mjs +156 -0
- package/dist/analysis/module-resolvers.mjs +30 -28
- package/dist/analysis/native-adapter.mjs +139 -146
- package/dist/analysis/native-boundary.mjs +52 -0
- package/dist/analysis/native-project.mjs +331 -231
- package/dist/analysis/native-session.mjs +20 -0
- package/dist/analysis/owner-accessibility.mjs +74 -0
- package/dist/analysis/owner-analysis-cache.mjs +125 -0
- package/dist/analysis/owner-analysis-key.mjs +114 -0
- package/dist/analysis/owner-choices.mjs +896 -0
- package/dist/analysis/owner-composition.mjs +636 -0
- package/dist/analysis/owner-controls.mjs +27 -0
- package/dist/analysis/owner-discovery.mjs +164 -0
- package/dist/analysis/owner-failures.mjs +19 -0
- package/dist/analysis/owner-outcomes.mjs +42 -0
- package/dist/analysis/owner-reuse.mjs +100 -0
- package/dist/analysis/owner-source.mjs +1555 -0
- package/dist/analysis/prose-owners.mjs +57 -0
- package/dist/analysis/public-imports.mjs +31 -0
- package/dist/analysis/queries.mjs +72 -54
- package/dist/analysis/runtime-setters.mjs +114 -0
- package/dist/analysis/scenario-keys.mjs +151 -0
- package/dist/analysis/service.mjs +111 -70
- package/dist/analysis/standalone.mjs +40 -37
- package/dist/analysis/styling-ownership.mjs +298 -0
- package/dist/analysis/svg-attributes.mjs +199 -0
- package/dist/analysis/syntax.mjs +82 -78
- package/dist/analysis/visual-bindings.mjs +68 -0
- package/dist/analysis/worker-protocol.mjs +302 -0
- package/dist/analysis/worker.mjs +234 -166
- package/dist/api-signature.mjs +53 -0
- package/dist/app-icon-checks.mjs +298 -0
- package/dist/app-icon-declaration.d.mts +53 -0
- package/dist/app-icon-declaration.mjs +66 -0
- package/dist/asset-binding.mjs +35 -0
- package/dist/asset-catalog.mjs +83 -0
- package/dist/asset-declaration.d.mts +42 -0
- package/dist/asset-declaration.mjs +108 -0
- package/dist/asset-macro.d.mts +63 -0
- package/dist/asset-macro.mjs +22 -0
- package/dist/asset-model.mjs +74 -0
- package/dist/asset-usage.mjs +14 -0
- package/dist/asset-view-facts.mjs +41 -0
- package/dist/authoring-macro.d.mts +11 -0
- package/dist/authoring-macro.mjs +21 -0
- package/dist/autocomplete-hints.mjs +31 -0
- package/dist/availability.mjs +9 -0
- package/dist/behavior-macro.d.mts +31 -0
- package/dist/behavior-macro.mjs +3 -0
- package/dist/behavior-registry.mjs +358 -0
- package/dist/boundaries.mjs +50 -212
- package/dist/browser-runtime.mjs +73 -0
- package/dist/browser-test.d.mts +3 -0
- package/dist/browser-test.mjs +2 -0
- package/dist/bun-bundler.mjs +10 -0
- package/dist/bun-compiler.mjs +30 -18
- package/dist/bun-runtime.mjs +4 -0
- package/dist/bun-worker.mjs +10 -4
- package/dist/capture/request.mjs +81 -0
- package/dist/capture/worker.mjs +69 -40
- package/dist/capture/worker.page.mjs +6 -0
- package/dist/capture-store.mjs +159 -75
- package/dist/capture.mjs +232 -95
- package/dist/check-service.mjs +27 -33
- package/dist/check.mjs +206 -904
- package/dist/cli-arguments.mjs +278 -0
- package/dist/cli.mjs +374 -304
- package/dist/color-values.mjs +294 -242
- package/dist/composed-contrast.mjs +648 -0
- package/dist/composed-keyline.mjs +107 -0
- package/dist/config.mjs +162 -468
- package/dist/construction-output.mjs +345 -0
- package/dist/construction-spec.d.mts +915 -0
- package/dist/construction-spec.mjs +1178 -0
- package/dist/corner-overpaint.mjs +53 -0
- package/dist/css-length.mjs +80 -0
- package/dist/css-quantity.mjs +173 -0
- package/dist/deletion-model.mjs +56 -0
- package/dist/deletion-plan.mjs +364 -0
- package/dist/dependency-manifest.mjs +56 -0
- package/dist/design-context-model.d.mts +61 -0
- package/dist/design-context-model.mjs +79 -0
- package/dist/design-contexts.mjs +105 -0
- package/dist/design-foundation.mjs +532 -0
- package/dist/design-inputs.mjs +156 -0
- package/dist/design-modules.mjs +27 -0
- package/dist/design-rejection.d.mts +23 -0
- package/dist/design-rejection.mjs +29 -0
- package/dist/design-system-closure.mjs +108 -0
- package/dist/design-usage.mjs +54 -0
- package/dist/development-modules.mjs +2 -0
- package/dist/development-runtime.mjs +0 -7
- package/dist/digest.mjs +2 -0
- package/dist/draft-boundary.mjs +1 -27
- package/dist/draft-workspace.mjs +11 -5
- package/dist/emit/accept.mjs +33 -0
- package/dist/emit/app-icon-emission.mjs +124 -0
- package/dist/emit/app-icon-render.mjs +126 -0
- package/dist/emit/asset-imports.mjs +18 -0
- package/dist/emit/cli-report.mjs +97 -0
- package/dist/emit/contract.mjs +136 -0
- package/dist/emit/emission.mjs +182 -0
- package/dist/emit/font-emission.mjs +111 -0
- package/dist/emit/foundation-sheet.mjs +56 -0
- package/dist/emit/icon-containers.mjs +46 -0
- package/dist/emit/integrity.mjs +61 -0
- package/dist/emit/lock.mjs +66 -0
- package/dist/emit/namespace.mjs +79 -0
- package/dist/emit/operation-reply.mjs +3 -0
- package/dist/emit/operation.mjs +36 -0
- package/dist/emit/output-location.mjs +20 -0
- package/dist/emit/output-package.mjs +7 -0
- package/dist/emit/owner-emission-cache.mjs +52 -0
- package/dist/emit/palette-module.mjs +19 -0
- package/dist/emit/palette-refresh.mjs +77 -0
- package/dist/emit/preview-emitter.mjs +110 -0
- package/dist/emit/preview-tree.mjs +174 -0
- package/dist/emit/scheduler.mjs +75 -0
- package/dist/emit/service.mjs +249 -0
- package/dist/emit/sync.mjs +38 -0
- package/dist/emit/watch.mjs +74 -0
- package/dist/emit/writer.mjs +102 -0
- package/dist/evidence.mjs +6 -8
- package/dist/example-babel.mjs +7 -0
- package/dist/example-literals.mjs +88 -0
- package/dist/finding-rules.mjs +78 -77
- package/dist/focus-checks.mjs +93 -0
- package/dist/font-checks.mjs +185 -0
- package/dist/font-declaration.d.mts +64 -0
- package/dist/font-declaration.mjs +99 -0
- package/dist/font-fallback.d.mts +37 -0
- package/dist/font-fallback.mjs +25 -0
- package/dist/font-macro.d.mts +42 -0
- package/dist/font-macro.mjs +6 -0
- package/dist/font-metrics.d.mts +34 -0
- package/dist/font-metrics.mjs +314 -0
- package/dist/font-model.mjs +63 -0
- package/dist/form-states.mjs +82 -0
- package/dist/foundation-macro.d.mts +108 -0
- package/dist/foundation-macro.mjs +6 -0
- package/dist/frame-regions.mjs +253 -0
- package/dist/glyph-set-declaration.d.mts +27 -0
- package/dist/glyph-set-declaration.mjs +36 -0
- package/dist/grid-checks.mjs +94 -0
- package/dist/grid-facts.mjs +148 -0
- package/dist/grid-lowering.mjs +263 -0
- package/dist/guard/cli.mjs +51 -0
- package/dist/guard/config.mjs +67 -0
- package/dist/guard/files.mjs +31 -0
- package/dist/guard/index.mjs +3 -0
- package/dist/guard/run.mjs +56 -0
- package/dist/guard/tsconfig.declarations.json +13 -0
- package/dist/index.mjs +2 -7
- package/dist/init-project.mjs +134 -0
- package/dist/init.mjs +217 -264
- package/dist/input-digests.mjs +109 -163
- package/dist/input-scope.mjs +18 -41
- package/dist/inspected-svg.d.mts +28 -0
- package/dist/inspected-svg.mjs +40 -0
- package/dist/inventories.mjs +149 -0
- package/dist/inventory-query.mjs +15 -0
- package/dist/investigations.mjs +177 -99
- package/dist/json.d.mts +10 -0
- package/dist/json.mjs +36 -0
- package/dist/linaria/atomic-processor.json +96 -0
- package/dist/linaria/atomic-processor.mjs +2452 -0
- package/dist/linaria/backend-identity.mjs +26 -0
- package/dist/linaria/compatibility.json +61 -0
- package/dist/linaria/css-shape.mjs +94 -0
- package/dist/linaria/custom-property-css.mjs +56 -0
- package/dist/linaria/delivery.mjs +111 -0
- package/dist/linaria/direct-extract.mjs +43 -0
- package/dist/linaria/extraction-cache.mjs +31 -0
- package/dist/linaria/extraction-model.mjs +5 -0
- package/dist/linaria/fingerprint.mjs +183 -0
- package/dist/linaria/pair-manifest.json +2315 -0
- package/dist/linaria/persisted-extraction-cache.mjs +352 -0
- package/dist/linaria/preservation.mjs +13 -0
- package/dist/linaria/priority-emitted-rank.mjs +40 -0
- package/dist/linaria/priority-manifest.mjs +87 -0
- package/dist/linaria/priority-table.mjs +47 -0
- package/dist/linaria/priority-tiers.mjs +27 -0
- package/dist/linaria/processor-host.mjs +42 -0
- package/dist/linaria/processor-runtime.mjs +36 -0
- package/dist/linaria-processor-NOTICES.md +147 -0
- package/dist/lowering-components.mjs +14 -0
- package/dist/lowering-effects.mjs +38 -0
- package/dist/lowering-emitter.mjs +29 -0
- package/dist/lowering-enter.mjs +31 -0
- package/dist/lowering-hidden.mjs +30 -0
- package/dist/lowering-layer.mjs +141 -0
- package/dist/lowering-motion.mjs +37 -0
- package/dist/lowering-normalize.mjs +194 -0
- package/dist/lowering-overlaps.mjs +328 -0
- package/dist/lowering-paint.mjs +32 -0
- package/dist/lowering-properties.mjs +165 -0
- package/dist/lowering-region-layout.mjs +225 -0
- package/dist/lowering-sequence.mjs +89 -0
- package/dist/lowering-serialize.mjs +40 -0
- package/dist/lowering-session.mjs +137 -0
- package/dist/lowering-tiers.mjs +23 -0
- package/dist/lowering-transitions.mjs +53 -0
- package/dist/mcp/ads-mcp.mjs +423 -0
- package/dist/mcp/apps.mjs +3 -25
- package/dist/mcp/behavior-pages.mjs +58 -51
- package/dist/mcp/build-status.mjs +233 -267
- package/dist/mcp/catalog.mjs +21 -128
- package/dist/mcp/compiler-channel.mjs +218 -83
- package/dist/mcp/context.mjs +50 -40
- package/dist/mcp/deletions.mjs +147 -0
- package/dist/mcp/draft-discovery.mjs +43 -38
- package/dist/mcp/drafts.mjs +635 -691
- package/dist/mcp/execution-context.mjs +33 -22
- package/dist/mcp/execution-coordinator.mjs +367 -354
- package/dist/mcp/execution-results.mjs +440 -173
- package/dist/mcp/mutation-limits.mjs +1 -2
- package/dist/mcp/mutations.mjs +515 -553
- package/dist/mcp/patch.mjs +117 -75
- package/dist/mcp/preview-http.bundle.js +3 -7
- package/dist/mcp/preview-http.mjs +220 -107
- package/dist/mcp/preview-owner-guard.mjs +81 -43
- package/dist/mcp/preview-watch.mjs +428 -365
- package/dist/mcp/preview-widget.bundle.js +42 -46
- package/dist/mcp/preview-work.mjs +25 -13
- package/dist/mcp/prompts.mjs +22 -16
- package/dist/mcp/resource-loader.js +1 -1
- package/dist/mcp/result-pages.mjs +94 -54
- package/dist/mcp/sandbox-host.mjs +41 -19
- package/dist/mcp/server-discovery.mjs +96 -0
- package/dist/mcp/server-guides.mjs +43 -0
- package/dist/mcp/server-host.mjs +203 -0
- package/dist/mcp/server-observation.mjs +225 -0
- package/dist/mcp/server-project.mjs +371 -0
- package/dist/mcp/server-resources.mjs +466 -0
- package/dist/mcp/server-shared.mjs +79 -0
- package/dist/mcp/server-tools.mjs +791 -0
- package/dist/mcp/server.mjs +2 -2813
- package/dist/mcp/showcase-host.mjs +209 -135
- package/dist/mcp/showcase-http.mjs +50 -28
- package/dist/mcp/skills.mjs +32 -36
- package/dist/mcp/text-diff.mjs +18 -36
- package/dist/measured-geometry.mjs +157 -0
- package/dist/motion-model.mjs +52 -0
- package/dist/non-text-contrast.mjs +118 -0
- package/dist/owner-analysis-check.mjs +711 -0
- package/dist/owner-design.mjs +15 -0
- package/dist/owner-errors.mjs +216 -0
- package/dist/owner-lowering.mjs +206 -0
- package/dist/owner-scenarios.mjs +854 -0
- package/dist/ownership-model.d.mts +6 -0
- package/dist/ownership-model.mjs +143 -0
- package/dist/package-declarations.mjs +34 -0
- package/dist/paint-contrast.mjs +186 -0
- package/dist/palette-generated.mjs +101 -116
- package/dist/pictogram-model.mjs +13 -51
- package/dist/placeholder-contrast.mjs +35 -0
- package/dist/platform-features.mjs +401 -0
- package/dist/press-scale.mjs +26 -0
- package/dist/preview-bun.mjs +334 -404
- package/dist/preview-compile-inputs.mjs +78 -0
- package/dist/preview-contexts.mjs +7 -0
- package/dist/preview-controls.mjs +35 -0
- package/dist/preview-failure.mjs +20 -10
- package/dist/preview-files.mjs +18 -36
- package/dist/preview-imports.mjs +76 -70
- package/dist/preview-incremental.mjs +322 -222
- package/dist/preview-inputs.mjs +26 -26
- package/dist/preview-manifest-update.mjs +67 -49
- package/dist/preview-requests.mjs +10 -17
- package/dist/preview-resources.mjs +275 -323
- package/dist/preview-scope.mjs +15 -17
- package/dist/preview-source.mjs +182 -0
- package/dist/preview-spatial.mjs +27 -0
- package/dist/profile-macro.d.mts +56 -0
- package/dist/profile-macro.mjs +6 -0
- package/dist/profile-model.d.mts +65 -0
- package/dist/profile-model.mjs +213 -0
- package/dist/profile-view-facts.mjs +93 -0
- package/dist/program-cache.mjs +9 -7
- package/dist/project-boundary.mjs +8 -13
- package/dist/project-documents.mjs +25 -29
- package/dist/property-registrations.mjs +44 -35
- package/dist/prose-model.d.mts +81 -0
- package/dist/prose-model.mjs +101 -0
- package/dist/public-catalog.mjs +76 -0
- package/dist/recipe-defaults.mjs +117 -0
- package/dist/recipe-macro.d.mts +502 -0
- package/dist/recipe-macro.mjs +23 -0
- package/dist/recipe-model.d.mts +26 -0
- package/dist/recipe-model.mjs +214 -0
- package/dist/region-lowering.mjs +723 -0
- package/dist/registration-css.mjs +41 -0
- package/dist/registration-roles.mjs +35 -0
- package/dist/render-audit/axe-run.page.mjs +28 -0
- package/dist/render-audit/corner-overpaint.page.mjs +54 -0
- package/dist/render-audit/first-render.page.mjs +35 -0
- package/dist/render-audit/image-shape.page.mjs +42 -0
- package/dist/render-audit/layout-overflow.page.mjs +240 -0
- package/dist/render-audit/layout-shift.page.mjs +36 -0
- package/dist/render-audit/non-text-contrast.page.mjs +138 -0
- package/dist/render-audit/render-states.mjs +66 -293
- package/dist/render-audit/render-states.page.mjs +177 -0
- package/dist/render-audit/text-scale.mjs +42 -0
- package/dist/render-audit/text-scale.page.mjs +25 -0
- package/dist/render-audit/worker.mjs +130 -112
- package/dist/render-audit/worker.page.mjs +21 -0
- package/dist/render-audit.mjs +490 -500
- package/dist/resource-limits.mjs +174 -223
- package/dist/result.d.mts +34 -0
- package/dist/result.mjs +60 -0
- package/dist/role-vocabulary.d.mts +260 -0
- package/dist/role-vocabulary.mjs +258 -0
- package/dist/runtime-paint-contrast.mjs +97 -0
- package/dist/runtime-paint.mjs +42 -0
- package/dist/runtime-requirements.mjs +10 -11
- package/dist/runtime-style.mjs +21 -0
- package/dist/scenario-groups.mjs +42 -33
- package/dist/scenario-inspector.mjs +4 -4
- package/dist/scenario-kit.d.mts +85 -0
- package/dist/scenario-kit.mjs +18 -0
- package/dist/scenario-registry-model.mjs +2 -0
- package/dist/scenario-registry.mjs +89 -108
- package/dist/scenarios-compiler.mjs +875 -662
- package/dist/scheme-switch.d.mts +8 -0
- package/dist/scheme-switch.mjs +1 -0
- package/dist/showcase/ads-views.mjs +166 -0
- package/dist/showcase/assets-view.mjs +252 -0
- package/dist/showcase/client.bundle.js +211 -48
- package/dist/showcase/guide-controls.d.mts +28 -0
- package/dist/showcase/guide-controls.mjs +31 -0
- package/dist/showcase/http-client.bundle.js +172 -9
- package/dist/showcase/index.html +1 -1
- package/dist/showcase/preview-frame.css +18 -0
- package/dist/showcase/preview-frame.d.mts +5 -0
- package/dist/showcase/preview-frame.mjs +4 -0
- package/dist/showcase/preview-root.d.mts +2 -0
- package/dist/showcase/preview-root.mjs +9 -0
- package/dist/showcase/profiles-view.mjs +321 -0
- package/dist/showcase/project-rules.mjs +9 -0
- package/dist/showcase/sandbox.bundle.js +1 -1
- package/dist/showcase/scenario-page.d.mts +49 -0
- package/dist/showcase/scenario-page.mjs +105 -0
- package/dist/showcase/style.css +2 -0
- package/dist/showcase/token-sample.mjs +89 -0
- package/dist/showcase/tokens-view.mjs +233 -0
- package/dist/showcase/ui/apple-touch-icon-9zwv3w79.png +0 -0
- package/dist/showcase/{favicon.ico → ui/favicon-c2c9kvtf.ico} +0 -0
- package/dist/showcase/ui/icon-192-t5zh7mxx.png +0 -0
- package/dist/showcase/ui/icon-512-ed6yz0n0.png +0 -0
- package/dist/showcase/ui/ui.css +1 -1353
- package/dist/showcase/ui/ui.js +165 -1064
- package/dist/showcase-http-routes.mjs +28 -21
- package/dist/skills/README.md +28 -28
- package/dist/skills/ads-designer/README.md +1 -1
- package/dist/skills/ads-designer/SKILL.md +313 -551
- package/dist/skills/ads-designer/references/accessibility.md +162 -114
- package/dist/skills/ads-designer/references/atomic-styles.md +72 -277
- package/dist/skills/ads-designer/references/behaviors.md +144 -280
- package/dist/skills/ads-designer/references/branding.md +137 -222
- package/dist/skills/ads-designer/references/captures.md +13 -7
- package/dist/skills/ads-designer/references/cli.md +80 -63
- package/dist/skills/ads-designer/references/contracts.md +225 -286
- package/dist/skills/ads-designer/references/design-craft.md +2 -2
- package/dist/skills/ads-designer/references/design-data.md +299 -323
- package/dist/skills/ads-designer/references/drafts.md +83 -22
- package/dist/skills/ads-designer/references/evidence.md +2 -1
- package/dist/skills/ads-designer/references/forms.md +199 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +37 -48
- package/dist/skills/ads-designer/references/layers.md +64 -76
- package/dist/skills/ads-designer/references/layout.md +224 -330
- package/dist/skills/ads-designer/references/mobile.md +2 -2
- package/dist/skills/ads-designer/references/motion.md +66 -25
- package/dist/skills/ads-designer/references/performance.md +55 -50
- package/dist/skills/ads-designer/references/pictograms.md +62 -127
- package/dist/skills/ads-designer/references/recipes.md +368 -0
- package/dist/skills/ads-designer/references/review.md +51 -95
- package/dist/skills/ads-designer/references/runtimes.md +34 -33
- package/dist/skills/ads-designer/references/scenarios.md +256 -216
- package/dist/skills/ads-designer/references/stress-test.md +13 -5
- package/dist/skills/ads-designer/references/validation.md +28 -21
- package/dist/skills/ads-designer/references/workflows.md +7 -5
- package/dist/skills/ads-import/SKILL.md +29 -29
- package/dist/skills/ads-import/references/atomic-styles.md +72 -277
- package/dist/skills/ads-import/references/behaviors.md +144 -280
- package/dist/skills/ads-import/references/branding.md +24 -41
- package/dist/skills/ads-import/references/captures.md +13 -7
- package/dist/skills/ads-import/references/cli.md +80 -63
- package/dist/skills/ads-import/references/compatibility.md +3 -3
- package/dist/skills/ads-import/references/contracts.md +225 -286
- package/dist/skills/ads-import/references/design-data.md +299 -323
- package/dist/skills/ads-import/references/drafts.md +83 -22
- package/dist/skills/ads-import/references/evidence.md +2 -1
- package/dist/skills/ads-import/references/forms.md +199 -0
- package/dist/skills/ads-import/references/guarded-editing.md +37 -48
- package/dist/skills/ads-import/references/implementation.md +20 -20
- package/dist/skills/ads-import/references/layers.md +64 -76
- package/dist/skills/ads-import/references/layout.md +224 -330
- package/dist/skills/ads-import/references/recipes.md +368 -0
- package/dist/skills/ads-import/references/review.md +51 -95
- package/dist/skills/ads-import/references/runtimes.md +34 -33
- package/dist/skills/ads-import/references/scenarios.md +256 -216
- package/dist/skills/ads-import/references/tokens.md +26 -17
- package/dist/skills/ads-import/references/validation.md +28 -21
- package/dist/skills/ads-import/references/workflows.md +7 -5
- package/dist/skills/ads-migrate/SKILL.md +20 -5
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +6 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-boundary.md +71 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-grid.md +204 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0.md +727 -0
- package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
- package/dist/skills/ads-port/SKILL.md +27 -28
- package/dist/skills/ads-port/references/atomic-styles.md +72 -277
- package/dist/skills/ads-port/references/behaviors.md +144 -280
- package/dist/skills/ads-port/references/captures.md +13 -7
- package/dist/skills/ads-port/references/cli.md +80 -63
- package/dist/skills/ads-port/references/contracts.md +225 -286
- package/dist/skills/ads-port/references/design-data.md +299 -323
- package/dist/skills/ads-port/references/drafts.md +83 -22
- package/dist/skills/ads-port/references/evidence.md +2 -1
- package/dist/skills/ads-port/references/forms.md +199 -0
- package/dist/skills/ads-port/references/guarded-editing.md +37 -48
- package/dist/skills/ads-port/references/layers.md +64 -76
- package/dist/skills/ads-port/references/layout.md +224 -330
- package/dist/skills/ads-port/references/lint-and-docs.md +2 -3
- package/dist/skills/ads-port/references/native-implementation.md +23 -33
- package/dist/skills/ads-port/references/recipes.md +368 -0
- package/dist/skills/ads-port/references/review.md +51 -95
- package/dist/skills/ads-port/references/runtimes.md +34 -33
- package/dist/skills/ads-port/references/scenarios.md +256 -216
- package/dist/skills/ads-port/references/validation.md +28 -21
- package/dist/skills/ads-port/references/workflows.md +7 -5
- package/dist/source-inventory.mjs +33 -0
- package/dist/source-values.mjs +272 -262
- package/dist/spatial-css.mjs +403 -0
- package/dist/spatial-metadata.mjs +11 -11
- package/dist/spatial-model.mjs +438 -0
- package/dist/spatial-reading.mjs +127 -0
- package/dist/stage-timing.mjs +27 -0
- package/dist/state-conditions.d.mts +80 -0
- package/dist/state-conditions.mjs +107 -0
- package/dist/static-values.mjs +94 -0
- package/dist/surface-contrast.mjs +252 -0
- package/dist/surface-effects.mjs +98 -0
- package/dist/target-size.mjs +177 -0
- package/dist/task-cache.mjs +142 -136
- package/dist/task-worker.mjs +18 -18
- package/dist/test-boundaries.mjs +50 -189
- package/dist/token-checks.mjs +21 -0
- package/dist/token-dtcg.mjs +136 -0
- package/dist/token-expression.mjs +19 -0
- package/dist/token-inventory.mjs +146 -0
- package/dist/token-operations.mjs +37 -0
- package/dist/token-overlap.mjs +29 -0
- package/dist/token-provenance.mjs +260 -0
- package/dist/token-references.mjs +71 -0
- package/dist/token-registrations.mjs +116 -0
- package/dist/token-resolution.mjs +38 -0
- package/dist/token-sections.mjs +123 -0
- package/dist/token-shapes.mjs +121 -0
- package/dist/token-sheet-check.mjs +54 -0
- package/dist/token-type-check.mjs +89 -0
- package/dist/token-view-facts.mjs +111 -0
- package/dist/tsconfig.declarations.json +24 -0
- package/dist/types/css-tree.d.ts +45 -0
- package/dist/ui-framework.mjs +34 -34
- package/dist/units.mjs +186 -226
- package/dist/unknown.d.mts +9 -0
- package/dist/unknown.mjs +13 -0
- package/dist/unreached-sources.mjs +5 -0
- package/dist/validation-checks.mjs +62 -71
- package/dist/validation-inputs.mjs +209 -279
- package/dist/validation.mjs +132 -159
- package/dist/verification/browser.d.mts +21 -25
- package/dist/verification/browser.mjs +281 -124
- package/dist/verification/browser.page.d.mts +22 -0
- package/dist/verification/browser.page.mjs +19 -0
- package/dist/verification/paint-audit.page.d.mts +55 -0
- package/dist/verification/paint-audit.page.mjs +144 -0
- package/dist/verification/playwright-reporter.mjs +160 -0
- package/dist/verification/preview-startup.d.mts +51 -0
- package/dist/verification/preview-startup.mjs +76 -0
- package/dist/verification/request.d.mts +28 -0
- package/dist/verification/request.mjs +30 -0
- package/dist/verification/unit-preload.mjs +37 -0
- package/dist/verification.mjs +574 -607
- package/docs/ADS.md +585 -565
- package/docs/ARCHITECTURE.md +2002 -1384
- package/docs/ASSETS.md +487 -0
- package/docs/BEHAVIORS.md +339 -370
- package/docs/CACHING.md +365 -154
- package/docs/CHANGELOG.md +462 -21
- package/docs/COMPARISON.md +21 -26
- package/docs/DESIGN-REFERENCES.md +40 -27
- package/docs/GUIDE.md +2473 -1292
- package/docs/LANGUAGE.md +1159 -0
- package/docs/LOWERING.md +180 -0
- package/docs/MCP.md +1461 -1179
- package/docs/MOTION.md +491 -0
- package/docs/PROFILE-KINDS.md +544 -0
- package/docs/PROFILES.md +176 -0
- package/docs/RULES.md +590 -0
- package/docs/TOKEN-ROLES.md +377 -0
- package/docs/benchmarks/README.md +26 -27
- package/package.json +59 -45
- package/dist/a11y.mjs +0 -187
- package/dist/assets.mjs +0 -159
- package/dist/atomic-composition.mjs +0 -337
- package/dist/atomic-trace.mjs +0 -162
- package/dist/behavior-libraries.mjs +0 -174
- package/dist/behaviors.mjs +0 -306
- package/dist/brand-assets.mjs +0 -458
- package/dist/brands.mjs +0 -141
- package/dist/component-contrast.mjs +0 -256
- package/dist/construction-styles.cjs +0 -10
- package/dist/contracts/foundation.json +0 -211
- package/dist/contracts/tokens.json +0 -52
- package/dist/contracts.d.mts +0 -30
- package/dist/contrast-composition.mjs +0 -80
- package/dist/contrast-styles.mjs +0 -88
- package/dist/control-padding.mjs +0 -113
- package/dist/css-values.mjs +0 -27
- package/dist/declarative-flow.mjs +0 -244
- package/dist/design-values.mjs +0 -173
- package/dist/font-rules.mjs +0 -108
- package/dist/fonts-generated.mjs +0 -112
- package/dist/foundation-views.mjs +0 -242
- package/dist/foundation.mjs +0 -154
- package/dist/generated-entries.mjs +0 -198
- package/dist/html.mjs +0 -30
- package/dist/icons.mjs +0 -154
- package/dist/image-attributes.mjs +0 -187
- package/dist/image-size.mjs +0 -28
- package/dist/layers.mjs +0 -461
- package/dist/layout-widths.mjs +0 -332
- package/dist/linaria/atomic-css.cjs +0 -2
- package/dist/linaria/atomic-styled.cjs +0 -2
- package/dist/linaria/preserve-values.cjs +0 -58
- package/dist/linaria/spatial-inputs.cjs +0 -56
- package/dist/linaria.d.mts +0 -1
- package/dist/linaria.mjs +0 -9
- package/dist/lockup-composition.mjs +0 -44
- package/dist/lockup-model.cjs +0 -64
- package/dist/paint-contracts.mjs +0 -216
- package/dist/pictograms.mjs +0 -52
- package/dist/public-api.mjs +0 -121
- package/dist/public-props.mjs +0 -91
- package/dist/render-audit/axe-run.mjs +0 -17
- package/dist/render-audit/first-render.mjs +0 -40
- package/dist/render-audit/image-shape.mjs +0 -46
- package/dist/render-audit/layout-overflow.mjs +0 -167
- package/dist/render-audit/layout-shift.mjs +0 -32
- package/dist/render-audit/non-text-contrast.mjs +0 -151
- package/dist/render-audit/pictograms.mjs +0 -88
- package/dist/render-color-probe.mjs +0 -202
- package/dist/render-composition.mjs +0 -186
- package/dist/runtime-contracts.mjs +0 -506
- package/dist/scenario-program.mjs +0 -19
- package/dist/scenario-selectors.mjs +0 -237
- package/dist/scenario-slots.mjs +0 -217
- package/dist/scenario-trace.mjs +0 -314
- package/dist/scenarios-vite.d.mts +0 -2
- package/dist/scenarios-vite.mjs +0 -2
- package/dist/scenarios.mjs +0 -616
- package/dist/selector-match.mjs +0 -94
- package/dist/showcase/comparison.js +0 -48
- package/dist/showcase/connection.js +0 -10
- package/dist/showcase/draft-navigation.js +0 -59
- package/dist/showcase/foundation-view.css +0 -58
- package/dist/showcase/foundation-view.mjs +0 -255
- package/dist/showcase/guide-controls.ads.review.mjs +0 -32
- package/dist/showcase/http-connection.js +0 -86
- package/dist/showcase/http-preview.js +0 -81
- package/dist/showcase/icons.js +0 -2
- package/dist/showcase/navigation.js +0 -13
- package/dist/showcase/pictogram-view.mjs +0 -53
- package/dist/showcase/preview-frame.ads.review.css +0 -46
- package/dist/showcase/preview-frame.ads.review.d.mts +0 -11
- package/dist/showcase/preview-frame.ads.review.mjs +0 -22
- package/dist/showcase/preview-state.js +0 -11
- package/dist/showcase/refresh-scheduler.js +0 -23
- package/dist/showcase/resource-reader.js +0 -37
- package/dist/showcase-coverage.mjs +0 -139
- package/dist/source-symbols.mjs +0 -4
- package/dist/spatial-composition.mjs +0 -322
- package/dist/spatial-contexts.cjs +0 -56
- package/dist/spatial-css.cjs +0 -351
- package/dist/spatial-inputs.cjs +0 -80
- package/dist/spatial-model.cjs +0 -322
- package/dist/spatial.mjs +0 -21
- package/dist/stage-timing.cjs +0 -21
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +0 -105
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -275
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +0 -8
- package/dist/starters/preact/ds.config.json +0 -37
- package/dist/starters/preact/package.json +0 -35
- package/dist/starters/preact/src/vite-env.d.ts +0 -7
- package/dist/starters/preact/tsconfig.json +0 -35
- package/dist/starters/preact/vite.config.ts +0 -23
- package/dist/starters/react/ADS.md +0 -286
- package/dist/starters/react/README.md +0 -184
- package/dist/starters/react/biome.css.json +0 -21
- package/dist/starters/react/design-system/assets/brand/README.md +0 -41
- package/dist/starters/react/design-system/assets/brand/app-icon.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/logo.dark.svg +0 -6
- package/dist/starters/react/design-system/assets/brand/logo.svg +0 -6
- package/dist/starters/react/design-system/assets/glyphs/README.md +0 -15
- package/dist/starters/react/design-system/assets/glyphs/aliases.json +0 -1
- package/dist/starters/react/design-system/assets/glyphs/check.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/external-link.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/info.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/menu.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/plus.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/warning.svg +0 -1
- package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +0 -13
- package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +0 -7
- package/dist/starters/react/design-system/assets/pictograms/journey.svg +0 -7
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -56
- package/dist/starters/react/design-system/components/Actions/Button/README.md +0 -12
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +0 -9
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -60
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +0 -17
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +0 -6
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -42
- package/dist/starters/react/design-system/components/Content/Icon/README.md +0 -17
- package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +0 -17
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -2
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -51
- package/dist/starters/react/design-system/components/Content/Image/README.md +0 -20
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +0 -35
- package/dist/starters/react/design-system/components/Content/Logo/README.md +0 -12
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +0 -7
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +0 -26
- package/dist/starters/react/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -61
- package/dist/starters/react/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +0 -5
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +0 -13
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -164
- package/dist/starters/react/design-system/index.ts +0 -12
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +0 -15
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +0 -105
- package/dist/starters/react/design-system/patterns/Conversation/README.md +0 -9
- package/dist/starters/react/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Shell/README.md +0 -43
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -274
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
- package/dist/starters/react/design-system/review/index.ads.review.ts +0 -4
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
- package/dist/starters/react/design-system/showcase/mcp/main.ads.mount.tsx +0 -10
- package/dist/starters/react/design-system/styles.css +0 -7
- package/dist/starters/react/design-system/tokens/base.css +0 -36
- package/dist/starters/react/design-system/tokens/catalog.ads.json +0 -1221
- package/dist/starters/react/design-system/tokens/colors.css +0 -215
- package/dist/starters/react/design-system/tokens/elevation.css +0 -53
- package/dist/starters/react/design-system/tokens/spacing.css +0 -87
- package/dist/starters/react/design-system/tokens/spatial.ads.json +0 -70
- package/dist/starters/react/design-system/tokens/themes.generated.css +0 -142
- package/dist/starters/react/design-system/tokens/themes.generated.ts +0 -402
- package/dist/starters/react/design-system/tokens/typography.css +0 -31
- package/dist/starters/react/ds.config.json +0 -37
- package/dist/starters/react/gitignore.template +0 -8
- package/dist/starters/react/package.json +0 -39
- package/dist/starters/react/scripts/build-mcp-previews.mjs +0 -3
- package/dist/starters/react/src/vite-env.d.ts +0 -7
- package/dist/starters/react/tsconfig.build.json +0 -20
- package/dist/starters/react/tsconfig.json +0 -34
- package/dist/starters/react/vite.config.ts +0 -23
- package/dist/style-boundaries.mjs +0 -106
- package/dist/style-token-rules.mjs +0 -51
- package/dist/themes-generated.mjs +0 -161
- package/dist/themes-watch.mjs +0 -83
- package/dist/themes.mjs +0 -360
- package/dist/token-export.mjs +0 -94
- package/dist/token-origins.mjs +0 -24
- package/dist/token-policy.mjs +0 -26
- package/dist/token-quality.mjs +0 -149
- package/dist/token-samples.mjs +0 -19
- package/dist/tokens.mjs +0 -194
- package/dist/unit-contracts.mjs +0 -396
- package/dist/usage.mjs +0 -184
- package/dist/verification/playwright-reporter.cjs +0 -87
- package/docs/CONTRACTS.md +0 -285
- package/docs/HTTP-SHOWCASE-POC.md +0 -397
- package/docs/SPATIAL-CHECKS.md +0 -69
- package/docs/benchmarks/http-showcase-optimized.json +0 -1879
- package/docs/benchmarks/http-showcase-profile.json +0 -308
- package/docs/benchmarks/http-showcase.json +0 -3069
- /package/dist/{starters/react/design-system/assets/fonts/.gitkeep → analysis/semantic.mjs} +0 -0
- /package/dist/{starters/react/design-system/controllers/.gitkeep → lowering-model.mjs} +0 -0
- /package/dist/showcase/{favicon.svg → ui/favicon-scavmehf.svg} +0 -0
package/docs/LANGUAGE.md
ADDED
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
# The authoring language
|
|
2
|
+
|
|
3
|
+
A design system is written with typed declarations. Each is a macro import
|
|
4
|
+
(`with { type: "macro" }`) from a subpath of `@reqvire-org/ads`: `profile()`
|
|
5
|
+
from `/profile`, `recipe()` and `combineRecipes()` from `/recipe`, `asset()`,
|
|
6
|
+
`glyphSet()` and `glyph()` from `/asset`, `font()` from `/font`, and
|
|
7
|
+
`foundation()` from `/foundation`. Tokens are ordinary CSS in role sheets.
|
|
8
|
+
`ads check` reads the declarations and `ads emit` compiles them to plain
|
|
9
|
+
TypeScript and CSS; ADS does not run in the application. The examples come
|
|
10
|
+
from the example design system, the one ADS is tested with (in its repository,
|
|
11
|
+
under `tests/fixtures/starter-project/`); `ads init` installs no design system.
|
|
12
|
+
[RULES.md](RULES.md) lists every rule.
|
|
13
|
+
|
|
14
|
+
## The authoring invariant
|
|
15
|
+
|
|
16
|
+
**Tokens define values → profiles bind them to design responsibilities → recipes
|
|
17
|
+
consume profiles and declare construction → TypeScript handles markup and behavior.**
|
|
18
|
+
|
|
19
|
+
Components and patterns cannot author design measurements, paints, local custom
|
|
20
|
+
properties or direct token reads. This includes a token-derived border-width ×
|
|
21
|
+
1.5 used as a gap. Prefixes such as `--ds-` or `--ux-` give no exception. A new
|
|
22
|
+
shared measurement belongs in a role file and a profile, even with one user.
|
|
23
|
+
|
|
24
|
+
TypeScript supplies content, behavior and finite public choices. The
|
|
25
|
+
prohibition applies to authored owners; generated output contains CSS values
|
|
26
|
+
and calculations.
|
|
27
|
+
|
|
28
|
+
Local construction choices are closed:
|
|
29
|
+
|
|
30
|
+
- `span: 2`: two active grid tracks; a bounded integer, checked against parent
|
|
31
|
+
tracks.
|
|
32
|
+
- `align: "center"`: a supported alignment operation, not a numeric nudge.
|
|
33
|
+
- `frame: { ratio: "3 / 2" }`: a ratio the selected spatial contract permits.
|
|
34
|
+
- `gutter: "narrow"`, `bound: "system"`: named shared policies, no local
|
|
35
|
+
lengths.
|
|
36
|
+
- `margin: "none"`: suppresses external margin; no arbitrary margin value.
|
|
37
|
+
- `gap: { slot: "spacing", field: "detailsGap" }`: a typed field, never border
|
|
38
|
+
width or motion distance.
|
|
39
|
+
|
|
40
|
+
Unknown fields, `span: 1.5`, `gap: 2`, arbitrary arithmetic and unresolved
|
|
41
|
+
evidence fail. `normalize` is no generic CSS escape: it permits only the
|
|
42
|
+
closed native operations (`margin: 0`, `borderStyle`, `textDecoration`,
|
|
43
|
+
`pointerEvents`) and the closed [interaction properties](#interaction-properties)
|
|
44
|
+
(`cursor`, `touchAction`, `userSelect`), optionally under an owned selector in
|
|
45
|
+
`when`.
|
|
46
|
+
|
|
47
|
+
## Mocks are the application's screens, mocked
|
|
48
|
+
|
|
49
|
+
A mock supplies mock data, state and simulated application actions to
|
|
50
|
+
public components and patterns, as the application will. It can switch views. It cannot define recipes, profiles,
|
|
51
|
+
styles, spacing or native layout wrappers, or pass design through props or
|
|
52
|
+
helpers. Application logic assembles the emitted public owners in its own
|
|
53
|
+
source. Production exports exclude mocks, fixtures and scenarios.
|
|
54
|
+
|
|
55
|
+
In the example design system, Shell (`patterns/Shell/Shell.tsx`) owns shell layout and
|
|
56
|
+
Workspace (`patterns/Workspace/Workspace/Workspace.tsx`) supplies feature
|
|
57
|
+
content. Its mock (`mocks/Workspace/Workspace.ads.scenario.tsx`)
|
|
58
|
+
supplies only state, data and callbacks, as does ConstructionWorkbench's.
|
|
59
|
+
|
|
60
|
+
Mock-owned `media/` can contain a small mock image, passed to a public
|
|
61
|
+
pattern as URL and intrinsic metadata. It is application data: never raw
|
|
62
|
+
markup, never an import available to production owners, and never emitted.
|
|
63
|
+
|
|
64
|
+
`ads check` enforces these rules (`mock-ownership`, codes
|
|
65
|
+
`mock/<kind>`, `src/analysis/mock-check.mts`) for every script under `mocks/` and
|
|
66
|
+
the helpers it imports. Such a script may import any public export from `@ds`,
|
|
67
|
+
any framework hook and any declared library; by relative path it imports only
|
|
68
|
+
captured helpers inside `mocks/` and its own `media/` images. It renders only
|
|
69
|
+
what it imports from `@ds`: a pattern arranges the screen, and a component
|
|
70
|
+
appears only inside a pattern. It passes no design props, spreads, re-exports,
|
|
71
|
+
imperative styles, DOM creation, dynamic code or design definitions hidden in
|
|
72
|
+
strings.
|
|
73
|
+
|
|
74
|
+
## Shared values and profiles
|
|
75
|
+
|
|
76
|
+
`tokens/<group>/<role>.ads.css` declares values; the exact filename supplies
|
|
77
|
+
their role, not the folder. Global token names are unique. Theme and brand
|
|
78
|
+
overrides stay in the same role file. The [33-role catalogue](TOKEN-ROLES.md)
|
|
79
|
+
and [registry](../src/role-vocabulary.mts) define allowed values and consumers.
|
|
80
|
+
|
|
81
|
+
`profiles/**/*.ads.ts` contains globally named `profile()` declarations. Files
|
|
82
|
+
and groups are organizational: references cross them by name, and no central
|
|
83
|
+
registry or import order controls composition.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
profile({
|
|
87
|
+
name: "card", kind: "composite",
|
|
88
|
+
fields: {
|
|
89
|
+
frameProfile: "card-frame",
|
|
90
|
+
surfaceProfile: "quiet-surface",
|
|
91
|
+
spacingProfile: "card-spacing",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The ten kinds are `text`, `frame`, `surface`, `visual`, `spacing`, `motion`,
|
|
97
|
+
`focus`, `spatial`, `layer` and `composite`; card, control and person are
|
|
98
|
+
project names. [PROFILE-KINDS.md](PROFILE-KINDS.md) owns each kind's fields;
|
|
99
|
+
[PROFILES.md](PROFILES.md) owns composition (`with`, typed slots, conflicts,
|
|
100
|
+
choices and partial inputs).
|
|
101
|
+
|
|
102
|
+
Profiles own values and finite choices, not DOM selectors, layout modes,
|
|
103
|
+
callbacks or per-instance offsets. A field value that begins with `--` is a
|
|
104
|
+
validated token reference. A named selection is
|
|
105
|
+
`{ profile: "label", select: { size: "lg" } }`.
|
|
106
|
+
|
|
107
|
+
## Owner-local recipes
|
|
108
|
+
|
|
109
|
+
`recipe({ layout, profile, ... })` constructs an owned element and stays local
|
|
110
|
+
to its component or pattern. `layout` is an operation, not a shared recipe
|
|
111
|
+
name: `inline`, `stack`, `fluid`, `hybrid`, `fixed`, `flow`, `inherited` or
|
|
112
|
+
`layered`. Omit it for a treatment or selection fragment or a native frame-only
|
|
113
|
+
element.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
const card = recipe({ layout: "stack", profile: "card", frame: "container" });
|
|
117
|
+
<section className={card.root}>{children}</section>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The spacing profile supplies the default content gap; repeating it is an error.
|
|
121
|
+
Frames, parts, placement and public row alignment belong in this object. Reuse
|
|
122
|
+
values through profiles and UI through public owners.
|
|
123
|
+
|
|
124
|
+
`combineRecipes(a, b, c)` composes local recipe fragments, left to right:
|
|
125
|
+
|
|
126
|
+
- The rightmost **different** value wins at each field, recursively: a changed
|
|
127
|
+
`parts.label.required` keeps an earlier `parts.label.kind`. An identical
|
|
128
|
+
redeclaration is an error. There is no `prefer` option.
|
|
129
|
+
- Every input is validated, so an invalid losing value cannot hide. The result
|
|
130
|
+
must satisfy its operation, profile, required parts and asset bindings.
|
|
131
|
+
- Shared profile composition differs: there a conflict needs explicit local
|
|
132
|
+
resolution. Neither operation can override a child's interior.
|
|
133
|
+
|
|
134
|
+
A fragment is an unexported top-level `const` in the same owner, initialized by
|
|
135
|
+
`recipe` or `combineRecipes` before its consumers and used only as a
|
|
136
|
+
combination argument. Imported fragments, helper results, spreads, computed
|
|
137
|
+
arguments and cycles fail. Without a local difference, author one recipe.
|
|
138
|
+
|
|
139
|
+
The classes on one element are not merged by stylesheet order: ADS combines
|
|
140
|
+
their recipes by the same rules. Every reachable combination must form one
|
|
141
|
+
construction: one active arrangement, compatible profile selections and one
|
|
142
|
+
provider per field. A fragment can add to an existing part; it cannot retarget
|
|
143
|
+
it or silently compete with another class. Incomplete evidence fails; no
|
|
144
|
+
branch is sampled.
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
const compact = recipe({ select: { size: "sm" } });
|
|
148
|
+
const largerText = recipe({ select: { typography: "lg" } });
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
A control recipe may name its own text profile, `text: "caption"`, as a region
|
|
152
|
+
does. It replaces the text slot of the control's profile, and the control's
|
|
153
|
+
box is sized from that text's line.
|
|
154
|
+
|
|
155
|
+
- Explicit selections are collected before defaults. Repeating a selected
|
|
156
|
+
argument or its existing default is an error; a default branch needs no
|
|
157
|
+
selection class. A fixed selection can go in the profile reference object.
|
|
158
|
+
- A part inherits the nearest recipe's profile unless it changes it.
|
|
159
|
+
- Typed field access is `{ slot: "spacing", field: "detailsGap" }`, not a direct
|
|
160
|
+
token lookup. Named text, visual and surface treatments stay subject to kind
|
|
161
|
+
checks.
|
|
162
|
+
|
|
163
|
+
## Parts and frames
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
recipe({
|
|
167
|
+
layout: "inline", profile: "interactive-control", frame: "control", align: "center",
|
|
168
|
+
parts: {
|
|
169
|
+
label: { selector: ".ds-button-label", kind: "text", required: false,
|
|
170
|
+
textEdge: ["cap", "alphabetic"], wrap: true },
|
|
171
|
+
visual: { selector: ".ds-button-glyph", kind: "visual", required: false },
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
A part names owned markup, its presence and its type. It cannot select a child
|
|
177
|
+
public component's private elements. Text uses the text profile; visual uses
|
|
178
|
+
the visual profile and asset metadata. An absent optional part contributes no
|
|
179
|
+
geometry or gap. A nested `recipe: { layout: "stack", ... }` constructs an owned
|
|
180
|
+
part's children.
|
|
181
|
+
|
|
182
|
+
- `frame: {}` applies the declared frame fields and adds no padding or borders.
|
|
183
|
+
- `frame: "control"` uses the frame and text slots, and optional visual,
|
|
184
|
+
spacing and focus slots, to calculate border-aware block insets and a minimum
|
|
185
|
+
size. Its frame profile can declare `minInlineSize` (a `control-min-size`
|
|
186
|
+
token), which makes an icon-only control square without deriving its padding
|
|
187
|
+
from its height. See the [equations](LOWERING.md#control-frame-calculation).
|
|
188
|
+
- `frame: "container"` requires complete frame and surface contracts.
|
|
189
|
+
- A frame without a layout keeps native display semantics, including
|
|
190
|
+
Disclosure's summary marker.
|
|
191
|
+
- Minimum dimensions must grow for wrapping and large text.
|
|
192
|
+
|
|
193
|
+
The shared construction model uses presence, optical extents, border thickness
|
|
194
|
+
and text metrics once; parents cannot replace them through placement or
|
|
195
|
+
descendant styling. Browser shaping and actual wrapping stay browser facts.
|
|
196
|
+
|
|
197
|
+
## Closed layout constructs
|
|
198
|
+
|
|
199
|
+
Each construct is a closed field lowered on the element's own path
|
|
200
|
+
(`src/lowering-region-layout.mts`). Two constructs that write one property
|
|
201
|
+
differently on one element are rejected (`construction/extent-conflict`,
|
|
202
|
+
`construction/element-normalization-conflict`); input order settles nothing.
|
|
203
|
+
The example design system's Inspector (`patterns/Inspector/Inspector/Inspector.tsx`) uses
|
|
204
|
+
them all.
|
|
205
|
+
|
|
206
|
+
| Field | On | Lowers to | Rejected when |
|
|
207
|
+
| --- | --- | --- | --- |
|
|
208
|
+
| frame profile `paddingInline` / `paddingBlock` | frame | logical insets per axis | the profile also sets `padding` (`construction/frame-field-conflict`) |
|
|
209
|
+
| frame profile `paddingInlineStart` / `paddingInlineEnd` / `paddingBlockStart` / `paddingBlockEnd` | container frame, control frame | one side's inset, where the two sides of an axis differ (a tag padded more before its remove button). On a control frame a block side's inset is its least inset, and `minimumBlockInset` is the block axis's field | the profile also sets that side's axis or `padding`; on a control frame, a block inset beside `minimumBlockInset` (`construction/frame-field-conflict`) |
|
|
210
|
+
| `frame: { profile: "<frame profile>" }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (`box-sizing: border-box`) | another field beside `profile`; a frame field the profile misuses, as on a root |
|
|
211
|
+
| `frame: { rules: ["block-end", …] }` (root), `frame: { kind: "control", rules: [...] }` (control part) | region root, control part | the profile's `border-width`, solid, on the named logical sides only, painted by the element's surface `border-color` (mirrors in RTL); on a control part an unruled side keeps the border's space as inset, so the box and its text do not move (a soft field's underline) | empty or repeated sides; no profile width (`rule-width-missing`); no surface border colour (`rule-paint-missing`); on a grid |
|
|
212
|
+
| `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a frame profile without `radius` (`profile-field-missing`) |
|
|
213
|
+
| `at: { <condition>: { frame: { rules?, corners? } } }` | region root with a `frame` | under the named condition of the root's spatial profile (`@media (width < bound)`), only the border and corner writes that differ: a divider that is the block-end edge when wide and the inline-start edge when narrow | a condition the spatial profile does not name (`construction/condition-unknown`); `rules` under the condition without `rules` on the frame; more than one condition |
|
|
214
|
+
| `accessibility: { boundary: "visible-label" \| "boundary-on-interaction", reason }` | control part (`frame: "control"`, a text-like input, textarea or select) | nothing: its border contrast error becomes the review item `boundary-identified-otherwise`; acceptance enforces human approval | another kind, a reason outside 20–300 characters (`accessibility-declaration-invalid`); another part (`accessibility-declaration-unsupported`); an approver, date or other field (`field-unsupported`) |
|
|
215
|
+
| `overflow: "clip" \| "scroll-block" \| "scroll-inline" \| "scroll-both"` | root, part | `overflow` (physical x/y pair of the horizontal writing mode) and a released axis minimum | on a top-layer root (`profile-provider-conflict`); with truncation |
|
|
216
|
+
| `align` / `justify` on an element that scrolls | root, part | `safe center` / `safe end` on the axis the element itself scrolls: content stays aligned while it fits and starts at the scroll origin when it overflows, so its start is never unreachable | n/a (automatic) |
|
|
217
|
+
| a rounded frame (`radius`) with visible overflow | region root | n/a | a first or last part of a stack, or a layer, that paints a background over a corner with no inset there (`construction/corner-overpaint`): clip the root, inset it, or round the part |
|
|
218
|
+
| `sticky: { edge: "block-start" \| "block-end", clear?: "block-start" }` | root (not a top-layer root), part | `position: sticky` at that edge of the nearest scrolling container (`inset-block-start: 0`); with `clear`, below the region the layer profile's `clearBlockStart` names; `z-index` from the layer profile's `stickyLayer` when it has one | `clear` with the end edge; `clear` without a layer profile that states `clearBlockStart` |
|
|
219
|
+
| `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released; `align-self: stretch` with `fill-both` | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
|
|
220
|
+
| `extent: "content" \| "container"` | root of an `inline` row, or of a control | `"content"` (the default): as wide as its content, never wider than its container (`display: inline-flex; max-inline-size: 100%`, or `min(100%, <cap>)` under its frame's own cap); `"container"`: the width available in any parent, a block one, a column that aligns its children, or a row beside siblings (`display: flex; inline-size: 100%`), so a filling part has the rest of the row | on a `stack`, `flow`, `layered` or top-layer root, which never hug (`spec/field-unsupported`); `"container"` with a frame that fixes the row's width (`construction/extent-conflict`); a part with `extent: "fill"` in a `"content"` row whose frame does not fix its width (`construction/extent-row-hugs`) |
|
|
221
|
+
| `layout: "layered"` | root, part recipe | one `minmax(0,1fr)` grid area; every declared child part at `1 / 1`; paint order is DOM order, no `z-index` | fewer than two parts (`layered-parts-missing`); `gap` or `wrap` |
|
|
222
|
+
| `outset: { block?, inline? }` (spacing fields) | a childless, non-text part of a `layered` parent | `margin-block` / `margin-inline: calc(-1 * <spacing>)`: the backdrop is drawn past its parent's box (a glow behind a card); the grid area and the layout around it are unchanged | any other part (`construction/outset-unsupported`) |
|
|
223
|
+
| `scheme: "light" \| "dark"` | a visual part rendered as a content `<img>`; its sibling declares the other scheme | `display: var(--ads-not-light, block)` (or `--ads-not-dark`): the image is displayed under its colour scheme and `display: none` under the other, by the scheme switches `foundation.css` writes wherever it sets `color-scheme` (root `data-theme`, a themed section, the OS preference); no script. An `at` condition still hides the part: it is displayed where both show it | siblings without exactly one `light` and one `dark` part (`spec/value-invalid`); a part that is not visual (`spec/field-unsupported`); a part that is not an `<img>` or has an artwork binding (`source/scheme-image-element`, `construction/scheme-unsupported`); an image without `width` or `height` (`source/scheme-image-size-missing`); the image of the scheme the first declared theme does not have without `loading="lazy"` in every choice (`source/scheme-image-not-lazy`) |
|
|
224
|
+
| control `layout: "stack"` | control | visual above label; the control box centres visual + gap + line | `justify` |
|
|
225
|
+
| `at: { "<condition>": { visible } }` | part | `display: none` inside the condition's range, the part's own display inside its complement | unknown condition (`condition-unknown`); a required part hidden (`condition-hides-required`); more than one condition |
|
|
226
|
+
| `at: { "<condition>": { visual: "<visual profile>" } }` | visual part (`kind: "visual"`) | the part's geometry at that profile's size, inside the condition's range; may stand beside `visible` | a part that is not a visual, cropped or inspected media, or a size that selects another drawing of the asset (`construction/condition-visual-unsupported`) |
|
|
227
|
+
| `recipe.conditionQuery["<condition>"]` | owner code | the literal media range the CSS writes (`(width < 47.5rem)`), for `matchMedia` | the recipe's spatial profile lacks it (`choice/recipe-access-unsupported`) |
|
|
228
|
+
| `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary"`, `marker: "none"` | root, part | the element's closed UA normalization (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
|
|
229
|
+
| `normalize: { textDecoration: "none", pointerEvents: "none", borderStyle: "none" }` | root, `normalize.when` | `text-decoration-line`, `pointer-events`, `border-style` | pointer transparency on focusable or interactive, non-`aria-hidden` markup (`source/pointer-transparent-interactive`) |
|
|
230
|
+
| `normalize: { cursor, touchAction, userSelect }`, `snap` | root, part, `normalize.when`; scrolling arrangement | see [interaction properties](#interaction-properties) | a value outside its set (`spec/value-invalid`); snap without scrolling (`snap-without-scroll`) |
|
|
231
|
+
| `wrap: "anywhere" \| "never" \| "truncate" \| "balance" \| "pretty"` (`true` = anywhere), `textAlign`, `reserveLines: 1–3` | text part | `overflow-wrap`, `white-space`, one-line ellipsis truncation, `text-wrap: balance \| pretty` (without support: normal wrapping); `text-align`; `min-block-size: Nlh` | reserved lines without a text profile (`reserve-without-text`) |
|
|
232
|
+
| `wrap: "truncate", lines: 2 \| 3` | text part | a clamp: at most N lines, the last ending in "…" (`line-clamp` beside `display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp`, `overflow: hidden`) | `lines: 1` or another value (one line is plain `truncate`); `reserveLines` above `lines` (`spec/value-invalid` at `reserveLines`, naming both); `lines` with another `wrap`; on a declared `element`; an arrangement's display (`extent-conflict`); on, or inside, a control or form label (`source/clamp-on-control`) |
|
|
233
|
+
| control label `wrap`: absent, `true`/`"anywhere"`, `"never"` | control text part | breaks between words when one word alone would overflow (`overflow-wrap: break-word`, the default), anywhere, or never: one line, and the control does not shrink below the label's width | `"truncate"` or another value |
|
|
234
|
+
| `kind: "vector", surface, stroke: { slot: "visual", field }` | part | `stroke` from a colour-only surface, `stroke-width` from the visual profile, `fill: none`, non-scaling stroke; any number of data-driven shapes | a surface with other fields (`vector-surface-unsupported`); not an SVG shape under an owned `<svg>` |
|
|
235
|
+
| `kind: "visual", media: "inspected-svg"` | part | contains the inserted drawing within the visual profile's size; its intrinsic size is data | markup, children or `dangerouslySetInnerHTML` in the part (`source/inspected-svg-inline`); the owner parses markup (`source/inspected-svg-parsed`) |
|
|
236
|
+
|
|
237
|
+
ADS parses the inspected project's SVG once (`sanitizeInspectedSvg` from
|
|
238
|
+
`@reqvire-org/ads/inspection`, run by the host): SVG elements only, no scripts,
|
|
239
|
+
foreign content, links, images, animations, handlers or external references,
|
|
240
|
+
the caller's size, hidden from assistive technology. The owner inserts the
|
|
241
|
+
element it receives.
|
|
242
|
+
|
|
243
|
+
No runtime measures text. `wrap` is one field, so balance or pretty never meets
|
|
244
|
+
truncation. `balance` evens out line lengths and suits headings and short
|
|
245
|
+
titles (browsers balance only a few lines). `pretty` avoids a lone short word
|
|
246
|
+
on a paragraph's last line and suits body text. A clamp (`lines`) keeps a grid
|
|
247
|
+
of cards even by cutting long text; `reserveLines` keeps short text from
|
|
248
|
+
shrinking the card. Together, a description always takes exactly its lines:
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
parts: { description: { selector: ".card-desc", kind: "text",
|
|
252
|
+
wrap: "truncate", lines: 2, // at most 2 lines, then "…"
|
|
253
|
+
reserveLines: 2 } } // always 2 lines' height
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
What analysis cannot prove is a nonblocking `owner-analysis-review` note: a
|
|
257
|
+
scroll container with nothing focusable in or on it
|
|
258
|
+
(`review/scroll-unreachable`); a markerless summary without artwork
|
|
259
|
+
(`review/marker-none-unlabelled`); truncated or clamped text without a `title`
|
|
260
|
+
(`review/truncated-text-unnamed`: analysis cannot see an expand control or the
|
|
261
|
+
full content elsewhere); `balance` on a text part rendered as a `<p>`
|
|
262
|
+
(`review/balance-on-paragraph`, at the part's `wrap`: use `pretty`, or a
|
|
263
|
+
heading element).
|
|
264
|
+
|
|
265
|
+
## State, focus and motion
|
|
266
|
+
|
|
267
|
+
`when` on a recipe or part selects shared profiles by state:
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
recipe({
|
|
271
|
+
surface: "action-surface",
|
|
272
|
+
when: { "&:hover:not(:disabled)": { surface: "action-hover-surface" } },
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
A `when` key is a state of the owner's root, in a closed grammar
|
|
277
|
+
([state-conditions.mts](../src/state-conditions.mts)): `&` followed by one or
|
|
278
|
+
more of `:hover`, `:active`, `:focus`, `:focus-visible`, `:focus-within`,
|
|
279
|
+
`:disabled`, `:enabled`, `:checked`, `:indeterminate`, `[aria-*]`, `[data-*]`
|
|
280
|
+
or `[open]` (an attribute optionally with one double-quoted value), each
|
|
281
|
+
optionally inside `:not(…)`. The example design system uses hover and active excluding
|
|
282
|
+
disabled, `&[aria-busy="true"]`, `&[data-user-invalid]`, `&[data-autofill]` and
|
|
283
|
+
`&[open]`.
|
|
284
|
+
|
|
285
|
+
A `when` entry may also select the element's text: `when: {
|
|
286
|
+
'&[aria-pressed="true"]': { text: "label-strong" } }` on a text part, a root
|
|
287
|
+
or a control. The state's text profile may differ from the element's own in
|
|
288
|
+
`fontWeight` and `letterSpacing` only (`construction/state-text-field`
|
|
289
|
+
otherwise), so the line and the box's height stay where they are. A heavier
|
|
290
|
+
weight is wider: whether the box may grow with it is the designer's choice.
|
|
291
|
+
|
|
292
|
+
A state of one of the recipe's own direct parts is also a state of the root,
|
|
293
|
+
written `:has(> .part:state)` with `:checked`, `:indeterminate`,
|
|
294
|
+
`:focus-visible`, `:hover` or `:disabled`:
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
parts: {
|
|
298
|
+
input: { selector: ".ds-checkbox-input" }, // the native <input type="checkbox">
|
|
299
|
+
box: {
|
|
300
|
+
selector: ".ds-checkbox-box", surface: "control-surface",
|
|
301
|
+
when: {
|
|
302
|
+
"&:has(> .ds-checkbox-input:checked)": { surface: "action-surface" },
|
|
303
|
+
"&:has(> .ds-checkbox-input:focus-visible)": { surface: "focused-control-surface" },
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
A checkbox's drawn box follows its native input without script, and a field's
|
|
310
|
+
control reacts to its own hover (`&:has(> .ds-field-control:hover)`), not to
|
|
311
|
+
the label's. The class must be a direct part of the recipe, and nothing else
|
|
312
|
+
goes inside `:has()`.
|
|
313
|
+
|
|
314
|
+
Anything else is rejected where authored (`spec/condition-unsupported`):
|
|
315
|
+
a pseudo-element (`&::placeholder`), a combinator or class (`& > .child`), a
|
|
316
|
+
type, a nested `&`, another attribute operator or a functional pseudo-class
|
|
317
|
+
(`:has`, `:is`, `:dir`). Lowering appends the part path to the condition, so
|
|
318
|
+
such a key would select a different element or none.
|
|
319
|
+
|
|
320
|
+
A `when` entry selects surfaces, which carry paint only: frames, padding and
|
|
321
|
+
sizes never change by state. Overlapping states that set one paint need
|
|
322
|
+
excluding conditions (`&[data-autofill]:not([data-user-invalid])`). An
|
|
323
|
+
appearance contract never creates dragging, activation, loading or a state
|
|
324
|
+
machine: ordinary behavior owns the state (native Disclosure binds the actual
|
|
325
|
+
`details.open`).
|
|
326
|
+
|
|
327
|
+
**Form states** are attribute states of the root. `:user-invalid`,
|
|
328
|
+
`:user-valid` and `:autofill` match a field's `<input>`, never its owner root,
|
|
329
|
+
so they are rejected with a pointer to the states that the form-field bridge
|
|
330
|
+
(the example design system's `controllers/FormField`) mirrors onto the root:
|
|
331
|
+
`[data-user-invalid]` (an error is shown: a constraint error after interaction,
|
|
332
|
+
or the application's error), `[data-user-valid]` (interacted and valid) and
|
|
333
|
+
`[data-autofill]` (the browser filled it). Owner analysis holds two rules for
|
|
334
|
+
them ([form-states.mts](../src/form-states.mts)):
|
|
335
|
+
|
|
336
|
+
- `source/form-state-colour-only`: an error state (`[data-user-invalid]`,
|
|
337
|
+
`[data-invalid]`, `[aria-invalid="true"]`) or the autofill state shown by
|
|
338
|
+
colour alone. A treatment under the state adds a ring or edge (`boxShadow`),
|
|
339
|
+
a pattern (`backgroundImage`) or a border that appears.
|
|
340
|
+
- `source/autofill-layout-shift`: a `borderStyle` normalization or a press
|
|
341
|
+
`scale` under the autofill state.
|
|
342
|
+
|
|
343
|
+
The [forms guide](../skills/ads-designer/references/forms.md)
|
|
344
|
+
(`ads://guides/forms`) covers the timing and the bridge.
|
|
345
|
+
|
|
346
|
+
**Placeholder text.** A part that renders an `<input>` or `<textarea>` can
|
|
347
|
+
treat its placeholder. The pseudo-element surface is colour only, with its own
|
|
348
|
+
owner-state treatments:
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
control: {
|
|
352
|
+
selector: ".ds-field-control", kind: "text", surface: "control-surface",
|
|
353
|
+
when: { "&[data-user-invalid]": { surface: "invalid-control-surface" } },
|
|
354
|
+
pseudo: {
|
|
355
|
+
placeholder: {
|
|
356
|
+
surface: "placeholder-foreground",
|
|
357
|
+
when: { "&[data-user-invalid]": { surface: "error-foreground" } },
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
It lowers to `& > .ds-field-control::placeholder { color; opacity: 1 }` and
|
|
364
|
+
`&[data-user-invalid] > .ds-field-control::placeholder { color }`. The
|
|
365
|
+
pseudo-element is always last; `opacity: 1` removes Firefox's default dimming.
|
|
366
|
+
`placeholder` is the only pseudo-element, and another element cannot host it
|
|
367
|
+
(`source/pseudo-host-unsupported`).
|
|
368
|
+
|
|
369
|
+
**Contrast**, in every theme, brand and token condition:
|
|
370
|
+
|
|
371
|
+
- The placeholder colour needs 4.5:1 against the part's own background colour,
|
|
372
|
+
for every placeholder state against every background state it can meet
|
|
373
|
+
(`construction/placeholder-contrast-insufficient`). A part without an opaque
|
|
374
|
+
background of its own cannot be proven and is rejected
|
|
375
|
+
(`construction/placeholder-contrast-unresolved`).
|
|
376
|
+
- Where a `when` surface's colour meets a background from another surface
|
|
377
|
+
profile, the pair needs 4.5:1 (`construction/state-contrast-insufficient`; an
|
|
378
|
+
unprovable pair is the review note `review/state-contrast-unresolved`).
|
|
379
|
+
States that exclude each other (two values of one attribute, a state and its
|
|
380
|
+
`:not()`) are never paired.
|
|
381
|
+
- A profile's own colour and background are checked with the profile
|
|
382
|
+
(`surface-contrast`).
|
|
383
|
+
- An element whose surface sets only a colour (a link, secondary text, a badge
|
|
384
|
+
label) is checked on the background around it (`component-contrast`; see
|
|
385
|
+
[composed text contrast](ADS.md#composed-text-contrast)).
|
|
386
|
+
|
|
387
|
+
**Focus and motion.** Focus uses the focus slot. Motion is an ordinary profile
|
|
388
|
+
kind consumed through the selected composite's motion slot.
|
|
389
|
+
[MOTION.md](MOTION.md) owns its constructs:
|
|
390
|
+
[part effects](MOTION.md#effect-and-state-semantics) (`transition` channels with
|
|
391
|
+
typed `when` endpoints), the [root press](MOTION.md#root-press),
|
|
392
|
+
[`paintTransition`](MOTION.md#paint-transitions) and
|
|
393
|
+
[`enter`](MOTION.md#entrances), an entrance on first render,
|
|
394
|
+
[motion on a region's parts](MOTION.md#motion-on-a-regions-parts),
|
|
395
|
+
[`play`](MOTION.md#sequences) for a sequence of steps, and `motion` on a
|
|
396
|
+
[measured value](MOTION.md#animating-a-measured-value). An animation is
|
|
397
|
+
[defined in the recipe and controlled in script](MOTION.md#defined-in-the-recipe-controlled-in-script).
|
|
398
|
+
|
|
399
|
+
## Prose: long-form content
|
|
400
|
+
|
|
401
|
+
Articles, documentation, legal text and anything a content system or Markdown
|
|
402
|
+
produces is markup the owner does not write. A recipe with `layout: "prose"`
|
|
403
|
+
styles it: a closed set of plain flow elements inside its root, wherever they
|
|
404
|
+
nest.
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const article = recipe({
|
|
408
|
+
layout: "prose",
|
|
409
|
+
profile: "article", // spacing and surface slots, as any recipe
|
|
410
|
+
rhythm: { slot: "spacing", field: "contentGap" }, // the space between blocks
|
|
411
|
+
elements: {
|
|
412
|
+
paragraph: { text: "body" },
|
|
413
|
+
heading2: { text: "heading-2", spaceBefore: { slot: "spacing", field: "sectionGap" } },
|
|
414
|
+
link: { surface: "link", when: { "&:hover": { surface: "link-hover" } } },
|
|
415
|
+
strong: { text: "body-strong" },
|
|
416
|
+
list: { indent: { slot: "spacing", field: "indent" } },
|
|
417
|
+
item: { marker: "list-marker" },
|
|
418
|
+
quote: { surface: "quote", frame: "quote-frame" },
|
|
419
|
+
rule: { surface: "divider", frame: "divider-frame" },
|
|
420
|
+
pre: { surface: "code-block", text: "code" },
|
|
421
|
+
},
|
|
422
|
+
}).root;
|
|
423
|
+
|
|
424
|
+
export function Prose({ children }: { children: ReactNode }) {
|
|
425
|
+
return <div className={article}>{children}</div>;
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
```tsx
|
|
430
|
+
<Prose>
|
|
431
|
+
<h2>Title</h2>
|
|
432
|
+
<p>Text with a <a href="/docs">link</a>.</p>
|
|
433
|
+
<Callout tone="info">A component among the content.</Callout>
|
|
434
|
+
</Prose>
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**The elements.** The set is what Markdown produces (CommonMark with tables and
|
|
438
|
+
strikethrough) and the common HTML beside it:
|
|
439
|
+
|
|
440
|
+
| Element | Tags | Element | Tags |
|
|
441
|
+
| --- | --- | --- | --- |
|
|
442
|
+
| `paragraph` | `p` | `link` | `a` |
|
|
443
|
+
| `heading1` … `heading6` | `h1` … `h6` | `strong` | `strong`, `b` |
|
|
444
|
+
| `list` | `ul`, `ol` | `emphasis` | `em`, `i` |
|
|
445
|
+
| `item` | `li` | `deleted` | `del`, `s` |
|
|
446
|
+
| `quote` | `blockquote` | `code` | `code` |
|
|
447
|
+
| `rule` | `hr` | `sub`, `sup` | `sub`, `sup` |
|
|
448
|
+
| `pre` | `pre` | `kbd` | `kbd` |
|
|
449
|
+
| `table`, `headerCell`, `cell` | `table`, `th`, `td` | `mark` | `mark` |
|
|
450
|
+
| `figure`, `caption` | `figure`, `figcaption` | `descriptions`, `term`, `definition` | `dl`, `dt`, `dd` |
|
|
451
|
+
| `media` | `img`, `video`, `iframe` | | |
|
|
452
|
+
|
|
453
|
+
**An element is a part selected by tag.** Each entry names profiles: `text`
|
|
454
|
+
(a text profile), `surface` (a surface profile, with `when` for its states) and
|
|
455
|
+
`frame` (a frame profile: padding, borders, radius, sizes). Three extras belong
|
|
456
|
+
to one element each: `spaceBefore` on a block (it replaces the rhythm before
|
|
457
|
+
it), `indent` on `list`, and `marker` on `item` (a colour-only surface).
|
|
458
|
+
|
|
459
|
+
**What ADS guarantees.**
|
|
460
|
+
|
|
461
|
+
- **Only elements without a class are styled** (`p:not([class])`). Every
|
|
462
|
+
element an ADS owner renders has a class, so a component placed in the
|
|
463
|
+
content keeps its own design, and a paragraph inside that component is the
|
|
464
|
+
component's.
|
|
465
|
+
- **Nesting follows HTML.** A list in a list, a paragraph in a quote, a link in
|
|
466
|
+
a table cell: each is styled where it stands.
|
|
467
|
+
- **The rhythm is even.** Every block takes the rhythm (or its own
|
|
468
|
+
`spaceBefore`) before it, declared or not, and the first plain element of
|
|
469
|
+
the root and of each plain container starts flush. Browser margins, a
|
|
470
|
+
quote's and a figure's indent, a rule's inset border, a table's doubled
|
|
471
|
+
borders and media wider than its column are replaced.
|
|
472
|
+
- **A component among the blocks is spaced like them.** A component placed
|
|
473
|
+
directly in the prose root takes the rhythm before it (unless it comes
|
|
474
|
+
first); nothing else of it changes. A component inside a paragraph is inline
|
|
475
|
+
content and is left alone.
|
|
476
|
+
- **A table's structure and line breaks are content.** `thead`, `tbody`,
|
|
477
|
+
`tfoot` and `tr` come with a declared `table`, and `br` with any prose; no
|
|
478
|
+
rule is written for them.
|
|
479
|
+
- **Contrast is proven.** Each declared colour (base and state surfaces) is
|
|
480
|
+
checked on the root's background and on the background of every declared
|
|
481
|
+
element that can contain it, in every theme and brand:
|
|
482
|
+
`construction/prose-contrast-insufficient`. A code block holds code, so a
|
|
483
|
+
link's colour is not held to it.
|
|
484
|
+
- **The source of the markup does not matter.** JSX children, rendered
|
|
485
|
+
Markdown and HTML from a content system are styled alike.
|
|
486
|
+
|
|
487
|
+
**Content as an HTML string.** A content system or a Markdown renderer hands
|
|
488
|
+
the application a string. Application source cannot inject it
|
|
489
|
+
(`dangerouslySetInnerHTML` is a design prop to `ads-guard`), and it should not:
|
|
490
|
+
the injection belongs in one place. Give the same recipe a second component
|
|
491
|
+
that takes the string:
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
export function ProseHtml({ html }: { html: string }) {
|
|
495
|
+
return <div className={article} dangerouslySetInnerHTML={{ __html: html }} />;
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
The application passes `html` as a plain prop. The string is injected as
|
|
500
|
+
written, so **the application sanitises it first**: ADS checks source, not
|
|
501
|
+
strings, and unsanitised HTML from outside is a security hole. Classes inside
|
|
502
|
+
the string are not styled by prose (only classless elements are), and elements
|
|
503
|
+
the recipe does not declare are drawn in the root's text without any report,
|
|
504
|
+
because no check reads the string. The example design system's Prose pattern exports both
|
|
505
|
+
forms.
|
|
506
|
+
|
|
507
|
+
**What a prose recipe does not have.** No `parts`, `gap`, `align` or `layer`:
|
|
508
|
+
prose flows. An element the recipe does not declare is drawn in the root's
|
|
509
|
+
text; the markup checks report it where content uses it
|
|
510
|
+
(`prose-element-undeclared`), so the gap shows up where it matters.
|
|
511
|
+
|
|
512
|
+
**The markup checks.** In scenarios, mocks and application source, plain flow
|
|
513
|
+
markup is accepted as the content of a prose owner: inside its element, through
|
|
514
|
+
plain prose elements only. A component between the owner and the element owns
|
|
515
|
+
what is inside it. An element outside the set (`div`, `span`, `section`) is
|
|
516
|
+
still markup of the file's own. `ads emit` records the prose owners in
|
|
517
|
+
`ads-prose.json` beside the entry, which is how `ads-guard` knows them.
|
|
518
|
+
|
|
519
|
+
## Sticky elements
|
|
520
|
+
|
|
521
|
+
A bar, a contents list or a table header that stays in view while its container
|
|
522
|
+
scrolls declares `sticky` on its root or on the part:
|
|
523
|
+
|
|
524
|
+
```ts
|
|
525
|
+
profile({ name: "under-bar", kind: "layer", fields: { clearBlockStart: "--bar-height", stickyLayer: "--layer-sticky" } });
|
|
526
|
+
|
|
527
|
+
const bar = recipe({ layout: "inline", profile: "site-bar", sticky: { edge: "block-start" } }).root;
|
|
528
|
+
const page = recipe({
|
|
529
|
+
layout: "stack",
|
|
530
|
+
profile: "docs-page", // its composite selects layerProfile: "under-bar"
|
|
531
|
+
parts: { contents: { selector: ".ux-contents", sticky: { edge: "block-start", clear: "block-start" } } },
|
|
532
|
+
}).root;
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
- The element sticks inside its nearest scrolling container: the page, or an
|
|
536
|
+
ancestor that scrolls (a table header in a scrolling table). ADS does not
|
|
537
|
+
choose the container; an ancestor that scrolls on that axis becomes it.
|
|
538
|
+
- `clear: "block-start"` holds the element below a bar at the top by one shared
|
|
539
|
+
token, the layer profile's `clearBlockStart`, the same field an anchored
|
|
540
|
+
popover clears by. Change the bar's height in one place.
|
|
541
|
+
- The layer profile's `stickyLayer` (role `layer`) stacks the element above
|
|
542
|
+
positioned content that scrolls under it. Without it the element keeps its
|
|
543
|
+
place in document order.
|
|
544
|
+
- Only block edges stick. A top-layer root takes no `sticky`.
|
|
545
|
+
|
|
546
|
+
## Top-layer roots
|
|
547
|
+
|
|
548
|
+
A region recipe's root can live in the browser's top layer: a closed `layer`
|
|
549
|
+
clause, on the recipe root only (`spec/field-unsupported` on a part). Its
|
|
550
|
+
`element` selects the variant and the fields it admits:
|
|
551
|
+
|
|
552
|
+
```ts
|
|
553
|
+
recipe({
|
|
554
|
+
layout: "stack",
|
|
555
|
+
profile: "workspace-drawer", // spatial, frame, surface and motion slots
|
|
556
|
+
frame: {},
|
|
557
|
+
layer: {
|
|
558
|
+
element: "dialog", edge: "start",
|
|
559
|
+
backdrop: { surface: "scrim-surface", dismiss: "press" },
|
|
560
|
+
motion: "slide", modalBelow: "lg",
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
recipe({
|
|
564
|
+
layout: "stack",
|
|
565
|
+
profile: "menu-popover", // frame, surface, spacing, layer and motion slots
|
|
566
|
+
frame: {},
|
|
567
|
+
layer: { element: "popover", popover: "auto", corner: { block: "start", inline: "end" }, clear: "block-start", motion: "fade" },
|
|
568
|
+
});
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
- **Modal sheet** (`element: "dialog"`; `edge: "start" | "end"`): a `<dialog>`
|
|
572
|
+
the owner opens with `showModal()`. Containment, page inertness, Escape and
|
|
573
|
+
focus return are native. It covers the full block extent from its logical
|
|
574
|
+
`edge` (mirrored in RTL). The backdrop surface paints `::backdrop`, background
|
|
575
|
+
only (`construction/backdrop-surface-unsupported`). With `dismiss: "press"`
|
|
576
|
+
(not `"none"`) the owner closes on a press outside the sheet's box, so the
|
|
577
|
+
root carries no padding (`construction/layer-root-padding`); padding belongs
|
|
578
|
+
to an owned child with its own frame. Every modal sheet also emits the
|
|
579
|
+
document scroll lock `html:has(:modal) { overflow: hidden }` once in its
|
|
580
|
+
owner's sheet.
|
|
581
|
+
- **Anchored popover** (`element: "popover"`; `popover: "auto" | "manual"`): a
|
|
582
|
+
non-modal panel pinned to a viewport `corner` by logical insets, with light
|
|
583
|
+
dismiss and Escape from `popover="auto"`. A `layer` profile (`edge-gap`,
|
|
584
|
+
`viewport-margin` and, for `clear: "block-start"`, `clear-block-start`)
|
|
585
|
+
places it; `100dvh` bounds its height. The clearance must resolve to a fixed
|
|
586
|
+
length (`construction/layer-clearance-unbounded`).
|
|
587
|
+
- **Measured popover** (`placement: "measured"`): the same panel, anchored by
|
|
588
|
+
the owner to an element (its trigger, a pointer, a text selection). The
|
|
589
|
+
compiler fixes it in the top layer with every inset released and its size
|
|
590
|
+
within the viewport less the layer profile's `viewport-margin`. The owner
|
|
591
|
+
writes the position through the recipe's
|
|
592
|
+
[measured values](#measured-runtime-geometry), which the panel reads only
|
|
593
|
+
while open. Its root declares at least one measured inset or `translate`
|
|
594
|
+
(`construction/measured-placement-missing`); `corner` and `clear` do not
|
|
595
|
+
apply. CSS anchor positioning is not used: it cannot follow a pointer or a
|
|
596
|
+
selection.
|
|
597
|
+
|
|
598
|
+
The compiler normalizes the UA box (inset, margin, padding, border, size
|
|
599
|
+
limits) and writes the arrangement's `display` only under the native open state
|
|
600
|
+
(`&[open]`, `&:popover-open`), so an author `display` never beats the UA's
|
|
601
|
+
closed `display: none`. Open-state conditions are compiler-issued; `when` keeps
|
|
602
|
+
its closed grammar. The frame and normalization of a layer root write no
|
|
603
|
+
placement (`construction/layer-frame-position`). A layer's motion and a paint
|
|
604
|
+
transition cannot share the root's transition set
|
|
605
|
+
(`construction/profile-provider-conflict`).
|
|
606
|
+
|
|
607
|
+
Motion uses the recipe's motion slot with the `static` reduced policy: a sheet
|
|
608
|
+
slides its own extent from its edge (`"slide"`), a popover fades (`"fade"`).
|
|
609
|
+
Opening starts from `@starting-style` in every browser. Closing keeps
|
|
610
|
+
`display` and `overlay` through `transition-behavior: allow-discrete`: a
|
|
611
|
+
browser that can transition `overlay` animates the exit, any other closes at
|
|
612
|
+
once (the contract's platform inventory lists both features with how each
|
|
613
|
+
degrades). Reduced motion zeroes `transition-duration` and `transition-delay`
|
|
614
|
+
and never writes what `@starting-style` writes.
|
|
615
|
+
|
|
616
|
+
Owner analysis checks the root: a modal sheet renders a `<dialog>`, a popover
|
|
617
|
+
the declared `popover` value (`source/layer-element-mismatch`); a sheet never
|
|
618
|
+
renders `open` (`source/layer-open-attribute`); a dialog, and a popover with
|
|
619
|
+
`role="dialog"`, is named (`source/layer-name-missing`); a layer root is not a
|
|
620
|
+
grid cell (`source/layer-in-grid-cell`). Behavior guarantees (focus, Escape, inertness, dismissal) are browser tests,
|
|
621
|
+
not static rules.
|
|
622
|
+
|
|
623
|
+
`modalBelow` names a breakpoint of the recipe's spatial profile
|
|
624
|
+
(`construction/layer-tier-unknown`). The recipe then exposes `modalQuery`, the
|
|
625
|
+
media term the spatial algebra writes for the range below that tier
|
|
626
|
+
(`"(width < 66rem)"`). Emission replaces each `recipe.modalQuery` read with
|
|
627
|
+
that literal, so the owner's `matchMedia` and the CSS agree. It is a viewport
|
|
628
|
+
query, so the owner's grids must not respond to a container
|
|
629
|
+
(`source/layer-modal-context`). Reading it from another recipe is
|
|
630
|
+
`choice/recipe-access-unsupported`. The example design system's Shell closes its sheet when
|
|
631
|
+
the viewport leaves that range and moves focus to the in-track navigation.
|
|
632
|
+
|
|
633
|
+
## Measured runtime geometry
|
|
634
|
+
|
|
635
|
+
Some geometry is known only at runtime: an anchored popup's position and the
|
|
636
|
+
space below its trigger, a splitter's track, a virtualized row's offset, a
|
|
637
|
+
dragged item's translation. A recipe declares each such value; nothing else an
|
|
638
|
+
owner writes reaches the style.
|
|
639
|
+
|
|
640
|
+
```ts
|
|
641
|
+
const panel = recipe({
|
|
642
|
+
layout: "stack",
|
|
643
|
+
profile: "menu-popover",
|
|
644
|
+
frame: {},
|
|
645
|
+
layer: { element: "popover", popover: "auto", placement: "measured" },
|
|
646
|
+
measured: {
|
|
647
|
+
x: { type: "length", property: "inset-inline-start" },
|
|
648
|
+
y: { type: "length", property: "inset-block-start" },
|
|
649
|
+
available: { type: "length", property: "max-block-size" },
|
|
650
|
+
},
|
|
651
|
+
});
|
|
652
|
+
const split = recipe({
|
|
653
|
+
layout: "fluid", profile: "split-layout", columns: 2, gutter: "narrow",
|
|
654
|
+
cells: { ".start": { start: 1, span: 1 }, ".end": { start: 2, span: 1 } },
|
|
655
|
+
measured: { start: { type: "size-track", property: "grid-template-columns", track: 1, fallback: 240 } },
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
// Owner code: ordinary TypeScript (or a declared library such as Floating UI) computes the numbers.
|
|
659
|
+
panel.measured.set(element, { x: box.left, y: box.bottom, available: innerHeight - box.bottom - 12 });
|
|
660
|
+
split.measured.set(root, { start: 320 });
|
|
661
|
+
split.measured.clear(root); // the fallbacks apply again
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
Each `type` (setter value; place) has a closed property list:
|
|
665
|
+
|
|
666
|
+
- `length` (a px number; root, top-level part): `inset-block-start`,
|
|
667
|
+
`inset-block-end`, `inset-inline-start`, `inset-inline-end`, `inline-size`,
|
|
668
|
+
`block-size`, `min-inline-size`, `max-inline-size`, `min-block-size`,
|
|
669
|
+
`max-block-size`.
|
|
670
|
+
- `transform` (`{ x, y }` px; root, top-level part): `translate`.
|
|
671
|
+
- `size-track` (a px number; grid root): one `track` (1-based) of the grid's
|
|
672
|
+
own `grid-template-columns` or `grid-template-rows`.
|
|
673
|
+
- `intrinsic-size` (`[width, height]`, the image file's own pixel size):
|
|
674
|
+
`inline-size` of a contained application image, a visual part whose visual
|
|
675
|
+
profile declares `fit: "contain"`.
|
|
676
|
+
- `position` (`[x, y]` in optical-centre coordinates: fractions of the image's
|
|
677
|
+
width and height from its centre, right and down positive, within ±0.5):
|
|
678
|
+
`object-position` of a cropped application image, a top-level visual part
|
|
679
|
+
whose visual profile declares `fit: "cover"`.
|
|
680
|
+
|
|
681
|
+
Rules:
|
|
682
|
+
|
|
683
|
+
- Each value lowers to an owner-private custom property, `--<owner>-m-<name>`
|
|
684
|
+
(the owner module's base name in kebab case), read by the declared property: `inset-inline-start: var(--anchored-menu-m-x, auto)`.
|
|
685
|
+
- Before the first set the fallback applies: the declared `fallback` (px; for a
|
|
686
|
+
`transform`, `{ x, y }`), else the construction's own value of that property
|
|
687
|
+
(a layer's viewport cap, the grid algebra's track, a released minimum), else
|
|
688
|
+
the property's initial value.
|
|
689
|
+
- A measured track is read in every tier, so the grid's list must have that
|
|
690
|
+
track in each (no `auto-fill` tiles, no inherited tracks).
|
|
691
|
+
- On a top-layer root the values are written under its open state (`&[open]`,
|
|
692
|
+
`&:popover-open`); the closed element keeps its own values. Only a
|
|
693
|
+
`placement: "measured"` popover takes a measured position.
|
|
694
|
+
- `recipe.measured.set(element, { … })` and `.clear(element)` are typed by the
|
|
695
|
+
declaration: an undeclared name is a type error and
|
|
696
|
+
`source/measured-undeclared`. They compile to plain
|
|
697
|
+
`element.style.setProperty`/`removeProperty` calls on the private names, with
|
|
698
|
+
no ADS runtime. Call them directly with an object literal; the setter is not
|
|
699
|
+
passed on. Custom properties inherit, so a part's value can be written on the
|
|
700
|
+
root.
|
|
701
|
+
- `recipe.measured.props({ … })` returns the same values as a `style`, for a
|
|
702
|
+
value known at render (a photo's focal point):
|
|
703
|
+
`<img {...image.measured.props({ focus })} />`. Server-rendered markup then
|
|
704
|
+
carries it and the first paint is right; a `set` in an effect would paint the
|
|
705
|
+
fallback first. It is the one spread an owned element takes (any other is
|
|
706
|
+
`source/spread-attribute`), is checked like `set`, and returns `{}` without a
|
|
707
|
+
value.
|
|
708
|
+
- Profiles keep the design values: padding, margin, gap, typography, borders,
|
|
709
|
+
radius and paint are not measured
|
|
710
|
+
(`construction/measured-property-unsupported`, which also covers a type's
|
|
711
|
+
wrong property, a track the grid lacks, and a position on a layer its clause
|
|
712
|
+
places). Neither is a property the element's frame profile supplies
|
|
713
|
+
(`construction/measured-profile-conflict`).
|
|
714
|
+
- One name per recipe, one value per property; nested parts and controls
|
|
715
|
+
declare none.
|
|
716
|
+
- A declared value the owner never sets is the review item
|
|
717
|
+
`review/measured-unused`. Any other DOM style write in an owner (`style`,
|
|
718
|
+
`setProperty`, `classList`, `setAttribute("style")`) is
|
|
719
|
+
`source/owner-style-write`, with this construct as the repair.
|
|
720
|
+
- Checks treat the values as unknown. Target size uses the fallback of a
|
|
721
|
+
measured size on a `frame: "control"` part and reviews it
|
|
722
|
+
(`review/target-size-unresolved`). Contrast is unaffected.
|
|
723
|
+
|
|
724
|
+
Measuring, positioning and releasing observers and listeners stay the owner's
|
|
725
|
+
code or a declared behaviour library; the compiler generates none.
|
|
726
|
+
|
|
727
|
+
## Interaction properties
|
|
728
|
+
|
|
729
|
+
Drag handles, splitters and carousels need pointer, touch and scrolling
|
|
730
|
+
behaviour. It is a recipe choice of closed literals, lowered to plain
|
|
731
|
+
declarations. Nothing new runs in the browser; the owner's behaviour code only
|
|
732
|
+
switches its own state on.
|
|
733
|
+
|
|
734
|
+
```ts
|
|
735
|
+
const split = recipe({
|
|
736
|
+
layout: "inline",
|
|
737
|
+
extent: "container",
|
|
738
|
+
align: "stretch",
|
|
739
|
+
parts: {
|
|
740
|
+
start: { selector: ".split-start", measured: { width: { type: "length", property: "inline-size", fallback: 240 } } },
|
|
741
|
+
grip: {
|
|
742
|
+
selector: ".split-grip",
|
|
743
|
+
normalize: {
|
|
744
|
+
cursor: "col-resize",
|
|
745
|
+
touchAction: "none", // touch-dragging doesn't scroll the page
|
|
746
|
+
userSelect: "none", // dragging doesn't select text
|
|
747
|
+
when: { '&[data-dragging="true"]': { cursor: "grabbing" } },
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
end: { selector: ".split-end", extent: "fill" },
|
|
751
|
+
},
|
|
752
|
+
});
|
|
753
|
+
// Owner code: <div data-dragging={dragging ? "true" : "false"}>, and on pointermove
|
|
754
|
+
split.measured.set(root, { width });
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
`resize: "vertical" | "none"` in a part's `normalize` states how the user may
|
|
758
|
+
resize a multi-line text field. It belongs on a part rendered as `<textarea>`
|
|
759
|
+
(`source/resize-not-textarea` otherwise) and takes no `when`.
|
|
760
|
+
|
|
761
|
+
The fields occur in a root's or a part's `normalize` and in its `when`:
|
|
762
|
+
|
|
763
|
+
- `cursor`: `pointer`, `default`, `grab`, `grabbing`, `col-resize`,
|
|
764
|
+
`row-resize`, `move`, `text` or `not-allowed`.
|
|
765
|
+
- `touchAction` (lowers to `touch-action`): `none`, `pan-x` or `pan-y`.
|
|
766
|
+
- `userSelect`: `none`. It lowers to `user-select` with its prefixed companion
|
|
767
|
+
`-webkit-user-select` (some engines read only the prefixed property; the
|
|
768
|
+
contract lists it as a prefixed form).
|
|
769
|
+
|
|
770
|
+
Rules:
|
|
771
|
+
|
|
772
|
+
- A part's `normalize` takes only these three fields. A root's (region or
|
|
773
|
+
control) also takes the native operations in
|
|
774
|
+
[the authoring invariant](#the-authoring-invariant). A vector part takes none.
|
|
775
|
+
- A part `when` key is an owner state in the closed
|
|
776
|
+
[`when` grammar](#state-focus-and-motion). The rule is written under the
|
|
777
|
+
owner's state with the part path appended
|
|
778
|
+
(`&[data-dragging="true"] > .split-grip { cursor: grabbing }`). A region
|
|
779
|
+
root's `normalize.when` keeps its owned selectors (`& > .part`).
|
|
780
|
+
- A part's own normalization and the root's for the same part cannot write one
|
|
781
|
+
property (`construction/extent-conflict`).
|
|
782
|
+
- Any other value (`touchAction: "manipulation"`, `cursor: "url(…)"`,
|
|
783
|
+
`userSelect: "text"`) is `spec/value-invalid` at the field.
|
|
784
|
+
- While dragging, the owner sets its state attribute on its root and writes the
|
|
785
|
+
position through its [measured values](#measured-runtime-geometry). The CSS
|
|
786
|
+
of both states already exists; the attribute selects it.
|
|
787
|
+
|
|
788
|
+
**Scroll snap follows ownership.** Snap spans the scrolling element and the
|
|
789
|
+
children it places. That element's arrangement declares both, as a grid places
|
|
790
|
+
its cells:
|
|
791
|
+
|
|
792
|
+
```ts
|
|
793
|
+
const carousel = recipe({
|
|
794
|
+
layout: "stack",
|
|
795
|
+
parts: {
|
|
796
|
+
track: {
|
|
797
|
+
selector: ".carousel-track", overflow: "scroll-inline",
|
|
798
|
+
recipe: { layout: "inline", snap: { type: "inline mandatory", align: "start" } },
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
});
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
- `snap.type` (`inline | block | both` + `mandatory | proximity`), on a region
|
|
805
|
+
root's recipe or a part's nested `recipe`, lowers to `scroll-snap-type` on
|
|
806
|
+
the element.
|
|
807
|
+
- `snap.align` (`start`, `center`, `end`) lowers to `scroll-snap-align` on its
|
|
808
|
+
children (`& > .carousel-track > *`).
|
|
809
|
+
- Both fields are required. The axes are logical, follow the writing mode and
|
|
810
|
+
are lowered as written (`scroll-snap-type: inline mandatory`); the physical
|
|
811
|
+
`x` and `y` are not accepted.
|
|
812
|
+
- The element must scroll on every axis it snaps (`scroll-inline` for `inline`,
|
|
813
|
+
`scroll-block` for `block`, `scroll-both` for `both`). Otherwise the
|
|
814
|
+
declaration has no effect and is `construction/snap-without-scroll`.
|
|
815
|
+
- A child never sets its own snap (a part's own `snap` is
|
|
816
|
+
`spec/field-unsupported`), and grids declare none.
|
|
817
|
+
|
|
818
|
+
Reviewed, never blocking: `userSelect: "none"` on an element that shows text
|
|
819
|
+
(a text part or treatment, or text parts inside it), which users cannot copy
|
|
820
|
+
(`review/user-select-text`); and `touchAction: "none"` in an owner whose markup
|
|
821
|
+
handles no pointer or touch events (`onPointer*`, `onTouch*`), which is dead on
|
|
822
|
+
touch screens (`review/touch-action-unhandled`).
|
|
823
|
+
|
|
824
|
+
## Runtime paint from data
|
|
825
|
+
|
|
826
|
+
Charts and data views paint items by their data: a series, a category, a status
|
|
827
|
+
from a feed. A recipe declares each such paint with the finite set of paint
|
|
828
|
+
tokens it can take. The owner selects one at runtime through the recipe's typed
|
|
829
|
+
setter.
|
|
830
|
+
|
|
831
|
+
```ts
|
|
832
|
+
const chart = recipe({
|
|
833
|
+
profile: "series-chart",
|
|
834
|
+
parts: {
|
|
835
|
+
mark: {
|
|
836
|
+
selector: ".ds-series-mark", kind: "vector", surface: "primary-foreground",
|
|
837
|
+
stroke: { slot: "visual", field: "strokeWidth" },
|
|
838
|
+
paints: {
|
|
839
|
+
series: { property: "fill", values: ["--chart-1", "--chart-2", "--chart-3"], fallback: "--chart-1" },
|
|
840
|
+
},
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
/** Application data names the allowed paints with the recipe's union. */
|
|
846
|
+
export type SeriesPaint = (typeof chart)["paints"]["series"]; // "--chart-1" | "--chart-2" | "--chart-3"
|
|
847
|
+
|
|
848
|
+
chart.paints.set(markElement, { series: item.paint }); // item.paint: SeriesPaint
|
|
849
|
+
chart.paints.clear(markElement); // the fallback applies again
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
- `paints: { name: { property, values, fallback } }` goes on a region's root or
|
|
853
|
+
a top-level part; nested parts, grids and controls declare none. Names are
|
|
854
|
+
camelCase, unique in the recipe and never `set` or `clear`.
|
|
855
|
+
- `property` is one of `fill`, `stroke`, `color`, `background-color`,
|
|
856
|
+
`border-color`, once per element
|
|
857
|
+
(`construction/paint-property-unsupported`).
|
|
858
|
+
- `values` lists paint-role tokens only, never raw colours, URLs or free
|
|
859
|
+
strings (`construction/paint-value-role`). `fallback` is one of them.
|
|
860
|
+
- Each paint lowers to an owner-private custom property, `--<owner>-p-<name>`,
|
|
861
|
+
read over its fallback token:
|
|
862
|
+
`fill: var(--series-chart-p-series, var(--chart-1))`. Every declared token
|
|
863
|
+
joins the owner's token closure, in every theme and brand.
|
|
864
|
+
- `recipe.paints.set(element, { name: token })` writes `var(<token>)` on the
|
|
865
|
+
element it is given (the part instance's, so each item can differ);
|
|
866
|
+
`clear(element)` removes every paint. Both compile to plain
|
|
867
|
+
`style.setProperty`/`removeProperty` calls. The owner writes a token
|
|
868
|
+
reference, so a theme or brand switch repaints the element.
|
|
869
|
+
- The setter's value type is the literal union of the declared values. A
|
|
870
|
+
written `string`, `any` or wider type is `source/paint-value-untyped`; an
|
|
871
|
+
undeclared name is a type error and `source/paint-undeclared`. A data model
|
|
872
|
+
with its own keys maps them to tokens through a typed record
|
|
873
|
+
(`Record<Status, SeriesPaint>`) in owner or application code. Emission writes
|
|
874
|
+
`(typeof recipe)["paints"]["name"]` out as the union.
|
|
875
|
+
- A property the element's surface treatments also supply stays the profile's
|
|
876
|
+
(`construction/paint-profile-conflict`): `color`, `background` for
|
|
877
|
+
`background-color`, `border-color` and a vector shape's stroke, from its base
|
|
878
|
+
surface or an owner state's.
|
|
879
|
+
- Contrast is checked over every declared value, in every context, against the
|
|
880
|
+
background the construction knows (the element's own, else its root's). One
|
|
881
|
+
failing value fails (`construction/paint-contrast-insufficient`;
|
|
882
|
+
[RULES.md](RULES.md) gives the minimum per property). An unknown or
|
|
883
|
+
translucent background is the review item `review/paint-contrast-unresolved`.
|
|
884
|
+
- A declared paint the owner never sets is the review item `review/paint-unused`.
|
|
885
|
+
|
|
886
|
+
Renderers outside CSS (canvas, WebGL) read the generated palette per context
|
|
887
|
+
(`paletteFor`); a chart token resolves there like any other paint.
|
|
888
|
+
|
|
889
|
+
## Spatial construction and public alignment
|
|
890
|
+
|
|
891
|
+
The same recipe covers grid and component construction. The parent owns
|
|
892
|
+
external placement and gutters; each element owns its frame and child
|
|
893
|
+
arrangement. No second layout API or parent-owned internal padding exists.
|
|
894
|
+
|
|
895
|
+
```ts
|
|
896
|
+
recipe({
|
|
897
|
+
layout: "fluid", profile: "form-grid", context: "container",
|
|
898
|
+
columns: 2, gutter: "narrow", margin: "none", bound: "full",
|
|
899
|
+
rows: ["auto", "auto", "auto", "auto"],
|
|
900
|
+
cells: {
|
|
901
|
+
".ux-invite-field": { span: "full", row: 1, rowSpan: 3, at: { md: { span: 1 } } },
|
|
902
|
+
".ux-invite-action": { span: "full", row: 4, at: { md: { start: 2, span: 1, row: 2 } } },
|
|
903
|
+
},
|
|
904
|
+
alignRows: { ".ux-invite-field": ["label", "control", "help"] },
|
|
905
|
+
});
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
A fluid grid with local `columns` may weigh them: `columns: 2, weights: [0.85,
|
|
909
|
+
1.15]` gives each column its share of the width (`minmax(0, 0.85fr) minmax(0,
|
|
910
|
+
1.15fr)`), and the checks size each cell by the same shares. One positive
|
|
911
|
+
number per column; every column weighs 1 without `weights`. A cell still
|
|
912
|
+
stacks at a narrow tier by spanning both columns (`span: "full"` with
|
|
913
|
+
`at: { md: { span: 1 } }`).
|
|
914
|
+
|
|
915
|
+
[Spatial profiles](PROFILE-KINDS.md#spatial) own units, scales, ratios, max
|
|
916
|
+
width, track counts, breakpoints, gutter pairs, fixed sides and named
|
|
917
|
+
conditions. Owner `at` selects those names. A relative condition such as `below: "--form-wrap-width"` keeps
|
|
918
|
+
its 30em meaning; no root size is assumed.
|
|
919
|
+
|
|
920
|
+
Every declared spatial profile reads through the grid algebra, selected or not
|
|
921
|
+
(`spatial-profile-invalid`, at the profile). The algebra holds in every theme,
|
|
922
|
+
brand and condition context:
|
|
923
|
+
|
|
924
|
+
- Margins, gutters, the maximum width and fixed tracks are read live and can
|
|
925
|
+
differ by context when every grid still fits there
|
|
926
|
+
(`construction/grid-context-invalid` names the context otherwise).
|
|
927
|
+
- Breakpoint widths, column counts and condition bounds are compiled into media
|
|
928
|
+
queries and track lists, so no context can change them
|
|
929
|
+
(`spatial-context-unsupported`).
|
|
930
|
+
|
|
931
|
+
**Context.** Container context uses its region; viewport context uses the
|
|
932
|
+
viewport. A container-context grid queries the nearest `ads-region` size
|
|
933
|
+
container, so an owned ancestor in its owner starts one in every choice
|
|
934
|
+
(`frame: { container: "region" }`, the only container). Otherwise the grid
|
|
935
|
+
fails at the construction (`source/grid-container-missing`, GC-05).
|
|
936
|
+
|
|
937
|
+
**Public rows.** A field exposes named rows through `exposeRows`. The example design system's
|
|
938
|
+
InviteMember binds them through `alignRows`, which
|
|
939
|
+
[lowers to subgrid](LOWERING.md#public-row-alignment). The cell must span
|
|
940
|
+
exactly those rows. Aligned rows share one gap: the grid takes the gap the rows
|
|
941
|
+
expose, and a different declared row gap is an error. Inherited tracks follow
|
|
942
|
+
the declared parent; independent layouts belong to child regions. Unsupported
|
|
943
|
+
combinations and missing parent relationships fail.
|
|
944
|
+
|
|
945
|
+
**Cells.** A cell names one owned element or public component (placed through
|
|
946
|
+
its className marker). Several or mapped instances can share a cell only when
|
|
947
|
+
it auto-places (`start: "auto"`) at every tier.
|
|
948
|
+
|
|
949
|
+
- A cell's frame with a fixed inline size, and any owned frame deeper inside it
|
|
950
|
+
(less the insets between), fits the region the algebra bounds for the cell at
|
|
951
|
+
every tier, and a tile's never exceeds the tile size
|
|
952
|
+
(`source/frame-exceeds-region`).
|
|
953
|
+
- Where the region cannot be bounded, and for a public component placed as a
|
|
954
|
+
cell or tile, it is reviewed (`review/frame-region-unresolved`), never passed.
|
|
955
|
+
- On a gutter other than `wide`, the first padded frame in a cell has an inline
|
|
956
|
+
padding that, with that gutter's start, equals the wide gutter's start within
|
|
957
|
+
the profile's fine unit (`source/keyline-missed`; `component-keyline` for a
|
|
958
|
+
public component placed in the cell). See
|
|
959
|
+
[the text keyline](GUIDE.md#the-text-keyline).
|
|
960
|
+
- A frame's maximum inline size and the grid bound both hold (the smaller
|
|
961
|
+
wins). Any other property both would write is an error.
|
|
962
|
+
|
|
963
|
+
The example design system's Shell and WorkspacePanels show hybrid, overlay, fixed, flow and
|
|
964
|
+
inherited layouts. Mixed tracks (a fixed indent beside fluid tracks, a fluid
|
|
965
|
+
avatar column with a fixed-size avatar, inherited message keylines) are proven
|
|
966
|
+
by a test fixture (`tests/helpers/conversation-project.ts`), not the example design system.
|
|
967
|
+
|
|
968
|
+
## Cropped media
|
|
969
|
+
|
|
970
|
+
A visual profile with `fit: "cover"` crops an image inside a box of its own.
|
|
971
|
+
The region's frame declares the shape (`frame: { ratio: "16 / 9" }`, a ratio
|
|
972
|
+
the spatial profile permits, or a frame profile's `blockSize`) and its
|
|
973
|
+
top-level visual part fills it (`object-fit: cover`). Without that box it is
|
|
974
|
+
`construction/cover-box-missing`. Nothing overflows, and the render audit's
|
|
975
|
+
image-shape check accepts the crop.
|
|
976
|
+
|
|
977
|
+
The focal point belongs to the image, in an asset's optical-centre
|
|
978
|
+
coordinates, never to the profile or the recipe:
|
|
979
|
+
|
|
980
|
+
- An application image carries it as data beside its source and size
|
|
981
|
+
(`{ src, width, height, focus: [0, -0.5] }`). The part declares a measured
|
|
982
|
+
`position` and the owner spreads `recipe.measured.props({ focus })` on the
|
|
983
|
+
`<img>`. Without a value the crop is centred.
|
|
984
|
+
- Registered intrinsic artwork crops around its own `opticalCenter`, compiled
|
|
985
|
+
into the sheet. Glyphs and paint-slot artwork (logos) never crop
|
|
986
|
+
(`construction/cover-asset-unsupported`).
|
|
987
|
+
|
|
988
|
+
```tsx
|
|
989
|
+
const cover = recipe({
|
|
990
|
+
layout: "stack", profile: "cover-media", // a composite whose visual profile declares fit: "cover"
|
|
991
|
+
parts: { visual: { selector: ".ds-content-image", kind: "visual", required: true,
|
|
992
|
+
measured: { focus: { type: "position", property: "object-position" } } } },
|
|
993
|
+
});
|
|
994
|
+
const wide = recipe({ frame: { ratio: "16 / 9" } }).root;
|
|
995
|
+
<span className={`${cover.root} ${wide}`}>
|
|
996
|
+
<img className="ds-content-image" {...cover.measured.props({ focus: source.focus })} src={source.src} alt={alt} />
|
|
997
|
+
</span>
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
A contained image (`fit: "contain"`) reserves its box the same way: the part
|
|
1001
|
+
declares a measured `intrinsic-size` and the owner spreads
|
|
1002
|
+
`recipe.measured.props({ intrinsic: [source.width, source.height] })`. Its
|
|
1003
|
+
width is then the smaller of the file's width and the width its ratio gives at
|
|
1004
|
+
the profile's height cap, known before the file loads, so nothing after it
|
|
1005
|
+
moves when it arrives. Without the value its size is the loaded file's.
|
|
1006
|
+
|
|
1007
|
+
ADS cannot see a crop that cuts off something that matters (text in a
|
|
1008
|
+
screenshot). The example design system's Image (`components/Content/Image/Image.tsx`) has both
|
|
1009
|
+
forms.
|
|
1010
|
+
|
|
1011
|
+
## Choices the compiler infers
|
|
1012
|
+
|
|
1013
|
+
Class selections and part presence are inferred from ordinary TypeScript:
|
|
1014
|
+
finite literal props and defaults, immutable local records, conditionals and
|
|
1015
|
+
`.map` over a literal array (or a local const array of records). A `.map`
|
|
1016
|
+
over data (a prop's array) is read through each item's declared type: a field
|
|
1017
|
+
typed as a literal union or a boolean is a finite choice, and an optional text
|
|
1018
|
+
field selects markup by presence, whether the callback destructures the item
|
|
1019
|
+
(`({ text, sub }) => …`) or reads its fields (`item.sub && <span>`). Both
|
|
1020
|
+
variants are checked, so the optional element must be a part that may be absent
|
|
1021
|
+
(`required: false`). A nested field (`item.a.b`), a number or a call is not
|
|
1022
|
+
finite. Application
|
|
1023
|
+
text (`string` props) selects markup by presence only (`help && <span>`): three
|
|
1024
|
+
variants, non-empty, empty and absent. Comparing or indexing designs by its
|
|
1025
|
+
content is an error, as is an unbounded choice. Spreads can pass props to
|
|
1026
|
+
public components but not to owned elements.
|
|
1027
|
+
|
|
1028
|
+
### Optional callbacks, objects and slots
|
|
1029
|
+
|
|
1030
|
+
An optional prop (or mapped item field) whose type is an object, a function or
|
|
1031
|
+
a node selects markup by whether it is given. It is one input with two
|
|
1032
|
+
variants, given and not given, and both are checked; ADS reads the declared
|
|
1033
|
+
type and never the value, so no second boolean prop, closed list of names or
|
|
1034
|
+
always-rendered `hidden` wrapper is needed:
|
|
1035
|
+
|
|
1036
|
+
```tsx
|
|
1037
|
+
function Tag({ label, icon, onRemove, footer }: { label: string; icon?: Glyph; onRemove?: () => void; footer?: ReactNode }) {
|
|
1038
|
+
return <span className={tag.root}>
|
|
1039
|
+
{icon && <span className="tag-icon" />}
|
|
1040
|
+
<span className="tag-label">{label}</span>
|
|
1041
|
+
{onRemove && <button type="button" className="tag-remove" onClick={onRemove}>Remove</button>}
|
|
1042
|
+
{footer !== undefined && <div className="tag-footer">{footer}</div>}
|
|
1043
|
+
</span>;
|
|
1044
|
+
}
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
| The prop's type | Tests that select | Variants |
|
|
1048
|
+
| --- | --- | --- |
|
|
1049
|
+
| an object or a function, optional (`icon?: Glyph`, `onRemove?: () => void`) | `prop && …`, `prop ? a : b`, `!prop`, `prop !== undefined`, `prop === undefined`, `prop != null`, `prop == null`, `prop ?? other` | given, not given |
|
|
1050
|
+
| the same with `null` (`icon?: Glyph \| null`) | the same, and `prop === null` | given, `null`, not given: each test holds as it does at run time |
|
|
1051
|
+
| a node, or any type that also admits text, a number or a boolean (`footer?: ReactNode`) | `prop !== undefined`, `prop === undefined` only | given, not given |
|
|
1052
|
+
|
|
1053
|
+
- A node that is given may still be falsy (`0`, `""`, `false`, `null`), so its
|
|
1054
|
+
truthiness, a comparison with `null` and `??` do not say whether it is given:
|
|
1055
|
+
`footer && <div>` is `choice/domain-not-finite`, and the message names the
|
|
1056
|
+
test to write (`!== undefined`). A given node that renders nothing (`null`,
|
|
1057
|
+
`false`) is the given variant.
|
|
1058
|
+
- A parameter default (`icon = defaultIcon`) makes the prop always given: there
|
|
1059
|
+
is one variant and no input. A required object or function selects nothing
|
|
1060
|
+
(`choice/domain-not-finite`), and an open `number` is never finite.
|
|
1061
|
+
- Inside the given variant the prop is an ordinary open value (`onClick={onRemove}`,
|
|
1062
|
+
`{footer}`). Its identity and its fields select nothing (`icon === other`,
|
|
1063
|
+
`icon.name === "x"`).
|
|
1064
|
+
- An element rendered in one variant only must be a part that may be absent
|
|
1065
|
+
(`required: false`).
|
|
1066
|
+
- Across owners, a placement that passes the prop selects the given variant and
|
|
1067
|
+
one that leaves it out the other; an argument that may be `undefined` (a
|
|
1068
|
+
conditional, a forwarded optional prop) or a spread selects both. `children`
|
|
1069
|
+
is content, so both variants are checked wherever the component is placed.
|
|
1070
|
+
- The variants count against the same bounds as every other choice
|
|
1071
|
+
(`choice/branch-limit`, `choice/construction-limit`).
|
|
1072
|
+
|
|
1073
|
+
## Artwork and text
|
|
1074
|
+
|
|
1075
|
+
[Asset macros](ASSETS.md) declare drawings, paint and optical anchors. A recipe
|
|
1076
|
+
chooses the asset, its state and the visual profile; the compiler derives the
|
|
1077
|
+
source from its size token and theme, so a component maintains no SVG/profile
|
|
1078
|
+
pairs. Generated `assets.<part>.source` is trusted captured SVG text for
|
|
1079
|
+
foreground and slot artwork, or an image URL for intrinsic art. No runtime
|
|
1080
|
+
registry is required.
|
|
1081
|
+
|
|
1082
|
+
A visual part binds exactly one of: an `asset` (name or alias), a glyph `set`
|
|
1083
|
+
(`assets.<part>.source[name]`, the name typed as the set's finite names), or a
|
|
1084
|
+
glyph `reference` (`glyph: "reference"`: the owner renders the `Glyph<N>` prop
|
|
1085
|
+
it receives as `glyph.source`). Set and reference bindings separate the drawing
|
|
1086
|
+
(data) from the construction: the members' shared grid, lowered once per visual
|
|
1087
|
+
profile and owner variant, never per glyph. An owner that takes an icon takes a
|
|
1088
|
+
glyph reference (`closeGlyph`), never a name string. See
|
|
1089
|
+
[icons and glyph sets](ASSETS.md#icons-and-glyph-sets).
|
|
1090
|
+
|
|
1091
|
+
Button pairs optional glyphs with text. Identity pairs an avatar with a
|
|
1092
|
+
complete text stack, or brand artwork with baseline-aligned text. The asset's
|
|
1093
|
+
optical center defaults to [0,0] and is shared across sizes and uses. The slot
|
|
1094
|
+
reserves [translated extents](LOWERING.md#optical-anchor-calculation). Text
|
|
1095
|
+
trimming has a line-box fallback. No source contract guarantees perceived
|
|
1096
|
+
balance, font fallback or painted alignment; those need visual review and
|
|
1097
|
+
rendering.
|
|
1098
|
+
|
|
1099
|
+
## Foundation and output
|
|
1100
|
+
|
|
1101
|
+
`foundation.ads.ts` holds the one `foundation()` declaration. It selects
|
|
1102
|
+
document defaults through profiles, requests role-token output and declares
|
|
1103
|
+
the contexts. It creates no runtime bootstrap. `ds.config.json` keeps only
|
|
1104
|
+
tooling settings; `themes` and `brands` are not fields there.
|
|
1105
|
+
|
|
1106
|
+
```ts
|
|
1107
|
+
export default foundation({
|
|
1108
|
+
tokens: "./tokens",
|
|
1109
|
+
text: "document-text",
|
|
1110
|
+
surface: "document-surface",
|
|
1111
|
+
focus: "keyboard-focus",
|
|
1112
|
+
reset: "document",
|
|
1113
|
+
themes: [
|
|
1114
|
+
{ name: "light", scheme: "light" },
|
|
1115
|
+
{ name: "dark", scheme: "dark" },
|
|
1116
|
+
{ name: "high-contrast", scheme: "dark" },
|
|
1117
|
+
],
|
|
1118
|
+
brands: [{ name: "northstar" }, { name: "iris" }],
|
|
1119
|
+
});
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
- `text`, `surface` and `focus` (all required) name the document's text,
|
|
1123
|
+
surface and default focus-indicator profiles.
|
|
1124
|
+
- `reset: "document"` is a closed compiler operation. It keeps every `[hidden]`
|
|
1125
|
+
element hidden (except `hidden="until-found"`) whatever display its
|
|
1126
|
+
construction lowers to.
|
|
1127
|
+
- `themes` is required: 1–8 entries, each a unique lowercase `name` and the
|
|
1128
|
+
`scheme` (`"light"` or `"dark"`) browsers use for native controls. **The
|
|
1129
|
+
first theme is the default**: the token sheets' plain `:root` values are its
|
|
1130
|
+
values, and `:root[data-theme="<name>"]` rules give every other theme its
|
|
1131
|
+
values.
|
|
1132
|
+
- `brands` is optional: up to 8 entries with unique lowercase names; none means
|
|
1133
|
+
one brand. The first is the default (the `:root` values); every other brand
|
|
1134
|
+
sets values under `:root[data-brand="<name>"]`.
|
|
1135
|
+
- `sections: true` is optional. Contexts are authored on `:root` only; with the
|
|
1136
|
+
field, any element with `data-theme` or `data-brand` switches every token in
|
|
1137
|
+
its subtree, and a default-named section resets to the default. The checks
|
|
1138
|
+
evaluate every context, so a section selects only proven values. See
|
|
1139
|
+
[the guide](GUIDE.md#colours-that-depend-on-their-surroundings) for the
|
|
1140
|
+
pattern and its limits.
|
|
1141
|
+
- [ADS.md](ADS.md#foundation-declaration) describes the cost of `sections` and
|
|
1142
|
+
the optional `followSystemTheme: true`, `palette: true` and
|
|
1143
|
+
[`appIcon`](ASSETS.md#the-application-icon-a-role-not-a-kind).
|
|
1144
|
+
|
|
1145
|
+
The macro validates the lists, and `ads check` reports a failure at the
|
|
1146
|
+
offending field (`contexts/list-invalid`). A theme or brand that a token sheet
|
|
1147
|
+
or asset variant names but the foundation does not declare is an error at that
|
|
1148
|
+
rule or variant (`contexts/theme-undeclared`, `contexts/brand-undeclared`). A
|
|
1149
|
+
declared non-default theme or brand that nothing defines is an error at its
|
|
1150
|
+
entry (`theme-undefined`, `brand-undefined`). See
|
|
1151
|
+
[contexts and tokens](ADS.md#contexts-and-tokens).
|
|
1152
|
+
|
|
1153
|
+
`ads emit` writes ordinary TypeScript/TSX, CSS and reachable artwork, and
|
|
1154
|
+
preserves public types and controller dependencies. A consumer needs no macro
|
|
1155
|
+
imports, metadata registry or ADS runtime. Props select precompiled class
|
|
1156
|
+
strings through ordinary lookups or conditionals. Recipe composition, conflict
|
|
1157
|
+
resolution and static class combinations belong to compilation; there is no
|
|
1158
|
+
runtime class-merging helper. Draft and preview data never enter production
|
|
1159
|
+
output. See [the guide](GUIDE.md#emitting-the-design-system).
|