@reqvire-org/ads 0.3.42 → 0.3.44

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.
Files changed (131) hide show
  1. package/README.md +11 -5
  2. package/dist/assets.mjs +48 -2
  3. package/dist/bootstrap-ds/ADS.md +2 -1
  4. package/dist/bootstrap-ds/README.md +25 -14
  5. package/dist/bootstrap-ds/design-system/assets/brand/README.md +26 -19
  6. package/dist/bootstrap-ds/design-system/assets/brand/app-icon.svg +4 -0
  7. package/dist/bootstrap-ds/design-system/assets/brand/logo.dark.svg +6 -0
  8. package/dist/bootstrap-ds/design-system/assets/brand/logo.svg +6 -0
  9. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
  10. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
  11. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
  12. package/dist/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
  13. package/dist/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.fixture.ts +1 -0
  14. package/dist/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
  15. package/dist/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +41 -0
  16. package/dist/bootstrap-ds/design-system/components/Content/Logo/README.md +10 -0
  17. package/dist/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
  18. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
  19. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
  20. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
  21. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
  22. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
  23. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
  24. package/dist/bootstrap-ds/design-system/index.ts +5 -1
  25. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
  26. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
  27. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
  28. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
  29. package/dist/bootstrap-ds/design-system/review/brand-preview/BrandPreview.tsx +115 -0
  30. package/dist/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  31. package/dist/bootstrap-ds/design-system/review/index.ts +3 -0
  32. package/dist/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  33. package/dist/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
  34. package/dist/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +12 -0
  35. package/dist/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx +4 -0
  36. package/dist/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
  37. package/dist/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
  38. package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Foundation.ads.fixture.ts → bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts} +1 -13
  39. package/dist/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
  40. package/dist/bootstrap-ds/ds.config.json +2 -1
  41. package/dist/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  42. package/dist/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  43. package/dist/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
  44. package/dist/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
  45. package/dist/bootstrap-ds-preact/ds.config.json +20 -0
  46. package/dist/bootstrap-ds-preact/package.json +38 -0
  47. package/dist/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
  48. package/dist/bootstrap-ds-preact/tsconfig.json +36 -0
  49. package/dist/bootstrap-ds-preact/vite.config.ts +23 -0
  50. package/dist/brand-assets.mjs +136 -3
  51. package/dist/check.mjs +4 -2
  52. package/dist/config.mjs +49 -1
  53. package/dist/init.mjs +16 -7
  54. package/dist/mcp/preview-widget.bundle.js +1 -1
  55. package/dist/mcp/project-widget.bundle.js +1 -1
  56. package/dist/mcp/server.mjs +5 -2
  57. package/dist/mcp/showcase-host.mjs +5 -1
  58. package/dist/preview-builder.mjs +8 -2
  59. package/dist/preview-bun.mjs +4 -2
  60. package/dist/preview-resources.mjs +1 -1
  61. package/dist/scenarios.mjs +11 -4
  62. package/dist/skills/ads-break-ui/SKILL.md +2 -2
  63. package/dist/skills/ads-designer/SKILL.md +42 -19
  64. package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +2 -1
  65. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +25 -14
  66. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +26 -19
  67. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/app-icon.svg +4 -0
  68. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.dark.svg +6 -0
  69. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.svg +6 -0
  70. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
  71. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
  72. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
  73. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
  74. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.fixture.ts +1 -0
  75. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
  76. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +41 -0
  77. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/README.md +10 -0
  78. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
  79. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
  80. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
  81. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
  82. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
  83. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
  84. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
  85. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +5 -1
  86. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
  87. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
  88. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
  89. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
  90. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/brand-preview/BrandPreview.tsx +115 -0
  91. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  92. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +3 -0
  93. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  94. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
  95. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +12 -0
  96. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx +4 -0
  97. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
  98. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
  99. package/dist/{bootstrap-ds/design-system/tokens/Foundation.ads.fixture.ts → skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts} +1 -13
  100. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
  101. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +2 -1
  102. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  103. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  104. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
  105. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
  106. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +20 -0
  107. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +38 -0
  108. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
  109. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +36 -0
  110. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +23 -0
  111. package/dist/skills/ads-designer/references/branding.md +89 -0
  112. package/dist/skills/ads-designer/references/cli.md +1 -1
  113. package/dist/skills/ads-designer/references/design-craft.md +1 -1
  114. package/dist/skills/ads-import/SKILL.md +2 -2
  115. package/dist/skills/ads-import/references/branding.md +10 -3
  116. package/dist/skills/ads-import/references/cli.md +1 -1
  117. package/dist/skills/ads-motion/SKILL.md +2 -2
  118. package/dist/skills/ads-port/SKILL.md +3 -3
  119. package/dist/skills/ads-port/references/cli.md +1 -1
  120. package/dist/token-fixtures.mjs +2 -2
  121. package/docs/ADS.md +12 -9
  122. package/docs/ARCHITECTURE.md +3 -2
  123. package/docs/CHANGELOG.md +56 -12
  124. package/docs/GUIDE.md +57 -15
  125. package/package.json +1 -1
  126. package/dist/bootstrap-ds/design-system/components/.gitkeep +0 -0
  127. package/dist/bootstrap-ds/design-system/composition/.gitkeep +0 -0
  128. package/dist/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
  129. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/.gitkeep +0 -0
  130. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/.gitkeep +0 -0
  131. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
@@ -0,0 +1,41 @@
1
+ import { css, cx } from "@linaria/atomic";
2
+ import { Button } from "../../../components/Actions/Button/Button";
3
+ import { TextField } from "../../../components/Forms/TextField/TextField";
4
+
5
+ export interface SearchBarProps {
6
+ id: string;
7
+ label: string;
8
+ placeholder?: string;
9
+ submitLabel?: string;
10
+ /** Called with the typed query when the person searches. */
11
+ onSearch?: (query: string) => void;
12
+ }
13
+
14
+ const form = css`
15
+ display: flex;
16
+ align-items: flex-end;
17
+ gap: var(--space-4);
18
+ `;
19
+ const query = css`
20
+ flex: 1;
21
+ min-width: 0;
22
+ `;
23
+
24
+ /** A search field with its submit action: Enter or the button searches. */
25
+ export function SearchBar({ id, label, placeholder, submitLabel = "Search", onSearch }: SearchBarProps) {
26
+ return (
27
+ <form
28
+ role="search"
29
+ className={cx("ds-search-bar", form)}
30
+ onSubmit={event => {
31
+ event.preventDefault();
32
+ onSearch?.(String(new FormData(event.currentTarget).get("query") ?? "").trim());
33
+ }}
34
+ >
35
+ <div className={query}>
36
+ <TextField id={id} label={label} name="query" placeholder={placeholder} />
37
+ </div>
38
+ <Button label={submitLabel} variant="primary" type="submit" />
39
+ </form>
40
+ );
41
+ }
@@ -0,0 +1,115 @@
1
+ import { css, cx } from "@linaria/atomic";
2
+
3
+ export interface BrandArtwork {
4
+ name: string;
5
+ use: string;
6
+ /** The default (light theme) artwork's URL. */
7
+ src: string;
8
+ /** Its dark-theme variant, `<name>.dark.svg`, when it has one. */
9
+ darkSrc?: string;
10
+ }
11
+ export interface BrandPreviewProps {
12
+ title: string;
13
+ artwork: readonly BrandArtwork[];
14
+ /** The `assets.iconSource` master, shown at the generated web icon sizes. */
15
+ icon?: { name: string; src: string; sizes: readonly number[] };
16
+ }
17
+
18
+ const page = css`
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: var(--space-12);
22
+ padding: var(--space-8);
23
+ `;
24
+ const heading = css`
25
+ margin: 0;
26
+ font-size: var(--text-base);
27
+ font-weight: var(--weight-semibold);
28
+ color: var(--text-body);
29
+ `;
30
+ const grid = css`
31
+ display: grid;
32
+ grid-template-columns: repeat(auto-fill, minmax(calc(var(--space-16) * 8), 1fr));
33
+ gap: var(--space-8);
34
+ `;
35
+ const tile = css`
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: var(--space-4);
39
+ padding: var(--space-8);
40
+ border: var(--border-w) solid var(--border-default);
41
+ border-radius: var(--radius-md);
42
+ background: var(--bg-surface);
43
+ `;
44
+ const stage = css`
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ min-height: calc(var(--space-16) * 3);
49
+ `;
50
+ const art = css`
51
+ max-width: 100%;
52
+ max-height: calc(var(--space-16) * 3);
53
+ `;
54
+ const label = css`
55
+ font-size: var(--text-sm);
56
+ color: var(--text-muted);
57
+ overflow-wrap: anywhere;
58
+ `;
59
+ // Paired artwork shows the variant of the current theme, as the UI does.
60
+ const light = css`:root[data-theme="dark"] & { display: none; }`;
61
+ const dark = css`
62
+ display: none;
63
+ :root[data-theme="dark"] & { display: block; }
64
+ `;
65
+ const icons = css`
66
+ display: flex;
67
+ flex-wrap: wrap;
68
+ align-items: flex-end;
69
+ gap: var(--space-8);
70
+ `;
71
+ const iconTile = css`
72
+ display: flex;
73
+ flex-direction: column;
74
+ align-items: center;
75
+ gap: var(--space-2);
76
+ `;
77
+ // Small sizes show at their real pixels; large ones are scaled down to fit the tile.
78
+ const iconImage = css`
79
+ max-width: calc(var(--space-16) * 4);
80
+ max-height: calc(var(--space-16) * 4);
81
+ `;
82
+
83
+ /** Development-only review of the brand artwork and the app icon at its generated sizes. */
84
+ export function BrandPreview({ title, artwork, icon }: BrandPreviewProps) {
85
+ return (
86
+ <section aria-label={title} className={cx("ux-brand-preview", page)}>
87
+ <h1 className={heading}>{title}</h1>
88
+ <div className={grid}>
89
+ {artwork.map(item => (
90
+ <article key={item.name} className={tile} aria-label={item.name}>
91
+ <div className={stage}>
92
+ <img className={cx(art, item.darkSrc ? light : undefined)} src={item.src} alt="" />
93
+ {item.darkSrc ? <img className={cx(art, dark)} src={item.darkSrc} alt="" /> : null}
94
+ </div>
95
+ <code className={label}>{item.darkSrc ? `${item.name} · ${item.name.replace(/\.svg$/, ".dark.svg")}` : item.name}</code>
96
+ <small className={label}>{item.use}</small>
97
+ </article>
98
+ ))}
99
+ </div>
100
+ {icon ? (
101
+ <div className={tile} aria-label="App icon">
102
+ <div className={icons}>
103
+ {icon.sizes.map(size => (
104
+ <div key={size} className={iconTile}>
105
+ <img className={iconImage} src={icon.src} alt="" width={size} height={size} />
106
+ <small className={label}>{size}px</small>
107
+ </div>
108
+ ))}
109
+ </div>
110
+ <code className={label}>{icon.name}</code>
111
+ </div>
112
+ ) : null}
113
+ </section>
114
+ );
115
+ }
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from "react";
2
+ import { css, cx } from "@linaria/atomic";
3
+
4
+ export interface DemoFrameProps {
5
+ /** `row` lays examples side by side; `column` stacks them at a readable width. */
6
+ layout?: "row" | "column";
7
+ children?: ReactNode;
8
+ }
9
+
10
+ const frame = css`
11
+ display: flex;
12
+ gap: var(--space-8);
13
+ padding: var(--space-12);
14
+ `;
15
+ const layouts = {
16
+ row: css`
17
+ flex-wrap: wrap;
18
+ align-items: flex-start;
19
+ `,
20
+ column: css`
21
+ flex-direction: column;
22
+ max-width: calc(var(--space-16) * 12);
23
+ `,
24
+ };
25
+
26
+ /** Development-only framing for component and pattern scenarios: spacing between examples. */
27
+ export function DemoFrame({ layout = "row", children }: DemoFrameProps) {
28
+ return <div className={cx(frame, layouts[layout])}>{children}</div>;
29
+ }
@@ -1 +1,4 @@
1
1
  export { TokenPreview } from "./token-preview/TokenPreview";
2
+ export { ScreenFrame } from "./screen-frame/ScreenFrame";
3
+ export { DemoFrame } from "./demo-frame/DemoFrame";
4
+ export { BrandPreview } from "./brand-preview/BrandPreview";
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from "react";
2
+ import { css } from "@linaria/atomic";
3
+
4
+ export interface ScreenFrameProps { title: string; description?: string; children?: ReactNode; }
5
+
6
+ const frame = css`
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: var(--space-8);
10
+ max-width: calc(var(--space-16) * 20);
11
+ padding: var(--space-12);
12
+ `;
13
+ const heading = css`
14
+ margin: 0;
15
+ font-size: var(--text-xl);
16
+ font-weight: var(--weight-semibold);
17
+ line-height: var(--leading-tight);
18
+ color: var(--text-strong);
19
+ `;
20
+ const lead = css`
21
+ margin: 0;
22
+ color: var(--text-muted);
23
+ `;
24
+
25
+ /** Development-only page framing for composition scenarios: a heading and the page width. */
26
+ export function ScreenFrame({ title, description, children }: ScreenFrameProps) {
27
+ return (
28
+ <main className={frame}>
29
+ <h1 className={heading}>{title}</h1>
30
+ {description ? <p className={lead}>{description}</p> : null}
31
+ {children}
32
+ </main>
33
+ );
34
+ }
@@ -1,31 +1,119 @@
1
- import { useLayoutEffect, useRef } from "react";
1
+ import { useLayoutEffect, useRef, useState } from "react";
2
2
  import { css, cx } from "@linaria/atomic";
3
3
 
4
4
  export interface TokenSample { token: `--${string}`; property: string; }
5
5
  export interface TokenPreviewProps { title: string; samples: readonly TokenSample[]; text: string; }
6
+
7
+ const grid = css`
8
+ display: grid;
9
+ grid-template-columns: repeat(auto-fill, minmax(calc(var(--space-8) * 10), 1fr));
10
+ gap: var(--space-8);
11
+ padding: var(--space-8);
12
+ `;
13
+ const heading = css`
14
+ grid-column: 1 / -1;
15
+ margin: 0;
16
+ font-size: var(--text-base);
17
+ font-weight: var(--weight-semibold);
18
+ color: var(--text-body);
19
+ `;
20
+ const tile = css`
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: var(--space-4);
24
+ padding: var(--space-8);
25
+ border: var(--border-w) solid var(--border-default);
26
+ border-radius: var(--radius-md);
27
+ background: var(--bg-surface);
28
+ overflow: hidden;
29
+ `;
30
+ const label = css`
31
+ font-size: var(--text-sm);
32
+ color: var(--text-muted);
33
+ overflow-wrap: anywhere;
34
+ `;
35
+ // Each sample shows its token through the property it styles: colors as swatches, lengths as
36
+ // bars, radius as a shape, type as text.
6
37
  const sampleStyle = css`
7
- display: inline-block;
8
- position: relative;
9
- white-space: pre-line;
10
- &[data-ads-property="animation-duration"] { animation-duration: var(--ux-token-preview-value); }
11
- &[data-ads-property="animation-timing-function"] { animation-timing-function: var(--ux-token-preview-value); }
12
- &[data-ads-property="background-color"] { background-color: var(--ux-token-preview-value); }
13
- &[data-ads-property="border-radius"] { border-radius: var(--ux-token-preview-value); }
14
- &[data-ads-property="box-shadow"] { box-shadow: var(--ux-token-preview-value); }
15
- &[data-ads-property="color"] { color: var(--ux-token-preview-value); }
16
- &[data-ads-property="font-family"] { font-family: var(--ux-token-preview-value); }
38
+ display: block;
39
+ min-height: calc(var(--space-8) * 2);
40
+ color: var(--text-body);
41
+ font-size: var(--text-base);
42
+ &[data-ads-property="background-color"] {
43
+ border: var(--border-w) solid var(--border-default);
44
+ border-radius: var(--radius-md);
45
+ background-color: var(--ux-token-preview-value);
46
+ }
47
+ &[data-ads-property="color"] { color: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
48
+ &[data-ads-property="width"] {
49
+ width: var(--ux-token-preview-value);
50
+ min-height: var(--space-8);
51
+ background: var(--accent);
52
+ }
53
+ &[data-ads-property="border-radius"] {
54
+ width: calc(var(--space-8) * 3);
55
+ border: var(--focus-w) solid var(--accent);
56
+ border-radius: var(--ux-token-preview-value);
57
+ }
58
+ &[data-ads-property="font-family"] { font-family: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
17
59
  &[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
18
- &[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); }
60
+ &[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
19
61
  &[data-ads-property="line-height"] { line-height: var(--ux-token-preview-value); }
20
- &[data-ads-property="width"] { width: var(--ux-token-preview-value); }
21
- &[data-ads-property="z-index"] { z-index: var(--ux-token-preview-value); }
62
+ &[data-ads-property="box-shadow"] {
63
+ border-radius: var(--radius-md);
64
+ background: var(--bg-surface);
65
+ box-shadow: var(--ux-token-preview-value);
66
+ }
67
+ /* Durations and easing move a dot across the tile. */
68
+ &[data-ads-property="animation-duration"], &[data-ads-property="animation-timing-function"] {
69
+ width: var(--space-8);
70
+ border-radius: 50%;
71
+ background: var(--accent);
72
+ animation-name: ux-token-preview-travel;
73
+ animation-iteration-count: infinite;
74
+ animation-direction: alternate;
75
+ }
76
+ &[data-ads-property="animation-duration"] {
77
+ animation-duration: calc(var(--ux-token-preview-value) * 8);
78
+ animation-timing-function: var(--ease-standard);
79
+ }
80
+ &[data-ads-property="animation-timing-function"] {
81
+ animation-duration: calc(var(--dur-normal) * 6);
82
+ animation-timing-function: var(--ux-token-preview-value);
83
+ }
84
+ &[data-ads-property="z-index"] { z-index: var(--ux-token-preview-value); position: relative; }
85
+ @keyframes ux-token-preview-travel { to { transform: translateX(calc(var(--space-8) * 6)); } }
22
86
  `;
23
- function Sample({ sample, text }: { sample: TokenSample; text: string }) {
87
+
88
+ function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
24
89
  const ref = useRef<HTMLSpanElement>(null);
25
- useLayoutEffect(() => { ref.current?.style.setProperty("--ux-token-preview-value", `var(${sample.token})`); }, [sample.token]);
26
- return <span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>{text}</span>;
90
+ const [value, setValue] = useState("");
91
+ useLayoutEffect(() => {
92
+ ref.current?.style.setProperty("--ux-token-preview-value", `var(${sample.token})`);
93
+ // The value as the page computes it now, again when the theme changes.
94
+ const read = () => setValue(getComputedStyle(document.documentElement).getPropertyValue(sample.token).trim());
95
+ read();
96
+ const observer = new MutationObserver(read);
97
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
98
+ return () => observer.disconnect();
99
+ }, [sample.token]);
100
+ return (
101
+ <article className={cx("ux-token-preview__item", tile)}>
102
+ <span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
103
+ {["background-color", "width", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
104
+ </span>
105
+ <code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
106
+ <small className={label}>{value}</small>
107
+ </article>
108
+ );
27
109
  }
28
- /** Project-owned review UI. Values always come from the real foundation CSS. */
110
+
111
+ /** Project-owned review UI: one tile per token. Values always come from the real foundation CSS. */
29
112
  export function TokenPreview({ title, samples, text }: TokenPreviewProps) {
30
- return <section className="ux-token-preview"><h1>{title}</h1>{samples.map(sample => <div key={`${sample.token}:${sample.property}`} className="ux-token-preview__item"><code className="ux-token-preview__name">{sample.token}</code><Sample sample={sample} text={text}/></div>)}</section>;
113
+ return (
114
+ <section aria-label={title} className={cx("ux-token-preview", grid)}>
115
+ <h1 className={heading}>{title}</h1>
116
+ {samples.map(sample => <TokenTile key={`${sample.token}:${sample.property}`} sample={sample} text={text} />)}
117
+ </section>
118
+ );
31
119
  }
@@ -0,0 +1,12 @@
1
+ import logo from "../assets/brand/logo.svg?url";
2
+ import logoDark from "../assets/brand/logo.dark.svg?url";
3
+ import appIcon from "../assets/brand/app-icon.svg?url";
4
+
5
+ export const fixture = {
6
+ title: "Brand",
7
+ artwork: [
8
+ { name: "logo.svg", use: "Logo in the UI (Logo component)", src: logo, darkSrc: logoDark },
9
+ { name: "app-icon.svg", use: "Master for the web icons and committed targets", src: appIcon },
10
+ ],
11
+ icon: { name: "app-icon.svg", src: appIcon, sizes: [16, 32, 48, 180, 192, 512] },
12
+ } as const;
@@ -0,0 +1,4 @@
1
+ import { BrandPreview } from "@ds/review";
2
+ import { fixture } from "./Brand.ads.fixture";
3
+ export const scenario = { title: fixture.title, covers: ["BrandPreview"], brand: true };
4
+ export default function Scenario() { return <BrandPreview {...fixture} />; }
@@ -0,0 +1,18 @@
1
+ export const fixture = {
2
+ "title": "Color",
3
+ "text": "Aa",
4
+ samples: [
5
+ {"token": "--accent", "property": "background-color", "probe": "rgb(31, 97, 163)"},
6
+ {"token": "--accent-fg", "property": "background-color", "probe": "rgb(31, 97, 163)"},
7
+ {"token": "--accent-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
8
+ {"token": "--bg-canvas", "property": "background-color", "probe": "rgb(31, 97, 163)"},
9
+ {"token": "--bg-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
10
+ {"token": "--bg-surface", "property": "background-color", "probe": "rgb(31, 97, 163)"},
11
+ {"token": "--border-default", "property": "background-color", "probe": "rgb(31, 97, 163)"},
12
+ {"token": "--border-focus", "property": "background-color", "probe": "rgb(31, 97, 163)"},
13
+ {"token": "--text-body", "property": "color", "probe": "rgb(31, 97, 163)"},
14
+ {"token": "--text-inverse", "property": "color", "probe": "rgb(31, 97, 163)"},
15
+ {"token": "--text-muted", "property": "color", "probe": "rgb(31, 97, 163)"},
16
+ {"token": "--text-strong", "property": "color", "probe": "rgb(31, 97, 163)"},
17
+ ]
18
+ } as const;
@@ -1,4 +1,4 @@
1
1
  import { TokenPreview } from "@ds/review";
2
- import { fixture } from "./Foundation.ads.fixture";
2
+ import { fixture } from "./Color.ads.fixture";
3
3
  export const scenario = { title: fixture.title, covers: ["TokenPreview"], samples: fixture.samples };
4
4
  export default function Scenario() { return <TokenPreview {...fixture} />; }
@@ -1,15 +1,7 @@
1
1
  export const fixture = {
2
- "title": "Foundation",
2
+ "title": "Space, type & motion",
3
3
  "text": "Aa",
4
4
  samples: [
5
- {"token": "--accent", "property": "background-color", "probe": "rgb(31, 97, 163)"},
6
- {"token": "--accent-fg", "property": "background-color", "probe": "rgb(31, 97, 163)"},
7
- {"token": "--accent-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
8
- {"token": "--bg-canvas", "property": "background-color", "probe": "rgb(31, 97, 163)"},
9
- {"token": "--bg-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
10
- {"token": "--bg-surface", "property": "background-color", "probe": "rgb(31, 97, 163)"},
11
- {"token": "--border-default", "property": "background-color", "probe": "rgb(31, 97, 163)"},
12
- {"token": "--border-focus", "property": "background-color", "probe": "rgb(31, 97, 163)"},
13
5
  {"token": "--border-w", "property": "width", "probe": "13.375px"},
14
6
  {"token": "--dur-fast", "property": "animation-duration", "probe": "0.375s"},
15
7
  {"token": "--dur-normal", "property": "animation-duration", "probe": "0.375s"},
@@ -33,12 +25,8 @@ export const fixture = {
33
25
  {"token": "--space-6", "property": "width", "probe": "13.375px"},
34
26
  {"token": "--space-8", "property": "width", "probe": "13.375px"},
35
27
  {"token": "--text-base", "property": "font-size", "probe": "41.375px"},
36
- {"token": "--text-body", "property": "color", "probe": "rgb(31, 97, 163)"},
37
- {"token": "--text-inverse", "property": "color", "probe": "rgb(31, 97, 163)"},
38
28
  {"token": "--text-lg", "property": "font-size", "probe": "41.375px"},
39
- {"token": "--text-muted", "property": "color", "probe": "rgb(31, 97, 163)"},
40
29
  {"token": "--text-sm", "property": "font-size", "probe": "41.375px"},
41
- {"token": "--text-strong", "property": "color", "probe": "rgb(31, 97, 163)"},
42
30
  {"token": "--text-xl", "property": "font-size", "probe": "41.375px"},
43
31
  {"token": "--weight-medium", "property": "font-weight", "probe": "327"},
44
32
  {"token": "--weight-normal", "property": "font-weight", "probe": "327"},
@@ -0,0 +1,4 @@
1
+ import { TokenPreview } from "@ds/review";
2
+ import { fixture } from "./SpaceTypeMotion.ads.fixture";
3
+ export const scenario = { title: fixture.title, covers: ["TokenPreview"], samples: fixture.samples };
4
+ export default function Scenario() { return <TokenPreview {...fixture} />; }
@@ -15,5 +15,6 @@
15
15
  ]
16
16
  }
17
17
  ]
18
- }
18
+ },
19
+ "assets": { "iconSource": "assets/brand/app-icon.svg" }
19
20
  }
@@ -0,0 +1,29 @@
1
+ import type { ComponentChildren } from "preact";
2
+ import { css, cx } from "@linaria/atomic";
3
+
4
+ export interface DemoFrameProps {
5
+ /** `row` lays examples side by side; `column` stacks them at a readable width. */
6
+ layout?: "row" | "column";
7
+ children?: ComponentChildren;
8
+ }
9
+
10
+ const frame = css`
11
+ display: flex;
12
+ gap: var(--space-8);
13
+ padding: var(--space-12);
14
+ `;
15
+ const layouts = {
16
+ row: css`
17
+ flex-wrap: wrap;
18
+ align-items: flex-start;
19
+ `,
20
+ column: css`
21
+ flex-direction: column;
22
+ max-width: calc(var(--space-16) * 12);
23
+ `,
24
+ };
25
+
26
+ /** Development-only framing for component and pattern scenarios: spacing between examples. */
27
+ export function DemoFrame({ layout = "row", children }: DemoFrameProps) {
28
+ return <div className={cx(frame, layouts[layout])}>{children}</div>;
29
+ }
@@ -0,0 +1,34 @@
1
+ import type { ComponentChildren } from "preact";
2
+ import { css } from "@linaria/atomic";
3
+
4
+ export interface ScreenFrameProps { title: string; description?: string; children?: ComponentChildren; }
5
+
6
+ const frame = css`
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: var(--space-8);
10
+ max-width: calc(var(--space-16) * 20);
11
+ padding: var(--space-12);
12
+ `;
13
+ const heading = css`
14
+ margin: 0;
15
+ font-size: var(--text-xl);
16
+ font-weight: var(--weight-semibold);
17
+ line-height: var(--leading-tight);
18
+ color: var(--text-strong);
19
+ `;
20
+ const lead = css`
21
+ margin: 0;
22
+ color: var(--text-muted);
23
+ `;
24
+
25
+ /** Development-only page framing for composition scenarios: a heading and the page width. */
26
+ export function ScreenFrame({ title, description, children }: ScreenFrameProps) {
27
+ return (
28
+ <main className={frame}>
29
+ <h1 className={heading}>{title}</h1>
30
+ {description ? <p className={lead}>{description}</p> : null}
31
+ {children}
32
+ </main>
33
+ );
34
+ }
@@ -0,0 +1,119 @@
1
+ import { useLayoutEffect, useRef, useState } from "preact/hooks";
2
+ import { css, cx } from "@linaria/atomic";
3
+
4
+ export interface TokenSample { token: `--${string}`; property: string; }
5
+ export interface TokenPreviewProps { title: string; samples: readonly TokenSample[]; text: string; }
6
+
7
+ const grid = css`
8
+ display: grid;
9
+ grid-template-columns: repeat(auto-fill, minmax(calc(var(--space-8) * 10), 1fr));
10
+ gap: var(--space-8);
11
+ padding: var(--space-8);
12
+ `;
13
+ const heading = css`
14
+ grid-column: 1 / -1;
15
+ margin: 0;
16
+ font-size: var(--text-base);
17
+ font-weight: var(--weight-semibold);
18
+ color: var(--text-body);
19
+ `;
20
+ const tile = css`
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: var(--space-4);
24
+ padding: var(--space-8);
25
+ border: var(--border-w) solid var(--border-default);
26
+ border-radius: var(--radius-md);
27
+ background: var(--bg-surface);
28
+ overflow: hidden;
29
+ `;
30
+ const label = css`
31
+ font-size: var(--text-sm);
32
+ color: var(--text-muted);
33
+ overflow-wrap: anywhere;
34
+ `;
35
+ // Each sample shows its token through the property it styles: colors as swatches, lengths as
36
+ // bars, radius as a shape, type as text.
37
+ const sampleStyle = css`
38
+ display: block;
39
+ min-height: calc(var(--space-8) * 2);
40
+ color: var(--text-body);
41
+ font-size: var(--text-base);
42
+ &[data-ads-property="background-color"] {
43
+ border: var(--border-w) solid var(--border-default);
44
+ border-radius: var(--radius-md);
45
+ background-color: var(--ux-token-preview-value);
46
+ }
47
+ &[data-ads-property="color"] { color: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
48
+ &[data-ads-property="width"] {
49
+ width: var(--ux-token-preview-value);
50
+ min-height: var(--space-8);
51
+ background: var(--accent);
52
+ }
53
+ &[data-ads-property="border-radius"] {
54
+ width: calc(var(--space-8) * 3);
55
+ border: var(--focus-w) solid var(--accent);
56
+ border-radius: var(--ux-token-preview-value);
57
+ }
58
+ &[data-ads-property="font-family"] { font-family: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
59
+ &[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
60
+ &[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
61
+ &[data-ads-property="line-height"] { line-height: var(--ux-token-preview-value); }
62
+ &[data-ads-property="box-shadow"] {
63
+ border-radius: var(--radius-md);
64
+ background: var(--bg-surface);
65
+ box-shadow: var(--ux-token-preview-value);
66
+ }
67
+ /* Durations and easing move a dot across the tile. */
68
+ &[data-ads-property="animation-duration"], &[data-ads-property="animation-timing-function"] {
69
+ width: var(--space-8);
70
+ border-radius: 50%;
71
+ background: var(--accent);
72
+ animation-name: ux-token-preview-travel;
73
+ animation-iteration-count: infinite;
74
+ animation-direction: alternate;
75
+ }
76
+ &[data-ads-property="animation-duration"] {
77
+ animation-duration: calc(var(--ux-token-preview-value) * 8);
78
+ animation-timing-function: var(--ease-standard);
79
+ }
80
+ &[data-ads-property="animation-timing-function"] {
81
+ animation-duration: calc(var(--dur-normal) * 6);
82
+ animation-timing-function: var(--ux-token-preview-value);
83
+ }
84
+ &[data-ads-property="z-index"] { z-index: var(--ux-token-preview-value); position: relative; }
85
+ @keyframes ux-token-preview-travel { to { transform: translateX(calc(var(--space-8) * 6)); } }
86
+ `;
87
+
88
+ function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
89
+ const ref = useRef<HTMLSpanElement>(null);
90
+ const [value, setValue] = useState("");
91
+ useLayoutEffect(() => {
92
+ ref.current?.style.setProperty("--ux-token-preview-value", `var(${sample.token})`);
93
+ // The value as the page computes it now, again when the theme changes.
94
+ const read = () => setValue(getComputedStyle(document.documentElement).getPropertyValue(sample.token).trim());
95
+ read();
96
+ const observer = new MutationObserver(read);
97
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
98
+ return () => observer.disconnect();
99
+ }, [sample.token]);
100
+ return (
101
+ <article className={cx("ux-token-preview__item", tile)}>
102
+ <span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
103
+ {["background-color", "width", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
104
+ </span>
105
+ <code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
106
+ <small className={label}>{value}</small>
107
+ </article>
108
+ );
109
+ }
110
+
111
+ /** Project-owned review UI: one tile per token. Values always come from the real foundation CSS. */
112
+ export function TokenPreview({ title, samples, text }: TokenPreviewProps) {
113
+ return (
114
+ <section aria-label={title} className={cx("ux-token-preview", grid)}>
115
+ <h1 className={heading}>{title}</h1>
116
+ {samples.map(sample => <TokenTile key={`${sample.token}:${sample.property}`} sample={sample} text={text} />)}
117
+ </section>
118
+ );
119
+ }
@@ -0,0 +1,6 @@
1
+ import { render, type ComponentType } from "preact";
2
+ import "@ds";
3
+ export function mountScenario(Scenario: ComponentType, container: HTMLElement) {
4
+ render(<Scenario />, container);
5
+ return () => render(null, container);
6
+ }