@reqvire-org/ads 0.3.42 → 0.3.43

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 (94) hide show
  1. package/README.md +6 -4
  2. package/dist/bootstrap-ds/ADS.md +2 -1
  3. package/dist/bootstrap-ds/README.md +23 -14
  4. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
  5. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
  6. package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
  7. package/dist/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
  8. package/dist/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
  9. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
  10. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
  11. package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
  12. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
  13. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
  14. package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
  15. package/dist/bootstrap-ds/design-system/index.ts +4 -1
  16. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
  17. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
  18. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
  19. package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
  20. package/dist/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  21. package/dist/bootstrap-ds/design-system/review/index.ts +2 -0
  22. package/dist/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  23. package/dist/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
  24. package/dist/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
  25. package/dist/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
  26. 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
  27. package/dist/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
  28. package/dist/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  29. package/dist/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  30. package/dist/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
  31. package/dist/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
  32. package/dist/bootstrap-ds-preact/ds.config.json +19 -0
  33. package/dist/bootstrap-ds-preact/package.json +38 -0
  34. package/dist/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
  35. package/dist/bootstrap-ds-preact/tsconfig.json +36 -0
  36. package/dist/bootstrap-ds-preact/vite.config.ts +23 -0
  37. package/dist/init.mjs +15 -7
  38. package/dist/mcp/showcase-host.mjs +5 -1
  39. package/dist/preview-builder.mjs +8 -2
  40. package/dist/skills/ads-break-ui/SKILL.md +2 -2
  41. package/dist/skills/ads-designer/SKILL.md +33 -19
  42. package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +2 -1
  43. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +23 -14
  44. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
  45. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
  46. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
  47. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
  48. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
  49. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
  50. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
  51. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
  52. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
  53. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
  54. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
  55. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +4 -1
  56. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
  57. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
  58. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
  59. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
  60. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  61. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +2 -0
  62. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  63. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
  64. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
  65. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
  66. 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
  67. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
  68. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
  69. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
  70. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
  71. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
  72. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +19 -0
  73. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +38 -0
  74. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
  75. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +36 -0
  76. package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +23 -0
  77. package/dist/skills/ads-designer/references/cli.md +1 -1
  78. package/dist/skills/ads-designer/references/design-craft.md +1 -1
  79. package/dist/skills/ads-import/SKILL.md +2 -2
  80. package/dist/skills/ads-import/references/cli.md +1 -1
  81. package/dist/skills/ads-motion/SKILL.md +2 -2
  82. package/dist/skills/ads-port/SKILL.md +3 -3
  83. package/dist/skills/ads-port/references/cli.md +1 -1
  84. package/docs/ADS.md +7 -7
  85. package/docs/ARCHITECTURE.md +3 -2
  86. package/docs/CHANGELOG.md +33 -12
  87. package/docs/GUIDE.md +16 -14
  88. package/package.json +1 -1
  89. package/dist/bootstrap-ds/design-system/components/.gitkeep +0 -0
  90. package/dist/bootstrap-ds/design-system/composition/.gitkeep +0 -0
  91. package/dist/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
  92. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/.gitkeep +0 -0
  93. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/.gitkeep +0 -0
  94. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
@@ -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} />; }
@@ -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
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "framework": "preact",
3
+ "behaviorLibraries": [],
4
+ "acceptance": { "checks": [], "behaviorChecks": false },
5
+ "validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
6
+ "mcp": {
7
+ "previewManifest": ".ds/preview/manifest.json"
8
+ },
9
+ "boundaries": {
10
+ "styleWrites": [
11
+ {
12
+ "file": "design-system/review/token-preview/TokenPreview.tsx",
13
+ "properties": [
14
+ "--ux-token-preview-value"
15
+ ]
16
+ }
17
+ ]
18
+ }
19
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "native-design-system",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Private starter workspace for a project's local Preact design system.",
7
+ "engines": {
8
+ "node": ">=22.12.0",
9
+ "bun": ">=1.4.1"
10
+ },
11
+ "sideEffects": [
12
+ "**/*.css"
13
+ ],
14
+ "scripts": {
15
+ "dev": "ads showcase",
16
+ "dev:showcase": "ads showcase",
17
+ "lint": "oxlint --deny-warnings src design-system && biome lint --config-path=biome.css.json .",
18
+ "typecheck": "tsc --noEmit",
19
+ "build": "npm run lint && npm run typecheck && npm run build:lib",
20
+ "build:lib": "vite build && tsc --project tsconfig.build.json",
21
+ "build:showcase": "ads compile .",
22
+ "preview": "ads showcase",
23
+ "preview:showcase": "ads showcase",
24
+ "build:mcp-previews": "ads compile ."
25
+ },
26
+ "devDependencies": {
27
+ "@babel/preset-react": "7.29.7",
28
+ "@babel/preset-typescript": "7.29.7",
29
+ "@biomejs/biome": "2.5.15",
30
+ "@linaria/atomic": "8.0.0",
31
+ "@types/node": "25.9.4",
32
+ "@wyw-in-js/vite": "2.1.3",
33
+ "oxlint": "1.72.0",
34
+ "preact": "11.0.1",
35
+ "typescript": "5.9.3",
36
+ "vite": "6.4.3"
37
+ }
38
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "@scenario" {
4
+ import type { ComponentType } from "preact";
5
+ const Scenario: ComponentType;
6
+ export default Scenario;
7
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": [
5
+ "ES2022",
6
+ "DOM",
7
+ "DOM.Iterable"
8
+ ],
9
+ "module": "ESNext",
10
+ "moduleResolution": "bundler",
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+ "jsxImportSource": "preact",
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "baseUrl": ".",
22
+ "paths": {
23
+ "@ds/review": [
24
+ "design-system/review/index.ts"
25
+ ],
26
+ "@ds": [
27
+ "design-system/index.ts"
28
+ ]
29
+ }
30
+ },
31
+ "include": [
32
+ "src",
33
+ "design-system",
34
+ "vite.config.ts"
35
+ ]
36
+ }
@@ -0,0 +1,23 @@
1
+ import path from "node:path";
2
+ import { defineConfig } from "vite";
3
+ import wyw from "@wyw-in-js/vite";
4
+ import { linariaTagResolver } from "@reqvire-org/ads/linaria";
5
+ import { draftImportGuard } from "@reqvire-org/ads/scenarios/vite";
6
+
7
+ export default defineConfig({
8
+ esbuild: { jsx: "automatic", jsxImportSource: "preact" },
9
+ plugins: [draftImportGuard(), wyw({ tagResolver: linariaTagResolver })],
10
+ resolve: {
11
+ alias: { "@ds/review": path.resolve(import.meta.dirname, "design-system/review/index.ts"), "@ds": path.resolve(import.meta.dirname, "design-system/index.ts") },
12
+ },
13
+ build: {
14
+ outDir: "dist",
15
+ lib: {
16
+ entry: path.resolve(import.meta.dirname, "design-system/index.ts"),
17
+ formats: ["es"],
18
+ fileName: () => "index.js",
19
+ cssFileName: "styles",
20
+ },
21
+ rollupOptions: { external: [/^preact(?:\/.*)?$/] },
22
+ },
23
+ });
package/dist/init.mjs CHANGED
@@ -8,6 +8,11 @@ import { assertFrameworkCompiler } from "./ui-framework.mjs";
8
8
 
9
9
  const tool = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
10
10
  const starter = fileURLToPath(new URL("./bootstrap-ds/", import.meta.url));
11
+ /** A framework's starter file: Preact's overlay replaces the React starter's where they differ. */
12
+ const starterFile = (framework, relative) => {
13
+ const overlay = fileURLToPath(new URL(`./bootstrap-ds-${framework}/${relative}`, import.meta.url));
14
+ return framework !== "react" && existsSync(overlay) ? overlay : path.join(starter, relative);
15
+ };
11
16
 
12
17
  function dependencySpec(value) {
13
18
  if (typeof value !== "string" || !value.trim()) throw new Error("toolPackage must be a version or local tool tarball path.");
@@ -151,13 +156,13 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
151
156
  return file;
152
157
  });
153
158
  if (!existingTokens.length) {
154
- for (const name of ["Foundation.ads.scenario.tsx", "Foundation.ads.fixture.ts"]) {
159
+ // The starter's token groups, each a scenario with its fixture.
160
+ for (const name of readdirSync(path.join(starter, "design-system/tokens")).filter(name => /\.ads\.(?:scenario\.tsx|fixture\.ts)$/.test(name)).sort()) {
155
161
  const content = readFileSync(path.join(starter, "design-system/tokens", name), "utf8").replaceAll('"@ds/review"', JSON.stringify(`${config.publicAlias}/review`)).replaceAll('"@ds"', JSON.stringify(config.publicAlias));
156
162
  addMissing(path.join(tokenRoot, name), content);
157
163
  }
158
164
  for (const name of ["TokenPreview.tsx"]) {
159
- let content = readFileSync(path.join(starter, "design-system/review/token-preview", name), "utf8");
160
- if (selectedFramework === "preact") content = content.replace('from "react"', 'from "preact/hooks"');
165
+ const content = readFileSync(starterFile(selectedFramework, `design-system/review/token-preview/${name}`), "utf8");
161
166
  addMissing(path.join(dsRoot, "review/token-preview", name), content.replaceAll('"@ds"', JSON.stringify(config.publicAlias)));
162
167
  }
163
168
  const reviewFile = path.relative(root, path.join(dsRoot, "review/token-preview/TokenPreview.tsx")).replaceAll("\\", "/");
@@ -185,7 +190,11 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
185
190
  if (current !== readFileSync(entryFile, "utf8")) updates.set(entryFile, current);
186
191
  }
187
192
  }
188
- for (const section of ["components", "patterns", "controllers", "composition"]) addMissing(path.join(dsRoot, section, ".gitkeep"), "");
193
+ // Keeps a section folder that has nothing in it yet.
194
+ for (const section of ["components", "patterns", "controllers", "composition"]) {
195
+ const directory = path.join(dsRoot, section);
196
+ if (!existsSync(directory) || !readdirSync(directory).length) addMissing(path.join(directory, ".gitkeep"), "");
197
+ }
189
198
  addMissing(path.join(dsRoot, "assets/brand/README.md"), readFileSync(path.join(starter, "design-system/assets/brand/README.md")));
190
199
  addMissing(path.join(dsRoot, "assets/fonts/.gitkeep"), "");
191
200
  const configFile = path.join(root, "ds.config.json");
@@ -199,9 +208,8 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
199
208
  updates.set(configFile, `${JSON.stringify({ ...saved, framework: selectedFramework, ...(nativePreviewMissing?{mcp:{...saved.mcp,previewManifest:config.mcp.previewManifest}}:{}), ...(!existingTokens.length ? { boundaries: config.boundaries } : {}) }, null, indent)}\n`);
200
209
  }
201
210
  }
202
- const mount=selectedFramework==="preact"?'import {render} from "preact";':'import {createRoot} from "react-dom/client";';
203
- const render=selectedFramework==="preact"?'render(<Scenario/>,container);return()=>render(null,container);':'const root=createRoot(container);root.render(<Scenario/>);return()=>root.unmount();';
204
- addMissing(path.join(dsRoot,"showcase/mcp/main.tsx"),`import ${JSON.stringify(config.publicAlias)};\n${mount}\nexport function mountScenario(Scenario,container){${render}}\n`);
211
+ // The framework's scenario mount, as the starter has it.
212
+ addMissing(path.join(dsRoot, "showcase/mcp/main.tsx"), readFileSync(starterFile(selectedFramework, "design-system/showcase/mcp/main.tsx"), "utf8").replaceAll('"@ds"', JSON.stringify(config.publicAlias)));
205
213
  const ignoreFile = path.join(root, ".gitignore");
206
214
  assertLocalFile(root, ignoreFile);
207
215
  const ignore = existsSync(ignoreFile) ? readFileSync(ignoreFile, "utf8") : "";
@@ -49,7 +49,11 @@ export async function startShowcaseHost(factory, { port = 0, observe } = {}) {
49
49
  }
50
50
  });
51
51
  try {
52
- await new Promise((resolve, reject) => { web.once("error", reject); web.listen(port, "127.0.0.1", resolve); });
52
+ await new Promise((resolve, reject) => { web.once("error", reject); web.listen(port, "127.0.0.1", resolve); }).catch(error => {
53
+ // Commonly the project's ADS MCP (\`ads mcp --port\`), which serves its own showcase there.
54
+ if (error?.code === "EADDRINUSE" || /in use/i.test(error?.message ?? "")) throw Object.assign(new Error(`Port ${port} is already in use, often by another ADS showcase or the project's ADS MCP (it serves the showcase on its own --port). Open that showcase, or give this one another --port.`), { code: "EADDRINUSE" });
55
+ throw error;
56
+ });
53
57
  sandbox = await startSandboxHost(`http://127.0.0.1:${web.address().port}`);
54
58
  }
55
59
  catch (error) { web.close(); await observer?.close(); await handler.close(); throw error; }
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { mkdirSync, rmSync, writeFileSync } from "node:fs";
2
+ import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { previewSourceRevision } from "./preview-inputs.mjs";
5
5
  import { createPreviewResources } from "./preview-resources.mjs";
@@ -56,7 +56,13 @@ export function createVitePreviewBuilder({ build, configure }) {
56
56
  // Rollup's watch task owns its input cache and replaces rollupOptions.cache.
57
57
  // Seed the first options hook; later builds use the watcher's own cache.
58
58
  let seed = moduleCache;
59
- const seedCache = {name:"ads-preview-seed-cache",options(input){if(!seed)return;const cache=seed;seed=undefined;return{...input,cache};}};
59
+ // A seeded module's transform ran in the previous graph's plugins. Styles a transform
60
+ // generates (Linaria's virtual `.wyw-in-js.css`) exist only in that plugin instance, so
61
+ // a cached module importing one is transformed again in this graph.
62
+ const virtualStyle = (id, code) => [...code.matchAll(/["']([^"'\n]+\.css)["']/g)].some(([, specifier]) =>
63
+ (specifier.startsWith(".") || path.isAbsolute(specifier)) && !existsSync(path.resolve(path.dirname(id), specifier)));
64
+ const seedCache = {name:"ads-preview-seed-cache",options(input){if(!seed)return;const cache=seed;seed=undefined;return{...input,cache};},
65
+ shouldTransformCachedModule({ id, code }) { return path.isAbsolute(id) && virtualStyle(id, code) || null; }};
60
66
  let started;
61
67
  let candidate;
62
68
  const capture = { name: "ads-incremental-preview", enforce: "post",
@@ -157,8 +157,8 @@ production and scenario builds; never alias React to Preact just to shrink a
157
157
  preview. Native Preact uses its own JSX transform, hooks and DOM events (live
158
158
  text updates use `onInput`). Native SVG uses DOM names such as `stroke-width`,
159
159
  not React presentation aliases. Keep Linaria extraction and the same public APIs.
160
- The shipped empty starter uses React; the tool repository's working example
161
- uses Preact. Neither is a component dependency of the receiving project.
160
+ The starter comes for React and for Preact; the tool repository's working
161
+ example uses Preact. Neither is a component dependency of the receiving project.
162
162
 
163
163
  ## Choose the work
164
164
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ads-designer
3
- description: Bootstrap an empty local React design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
3
+ description: Bootstrap an empty local React or Preact design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
4
4
  ---
5
5
 
6
6
  ## Choose the editing workflow
@@ -36,14 +36,14 @@ and memory limits in project configuration; verify real workloads under them.
36
36
  Inspect the target before editing. Read its `README.md`, `docs/ARCHITECTURE.md`
37
37
  and `docs/ADS.md` when present (or existing project guides), public exports, and relevant
38
38
  component guides. Preserve its
39
- framework and contracts. Starting from zero works from the bundled empty
40
- scaffold without an example repository.
39
+ framework and contracts. Starting from zero works from the bundled starter
40
+ without an example repository.
41
41
 
42
42
  Linaria is required for ADS component and pattern styling. Preserve the target's
43
43
  UI framework and integrate compatible Linaria extraction with both application
44
- and preview builds. The bundled React/TypeScript starter already configures it;
45
- `ads init` does not install or configure Linaria. Use the starter when its
46
- framework is appropriate. Current core
44
+ and preview builds. The bundled React and Preact starters already configure it;
45
+ `ads init` does not install or configure Linaria. Use the starter for the
46
+ project's framework. Current core
47
47
  guards inspect JS/TS/JSX, CSS, and imported Linaria templates, not Vue/Svelte
48
48
  single-file components or general HTML component templates. Entry HTML mount
49
49
  CSS is checked; that is not component-template coverage. Preserve the target stack and matching
@@ -54,12 +54,13 @@ production and scenario builds; never alias React to Preact just to shrink a
54
54
  preview. Native Preact uses its own JSX transform, hooks and DOM events (live
55
55
  text updates use `onInput`). Native SVG uses DOM names such as `stroke-width`,
56
56
  not React presentation aliases. Keep Linaria extraction and the same public APIs.
57
- The shipped empty starter uses React; the tool repository's working example
58
- uses Preact. Neither is a component dependency of the receiving project.
57
+ The starter comes for React (`bootstrap-ds/`) and Preact (the same files
58
+ with `bootstrap-ds-preact/` copied over them); the tool repository's working
59
+ example uses Preact. Neither is a component dependency of the receiving project.
59
60
 
60
61
  When initializing a project without a saved framework, pass `--framework react`
61
62
  or `--framework preact` for its actual runtime. Init saves the choice and later
62
- runs reuse it. The bundled starter already declares React. Resolve any explicit
63
+ runs reuse it. Each starter already declares its framework. Resolve any explicit
63
64
  JSX/configuration conflict deliberately; do not change frameworks to make init
64
65
  pass. Init does not install the runtime or configure the application's compiler.
65
66
 
@@ -200,21 +201,32 @@ checks; do not fetch the unpublished package.
200
201
 
201
202
  Read [assets/bootstrap-ds/README.md](assets/bootstrap-ds/README.md) and its
202
203
  [contract](assets/bootstrap-ds/ADS.md). The scaffold contains semantic token
203
- defaults, React/TypeScript/Linaria configuration, general lint, a public
204
- barrel, empty product component directories, a project-owned token review renderer, and a project preview compiler adapter. The browser shell is supplied by ADS tooling.
205
- It contains no components, shell patterns, vendored fonts, or example screens.
204
+ defaults, React or Preact TypeScript/Linaria configuration, general lint, a public
205
+ barrel, project-owned review renderers (token tiles, demo and screen frames), and a project preview compiler adapter. The browser shell is supplied by ADS tooling.
206
+ It has one example of each layer to build on: two token groups (Color; Space, type &
207
+ motion), two components in two groups (`components/Actions/Button`,
208
+ `components/Forms/TextField`), one pattern (`patterns/Search/SearchBar`) and one
209
+ composition (`composition/Search/SearchPage`). Treat them as the project's own: adapt or replace them
210
+ for the requested product. It has no vendored fonts or icons.
206
211
 
207
212
  Resolve assets relative to this skill's `SKILL.md`, including after installation
208
213
  by `npx skills`. In the tool checkout, root `bootstrap-ds/` is canonical.
209
- For a new empty project, copy its **contents**, including dotfiles:
214
+ For a new empty project, copy its **contents**, including dotfiles. For
215
+ Preact, copy `bootstrap-ds-preact/` over them and drop the React lockfile; never
216
+ port the React files by hand:
210
217
 
211
218
  ```sh
212
- starter_dir="/absolute/path/to/ads-designer/assets/bootstrap-ds"
219
+ assets_dir="/absolute/path/to/ads-designer/assets"
213
220
  target_dir="/absolute/path/to/new-project"
221
+ framework="react" # or "preact"
214
222
  mkdir -p "$target_dir"
215
- cp -a "$starter_dir/." "$target_dir/"
223
+ cp -a "$assets_dir/bootstrap-ds/." "$target_dir/"
224
+ if [ "$framework" = preact ]; then
225
+ cp -a "$assets_dir/bootstrap-ds-preact/." "$target_dir/"
226
+ rm "$target_dir/package-lock.json"
227
+ fi
216
228
  cd "$target_dir"
217
- # Run ads init here when an actual tool distribution is available.
229
+ # Run ads init --framework "$framework" here when an actual tool distribution is available.
218
230
  npm install
219
231
  npm run build
220
232
  ```
@@ -226,6 +238,8 @@ The bundled application defaults to npm. For a new Bun application,
226
238
  translate nested npm script calls to `bun run` and omit the starter npm lockfile;
227
239
  preserve an existing app's package manager and lockfile when merging.
228
240
  Initialize/install ADS before running `npm run dev:showcase` for visual inspection.
241
+ `dev:showcase` and the project's ADS MCP (`.mcp.json`) each serve a showcase:
242
+ give them different ports, or open the MCP's showcase instead of starting one.
229
243
  Use an existing MCP runtime URL when connected; do not leave an unrequested
230
244
  server running.
231
245
 
@@ -534,7 +548,7 @@ adding an approval step solely because a showcase exists.
534
548
 
535
549
  ## Notifications when a local Toast exists
536
550
 
537
- Read the local notification guide before using its API; the empty scaffold has
551
+ Read the local notification guide before using its API; the starter has
538
552
  no Toast. Follow its host/provider mounting, routing, scope, duration, and focus
539
553
  contracts instead of assuming Sonner compatibility or a particular native API.
540
554
 
@@ -546,12 +560,12 @@ information in the relevant form, inline alert, or dialog.
546
560
 
547
561
  Customize through shared tokens, component mappings and documented variants. Stacking, gestures,
548
562
  measured geometry, and animation belong to the component. Register applicable
549
- component-local usage rules in project tooling; do not assume the empty scaffold
563
+ component-local usage rules in project tooling; do not assume the starter
550
564
  includes them or that core tooling bundles this component.
551
565
 
552
566
  ## Validate
553
567
 
554
- Use the target's actual lint/typecheck/build commands. The empty scaffold provides:
568
+ Use the target's actual lint/typecheck/build commands. The starter provides:
555
569
 
556
570
  ```sh
557
571
  npm run typecheck
@@ -24,7 +24,8 @@ The starter declares React in `ds.config.json`. Keep that choice, JSX, runtime
24
24
  dependencies and the preview mount adapter consistent. Init records a choice for
25
25
  an unconfigured project; it does not convert copied React source to Preact.
26
26
 
27
- The starter has no components or patterns yet. Add only what the product needs.
27
+ The starter has one example of each layer (Button, TextField, SearchBar,
28
+ SearchPage). Rename, restyle or replace them; add only what the product needs.
28
29
  Keep the ADS in root `design-system/`, beside application `src/`.
29
30
  Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
30
31
  `styles.css` is the foundation CSS entry and contains token imports only.