@reqvire-org/ads 0.3.45 → 0.3.47
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 +23 -11
- package/dist/a11y.mjs +102 -0
- package/dist/assets.mjs +37 -8
- package/dist/atomic-composition.mjs +3 -2
- package/dist/brand-assets.mjs +48 -11
- package/dist/brands.mjs +82 -0
- package/dist/browser-audit/worker.mjs +45 -0
- package/dist/browser-audit.mjs +117 -0
- package/dist/capture/worker.mjs +2 -1
- package/dist/capture-store.mjs +4 -1
- package/dist/capture.mjs +10 -4
- package/dist/check.mjs +40 -9
- package/dist/cli.mjs +55 -8
- package/dist/color-values.mjs +325 -0
- package/dist/config.mjs +19 -2
- package/dist/contracts/tokens.json +1 -1
- package/dist/control-padding.mjs +93 -0
- package/dist/design-values.mjs +11 -4
- package/dist/finding-rules.mjs +61 -0
- package/dist/foundation.mjs +17 -1
- package/dist/icons.mjs +107 -0
- package/dist/init.mjs +3 -0
- package/dist/mcp/apps.mjs +9 -6
- package/dist/mcp/drafts.mjs +3 -0
- package/dist/mcp/mutations.mjs +17 -1
- package/dist/mcp/preview-widget.bundle.js +45 -39
- package/dist/mcp/project-widget.bundle.js +26 -26
- package/dist/mcp/server.mjs +23 -9
- package/dist/mcp/widget.bundle.js +17 -17
- package/dist/palette-generated.mjs +180 -0
- package/dist/preview-resources.mjs +12 -3
- package/dist/render-color-probe.mjs +148 -0
- package/dist/runtime-contracts.mjs +14 -4
- package/dist/scenarios.mjs +1 -1
- package/dist/showcase/client.bundle.js +28 -28
- package/dist/showcase/icons.js +146 -0
- package/dist/showcase/index.html +2 -1
- package/dist/showcase/style.css +19 -2
- package/dist/skills/README.md +2 -1
- package/dist/skills/ads-break-ui/SKILL.md +6 -5
- package/dist/skills/ads-break-ui/references/atomic-styles.md +12 -12
- package/dist/skills/ads-break-ui/references/captures.md +3 -2
- package/dist/skills/ads-break-ui/references/contracts.md +13 -10
- package/dist/skills/ads-break-ui/references/design-data.md +199 -2
- package/dist/skills/ads-break-ui/references/validation.md +8 -4
- package/dist/skills/ads-designer/SKILL.md +32 -15
- package/dist/skills/ads-designer/references/accessibility.md +77 -0
- package/dist/skills/ads-designer/references/atomic-styles.md +12 -12
- package/dist/skills/ads-designer/references/branding.md +61 -6
- package/dist/skills/ads-designer/references/captures.md +3 -2
- package/dist/skills/ads-designer/references/cli.md +8 -2
- package/dist/skills/ads-designer/references/contracts.md +13 -10
- package/dist/skills/ads-designer/references/design-data.md +199 -2
- package/dist/skills/ads-designer/references/validation.md +8 -4
- package/dist/skills/ads-import/SKILL.md +9 -8
- package/dist/skills/ads-import/references/atomic-styles.md +12 -12
- package/dist/skills/ads-import/references/captures.md +3 -2
- package/dist/skills/ads-import/references/cli.md +8 -2
- package/dist/skills/ads-import/references/contracts.md +13 -10
- package/dist/skills/ads-import/references/design-data.md +199 -2
- package/dist/skills/ads-import/references/tokens.md +7 -3
- package/dist/skills/ads-import/references/validation.md +8 -4
- package/dist/skills/ads-motion/SKILL.md +6 -5
- package/dist/skills/ads-motion/references/atomic-styles.md +12 -12
- package/dist/skills/ads-motion/references/build.md +33 -0
- package/dist/skills/ads-motion/references/captures.md +3 -2
- package/dist/skills/ads-motion/references/contracts.md +13 -10
- package/dist/skills/ads-motion/references/design-data.md +199 -2
- package/dist/skills/ads-motion/references/motion-review.md +2 -2
- package/dist/skills/ads-motion/references/validation.md +8 -4
- package/dist/skills/ads-port/SKILL.md +6 -5
- package/dist/skills/ads-port/references/atomic-styles.md +12 -12
- package/dist/skills/ads-port/references/captures.md +3 -2
- package/dist/skills/ads-port/references/cli.md +8 -2
- package/dist/skills/ads-port/references/contracts.md +13 -10
- package/dist/skills/ads-port/references/design-data.md +199 -2
- package/dist/skills/ads-port/references/validation.md +8 -4
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +19 -1
- package/dist/starters/preact/ds.config.json +13 -1
- package/dist/starters/react/ADS.md +43 -10
- package/dist/starters/react/README.md +61 -9
- package/dist/starters/react/design-system/assets/brand/README.md +8 -3
- package/dist/starters/react/design-system/assets/glyphs/README.md +15 -0
- package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
- package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +11 -4
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +6 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +16 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
- package/dist/starters/react/design-system/components/Content/Icon/README.md +17 -0
- package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +3 -9
- package/dist/starters/react/design-system/components/Content/Logo/README.md +4 -2
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +9 -5
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +164 -0
- package/dist/starters/react/design-system/index.ts +6 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +2 -5
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
- package/dist/starters/react/design-system/review/index.ts +1 -0
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +19 -1
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +114 -8
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
- package/dist/starters/react/design-system/tokens/{SpaceTypeMotion.ads.scenario.tsx → Layout.ads.scenario.tsx} +1 -1
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/base.css +9 -3
- package/dist/starters/react/design-system/tokens/colors.css +210 -24
- package/dist/starters/react/design-system/tokens/elevation.css +44 -6
- package/dist/starters/react/design-system/tokens/spacing.css +67 -3
- package/dist/starters/react/design-system/tokens/themes.generated.css +142 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +402 -0
- package/dist/starters/react/design-system/tokens/typography.css +25 -7
- package/dist/starters/react/ds.config.json +13 -1
- package/dist/style-boundaries.mjs +2 -1
- package/dist/themes-generated.mjs +150 -0
- package/dist/themes-watch.mjs +42 -0
- package/dist/themes.mjs +257 -0
- package/dist/token-export.mjs +69 -0
- package/dist/token-policy.mjs +2 -1
- package/dist/token-quality.mjs +112 -0
- package/dist/tokens.mjs +32 -30
- package/dist/validation.mjs +18 -1
- package/dist/verification/browser.mjs +14 -3
- package/docs/ADS.md +56 -13
- package/docs/ARCHITECTURE.md +82 -10
- package/docs/CACHING.md +2 -3
- package/docs/CHANGELOG.md +149 -13
- package/docs/CONTRACTS.md +13 -10
- package/docs/GUIDE.md +104 -8
- package/docs/MCP.md +46 -27
- package/docs/benchmarks/bun-previews.md +5 -5
- package/docs/benchmarks/{gidi-preview-memory.md → preview-memory.md} +14 -12
- package/docs/benchmarks/turbo-poc.md +24 -6
- package/package.json +2 -1
- package/dist/starters/react/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// The Icons view: ADS renders the project's glyph folder itself, in showcase chrome colours.
|
|
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, item.aliases.length ? element("p", { className: "icons-alias", textContent: `alias: ${item.aliases.join(", ")}` }) : null, 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
|
+
const muted = element("span", { className: "icons-logo-muted", title: `${file.name}, muted` });
|
|
90
|
+
muted.setAttribute("aria-hidden", "true");
|
|
91
|
+
muted.style.maskImage = muted.style.webkitMaskImage = `url("${file.src}")`;
|
|
92
|
+
figure.append(element("img", { src: file.src, alt: file.name, title: file.file }), muted, 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} · in color and muted` })),
|
|
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
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
<nav id="sections" aria-label="Showcase sections">
|
|
8
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
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>
|
|
10
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>
|
|
11
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>
|
|
12
13
|
<button data-section="composition"><svg viewBox="0 0 16 16"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>Composition</button>
|
|
13
14
|
</nav>
|
|
14
|
-
<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="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>
|
|
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>
|
|
15
16
|
</header>
|
|
16
17
|
<main>
|
|
17
18
|
<aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside>
|
package/dist/showcase/style.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
:root{font:13px/1.5 system-ui,sans-serif;color-scheme:light;background:#fafafa;color:#444;--frame-bg:#fafafa;--frame-ink:#444;--frame-line:#ddd;--pane-width:min(276px,42vw)}
|
|
2
|
-
:root[data-theme="dark"]{color-scheme:dark;--frame-bg:#181818;--frame-ink:#ddd;--frame-line:#444;background:var(--frame-bg);color:var(--frame-ink)}
|
|
1
|
+
:root{font:13px/1.5 system-ui,sans-serif;color-scheme:light;background:#fafafa;color:#444;--frame-bg:#fafafa;--frame-ink:#444;--frame-line:#ddd;--pane-width:min(276px,42vw);--icons-surface:#fff;--icons-muted:#6b7080;--icons-grid:#dfe0ee;--icons-grid-mid:#b4b7dc;--icons-grid-bg:#f6f6fd;--icons-error:#c23d51;--icons-error-bg:#fcecef}
|
|
2
|
+
:root[data-theme="dark"]{color-scheme:dark;--frame-bg:#181818;--frame-ink:#ddd;--frame-line:#444;background:var(--frame-bg);color:var(--frame-ink);--icons-surface:#202020;--icons-muted:#a0a4b0;--icons-grid:#34364a;--icons-grid-mid:#55598a;--icons-grid-bg:#1c1c26;--icons-error:#f08a9a;--icons-error-bg:#3a1f25}
|
|
3
3
|
.entry-preview{float:right;display:inline-flex;align-items:center;margin-inline-start:8px;opacity:.65}.entry-preview svg{width:14px;height:14px}.entry-preview[data-state="building"] svg{animation:preview-spin 1s linear infinite}.entry-preview[data-state="error"],.entry-preview[data-state="ready"]{opacity:1}@keyframes preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.entry-preview svg{animation:none!important}}
|
|
4
4
|
*{box-sizing:border-box}body{margin:0;height:100vh;display:flex;flex-direction:column;overflow:hidden}button,a{font:inherit;color:inherit}button{cursor:pointer;background:transparent;border:1px solid var(--frame-line);border-radius:4px}button:focus-visible,a:focus-visible{outline:2px solid var(--frame-ink);outline-offset:2px}svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;flex:none}svg:not([aria-label]){pointer-events:none}
|
|
5
5
|
header{height:52px;display:flex;flex:none;border-bottom:1px solid var(--frame-line);align-items:stretch;background:var(--frame-bg)}#brand{width:var(--pane-width);display:flex;flex:none;gap:8px;align-items:center;padding:0 12px;border-right:1px solid var(--frame-line);font-weight:600;white-space:nowrap}#brand .mark{font-weight:700}#title{min-width:0;overflow:hidden;text-overflow:ellipsis}#pane-toggle{width:28px;height:28px;margin-inline-start:auto;display:grid;place-items:center;flex:none}.collapsed #brand{width:44px;padding:0 8px;border-right:0}.collapsed #brand .mark,.collapsed #title{display:none}
|
|
@@ -28,3 +28,20 @@ main{flex:1;min-height:0;display:flex}#sidebar{width:var(--pane-width);flex:none
|
|
|
28
28
|
@media(max-width:480px){#preview-error{flex-wrap:wrap}#preview-error-message{flex-basis:calc(100% - 24px)}#preview-error-details{margin-inline-start:22px}}
|
|
29
29
|
|
|
30
30
|
#preview-status[data-warmup="warming"][data-phase="ready"] .status-dot{background:transparent;border:1.5px solid currentColor;animation:status-pulse 1.6s ease-in-out infinite}#warmup-status{margin:8px 0 0;opacity:.7}
|
|
31
|
+
/* The brand selector sits beside the theme button only when the project declares brands. */
|
|
32
|
+
#brand-select{height:28px;max-width:12em;font:inherit;color:inherit;background:transparent;border:1px solid var(--frame-line);border-radius:4px;padding:0 4px}
|
|
33
|
+
/* Icons: the project's glyph folder drawn natively in showcase chrome colours. */
|
|
34
|
+
body[data-active-section="icons"] #sidebar{display:none}
|
|
35
|
+
.icons-view{height:100%;overflow:auto;padding:24px 28px 40px;font-size:14px;line-height:1.4}.icons-view h1{font-size:22px;margin:0 0 4px}.icons-view h2{font-size:16px;margin:24px 0 10px}.icons-view h2 small{font-size:14px;font-weight:400;color:var(--icons-muted)}
|
|
36
|
+
.icons-head{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap}.icons-summary{margin:0;color:var(--icons-muted);overflow-wrap:anywhere}.icons-head input{font:inherit;color:inherit;background:var(--icons-surface);border:1px solid var(--frame-line);border-radius:6px;padding:6px 10px;width:min(260px,100%)}
|
|
37
|
+
.icons-set{display:grid;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:12px 0;justify-items:center;background:var(--icons-surface);border:1px solid var(--frame-line);border-radius:12px;padding:16px 18px}.icons-set-item{display:grid;place-items:center;padding:4px}
|
|
38
|
+
.icons-glyph{display:inline-flex;flex:none;color:inherit}.icons-glyph>svg{display:block;width:100%;height:100%;pointer-events:none}
|
|
39
|
+
.icons-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(200px,100%),1fr));gap:12px;align-items:start}
|
|
40
|
+
.icons-card{min-width:0;background:var(--icons-surface);border:1px solid var(--frame-line);border-radius:12px;padding:12px 14px}.icons-card[data-findings]{border-color:var(--icons-error)}
|
|
41
|
+
.icons-card-head{display:flex;gap:8px;align-items:center;justify-content:space-between}.icons-card h3{margin:0;font:600 14px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;overflow-wrap:anywhere}
|
|
42
|
+
.icons-badge{flex:none;background:var(--icons-error-bg);color:var(--icons-error);border-radius:999px;font-size:11px;font-weight:600;padding:1px 8px}.icons-alias{margin:2px 0 0;font-size:12px;color:var(--icons-muted);overflow-wrap:anywhere}
|
|
43
|
+
.icons-mag{position:relative;width:96px;height:96px;margin:10px auto;background:var(--icons-grid-bg)}.icons-mag>.icons-grid{position:absolute;inset:0;width:100%;height:100%}.icons-mag>.icons-glyph{position:absolute;inset:0}
|
|
44
|
+
.icons-grid line{stroke:var(--icons-grid);stroke-width:.5px;vector-effect:non-scaling-stroke}.icons-grid line.mid{stroke:var(--icons-grid-mid);stroke-width:1px}
|
|
45
|
+
.icons-sizes{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;justify-content:center}.icons-size{display:flex;flex-direction:column;align-items:center;gap:2px}.icons-size small{font-size:10px;color:var(--icons-muted)}
|
|
46
|
+
.icons-finding{margin:10px 0 0;font-size:12px;color:var(--icons-error);background:var(--icons-error-bg);border-radius:6px;padding:5px 8px;overflow-wrap:anywhere}.icons-empty{color:var(--icons-muted)}
|
|
47
|
+
.icons-logos{display:flex;flex-wrap:wrap;gap:12px}.icons-logo{display:flex;align-items:center;gap:10px;margin:0;background:var(--icons-surface);border:1px solid var(--frame-line);border-radius:10px;padding:8px 12px}.icons-logo img,.icons-logo-muted{width:24px;height:24px;object-fit:contain}.icons-logo-muted{display:inline-block;background:var(--icons-muted);-webkit-mask:center/contain no-repeat;mask:center/contain no-repeat}.icons-logo figcaption{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
|
package/dist/skills/README.md
CHANGED
|
@@ -71,7 +71,8 @@ redistributing the skills. Component-library notices belong beside the imported
|
|
|
71
71
|
project, separate from these skill notices.
|
|
72
72
|
|
|
73
73
|
The showcase is a tool-owned minimal shell plus an MCP client and Apps host.
|
|
74
|
-
Its
|
|
74
|
+
Its Brand, Tokens, Components, Patterns and Composition sections discover token
|
|
75
|
+
categories and scenario entries through MCP; its Icons tab shows the glyph set.
|
|
75
76
|
The skills use the connected runtime URL, or `ads showcase` for browser-only work;
|
|
76
77
|
they do not generate page browsers or duplicate the tool shell. Scenarios,
|
|
77
78
|
fixtures and adapters remain colocated with their owners; larger entries live in
|
|
@@ -114,11 +114,11 @@ helpers do not grant custom scenario CSS.
|
|
|
114
114
|
|
|
115
115
|
For atomic base/variant styling, helper/wrapper class composition, extracted
|
|
116
116
|
custom-property arithmetic, typed `@property` registrations, or an
|
|
117
|
-
`atomic-composition-review` / `atomic-composition-limit`
|
|
117
|
+
`atomic-composition-review` / `atomic-composition-limit` finding, read
|
|
118
118
|
[atomic style composition](references/atomic-styles.md). The same guide is served
|
|
119
119
|
as `ads://guides/atomic-styles`. It explains shorthand/logical conflicts and
|
|
120
120
|
matching-property fixes, plus the build resolver for preserving opaque custom
|
|
121
|
-
properties through extraction.
|
|
121
|
+
properties through extraction. Check review items in the real `cx` composition and verify
|
|
122
122
|
computed styles across affected sizes/states; retain intentional product behavior.
|
|
123
123
|
|
|
124
124
|
Controllers are UI behavior owners: private helpers stay with their component or
|
|
@@ -311,9 +311,10 @@ foundation CSS rather than assigning shared token values in JavaScript. Keep
|
|
|
311
311
|
full-app integration harnesses and workflow coverage in application test support.
|
|
312
312
|
|
|
313
313
|
Foundation CSS is checked, not an escape hatch. Value sheets define shared tokens
|
|
314
|
-
on the document root
|
|
315
|
-
three closed roles: root/body typography,
|
|
316
|
-
normalization; and global focus
|
|
314
|
+
on the document root (per-theme halves) or a brand's `[data-brand]`; `fonts.css`
|
|
315
|
+
holds font-face metadata. `base.css` has three closed roles: root/body typography,
|
|
316
|
+
canvas and theme defaults; limited native normalization; and global focus
|
|
317
|
+
indicators/reduced-motion rules. Every selector
|
|
317
318
|
branch, property and value must fit its role. Token-backed control skins, layout,
|
|
318
319
|
interactive state rules and owner hooks are rejected even through `:where()`.
|
|
319
320
|
Do not copy an unchecked upstream preflight or turn a component repair into a reset.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Atomic style composition
|
|
2
2
|
|
|
3
3
|
Use this guide when creating or migrating component/pattern styles, changing
|
|
4
|
-
base/size/state combinations, or reviewing `atomic-composition-review`
|
|
4
|
+
base/size/state combinations, or reviewing `atomic-composition-review` items.
|
|
5
5
|
It is also available as `ads://guides/atomic-styles` through ADS MCP.
|
|
6
6
|
|
|
7
7
|
## Why valid tokens can still render incorrectly
|
|
@@ -203,7 +203,7 @@ entire className; `<button {...props} className={cx(base, className)} />` compos
|
|
|
203
203
|
it explicitly. Keep the product's intended forwarding behavior when fixing an
|
|
204
204
|
overlap. Do not change the public API simply to make tracing easier.
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
Review items include a bounded `composition` path through traced helpers and
|
|
207
207
|
components. A `target` identifies a statically reached DOM element. This
|
|
208
208
|
establishes source composition, not that a scenario mounted it or that its
|
|
209
209
|
computed result is wrong. `writingModeDependent: true` identifies overlaps that
|
|
@@ -213,9 +213,9 @@ expand them safely. Token formulas, inheritance and runtime values still need
|
|
|
213
213
|
review. A margin shorthand and `margin-inline: auto` may agree horizontally but
|
|
214
214
|
disagree in vertical text, so horizontal equality alone is insufficient.
|
|
215
215
|
|
|
216
|
-
## Respond to a
|
|
216
|
+
## Respond to a review item
|
|
217
217
|
|
|
218
|
-
1. Follow the
|
|
218
|
+
1. Follow the review item's related file/line locations and inspect the actual `cx`
|
|
219
219
|
composition. Variant lookups may contribute several possible combinations.
|
|
220
220
|
2. In a current built preview, inspect computed properties and the winning CSS
|
|
221
221
|
rules. Establish whether extraction order, specificity, writing mode or an
|
|
@@ -231,7 +231,7 @@ Increasing specificity, adding `!important`, copying styles into scenarios or
|
|
|
231
231
|
moving component styling into `base.css` can hide the symptom while retaining
|
|
232
232
|
the conflict. Prefer resolving the composition itself. If an overlap is
|
|
233
233
|
intentional, document why its precedence is stable and verify the resulting
|
|
234
|
-
behavior rather than changing product capabilities to silence a
|
|
234
|
+
behavior rather than changing product capabilities to silence a review item.
|
|
235
235
|
|
|
236
236
|
Use existing behavior contracts and `ads_verify` for important geometry. Register
|
|
237
237
|
a check beside its owner, link its real scenario and use the project's browser
|
|
@@ -249,16 +249,16 @@ states, themes and supported writing modes. Wait for observable readiness; an
|
|
|
249
249
|
event-stream connection can prevent `networkidle` from settling. A generic
|
|
250
250
|
overlap scan cannot decide which dimensions the product intended. A failed
|
|
251
251
|
registered geometry assertion is blocking through the existing verification
|
|
252
|
-
contract; an overlap
|
|
252
|
+
contract; an overlap review item remains a review signal.
|
|
253
253
|
|
|
254
254
|
## What ADS checks
|
|
255
255
|
|
|
256
|
-
`atomic-composition-review` is a nonblocking
|
|
257
|
-
with `severity: "
|
|
258
|
-
errors; MCP checks and mutations preserve the
|
|
256
|
+
`atomic-composition-review` is a nonblocking review item, returned under `advisories`
|
|
257
|
+
with `severity: "review"`. CLI checks still exit successfully when there are no
|
|
258
|
+
errors; MCP checks and mutations preserve the review item and its guidance URI.
|
|
259
259
|
|
|
260
260
|
An unchanged advisory baseline is not evidence that the affected styles are
|
|
261
|
-
correct. Triage
|
|
261
|
+
correct. Triage review items that reach an edited owner or its shared helpers against
|
|
262
262
|
the actual DOM classes and computed styles in a compiled scenario. Interaction
|
|
263
263
|
checks may pass without measuring padding, alignment or sizing. When an intended
|
|
264
264
|
layout is known, add a focused rendered assertion for that contract; when keeping
|
|
@@ -285,7 +285,7 @@ unresolved DOM targets and traversal limits produce bounded
|
|
|
285
285
|
`atomic-composition-limit` informational advisories where known atomic styles
|
|
286
286
|
reach an unresolved composition. Ordinary externally supplied className values
|
|
287
287
|
remain open inputs, not guaranteed safe styles. Depth, work and alternative
|
|
288
|
-
limits keep source inspection bounded; an unreported path or an empty
|
|
288
|
+
limits keep source inspection bounded; an unreported path or an empty review
|
|
289
289
|
list does not establish visual correctness. Actual failed registered
|
|
290
290
|
browser/behavior checks remain blocking; potentially intentional source overlaps
|
|
291
|
-
remain
|
|
291
|
+
remain review items.
|
|
@@ -23,8 +23,9 @@ ads_capture({
|
|
|
23
23
|
})
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
The ID above is illustrative; use one returned by discovery.
|
|
27
|
-
|
|
26
|
+
The ID above is illustrative; use one returned by discovery. `theme` names one of the
|
|
27
|
+
project's declared themes (`ads_status.themes`); the default is the first declared theme at
|
|
28
|
+
1280 × 800 CSS pixels. Capture uses the real sandboxed MCP App with the
|
|
28
29
|
requested viewport and excludes showcase navigation. The default image records
|
|
29
30
|
the complete widget viewport, including its current scroll/state; it does not
|
|
30
31
|
automatically stitch every scroll position into one image.
|
|
@@ -154,11 +154,14 @@ valueFrom: ["paint", "scheme.day", "scheme.night"],
|
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
Register each matching `config.*.<path>` in `paintInputs`. The producer may write
|
|
157
|
-
one declared field, or
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
one declared field, or a per-theme value built with the generated helpers from
|
|
158
|
+
`tokens/themes.generated.ts`: `themed({ light: entry.scheme.day, dark: entry.scheme.night })`
|
|
159
|
+
(keys exactly the declared themes) or `themedByScheme({ light: …, dark: … })` (each theme
|
|
160
|
+
takes the value for its color scheme). Every value is a declared field and the argument is
|
|
161
|
+
an object literal without spreads. The normal key/map/root proof still applies. Raw
|
|
162
|
+
constants, undeclared fields, `light-dark()`, extra writes and unknown transforms are
|
|
163
|
+
rejected. The browser audit checks an accessible color reference in every theme's branch;
|
|
164
|
+
a local SVG URL or `none` is not a color there.
|
|
162
165
|
|
|
163
166
|
Families cannot overlap shared tokens, private runtime
|
|
164
167
|
prefixes or other bindings. A broad family such as `--color-${key}` grants no
|
|
@@ -167,12 +170,12 @@ cannot be established. Registered paint consumers list their allowed binding IDs
|
|
|
167
170
|
borrowing a peer's binding family or private runtime variable remains invalid. Bindings are scoped
|
|
168
171
|
to their actual root; portals outside it need deliberate project integration.
|
|
169
172
|
|
|
170
|
-
A registered binding producer
|
|
171
|
-
`
|
|
172
|
-
|
|
173
|
-
undefined tokens and SVG URLs
|
|
173
|
+
A registered binding producer gives a per-theme value with `themed()` or
|
|
174
|
+
`themedByScheme()`; its output is `var(--ads-if-<theme>, <reference>)` once per declared
|
|
175
|
+
theme, in declared order. The App paint audit checks every branch and its observed effect
|
|
176
|
+
in the active theme. Raw colors, undefined tokens and SVG URLs in a branch remain invalid.
|
|
174
177
|
This derived binding form does not widen public paint-input types; use constrained
|
|
175
|
-
references for each theme input and verify
|
|
178
|
+
references for each theme input and verify every theme in browser checks.
|
|
176
179
|
|
|
177
180
|
The App audit checks current mounted instances, accessible values, local SVG
|
|
178
181
|
resources and computed paint-property responses. Visibility and complete rendered
|
|
@@ -74,7 +74,7 @@ Review that intent and do not disguise a new design decision as arithmetic.
|
|
|
74
74
|
|
|
75
75
|
## Review overlap without deleting legitimate roles
|
|
76
76
|
|
|
77
|
-
`token-overlap-review` is a nonblocking
|
|
77
|
+
`token-overlap-review` is a nonblocking review item for shared tokens with identical
|
|
78
78
|
normalized definitions across their declared theme/condition scopes. It identifies
|
|
79
79
|
the tokens and source. Inspect their consumers and roles. If one decision is being
|
|
80
80
|
copied, reuse one shared token or make its relationship explicit with an alias.
|
|
@@ -82,10 +82,207 @@ Equal values alone do not prove equal purpose: body text and strong text, spacin
|
|
|
82
82
|
and control sizes, or two motion roles may intentionally differ later. A light-only
|
|
83
83
|
match does not justify merging tokens whose dark/reduced-motion values differ.
|
|
84
84
|
|
|
85
|
-
For
|
|
85
|
+
For existing workspaces, convert independent component constants explicitly:
|
|
86
86
|
select an existing shared role when it means the same thing; centralize genuinely
|
|
87
87
|
missing decisions; remove private sheets/imports and contract fields; update token
|
|
88
88
|
sample coverage in the shared directory. Preserve themes, units, public APIs and
|
|
89
89
|
behavior unless changing the visual policy was explicitly intended. Review a Git
|
|
90
90
|
diff and run core, project and browser checks. There is no compatibility mode that
|
|
91
91
|
keeps independent component token definitions valid.
|
|
92
|
+
|
|
93
|
+
## Accessibility and rhythm checks
|
|
94
|
+
|
|
95
|
+
`ads check` checks token values in every theme and brand. Each finding below is an error:
|
|
96
|
+
|
|
97
|
+
- `token-contrast`: the roles that meet on screen fall below WCAG 2.2 AA: `--text-strong`,
|
|
98
|
+
`--text-body`, `--text-muted`, `--text-link` and `--accent-text` on `--bg-canvas`,
|
|
99
|
+
`--bg-surface` and `--bg-hover`; `--accent-fg` on `--accent` and `--accent-hover`; each
|
|
100
|
+
status's `-fg` on its solid and `-text` on its `-bg` (4.5:1); `--border-focus` and
|
|
101
|
+
`--border-strong` on the canvas and surface (3:1). Fix it by choosing a different ramp
|
|
102
|
+
step for the role, in the theme the message names, never with a one-off color.
|
|
103
|
+
- `token-rhythm`: a numbered spacing step leaves the scale `--space-N` = N × 2 px.
|
|
104
|
+
- `control-padding`: pad a control with the token for its size. A block sized with
|
|
105
|
+
`--control-height-<size>` pads its sides with `--control-padding-<size>`; the small gap
|
|
106
|
+
inside a track (segmented control, switch) uses `--control-inset` (add it to the spacing
|
|
107
|
+
tokens if the project has none). Anything that is not a control does not use
|
|
108
|
+
`--control-height-*`.
|
|
109
|
+
|
|
110
|
+
`token-overlap-review` (review) compares values only within a token family (`--radius-*`
|
|
111
|
+
with `--radius-*`): a radius equal to a spacing step is two scales meeting, not a duplicate.
|
|
112
|
+
|
|
113
|
+
## Exchange format
|
|
114
|
+
|
|
115
|
+
`ads tokens --format dtcg` prints the tokens as W3C Design Tokens (Community Group draft)
|
|
116
|
+
JSON: groups by family, typed `$value`s, `{group.token}` references for `var()` aliases.
|
|
117
|
+
Values the format cannot express (fluid `clamp()` sizes, layered shadows) keep their CSS in
|
|
118
|
+
`$extensions["org.reqvire.ads"].css`; other themes' values are in
|
|
119
|
+
`$extensions["org.reqvire.ads"].scopes`.
|
|
120
|
+
|
|
121
|
+
## Grid
|
|
122
|
+
|
|
123
|
+
The `--grid-*` tokens describe a column grid: `--grid-columns-sm/md/lg` (the starter's 4, 8
|
|
124
|
+
and 16), `--grid-gutter`, `--grid-gutter-narrow`, `--grid-gutter-condensed` and
|
|
125
|
+
`--grid-margin-sm/md/lg`, aliasing spacing steps. The starter's `Grid` switches columns by
|
|
126
|
+
container width (768 and 1024 px) with container queries, since CSS variables cannot be
|
|
127
|
+
breakpoints. The showcase's grid overlay draws these tokens over every preview at the same
|
|
128
|
+
widths; a project without them shows no overlay. Align text to a cell's edge, not its gutter.
|
|
129
|
+
|
|
130
|
+
## Color roles and states
|
|
131
|
+
|
|
132
|
+
Name roles by element and purpose, the same in every theme; only their values change. Point roles at ramp steps rather than raw colors, so a theme is a ramp swap:
|
|
133
|
+
|
|
134
|
+
- Layers: `--bg-canvas` → `--bg-surface` → `--bg-raised` (menus, popovers), with `--bg-field`
|
|
135
|
+
for inputs. In dark themes each layer up is one step lighter; in light themes surfaces stay
|
|
136
|
+
near white.
|
|
137
|
+
- States move along the ramp: hover one step, pressed or active two, selected a subtle accent
|
|
138
|
+
step (`--bg-selected`). Solid fills hover one step darker (`--accent-hover`).
|
|
139
|
+
- Disabled is always neutral (`--bg-disabled`, `--text-disabled`, `--border-disabled`) with no
|
|
140
|
+
hover or focus response; WCAG exempts it from contrast, so `token-contrast` skips it.
|
|
141
|
+
- `--bg-overlay` is the translucent scrim behind modals; `--bg-skeleton` fills loading
|
|
142
|
+
placeholders.
|
|
143
|
+
- Never signal state or status by color alone: pair it with text, an icon or a shape.
|
|
144
|
+
|
|
145
|
+
## Themes
|
|
146
|
+
|
|
147
|
+
Declare themes in `ds.config.json` (`themes: [{ name, scheme }]`, the first is the default;
|
|
148
|
+
`scheme` sets `color-scheme` for native controls and scrollbars).
|
|
149
|
+
|
|
150
|
+
Write a token that differs per theme as one half per theme, named with the theme as suffix,
|
|
151
|
+
on `:root`:
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
:root {
|
|
155
|
+
--color-accent-9-light: oklch(55% .2 280);
|
|
156
|
+
--color-accent-9-dark: oklch(70% .16 280);
|
|
157
|
+
--bg-canvas-light: var(--slate-1-light);
|
|
158
|
+
--bg-canvas-dark: var(--slate-2-dark);
|
|
159
|
+
--accent: var(--color-accent-9);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- A half is a plain value or refers to halves: `--text-muted-dark: var(--slate-11-dark)`,
|
|
164
|
+
never `var(--slate-11)` (`theme-half-reference`).
|
|
165
|
+
- Give every themed token a half for every declared theme (`theme-coverage`). Tokens that do
|
|
166
|
+
not change per theme stay single values; a role that aliases a ramp step
|
|
167
|
+
(`--accent: var(--color-accent-9)`) needs no halves.
|
|
168
|
+
- Never set token values under `[data-theme]` or `prefers-color-scheme` (`theme-old-form`),
|
|
169
|
+
and never set a token both as one value and as halves (`theme-half-conflict`).
|
|
170
|
+
- ADS writes `tokens/themes.generated.css` from the halves and the declared themes and
|
|
171
|
+
brands: `ads assets` writes it, and the showcase and MCP server rewrite it whenever tokens
|
|
172
|
+
or `ds.config.json` change. Commit it, never edit it; it is the last foundation import.
|
|
173
|
+
After editing tokens without a running showcase, run `ads assets` (`themes-generated`
|
|
174
|
+
fails when it is stale).
|
|
175
|
+
- `data-theme="<name>"` on `<html>` themes the page; on any element it themes that section
|
|
176
|
+
and everything inside it, down to the next `data-theme`. A themed section paints its own
|
|
177
|
+
canvas and text (`base.css`).
|
|
178
|
+
- Add a theme for a real need: high contrast, a dimmed reading mode. Add a half for it to
|
|
179
|
+
every themed token. Check a theme in the showcase (the theme button steps through declared
|
|
180
|
+
themes) and capture it by name.
|
|
181
|
+
- Show content that belongs to one theme (a dark logo variant) with the generated display
|
|
182
|
+
switch: `display: var(--display-dark, block)`. It is `none` outside the nearest dark
|
|
183
|
+
theme. Never style by theme or brand with a selector (`[data-theme="dark"] &`,
|
|
184
|
+
`:root[data-brand] &`): it ignores the nearest section (`theme-selector`). Give per-theme
|
|
185
|
+
values as token halves instead.
|
|
186
|
+
- A per-theme value that comes from data at runtime (a chart series color, a highlighter
|
|
187
|
+
color) uses the generated helpers, never `light-dark()` (`theme-light-dark`):
|
|
188
|
+
`style={{ "--series": themed({ light: a, dark: b }) }}` with every declared theme as a key,
|
|
189
|
+
or `themedByScheme({ light: a, dark: b })` when the data has only light and dark (each
|
|
190
|
+
theme takes the value for its scheme). Values are complete colors.
|
|
191
|
+
- To follow the OS setting, set `"followSystemTheme": true` in `ds.config.json`: a page
|
|
192
|
+
without `data-theme` takes the first declared theme whose scheme matches
|
|
193
|
+
`prefers-color-scheme`. An explicit `data-theme` always wins. Letting the user choose and
|
|
194
|
+
remembering it is application code: it sets `data-theme`.
|
|
195
|
+
|
|
196
|
+
## Brands
|
|
197
|
+
|
|
198
|
+
A brand is a second axis beside the theme: the theme sets the color mode, the brand sets
|
|
199
|
+
identity (an accent ramp, a font). Use brands for white label (one product, each customer's
|
|
200
|
+
accent, font and logo, each in light and dark), a product family, or a co-branded partner
|
|
201
|
+
section; without them every combination becomes a theme (`acme-light`, `acme-dark`, …).
|
|
202
|
+
|
|
203
|
+
Declare brands in `ds.config.json` (`brands: [{ name }]`, the first is the default; leave
|
|
204
|
+
`brands` out for one brand). The default brand's values are the ones on `:root`. Another
|
|
205
|
+
brand re-sets existing tokens on its own selector only, with every half of a themed token it
|
|
206
|
+
changes:
|
|
207
|
+
|
|
208
|
+
```css
|
|
209
|
+
[data-brand="acme"] {
|
|
210
|
+
--color-accent-9-light: oklch(55% .2 25);
|
|
211
|
+
--color-accent-9-dark: oklch(70% .16 25);
|
|
212
|
+
--font-sans: Georgia, serif;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
- `data-brand="<name>"` on `<html>` brands the page; on any element that section. Brand and
|
|
217
|
+
theme are independent: each element takes its nearest brand and its nearest theme, at any
|
|
218
|
+
nesting depth, including the default brand inside another brand's section.
|
|
219
|
+
- Errors: a brand that gives a themed token one value (`brand-theme-value`) or only some of
|
|
220
|
+
its halves or ramp steps (`brand-coverage`), a token only a brand defines
|
|
221
|
+
(`brand-new-token`), a declared brand without values (`brand-empty`), a `data-brand` name
|
|
222
|
+
the config does not declare (`brand-undeclared`). `token-contrast` runs for every brand
|
|
223
|
+
in every theme.
|
|
224
|
+
- A brand's logo is brand artwork (`ads://guides/branding`). Render every brand's logo and
|
|
225
|
+
show each with `display: var(--display-brand-<brand>, block)`, so a section shows its
|
|
226
|
+
nearest brand's logo.
|
|
227
|
+
- The showcase shows a brand selector next to the theme button; captures take `brand`;
|
|
228
|
+
`ads tokens --format dtcg --brand <name>` exports a brand (with `--theme`, one brand in
|
|
229
|
+
one theme).
|
|
230
|
+
|
|
231
|
+
## Colors in Canvas, WebGL and SVG renderers
|
|
232
|
+
|
|
233
|
+
A renderer that needs colors as values (a graph, a chart, a canvas) reads them from the
|
|
234
|
+
generated palette, never from the page per item. `tokens/themes.generated.ts` holds every
|
|
235
|
+
color token resolved for every context (`<theme>`, and `<brand>/<theme>` for other brands)
|
|
236
|
+
as `{ css, rgba }`: `css` is `#rrggbb`, or `rgba(…)` when translucent; `rgba` is sRGB
|
|
237
|
+
0–255 with alpha 0–1. Aliases, halves and `color-mix()` are resolved; out-of-gamut colors
|
|
238
|
+
are clipped per channel, as a canvas does. ADS writes it with `themes.generated.css`.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { paletteFor, observePalette } from "@ds";
|
|
242
|
+
|
|
243
|
+
let colors = paletteFor(container); // once per render pass
|
|
244
|
+
const fill = colors["--accent"].rgba; // inside the per-node loop
|
|
245
|
+
const stop = observePalette(container, next => { colors = next; redraw(); });
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
- `paletteFor(element)` returns the palette of the element's nearest theme and brand (and
|
|
249
|
+
the OS setting under `followSystemTheme`). Call it once per render or context change; look
|
|
250
|
+
colors up inside loops.
|
|
251
|
+
- `observePalette(element, callback)` calls back once when the element's theme or brand
|
|
252
|
+
changes; redraw from it instead of rebuilding the renderer. It returns the unsubscribe.
|
|
253
|
+
- `paletteContext(element)` returns the context key (`<theme>` or `<brand>/<theme>`) for
|
|
254
|
+
`palette[key]` or for caching per context.
|
|
255
|
+
- `resolveColor(element, value)` resolves a color that is not a palette token (currentColor,
|
|
256
|
+
a value from data) once, without inserting elements, and caches it.
|
|
257
|
+
- A token whose value cannot be resolved ahead of time (currentColor, relative color syntax,
|
|
258
|
+
system colors) is not in the palette in any context; `unresolved` lists it. Use
|
|
259
|
+
`resolveColor` for those.
|
|
260
|
+
- The palette reflects token sheets, not inline token overrides at runtime or `@media`
|
|
261
|
+
variants.
|
|
262
|
+
|
|
263
|
+
`render-color-probe` (review) flags a computed-style color read or `getImageData` inside a
|
|
264
|
+
per-item path (an array callback, a loop body, `nodeReducer`/`edgeReducer`, d3 `.attr`/
|
|
265
|
+
`.style` callbacks). Move the read out with `paletteFor`.
|
|
266
|
+
|
|
267
|
+
## Spacing
|
|
268
|
+
|
|
269
|
+
`--space-N` is N × 2 px, from 2 to 160 px; the same values hold at every screen size, and a
|
|
270
|
+
layout steps down one or two sizes at narrow widths instead of scaling. Use the scale for
|
|
271
|
+
padding inside components and for gaps between them; a value off the scale needs a reason.
|
|
272
|
+
|
|
273
|
+
- Distance says how related things are: closer means more related. Group with space before
|
|
274
|
+
reaching for dividers, borders or cards.
|
|
275
|
+
- More space around an element gives it more importance. Sections can be dense, but leave the
|
|
276
|
+
page as a whole room to breathe.
|
|
277
|
+
- Parents own the space between their children (`gap`, stack tokens); a component carries no
|
|
278
|
+
outer margin, so it fits wherever it is placed.
|
|
279
|
+
- Horizontal layout follows the column grid; percentages are fine for splitting a region and
|
|
280
|
+
for minimum and maximum widths.
|
|
281
|
+
|
|
282
|
+
## Motion tokens
|
|
283
|
+
|
|
284
|
+
Six durations (`--dur-instant` 70 ms, `--dur-fast` 110, `--dur-moderate` 150, `--dur-normal`
|
|
285
|
+
240, `--dur-slow` 400, `--dur-slower` 700) and three curve pairs (standard, enter and exit, each everyday and
|
|
286
|
+
`-strong`). Every duration is 0 under `prefers-reduced-motion`. Pick by purpose, not by
|
|
287
|
+
number: the ads-motion skill's build guide maps each token to its use and gives the easing
|
|
288
|
+
rules.
|
|
@@ -41,6 +41,10 @@ implicitly requiring them at acceptance.
|
|
|
41
41
|
all registered behavior checks. Use before a release, after ownership/test/config
|
|
42
42
|
migrations and for an explicit complete audit. Changed scope narrows registered
|
|
43
43
|
owners while project scripts and core gates retain full scope.
|
|
44
|
+
- `browserAudit: true` in either policy adds the axe-core audit of every rendered
|
|
45
|
+
UI scenario in every brand and theme (`browser-accessibility-audit`). Its `a11y-axe`
|
|
46
|
+
findings are errors that fail the policy; draft and patch acceptance do not run it. See
|
|
47
|
+
ads://guides/accessibility.
|
|
44
48
|
- Draft create, edit and show are preview-only; they trigger neither policy.
|
|
45
49
|
`ads_verify` explicitly runs selected checks independently of either policy.
|
|
46
50
|
- Builds, hooks and CI trigger a policy only when their scripts invoke it. Use
|
|
@@ -49,11 +53,11 @@ implicitly requiring them at acceptance.
|
|
|
49
53
|
disable tests or weaken configuration to make a failing change pass.
|
|
50
54
|
|
|
51
55
|
Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
|
|
52
|
-
validation `behaviorChecks:true`. No lint/test/build script names are inferred.
|
|
56
|
+
validation `behaviorChecks:true`, both `browserAudit:false`. No lint/test/build script names are inferred.
|
|
53
57
|
Every listed script must exist; commands are trusted project configuration, not
|
|
54
|
-
MCP arguments.
|
|
55
|
-
and
|
|
56
|
-
|
|
58
|
+
MCP arguments. `mcp.mutationChecks` is a configuration error: list those scripts in
|
|
59
|
+
`acceptance.checks` and set `acceptance.behaviorChecks`. `mcp.mutationCheckTimeoutMs`
|
|
60
|
+
bounds each project script; behavior profiles have separate budgets.
|
|
57
61
|
|
|
58
62
|
Report the chosen policy, scope and revision. Skipped tests are not passed tests;
|
|
59
63
|
acceptance evidence is not complete-validation evidence. The two policies keep
|