@reqvire-org/ads 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -87
- package/dist/a11y.mjs +133 -48
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +142 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +22 -0
- package/dist/analysis/module-resolvers.mjs +46 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +153 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +179 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +6 -6
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +219 -77
- package/dist/boundaries.mjs +140 -41
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +28 -14
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +44 -58
- package/dist/check.mjs +754 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +127 -9
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/contrast-composition.mjs +134 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +9 -5
- package/dist/font-rules.mjs +22 -17
- package/dist/fonts-generated.mjs +23 -16
- package/dist/foundation-views.mjs +242 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +101 -34
- package/dist/icons.mjs +79 -32
- package/dist/image-attributes.mjs +143 -66
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +122 -41
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +298 -129
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +90 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +903 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +673 -234
- package/dist/mcp/preview-watch.mjs +448 -170
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +5 -5
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2409 -577
- package/dist/mcp/showcase-host.mjs +165 -41
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/pictogram-model.mjs +59 -0
- package/dist/pictograms.mjs +52 -0
- package/dist/preview-bun.mjs +494 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +8 -34
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +69 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +15 -5
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/render-audit/pictograms.mjs +88 -0
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +98 -30
- package/dist/render-audit.mjs +838 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/render-composition.mjs +164 -0
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +719 -378
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +421 -157
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +21 -3
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +58 -0
- package/dist/showcase/foundation-view.mjs +255 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/pictogram-view.mjs +53 -0
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1064 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +143 -120
- package/dist/skills/ads-designer/references/accessibility.md +78 -15
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +30 -27
- package/dist/skills/ads-designer/references/branding.md +101 -24
- package/dist/skills/ads-designer/references/captures.md +25 -0
- package/dist/skills/ads-designer/references/cli.md +21 -24
- package/dist/skills/ads-designer/references/contracts.md +7 -6
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +20 -17
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/performance.md +3 -2
- package/dist/skills/ads-designer/references/pictograms.md +131 -0
- package/dist/skills/ads-designer/references/review.md +37 -34
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +16 -18
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -75
- package/dist/skills/ads-designer/references/workflows.md +8 -33
- package/dist/skills/ads-import/SKILL.md +43 -325
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +30 -27
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +25 -0
- package/dist/skills/ads-import/references/cli.md +21 -24
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +7 -6
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +20 -17
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +14 -18
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +37 -34
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +16 -18
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -75
- package/dist/skills/ads-import/references/workflows.md +8 -33
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +58 -344
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +30 -27
- package/dist/skills/ads-port/references/captures.md +25 -0
- package/dist/skills/ads-port/references/cli.md +21 -24
- package/dist/skills/ads-port/references/contracts.md +7 -6
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +20 -17
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +14 -18
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +2 -1
- package/dist/skills/ads-port/references/review.md +37 -34
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +16 -18
- package/dist/skills/ads-port/references/validation.md +83 -75
- package/dist/skills/ads-port/references/workflows.md +8 -33
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +270 -129
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +25 -6
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +47 -49
- package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/index.ts +2 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +25 -6
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +70 -25
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +132 -59
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +57 -22
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +251 -104
- package/dist/units.mjs +209 -99
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +191 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +96 -80
- package/docs/ARCHITECTURE.md +368 -137
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +77 -17
- package/docs/CHANGELOG.md +332 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +300 -263
- package/docs/MCP.md +187 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +43 -34
- package/dist/browser-audit.mjs +0 -429
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -50
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -89
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -412
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
- package/dist/skills/ads-break-ui/references/captures.md +0 -135
- package/dist/skills/ads-break-ui/references/contracts.md +0 -317
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -194
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -97
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -166
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -90
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -385
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -412
- package/dist/skills/ads-motion/references/captures.md +0 -135
- package/dist/skills/ads-motion/references/contracts.md +0 -317
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -194
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -97
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -166
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -90
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
|
@@ -10,7 +10,7 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
|
|
|
10
10
|
const existing = entries.get(item.id);
|
|
11
11
|
entries.set(item.id, { ...existing, ...item, kind: "tokens", drafts: existing?.drafts ?? [] });
|
|
12
12
|
}
|
|
13
|
-
const owns = (unit, item) => unit === "tokens" && item.kind === "tokens" || (item.unit ? item.unit === unit : ownsScenario(unit, item.id));
|
|
13
|
+
const owns = (unit, item) => unit === "assets/pictograms" && item.kind === "pictograms" || unit === "tokens" && item.kind === "tokens" || (item.unit ? item.unit === unit : ownsScenario(unit, item.id));
|
|
14
14
|
const attach = (entry, draft) => {
|
|
15
15
|
if (!entry.drafts.some(item => item.id === draft.id)) entry.drafts.push(references.get(draft.id));
|
|
16
16
|
};
|
|
@@ -30,8 +30,8 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
|
|
|
30
30
|
}
|
|
31
31
|
for (const draft of drafts) {
|
|
32
32
|
for (const unit of draft.units) {
|
|
33
|
-
const kind = unit.split("/")[0];
|
|
34
|
-
if (!["brand", "tokens", "components", "patterns", "composition"].includes(kind)) continue;
|
|
33
|
+
const kind = unit === "assets/pictograms" ? "pictograms" : unit.split("/")[0];
|
|
34
|
+
if (!["brand", "pictograms", "tokens", "components", "patterns", "composition"].includes(kind)) continue;
|
|
35
35
|
const owned = [...entries.values()].filter(item => owns(unit, item));
|
|
36
36
|
if (owned.length) for (const item of owned) attach(item, draft);
|
|
37
37
|
else entries.set(unit, { id: unit, unit, title: unit.split("/").at(-1), kind, draftOnly: true, pendingDraftScenario: true, drafts: [references.get(draft.id)] });
|
|
@@ -39,3 +39,21 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
|
|
|
39
39
|
}
|
|
40
40
|
return { scenarios: [...entries.values()], categories: [...entries.values()].filter(item => item.kind === "tokens") };
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
const draftCategory = unit => unit === "assets/pictograms" ? "pictograms" : unit === "assets/glyphs" || unit === "assets/logos" ? "icons" : unit === "assets/brand" ? "brand" : unit === "foundation" ? "tokens" : ["brand","tokens","icons","components","patterns","composition"].includes(unit.split("/")[0]) ? unit.split("/")[0] : "other";
|
|
44
|
+
export const draftCategoryLabels = {brand:"Brand",icons:"Icons",pictograms:"Pictograms",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};
|
|
45
|
+
/** Every active proposal remains visible, even before it has a previewable scenario. */
|
|
46
|
+
export function draftNavigationEntries(scenarios, drafts) {
|
|
47
|
+
const result=[];
|
|
48
|
+
for(const draft of drafts){
|
|
49
|
+
const owned=scenarios.filter(item=>item.drafts?.some(value=>value.id===draft.id));
|
|
50
|
+
for(const item of owned)result.push({...item,id:`drafts/${encodeURIComponent(draft.id)}/${encodeURIComponent(item.id)}`,previewId:item.id,title:`${draft.title||draft.id} · ${item.title}`,group:draftCategoryLabels[item.kind]??"Other",drafts:[draft]});
|
|
51
|
+
for(const unit of draft.units??[]){
|
|
52
|
+
if(owned.some(item=>unit==="tokens"&&item.kind==="tokens"||item.unit===unit||!item.unit&&ownsScenario(unit,item.id)))continue;
|
|
53
|
+
const kind=draftCategory(unit);
|
|
54
|
+
result.push({id:`drafts/${encodeURIComponent(draft.id)}/${encodeURIComponent(unit)}`,unit,kind,title:`${draft.title||draft.id} · ${unit.split("/").at(-1)}`,group:draftCategoryLabels[kind],drafts:[draft]});
|
|
55
|
+
}
|
|
56
|
+
if(!owned.length&&!draft.units?.length)result.push({id:`drafts/${encodeURIComponent(draft.id)}`,kind:"other",title:draft.title||draft.id,group:"Other",drafts:[draft]});
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#222222"><title>ADS — Eye in the grid</title><path d="M10 10h12v12h-12zM26 10h12v12h-12zM42 10h12v12h-12zM10 26h12v12h-12zM42 26h12v12h-12zM10 42h12v12h-12zM26 42h12v12h-12zM42 42h12v12h-12z"/><path d="M26 26h12v12h-12z" fill="#36bba5"/><path d="M30 30h4v4h-4z" fill="#222222"/></svg>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* Specimen geometry only. Labels and layout come from the internal ADS UI. */
|
|
2
|
+
.ads-foundation{padding:0;overflow:auto;height:100%}
|
|
3
|
+
.ads-token-stage{display:flex;align-items:flex-start;min-width:0;overflow:auto}
|
|
4
|
+
.ads-token-sample{flex:none;inline-size:32px;block-size:32px;background:light-dark(#ddd,#444);color:var(--text-body);border:0 solid light-dark(#777,#999)}
|
|
5
|
+
.ads-token-type{inline-size:auto;block-size:auto;max-inline-size:100%;background:none;white-space:pre-wrap;font-family:var(--font-sans);font-size:var(--text-base);line-height:var(--leading-normal)}
|
|
6
|
+
[data-kind="shape"] .ads-token-stage{overflow:visible}
|
|
7
|
+
[data-kind="motion"] .ads-token-stage{height:48px;width:min(100%,192px);position:relative;overflow:visible;align-items:center;background:linear-gradient(var(--ads-ui-border-chrome),var(--ads-ui-border-chrome)) center/100% 1px no-repeat}
|
|
8
|
+
.ads-token-motion{position:relative;left:0;inline-size:16px;block-size:16px;border-radius:50%;background:var(--ads-ui-text-chrome);animation:ads-token-travel 1s ease-in-out infinite alternate}
|
|
9
|
+
@keyframes ads-token-travel{to{left:calc(100% - 16px)}}
|
|
10
|
+
@media(prefers-reduced-motion:reduce){.ads-token-motion{animation:none!important;transition:none!important}}
|
|
11
|
+
.ads-brand-clean{display:flex;max-width:100%}.ads-brand-master{display:block;height:96px;width:auto;max-width:100%;object-fit:contain}
|
|
12
|
+
.ads-pictogram-image{display:block;width:auto;max-width:none;object-fit:contain}
|
|
13
|
+
.ads-pictogram-stage{display:table;position:relative}
|
|
14
|
+
[data-pictogram] [data-slot="artwork"],[data-pictogram] [data-slot="construction"],[data-pictogram] [data-slot="sizes"]{overflow:auto}
|
|
15
|
+
.ads-brand-inspection{margin:0;min-width:0;max-width:100%;text-align:start}
|
|
16
|
+
.ads-brand-stage{position:relative;max-width:100%;width:128px;margin:0}
|
|
17
|
+
.ads-brand-art{display:block;width:100%;height:auto;max-height:none}
|
|
18
|
+
.ads-brand-grid-caption{margin-top:16px;color:var(--ads-ui-text-muted);font:12px/1.5 var(--ads-ui-font-mono);overflow-wrap:anywhere}
|
|
19
|
+
.ads-brand-sizes{display:flex;flex-wrap:wrap;gap:24px 16px;align-items:end;padding:8px}
|
|
20
|
+
/* Labels clear the 8px subject stage around each icon. */
|
|
21
|
+
.ads-brand-sizes figure{margin:0;flex:none;display:flex;flex-direction:column;align-items:center;gap:16px}.ads-brand-sizes img{display:block;width:auto;max-width:none;max-height:none;object-fit:contain}
|
|
22
|
+
.ads-brand-sizes figcaption{font:12px/1.5 var(--ads-ui-font-sans);color:var(--ads-ui-text-muted)}
|
|
23
|
+
.ux-brand-specimen .ads-foundation-note{font-size:12px;color:var(--ads-ui-text-muted)}
|
|
24
|
+
.ads-foundation-breakpoints{width:100%;border-collapse:collapse;margin:16px 0;font:inherit;font-size:14px;text-align:start}
|
|
25
|
+
.ads-foundation-breakpoints th,.ads-foundation-breakpoints td{text-align:start;padding:8px;border-bottom:1px solid light-dark(#ddd,#444)}
|
|
26
|
+
.ads-grid-example{margin-block:16px 32px}
|
|
27
|
+
.ux-spatial-cell{min-height:var(--space-24);padding:var(--grid-mini-unit);color:inherit;font:14px/1.5 system-ui}
|
|
28
|
+
.ads-grid-example-nested>.a{padding:0}
|
|
29
|
+
.ads-foundation-ratios{display:flex;gap:16px;flex-wrap:wrap;align-items:start;margin-bottom:32px}.ads-foundation-ratios>div{width:96px;min-height:0}
|
|
30
|
+
|
|
31
|
+
.ads-token-stage-length{overflow:hidden;position:relative;min-height:64px;align-items:flex-start;flex-direction:column;justify-content:center;gap:12px}
|
|
32
|
+
.ads-token-length{height:16px;min-height:16px;max-width:100%;background:var(--ads-ui-color-example-measure)}
|
|
33
|
+
.ads-token-length[data-zero="true"]{border-inline-start:1px dashed var(--ads-ui-text-muted)}
|
|
34
|
+
.ads-token-measure{position:absolute;visibility:hidden;pointer-events:none;height:0}
|
|
35
|
+
.ads-token-scale{order:1;font:12px/1.5 system-ui;color:var(--ads-ui-text-muted)}
|
|
36
|
+
.ads-token-stage-height{height:64px;overflow:auto;align-items:flex-end}
|
|
37
|
+
.ads-token-height{inline-size:96px;max-width:none;background:var(--ads-ui-bg-example)}
|
|
38
|
+
.ads-token-text{display:grid;place-items:center;inline-size:32px;block-size:32px;background:none;font:22px/1 var(--font-sans)}
|
|
39
|
+
.ads-token-color,.ads-token-text:empty{outline:1px solid var(--ads-ui-border-chrome);outline-offset:-1px}
|
|
40
|
+
.ads-token-stage-shadow{padding:16px;overflow:visible}
|
|
41
|
+
.ads-token-shadow{inline-size:96px;block-size:48px;background:var(--ads-ui-bg-surface)}
|
|
42
|
+
.ads-token-shape{inline-size:48px;block-size:48px;background:var(--ads-ui-bg-example)}
|
|
43
|
+
.ads-token-columns{inline-size:100%;block-size:48px;background:repeating-linear-gradient(to right,var(--ads-ui-bg-example) 0 calc((100% + 4px) / var(--ads-sample-columns) - 4px),transparent 0 calc((100% + 4px) / var(--ads-sample-columns)))}
|
|
44
|
+
.ads-token-columns[data-ads-property="grid-template-columns"]{display:grid;gap:4px;background:none}.ads-token-columns>span{background:var(--ads-ui-bg-example)}
|
|
45
|
+
.ads-token-stage-layer{isolation:isolate;position:relative;min-height:48px;overflow:hidden}
|
|
46
|
+
.ads-token-layer-reference{position:absolute;left:0;top:0;width:48px;height:32px;background:var(--ads-ui-bg-example);z-index:0}
|
|
47
|
+
.ads-token-layer{position:relative;margin:12px 0 0 16px;inline-size:48px;block-size:32px;background:var(--ads-ui-text-muted);color:var(--ads-ui-bg-surface);font:12px/32px system-ui;text-align:center}
|
|
48
|
+
.ads-token-effect{inline-size:64px;block-size:48px;font:24px/48px system-ui;text-align:center}
|
|
49
|
+
/* Units and scale: each bar is the token's real width; the label carries the measured value. */
|
|
50
|
+
.ads-grid-units{display:flex;flex-direction:column;gap:8px;margin-bottom:32px}
|
|
51
|
+
.ads-grid-unit{display:grid;grid-template-columns:var(--ads-grid-unit-track,96px) minmax(0,1fr);align-items:center;gap:12px;min-width:0}
|
|
52
|
+
.ads-grid-unit-bar{flex:none;display:block;min-width:1px;background:var(--ads-ui-bg-example,#dfeaf8)}
|
|
53
|
+
.ads-grid-unit-label,.ads-grid-chain{font:12px/1.5 var(--ads-ui-font-mono,ui-monospace,monospace);color:var(--ads-ui-text-muted,inherit);overflow-wrap:anywhere}
|
|
54
|
+
.ads-grid-roles{margin-bottom:8px}
|
|
55
|
+
.ads-grid-probe{position:absolute;visibility:hidden;height:0;pointer-events:none}
|
|
56
|
+
.ads-grid-link{padding:0;border:0;background:none;font:inherit;color:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
|
|
57
|
+
.ads-grid-link:focus-visible{outline:2px solid currentColor;outline-offset:2px}
|
|
58
|
+
.ux-token-record[data-ads-focus]{outline:2px solid var(--ads-ui-border-focus,#2f6fd1);outline-offset:4px}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createPreviewRoot } from "./preview-frame.ads.review.mjs";
|
|
2
|
+
import { specimenPage, specimenSection, specimenList, tokenRecord, brandSpecimen, artworkGrid } from "./ui/ui.js";
|
|
3
|
+
import "./ui/ui.css";
|
|
4
|
+
import "./foundation-view.css";
|
|
5
|
+
import { mountPictogram } from "./pictogram-view.mjs";
|
|
6
|
+
|
|
7
|
+
/** Framework-independent, tool-owned foundation presentation. */
|
|
8
|
+
export function mountFoundation(container, data) {
|
|
9
|
+
const root = createPreviewRoot(container), doc = root.ownerDocument;
|
|
10
|
+
root.classList.add("ads-foundation");
|
|
11
|
+
root.setAttribute("aria-label", data.title);
|
|
12
|
+
const element = (tag, className, text) => {
|
|
13
|
+
const node = doc.createElement(tag);
|
|
14
|
+
if (className) node.className = className;
|
|
15
|
+
if (text !== undefined) node.textContent = text;
|
|
16
|
+
return node;
|
|
17
|
+
};
|
|
18
|
+
const page=specimenPage({title:data.title,onSearch:data.tokens?query=>{const normalized=query.trim().toLowerCase();for(const record of root.querySelectorAll(".ux-token-record"))record.hidden=!record.textContent.toLowerCase().includes(normalized);}:undefined,description:data.tokens?.some(token=>/^(animation|transition)-/.test(token.property??""))?"Duration previews play at ⅛ speed. Easing previews use a one-second travel. Reduced-motion preferences are respected.":undefined});
|
|
19
|
+
const content=page.querySelector('[data-slot="content"]');
|
|
20
|
+
root.append(page);
|
|
21
|
+
const updatePictogram = data.pictogram ? mountPictogram(content, data.pictogram) : null;
|
|
22
|
+
const addSection=(title,children)=>{const section=specimenSection({title});section.querySelector('[data-slot="content"]').append(...children);content.append(section);};
|
|
23
|
+
const readouts = [], measurements = [];
|
|
24
|
+
const unitBars=[], roleValues=[];
|
|
25
|
+
// A token chain where each token links to the page that shows it; the host opens that page and highlights it.
|
|
26
|
+
const chainNodes=(chain,links,parent)=>chain.forEach((name,index)=>{
|
|
27
|
+
if(index)parent.append(" → ");
|
|
28
|
+
const target=links?.[name];
|
|
29
|
+
if(!target){parent.append(name);return;}
|
|
30
|
+
const link=element("button","ads-grid-link",name);link.type="button";link.title=`Open ${name}`;
|
|
31
|
+
link.addEventListener("click",()=>doc.dispatchEvent(new CustomEvent("ads-preview-navigate",{detail:{target,token:name}})));
|
|
32
|
+
parent.append(link);
|
|
33
|
+
});
|
|
34
|
+
let spatialReference;
|
|
35
|
+
if (data.spatial) {
|
|
36
|
+
spatialReference=specimenSection({title:"Grid reference"});
|
|
37
|
+
const referenceContent=spatialReference.querySelector('[data-slot="content"]');
|
|
38
|
+
const intro=element("p","ads-foundation-note","Fixed units size details. Fluid tracks organize space. Cell gutters, content padding and outer margins have separate responsibilities.");
|
|
39
|
+
referenceContent.append(intro);
|
|
40
|
+
const table=element("table","ads-foundation-breakpoints"), header=element("tr","");
|
|
41
|
+
for(const title of ["Breakpoint","From","Columns","Outer margin"])header.append(element("th","",title));
|
|
42
|
+
table.append(header);
|
|
43
|
+
// Margins belong to breakpoints: each margin cell carries its value and its token chain once.
|
|
44
|
+
const marginRole=name=>(data.spatial.roles??[]).find(role=>role.role===`Outer margin · ${name}`);
|
|
45
|
+
for(const point of data.spatial.breakpoints){
|
|
46
|
+
const row=element("tr","");
|
|
47
|
+
for(const value of [point.name,`${point.fromPx}px / ${point.fromPx/16}rem`,point.count])row.append(element("td","",String(value)));
|
|
48
|
+
const margin=element("td","",`${point.marginPx}px`),role=marginRole(point.name);
|
|
49
|
+
if(role){const chain=element("span","ads-grid-chain"," · ");chainNodes(role.chain,role.links,chain);margin.append(chain);}
|
|
50
|
+
row.append(margin);table.append(row);
|
|
51
|
+
}
|
|
52
|
+
referenceContent.append(table,element("p","ads-foundation-note","Resize the preview to inspect responsive tracks. The smallest tier also supplies the base fallback."));
|
|
53
|
+
// Units and scale: the fine and mini unit, then each scale step at its real width,
|
|
54
|
+
// measured live in mini units.
|
|
55
|
+
const units=element("div","ads-grid-units");
|
|
56
|
+
const unitSample=(token,label)=>{const row=element("div","ads-grid-unit"),bar=element("span","ads-grid-unit-bar"),text=element("span","ads-grid-unit-label");bar.style.width=`var(${token})`;bar.style.height=`var(${data.spatial.miniUnit})`;row.append(bar,text);unitBars.push({bar,text,token,label});return row;};
|
|
57
|
+
|
|
58
|
+
units.append(unitSample(data.spatial.fineUnit,"Fine unit"),unitSample(data.spatial.miniUnit,"Mini unit"),...data.spatial.scale.map(token=>unitSample(token,"")));
|
|
59
|
+
// The bar column is as wide as the largest scale step, so every label starts on one line.
|
|
60
|
+
units.style.setProperty("--ads-grid-unit-track",`var(${data.spatial.scale.at(-1)})`);
|
|
61
|
+
addSection("Units and scale",[units]);
|
|
62
|
+
// Each grid role, followed to the primitive it uses, with its live value.
|
|
63
|
+
if(data.spatial.roles?.length){
|
|
64
|
+
const roles=element("table","ads-foundation-breakpoints ads-grid-roles"),head=element("tr","");
|
|
65
|
+
for(const title of ["Role","Token → primitive","Value"])head.append(element("th","",title));
|
|
66
|
+
roles.append(head);
|
|
67
|
+
// Outer margins are listed with their breakpoints above, not repeated here.
|
|
68
|
+
for(const role of data.spatial.roles.filter(item=>!item.role.startsWith("Outer margin"))){
|
|
69
|
+
const row=element("tr",""),value=element("td","");
|
|
70
|
+
// A probe takes the token as its width, so any valid expression (calc(), a chain) reads as pixels.
|
|
71
|
+
const probe=element("span","ads-grid-probe");probe.style.width=`var(${role.token})`;
|
|
72
|
+
const chain=element("td","ads-grid-chain");
|
|
73
|
+
chainNodes(role.chain,role.links,chain);
|
|
74
|
+
chain.append(probe);
|
|
75
|
+
row.append(element("td","",role.role),chain,value);
|
|
76
|
+
roleValues.push({value,probe});roles.append(row);
|
|
77
|
+
}
|
|
78
|
+
addSection("Grid roles",[roles,element("p","ads-foundation-note","Roles come from the spatial definition; values are measured in this preview.")]);
|
|
79
|
+
}
|
|
80
|
+
for(const example of data.spatial.examples){
|
|
81
|
+
|
|
82
|
+
const style=element("style", "", example.css), region=element("section",`ads-grid-example ads-grid-example-${example.id}`);
|
|
83
|
+
region.setAttribute("aria-label",example.title);
|
|
84
|
+
region.dataset.adsSource=`tokens/spatial.ads.json#${example.id}`;
|
|
85
|
+
const makeCell=(className,text)=>element("div",`ux-spatial-cell ${className}`,text);
|
|
86
|
+
if(example.id==="hybrid")region.append(makeCell("a","Fixed"),makeCell("b","Fluid tracks fill the rest"));
|
|
87
|
+
else if(example.id==="push"||example.id==="cover")region.append(makeCell("a","Navigation"),makeCell("b","Main region"),makeCell("c",example.id==="push"?"Docked panel":"Floating panel"));
|
|
88
|
+
else if(example.id==="nested"){const cell=makeCell("a");cell.dataset.nested="true";cell.append(makeCell("b","1"),makeCell("c","Inherited content"));region.append(cell);}
|
|
89
|
+
else if(example.id==="fixed")for(let i=0;i<8;i++)region.append(makeCell("",String(i+1)));
|
|
90
|
+
else region.append(makeCell("a","Full region"),makeCell("b","1"),makeCell("c","Content keeps its natural height. Track width changes with the available space."));
|
|
91
|
+
addSection(example.title,[style,region]);
|
|
92
|
+
}
|
|
93
|
+
const ratios=element("div","ads-foundation-ratios");
|
|
94
|
+
for(const ratio of data.spatial.ratios){const sample=element("div","ux-spatial-cell",ratio);sample.style.aspectRatio=ratio.replace(":","/");ratios.append(sample);}
|
|
95
|
+
addSection("Proportions",[ratios]);
|
|
96
|
+
}
|
|
97
|
+
const list = specimenList({kind:"brand"});
|
|
98
|
+
if(data.kind==="brand")content.append(list);
|
|
99
|
+
const tokenLists=new Map();
|
|
100
|
+
// The server classifies each token (sample kind and section); one rule for every caller.
|
|
101
|
+
// A page of one section shows no section heading; the page title already names it.
|
|
102
|
+
const single=new Set((data.tokens??[]).map(token=>token.section?.key)).size<2;
|
|
103
|
+
const tokenSection=section=>{
|
|
104
|
+
const key=section?.key??"value";
|
|
105
|
+
if(!tokenLists.has(key)){
|
|
106
|
+
const items=specimenList();
|
|
107
|
+
if(single)content.append(items);
|
|
108
|
+
else{const container=specimenSection({title:section?.title??"Values"});container.querySelector('[data-slot="content"]').append(items);content.append(container);}
|
|
109
|
+
tokenLists.set(key,items);
|
|
110
|
+
}
|
|
111
|
+
return tokenLists.get(key);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
for (const token of [...data.tokens??[]].sort((a,b)=>(a.section?.order??0)-(b.section?.order??0)||a.name.localeCompare(b.name,undefined,{numeric:true}))) {
|
|
115
|
+
const property=token.property??"";
|
|
116
|
+
const kind=token.sampleKind??"value";
|
|
117
|
+
const type=kind==="type", text=kind==="text", color=kind==="color"||text, motion=kind==="motion", length=kind==="length";
|
|
118
|
+
const columns=kind==="columns", layer=kind==="layer", effect=kind==="effect";
|
|
119
|
+
const card=tokenRecord({name:token.name,meaning:token.meaning,kind});
|
|
120
|
+
if(kind!=="value"){
|
|
121
|
+
const stage=element("div",`ads-token-stage ads-token-stage-${kind}`),sample=element("div",`ads-token-sample ads-token-${kind}`);
|
|
122
|
+
sample.dataset.adsToken=token.name;sample.dataset.adsProperty=property;
|
|
123
|
+
if(!length)sample.style.setProperty(property,`var(${token.name})`);
|
|
124
|
+
if(text){
|
|
125
|
+
sample.textContent="Aa";
|
|
126
|
+
// Known shared role pairings, rather than arbitrary light/dark probe surfaces.
|
|
127
|
+
const backgrounds={"--accent-fg":"--accent","--success-fg":"--success","--warning-fg":"--warning","--danger-fg":"--danger","--info-fg":"--info","--success-text":"--success-bg","--warning-text":"--warning-bg","--danger-text":"--danger-bg","--info-text":"--info-bg"};
|
|
128
|
+
const background=backgrounds[token.name];
|
|
129
|
+
if(background&&data.tokens.some(item=>item.name===background)){
|
|
130
|
+
sample.style.backgroundColor=`var(${background})`;sample.title=`${token.name} on ${background}`;
|
|
131
|
+
}else if(token.name==="--text-inverse"){
|
|
132
|
+
// Without a declared paired fill, show the color itself instead of invisible type.
|
|
133
|
+
sample.textContent="";sample.style.backgroundColor=`var(${token.name})`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if(color)sample.style.backgroundColor=`var(${token.name})`;
|
|
137
|
+
else if(type)sample.textContent=property==="line-height"?"The quick brown fox\njumps over the lazy dog.":"Aa The quick brown fox 0123456789";
|
|
138
|
+
else if(motion){
|
|
139
|
+
sample.style.animationDuration=property.endsWith("duration")?`calc(var(${token.name}) * 8)`:"1s";
|
|
140
|
+
if(property.endsWith("timing-function"))sample.style.animationTimingFunction=`var(${token.name})`;
|
|
141
|
+
}else if(length){
|
|
142
|
+
const measure=element("span","ads-token-measure"), scale=element("small","ads-token-scale");
|
|
143
|
+
measure.style.width=`var(${token.name})`;stage.append(measure,scale);measurements.push({measure,sample,scale});
|
|
144
|
+
}
|
|
145
|
+
else if(columns){
|
|
146
|
+
sample.style.setProperty("--ads-sample-columns",`var(${token.name})`);
|
|
147
|
+
if(property==="grid-template-columns")for(let i=0;i<4;i++)sample.append(element("span","",String(i+1)));
|
|
148
|
+
}else if(layer){stage.append(element("span","ads-token-layer-reference","0"));sample.textContent="Layer";}
|
|
149
|
+
else if(effect)sample.textContent="Aa";
|
|
150
|
+
stage.append(sample);card.querySelector('[data-slot="sample"]').append(stage);
|
|
151
|
+
}
|
|
152
|
+
const value=card.querySelector('[data-slot="value"]');
|
|
153
|
+
readouts.push([value, token.name]);
|
|
154
|
+
tokenSection(token.section).append(card);
|
|
155
|
+
}
|
|
156
|
+
const artwork = data.artwork ?? [];
|
|
157
|
+
const brandImages=[];
|
|
158
|
+
// Reuse supplied bytes; never insert project SVG markup into the document.
|
|
159
|
+
const artworkCoordinates=new Map();
|
|
160
|
+
function coordinates(asset,img) {
|
|
161
|
+
if(!artworkCoordinates.has(asset.src)) {
|
|
162
|
+
let result=null;
|
|
163
|
+
if(asset.src.startsWith("data:image/svg+xml;base64,"))try {
|
|
164
|
+
const text=new TextDecoder().decode(Uint8Array.from(atob(asset.src.split(",")[1]),c=>c.charCodeAt(0)));
|
|
165
|
+
const svg=new doc.defaultView.DOMParser().parseFromString(text,"image/svg+xml").documentElement;
|
|
166
|
+
const values=svg.localName==="svg"?svg.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number):null;
|
|
167
|
+
if(values?.length===4&&values.every(Number.isFinite)&&values[2]>0&&values[3]>0)result={box:{x:values[0],y:values[1],width:values[2],height:values[3]},preserveAspectRatio:svg.getAttribute("preserveAspectRatio")||"xMidYMid meet",unit:"source units"};
|
|
168
|
+
}catch { /* Invalid artwork still gets its normal image/error presentation. */ }
|
|
169
|
+
artworkCoordinates.set(asset.src,result);
|
|
170
|
+
}
|
|
171
|
+
return artworkCoordinates.get(asset.src)??(img.naturalWidth&&img.naturalHeight?{box:{x:0,y:0,width:img.naturalWidth,height:img.naturalHeight},unit:"source pixels"}:null);
|
|
172
|
+
}
|
|
173
|
+
function updateGrid(item) {
|
|
174
|
+
if(!item.stage)return;
|
|
175
|
+
item.stage.querySelector(".ds-artwork-grid")?.remove();
|
|
176
|
+
if(!item.img.complete||!item.img.naturalWidth)return;
|
|
177
|
+
const current=coordinates(item.active,item.img);
|
|
178
|
+
if(!current){item.caption.textContent="Construction grid unavailable";return;}
|
|
179
|
+
const scale=Math.min(128/item.img.naturalHeight,280/item.img.naturalWidth);
|
|
180
|
+
item.stage.style.width=`${item.img.naturalWidth*scale}px`;
|
|
181
|
+
const grid=artworkGrid({...current,axes:false,overlay:true});
|
|
182
|
+
item.stage.append(grid);
|
|
183
|
+
const {box,unit}=current;
|
|
184
|
+
item.caption.textContent=`${box.width} × ${box.height} ${unit} · ${grid.dataset.step} per division`;
|
|
185
|
+
}
|
|
186
|
+
for (const asset of artwork.filter(item => !/\.dark\.[^.]+$/.test(item.name) || !artwork.some(base => base.name === item.name.replace(".dark.", ".")))) {
|
|
187
|
+
const card=brandSpecimen({name:asset.name});
|
|
188
|
+
card.dataset.artwork=asset.name;
|
|
189
|
+
const dark=artwork.find(item=>item.name===asset.name.replace(/(\.[^.]+)$/, ".dark$1"));
|
|
190
|
+
// The master shows clean first; its construction grid is a separate, secondary figure.
|
|
191
|
+
const clean=element("div","ads-brand-clean"),art=element("img","ads-brand-master");
|
|
192
|
+
art.alt=asset.name;art.src=asset.src;art.height=96;clean.append(art);
|
|
193
|
+
brandImages.push({img:art,asset,dark,active:asset});
|
|
194
|
+
const inspection=element("figure","ads-brand-inspection"),stage=element("div","ads-brand-stage"),img=element("img","ads-brand-art");
|
|
195
|
+
const caption=element("figcaption","ads-brand-grid-caption","Construction grid");
|
|
196
|
+
const item={img,asset,dark,active:asset,stage,caption};
|
|
197
|
+
img.onload=()=>updateGrid(item);
|
|
198
|
+
img.onerror=()=>{stage.querySelector(".ds-artwork-grid")?.remove();caption.textContent="Artwork could not be loaded";};
|
|
199
|
+
img.alt="";img.src=asset.src;
|
|
200
|
+
stage.append(img);inspection.append(stage,caption);card.querySelector('[data-slot="artwork"]').append(clean);card.querySelector('[data-slot="construction"]').append(inspection);
|
|
201
|
+
const info=card.querySelector('[data-slot="sizes"]');
|
|
202
|
+
brandImages.push(item);
|
|
203
|
+
const sizes=element("div","ads-brand-sizes");
|
|
204
|
+
// Clean actual-size samples stay separate from the enlarged construction grid.
|
|
205
|
+
for(const size of asset.appIcon?[16,32,48,64]:[16,32,64]) {
|
|
206
|
+
const figure=element("figure",""),sample=element("img","");
|
|
207
|
+
sample.src=asset.src;sample.alt="";sample.height=size;
|
|
208
|
+
if(asset.appIcon)sample.width=size;
|
|
209
|
+
brandImages.push({img:sample,asset,dark,active:asset});
|
|
210
|
+
figure.append(sample,element("figcaption","",`${size}px high`));sizes.append(figure);
|
|
211
|
+
}
|
|
212
|
+
info.append(element("p","ads-foundation-note","Actual sizes"),sizes);
|
|
213
|
+
if(asset.appIcon)info.append(element("p","ads-foundation-note","Home-screen icons (180, 192 and 512 px) use the same master."));
|
|
214
|
+
list.append(card);
|
|
215
|
+
}
|
|
216
|
+
if(spatialReference)content.append(spatialReference);
|
|
217
|
+
let pending;
|
|
218
|
+
const update = () => {
|
|
219
|
+
cancelAnimationFrame(pending);
|
|
220
|
+
pending = requestAnimationFrame(() => {
|
|
221
|
+
const style = doc.defaultView.getComputedStyle(root);
|
|
222
|
+
updatePictogram?.(root.closest("[data-theme]")?.getAttribute("data-theme"));
|
|
223
|
+
for (const [node, name] of readouts) node.textContent = style.getPropertyValue(name).trim() || "Not defined in this context";
|
|
224
|
+
for(const {measure,sample,scale} of measurements){
|
|
225
|
+
const pixels=parseFloat(doc.defaultView.getComputedStyle(measure).width)||0;
|
|
226
|
+
const factor=pixels>192?1/2**Math.ceil(Math.log2(pixels/192)):pixels>0&&pixels<8?8:1;
|
|
227
|
+
sample.style.width=`${pixels*factor}px`;
|
|
228
|
+
sample.dataset.zero=String(pixels===0);
|
|
229
|
+
scale.textContent=pixels===0?"Zero space":factor>1?`${factor}× enlarged`:factor<1?`1:${1/factor} scale`:"Actual size";
|
|
230
|
+
}
|
|
231
|
+
const mini=parseFloat(doc.defaultView.getComputedStyle(unitBars[1]?.bar??root).width)||0;
|
|
232
|
+
for(const {bar,text,token,label} of unitBars){
|
|
233
|
+
const pixels=parseFloat(doc.defaultView.getComputedStyle(bar).width)||0;
|
|
234
|
+
text.textContent=`${label?label+" · ":""}${token} · ${pixels}px${mini&&label!=="Fine unit"&&label!=="Mini unit"?` · ${+(pixels/mini).toFixed(2)} × mini`:""}`;
|
|
235
|
+
}
|
|
236
|
+
for(const {value,probe} of roleValues)value.textContent=`${+(parseFloat(doc.defaultView.getComputedStyle(probe).width)||0).toFixed(2)}px`;
|
|
237
|
+
const darkTheme=style.colorScheme==="dark";
|
|
238
|
+
for(const item of brandImages){const active=darkTheme&&item.dark?item.dark:item.asset;item.active=active;if(item.img.getAttribute("src")!==active.src)item.img.src=active.src;updateGrid(item);}
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const observer = new MutationObserver(update);
|
|
242
|
+
// Theme/brand context is inherited from the App host; no polling or product observers.
|
|
243
|
+
for (let parent = root; parent; parent = parent.parentElement) observer.observe(parent, { attributes: true, attributeFilter: ["data-theme", "data-brand", "style"] });
|
|
244
|
+
update();
|
|
245
|
+
// A link from another view asks to show one token: scroll to its record and mark it briefly.
|
|
246
|
+
const focus=event=>{
|
|
247
|
+
const record=[...root.querySelectorAll(".ux-token-record")].find(item=>item.getAttribute("aria-label")===event.detail?.token);
|
|
248
|
+
if(!record)return;
|
|
249
|
+
record.scrollIntoView({block:"center"});
|
|
250
|
+
record.dataset.adsFocus="true";
|
|
251
|
+
setTimeout(()=>{delete record.dataset.adsFocus;},2400);
|
|
252
|
+
};
|
|
253
|
+
doc.addEventListener("ads-preview-focus",focus);
|
|
254
|
+
return () => { doc.removeEventListener("ads-preview-focus",focus); observer.disconnect(); cancelAnimationFrame(pending);for(const {img} of brandImages){img.onload=null;img.onerror=null;}root.remove(); };
|
|
255
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Development-only controls for the existing preview guide overlay.
|
|
2
|
+
* A choice is a mode (where guides show) plus layers (what they draw):
|
|
3
|
+
* off shows nothing, hover shows the element under the pointer or focus,
|
|
4
|
+
* always shows every element. Layer choices are kept in every mode. */
|
|
5
|
+
export const guideOptionsEvent = "ads-preview-guide-options";
|
|
6
|
+
export const guideStateEvent = "ads-preview-guide-state";
|
|
7
|
+
export const guideModes = ["off", "hover", "always"];
|
|
8
|
+
export const guideLayers = ["bounds", "tracks", "gaps", "padding", "margins", "mini"];
|
|
9
|
+
export const defaultGuideOptions = Object.freeze({ mode: "off", bounds: true, tracks: false, gaps: false, padding: true, margins: true, mini: false });
|
|
10
|
+
|
|
11
|
+
export function normalizeGuideOptions(value) {
|
|
12
|
+
const mode = guideModes.includes(value?.mode) ? value.mode : value?.all === true ? "always" : "off";
|
|
13
|
+
return { mode, ...Object.fromEntries(guideLayers.map((layer) => [layer, value?.[layer] === true])) };
|
|
14
|
+
}
|
|
15
|
+
/** What the overlay draws: `all` means every element, the layers say which geometry. */
|
|
16
|
+
export function overlayGuides(options) {
|
|
17
|
+
const { mode, ...layers } = normalizeGuideOptions(options);
|
|
18
|
+
return { all: mode === "always", ...layers };
|
|
19
|
+
}
|
|
20
|
+
export function guidesVisible(options) {
|
|
21
|
+
const { mode, ...layers } = normalizeGuideOptions(options);
|
|
22
|
+
return mode !== "off" && Object.values(layers).some(Boolean);
|
|
23
|
+
}
|
|
24
|
+
export function setPreviewGuides(options) {
|
|
25
|
+
document.dispatchEvent(new CustomEvent(guideOptionsEvent, { detail: normalizeGuideOptions(options) }));
|
|
26
|
+
}
|
|
27
|
+
export function observePreviewGuides(listener) {
|
|
28
|
+
const receive = (event) => listener(normalizeGuideOptions(event.detail));
|
|
29
|
+
document.addEventListener(guideStateEvent, receive);
|
|
30
|
+
document.dispatchEvent(new CustomEvent(guideOptionsEvent));
|
|
31
|
+
return () => document.removeEventListener(guideStateEvent, receive);
|
|
32
|
+
}
|
package/dist/showcase/icons.js
CHANGED
|
@@ -1,146 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { iconsMounted, renderIcons, unmountIcons } from "./ui/ui.js";
|
|
2
2
|
export const ICONS_URI = "ads://project/icons";
|
|
3
|
-
const SVG = "http://www.w3.org/2000/svg";
|
|
4
|
-
|
|
5
|
-
function element(tag, props = {}, ...children) {
|
|
6
|
-
const node = Object.assign(document.createElement(tag), props);
|
|
7
|
-
node.append(...children.filter(child => child !== null && child !== undefined && child !== false));
|
|
8
|
-
return node;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const paint = { fill: "black", stroke: "none", "stroke-width": "1", "stroke-linecap": "butt", "stroke-linejoin": "miter", "stroke-miterlimit": "4", "stroke-dasharray": "none", "fill-opacity": "1", "stroke-opacity": "1", "fill-rule": "nonzero" };
|
|
12
|
-
/** Project SVG drawn inline so currentColor and the set's default strokes apply; scripts, foreign content and handlers are dropped. */
|
|
13
|
-
function sanitize(markup) {
|
|
14
|
-
const parsed = new DOMParser().parseFromString(markup, "image/svg+xml").documentElement;
|
|
15
|
-
if (parsed.namespaceURI !== SVG || parsed.localName !== "svg") return null;
|
|
16
|
-
for (const node of parsed.querySelectorAll("*")) {
|
|
17
|
-
if (["script", "foreignObject", "iframe", "image", "a", "animate", "set", "animateTransform", "animateMotion"].includes(node.localName) || node.namespaceURI !== SVG) node.remove();
|
|
18
|
-
}
|
|
19
|
-
for (const node of [parsed, ...parsed.querySelectorAll("*")]) {
|
|
20
|
-
for (const attribute of Array.from(node.attributes)) {
|
|
21
|
-
if (/^on/i.test(attribute.name) || /href$/i.test(attribute.name) && !attribute.value.trim().startsWith("#")) node.removeAttribute(attribute.name);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const svg = document.importNode(parsed, true);
|
|
25
|
-
for (const name of ["width", "height", "class"]) svg.removeAttribute(name);
|
|
26
|
-
// The showcase styles its own svg chrome; inline the glyph's own (or initial) paint so it draws as in the project's Icon.
|
|
27
|
-
for (const [name, initial] of Object.entries(paint)) if (!svg.style.getPropertyValue(name)) svg.style.setProperty(name, svg.getAttribute(name) ?? initial);
|
|
28
|
-
svg.setAttribute("aria-hidden", "true"); svg.setAttribute("focusable", "false");
|
|
29
|
-
return svg;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function glyph(item, px, label) {
|
|
33
|
-
const span = element("span", { className: "icons-glyph" });
|
|
34
|
-
span.style.width = span.style.height = `${px}px`;
|
|
35
|
-
const svg = sanitize(item.svg);
|
|
36
|
-
if (svg) span.append(svg);
|
|
37
|
-
if (label) { span.setAttribute("role", "img"); span.setAttribute("aria-label", label); span.title = label; }
|
|
38
|
-
else span.setAttribute("aria-hidden", "true");
|
|
39
|
-
return span;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** One line per viewBox unit (thinned on large boxes), the center lines stronger, under the glyph. */
|
|
43
|
-
function grid(box) {
|
|
44
|
-
const svg = document.createElementNS(SVG, "svg");
|
|
45
|
-
svg.setAttribute("class", "icons-grid"); svg.setAttribute("aria-hidden", "true");
|
|
46
|
-
svg.setAttribute("viewBox", `${box.x} ${box.y} ${box.width} ${box.height}`);
|
|
47
|
-
svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
|
|
48
|
-
const step = Math.max(1, Math.ceil(Math.max(box.width, box.height) / 48));
|
|
49
|
-
const line = (x1, y1, x2, y2, mid) => {
|
|
50
|
-
const node = document.createElementNS(SVG, "line");
|
|
51
|
-
for (const [name, value] of Object.entries({ x1, y1, x2, y2 })) node.setAttribute(name, value);
|
|
52
|
-
if (mid) node.setAttribute("class", "mid");
|
|
53
|
-
svg.append(node);
|
|
54
|
-
};
|
|
55
|
-
for (let unit = 0; unit <= box.width; unit += step) line(box.x + unit, box.y, box.x + unit, box.y + box.height, unit * 2 === box.width);
|
|
56
|
-
for (let unit = 0; unit <= box.height; unit += step) line(box.x, box.y + unit, box.x + box.width, box.y + unit, unit * 2 === box.height);
|
|
57
|
-
if (box.width % 2 && step === 1) line(box.x + box.width / 2, box.y, box.x + box.width / 2, box.y + box.height, true);
|
|
58
|
-
if (box.height % 2 && step === 1) line(box.x, box.y + box.height / 2, box.x + box.width, box.y + box.height / 2, true);
|
|
59
|
-
return svg;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
63
|
-
function findingCount(findings) {
|
|
64
|
-
const errors = findings.filter(item => item.severity === "error").length;
|
|
65
|
-
return errors === findings.length ? plural(errors, "error") : plural(findings.length, "issue");
|
|
66
|
-
}
|
|
67
|
-
function findingBox(finding) {
|
|
68
|
-
return element("p", { className: "icons-finding", title: finding.file ?? "" }, element("strong", { textContent: finding.rule }), " ", finding.message);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function card(item, sizes) {
|
|
72
|
-
const article = element("article", { className: "icons-card" });
|
|
73
|
-
article.dataset.glyph = item.name;
|
|
74
|
-
if (item.findings.length) article.dataset.findings = String(item.findings.length);
|
|
75
|
-
const header = element("div", { className: "icons-card-head" }, element("h3", { textContent: item.name }), item.findings.length ? element("span", { className: "icons-badge", textContent: findingCount(item.findings) }) : null);
|
|
76
|
-
const magnified = element("div", { className: "icons-mag" });
|
|
77
|
-
if (item.grid) magnified.append(grid(item.grid));
|
|
78
|
-
magnified.append(glyph(item, 96));
|
|
79
|
-
const scale = element("div", { className: "icons-sizes" }, ...sizes.map(size => element("span", { className: "icons-size" }, glyph(item, size.px), element("small", { textContent: String(size.px), title: size.token }))));
|
|
80
|
-
article.append(...[header, element("p", { className: "icons-alias", textContent: item.aliases.length ? `alias: ${item.aliases.join(", ")}` : "", title: item.aliases.join(", ") }), magnified, scale, ...item.findings.map(findingBox)].filter(Boolean));
|
|
81
|
-
article.setAttribute("aria-label", item.name);
|
|
82
|
-
return article;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function logo(file) {
|
|
86
|
-
const figure = element("figure", { className: "icons-logo" });
|
|
87
|
-
figure.dataset.logo = file.name;
|
|
88
|
-
if (file.tooLarge) { figure.append(element("figcaption", { textContent: `${file.name} (over 1 MB; not shown)` })); return figure; }
|
|
89
|
-
// The file exactly as it is, on a white and a black tile, so black and white artwork both show.
|
|
90
|
-
figure.append(element("span", { className: "icons-logo-tile" }, element("img", { src: file.src, alt: file.name, title: file.file })),
|
|
91
|
-
element("span", { className: "icons-logo-tile icons-logo-tile-black" }, element("img", { src: file.src, alt: "" })),
|
|
92
|
-
element("figcaption", { textContent: file.name }));
|
|
93
|
-
return figure;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const matches = (item, query) => !query || [item.name, ...item.aliases].some(name => name.toLowerCase().includes(query));
|
|
97
|
-
|
|
98
|
-
/** Renders the view into slot; a later call with the same slot keeps the search text and scroll. */
|
|
99
|
-
export function renderIcons(slot, data) {
|
|
100
|
-
let view = slot.querySelector(":scope > .icons-view");
|
|
101
|
-
const query = view?.querySelector("input[type=search]")?.value ?? "";
|
|
102
|
-
const scroll = view?.scrollTop ?? 0;
|
|
103
|
-
view = element("div", { className: "icons-view" });
|
|
104
|
-
view.setAttribute("role", "region"); view.setAttribute("aria-label", "Icons");
|
|
105
|
-
if (!data?.configured) {
|
|
106
|
-
view.append(element("h1", { textContent: "Icons" }), element("p", { className: "icons-summary", textContent: "The project configures no glyph set (assets.glyphs)." }));
|
|
107
|
-
slot.replaceChildren(view); return view;
|
|
108
|
-
}
|
|
109
|
-
const grid = data.mixed ? "mixed grids" : data.grid ? `${/^(?:8|11|18)(?!\d)|^8/.test(String(data.grid.width)) ? "an" : "a"} ${data.grid.width}×${data.grid.height} grid` : "no viewBox";
|
|
110
|
-
const summary = `${data.source} · ${plural(data.glyphs.length, "glyph")} on ${grid} · ${data.aliasCount} ${data.aliasCount === 1 ? "alias" : "aliases"}`;
|
|
111
|
-
const search = element("input", { type: "search", placeholder: "Search name or alias", value: query });
|
|
112
|
-
search.setAttribute("aria-label", "Search glyphs by name or alias");
|
|
113
|
-
const set = element("div", { className: "icons-set" });
|
|
114
|
-
set.setAttribute("role", "list"); set.setAttribute("aria-label", "The set");
|
|
115
|
-
const cards = element("div", { className: "icons-cards" });
|
|
116
|
-
const empty = element("p", { className: "icons-empty", hidden: true });
|
|
117
|
-
const text = data.textSize;
|
|
118
|
-
view.append(
|
|
119
|
-
element("div", { className: "icons-head" }, element("div", {}, element("h1", { textContent: "Icons" }), element("p", { className: "icons-summary", textContent: summary })), search),
|
|
120
|
-
...data.findings.map(findingBox),
|
|
121
|
-
element("h2", {}, "The set ", element("small", { textContent: text ? `every glyph at ${text.px} px, the size used beside text` : "every glyph" })), set,
|
|
122
|
-
element("h2", {}, "Glyphs ", element("small", { textContent: data.sizes.length ? "each on its grid, at every icon size" : "each on its grid" })), empty, cards,
|
|
123
|
-
);
|
|
124
|
-
for (const item of data.glyphs) {
|
|
125
|
-
const wrapper = element("span", { className: "icons-set-item" }, glyph(item, text?.px ?? 18, item.name));
|
|
126
|
-
wrapper.dataset.glyph = item.name; wrapper.setAttribute("role", "listitem");
|
|
127
|
-
set.append(wrapper);
|
|
128
|
-
cards.append(card(item, data.sizes));
|
|
129
|
-
}
|
|
130
|
-
if (data.logos) {
|
|
131
|
-
view.append(element("h2", {}, "Other products' logos ", element("small", { textContent: data.logos.source })),
|
|
132
|
-
data.logos.files.length ? element("div", { className: "icons-logos" }, ...data.logos.files.map(logo)) : element("p", { className: "icons-summary", textContent: "No images yet." }));
|
|
133
|
-
}
|
|
134
|
-
const filter = () => {
|
|
135
|
-
const value = search.value.trim().toLowerCase();
|
|
136
|
-
let shown = 0;
|
|
137
|
-
data.glyphs.forEach((item, index) => { const visible = matches(item, value); set.children[index].hidden = cards.children[index].hidden = !visible; shown += visible; });
|
|
138
|
-
empty.hidden = shown > 0; empty.textContent = `No glyph matches “${search.value.trim()}”.`;
|
|
139
|
-
};
|
|
140
|
-
search.addEventListener("input", filter);
|
|
141
|
-
filter();
|
|
142
|
-
slot.replaceChildren(view);
|
|
143
|
-
view.scrollTop = scroll;
|
|
144
|
-
if (query && document.activeElement === document.body) search.focus();
|
|
145
|
-
return view;
|
|
146
|
-
}
|
package/dist/showcase/index.html
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en" data-theme="light">
|
|
3
|
-
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>ADS Showcase</title><link rel="stylesheet" href="style.css"></head>
|
|
4
|
-
<body>
|
|
5
|
-
|
|
6
|
-
<div id="brand"><span class="mark">ADS</span><span id="title">Design System</span><button id="pane-toggle" aria-label="Hide navigation pane" aria-expanded="true" aria-controls="sidebar" title="Hide navigation pane"><svg viewBox="0 0 16 16"><path d="M10 4l-4 4 4 4"/></svg></button></div>
|
|
7
|
-
<nav id="sections" aria-label="Showcase sections">
|
|
8
|
-
<button data-section="brand" hidden><svg viewBox="0 0 16 16"><path d="M8 1.5 9.9 5.6l4.4.5-3.3 3 .9 4.4L8 11.3l-3.9 2.2.9-4.4-3.3-3 4.4-.5L8 1.5Z"/></svg>Brand</button>
|
|
9
|
-
<button data-section="tokens" aria-current="page"><svg viewBox="0 0 16 16"><path d="m8 2 6 3-6 3-6-3 6-3Zm-6 6 6 3 6-3M2 11l6 3 6-3"/></svg>Tokens</button>
|
|
10
|
-
<button data-section="icons" hidden><svg viewBox="0 0 16 16"><circle cx="5" cy="5" r="2.5"/><rect x="9.5" y="2.5" width="4" height="5" rx="1"/><path d="m2.5 13.5 2.5-4 2.5 4ZM9.5 11.5h4M11.5 9.5v4"/></svg>Icons</button>
|
|
11
|
-
<button data-section="components"><svg viewBox="0 0 16 16"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>Components</button>
|
|
12
|
-
<button data-section="patterns"><svg viewBox="0 0 16 16"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>Patterns</button>
|
|
13
|
-
<button data-section="composition"><svg viewBox="0 0 16 16"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>Composition</button>
|
|
14
|
-
</nav>
|
|
15
|
-
<div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p><p id="warmup-status" hidden></p></div><button id="viewport" aria-label="Phone viewport" aria-pressed="false" aria-controls="frame-slot" title="Preview at phone width (390 px)"><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg></button><button id="grid-overlay" aria-label="Show grid overlay" title="Show grid overlay" aria-pressed="false"><svg viewBox="0 0 16 16"><path d="M3 2v12M6.5 2v12M9.5 2v12M13 2v12"/></svg></button><select id="brand-select" aria-label="Preview brand" title="Preview brand" hidden></select><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
|
|
16
|
-
</header>
|
|
17
|
-
<main>
|
|
18
|
-
<aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside>
|
|
19
|
-
<section id="preview-workspace" aria-label="Preview workspace">
|
|
20
|
-
<div id="preview-error" role="alert" hidden>
|
|
21
|
-
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="m8 2 7 12H1L8 2Z"/><path d="M8 6v3M8 11v.5"/></svg>
|
|
22
|
-
<p id="preview-error-message"></p>
|
|
23
|
-
<button id="preview-error-details" type="button" popovertarget="status-details">Details</button>
|
|
24
|
-
<button id="retry-preview" type="button">Retry preview</button>
|
|
25
|
-
</div>
|
|
26
|
-
<section id="preview" aria-label="Preview">
|
|
27
|
-
<div id="loader" role="status" aria-label="Loading preview" hidden><span class="spinner" aria-hidden="true"></span></div>
|
|
28
|
-
<div id="frame-slot"></div>
|
|
29
|
-
</section>
|
|
30
|
-
</section>
|
|
31
|
-
</main>
|
|
32
|
-
<script type="module" src="client.js"></script>
|
|
33
|
-
</body></html>
|
|
3
|
+
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>ADS Showcase</title><link rel="icon" href="favicon.ico" sizes="32x32"><link rel="icon" href="favicon.svg" type="image/svg+xml"><link rel="stylesheet" href="ui.css"><link rel="stylesheet" href="style.css"></head>
|
|
4
|
+
<body><div id="app"></div><script type="module" src="client.js"></script></body>
|
|
5
|
+
</html>
|