@behavioral-agentic-design-system/core 0.40.0 → 0.42.0
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 +2 -0
- package/package.json +19 -3
- package/scripts/a11y-lint.cjs +41 -2
- package/scripts/health-report.mjs +16 -2
- package/scripts/lint-slop.mjs +25 -1
- package/scripts/wcag-audit.cjs +72 -5
- package/src/app/opengraph-image.tsx +5 -0
- package/src/app/preview/components/page.tsx +1269 -2
- package/src/app/shell.tsx +8 -5
- package/src/components/Foundations/Motion.stories.tsx +1 -0
- package/src/components/customize/design-controls.tsx +16 -1
- package/src/components/studio/studio.tsx +153 -0
- package/src/components/ui/anchor.tsx +37 -3
- package/src/components/ui/attachment.tsx +211 -0
- package/src/components/ui/chart.tsx +3 -0
- package/src/components/ui/code.tsx +1 -1
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/gauge-chart.tsx +238 -0
- package/src/components/ui/heatmap.tsx +256 -0
- package/src/components/ui/index.ts +9 -0
- package/src/components/ui/infinite-scroll.tsx +103 -0
- package/src/components/ui/json-input.tsx +351 -0
- package/src/components/ui/navigation-progress.tsx +281 -0
- package/src/components/ui/number-input.tsx +1 -4
- package/src/components/ui/password-input.tsx +2 -1
- package/src/components/ui/password-strength-input.tsx +288 -0
- package/src/components/ui/pill.tsx +140 -0
- package/src/components/ui/popover.tsx +27 -4
- package/src/components/ui/scroll-progress.tsx +100 -0
- package/src/components/ui/snackbar.tsx +393 -0
- package/src/components/ui/sortable-list.tsx +342 -0
- package/src/components/ui/squircle.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tour.tsx +1 -3
- package/src/data/docs-index.ts +24 -0
- package/src/lib/clamp.ts +2 -0
- package/src/stories/Anchor.stories.tsx +54 -0
- package/src/stories/Attachment.stories.tsx +189 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/Code.stories.tsx +1 -0
- package/src/stories/ColorPicker.stories.tsx +1 -0
- package/src/stories/GaugeChart.stories.tsx +163 -0
- package/src/stories/Heatmap.stories.tsx +172 -0
- package/src/stories/InfiniteScroll.stories.tsx +225 -0
- package/src/stories/JsonInput.stories.tsx +212 -0
- package/src/stories/NavigationProgress.stories.tsx +159 -0
- package/src/stories/NumberInput.stories.tsx +1 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
- package/src/stories/Pill.stories.tsx +201 -0
- package/src/stories/Popover.stories.tsx +29 -1
- package/src/stories/Portal.stories.tsx +3 -1
- package/src/stories/ScrollProgress.stories.tsx +117 -0
- package/src/stories/Snackbar.stories.tsx +315 -0
- package/src/stories/SortableList.stories.tsx +263 -0
- package/src/stories/Squircle.stories.tsx +1 -0
- package/src/stories/Table.stories.tsx +1 -0
- package/src/stories/Tour.stories.tsx +1 -0
- package/src/stories/story-groups.json +17 -6
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ import { Button } from "@behavioral-agentic-design-system/core/components/ui/but
|
|
|
15
15
|
import tokens from "@behavioral-agentic-design-system/core/tokens.json";
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Import one file per component, from its own subpath, as above. The package root doesn't export components, and the `components/ui` index loads every component, including ones that need peer dependencies you may not have installed. Peer dependencies are optional: install the ones for the components you use (for example, `@tanstack/react-table` for `data-table`).
|
|
19
|
+
|
|
18
20
|
For client repos that fork the BADS template, this package is consumed via pnpm workspace protocol (`"@behavioral-agentic-design-system/core": "workspace:*"`). For client repos that just want the components, install from the registry.
|
|
19
21
|
|
|
20
22
|
## Publishing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -128,10 +128,13 @@
|
|
|
128
128
|
"clsx": "^2.1.0",
|
|
129
129
|
"react-markdown": "^10.1.0",
|
|
130
130
|
"remark-gfm": "^4.0.1",
|
|
131
|
-
"tailwind-merge": "^3.
|
|
131
|
+
"tailwind-merge": "^3.7.0",
|
|
132
132
|
"uqr": "^0.1.3"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
|
+
"@dnd-kit/core": ">=6",
|
|
136
|
+
"@dnd-kit/sortable": ">=7",
|
|
137
|
+
"@dnd-kit/utilities": ">=3",
|
|
135
138
|
"@radix-ui/react-accordion": "*",
|
|
136
139
|
"@radix-ui/react-aspect-ratio": "*",
|
|
137
140
|
"@radix-ui/react-avatar": "*",
|
|
@@ -157,6 +160,7 @@
|
|
|
157
160
|
"@radix-ui/react-toggle": "*",
|
|
158
161
|
"@radix-ui/react-toggle-group": "*",
|
|
159
162
|
"@radix-ui/react-tooltip": "*",
|
|
163
|
+
"@tanstack/react-table": "^8",
|
|
160
164
|
"cmdk": "*",
|
|
161
165
|
"lucide-react": "*",
|
|
162
166
|
"next-themes": "*",
|
|
@@ -168,6 +172,15 @@
|
|
|
168
172
|
"sonner": "*"
|
|
169
173
|
},
|
|
170
174
|
"peerDependenciesMeta": {
|
|
175
|
+
"@dnd-kit/core": {
|
|
176
|
+
"optional": true
|
|
177
|
+
},
|
|
178
|
+
"@dnd-kit/sortable": {
|
|
179
|
+
"optional": true
|
|
180
|
+
},
|
|
181
|
+
"@dnd-kit/utilities": {
|
|
182
|
+
"optional": true
|
|
183
|
+
},
|
|
171
184
|
"@radix-ui/react-accordion": {
|
|
172
185
|
"optional": true
|
|
173
186
|
},
|
|
@@ -243,6 +256,9 @@
|
|
|
243
256
|
"@radix-ui/react-tooltip": {
|
|
244
257
|
"optional": true
|
|
245
258
|
},
|
|
259
|
+
"@tanstack/react-table": {
|
|
260
|
+
"optional": true
|
|
261
|
+
},
|
|
246
262
|
"cmdk": {
|
|
247
263
|
"optional": true
|
|
248
264
|
},
|
|
@@ -268,4 +284,4 @@
|
|
|
268
284
|
"devDependencies": {
|
|
269
285
|
"@types/react-dom": "^19.3.0"
|
|
270
286
|
}
|
|
271
|
-
}
|
|
287
|
+
}
|
package/scripts/a11y-lint.cjs
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* bads-a11y-lint # report violations, exit 1 on fail
|
|
24
24
|
* bads-a11y-lint --warn # report but exit 0 (advisory)
|
|
25
25
|
* bads-a11y-lint path/to.tsx # scan a specific file
|
|
26
|
+
* bads-a11y-lint path/to/dir # scan every .tsx under a directory
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
'use strict';
|
|
@@ -44,6 +45,18 @@ const { readSourceOfTruth } = require('./source-of-truth.cjs');
|
|
|
44
45
|
const ROOT = process.cwd();
|
|
45
46
|
const advisory = process.argv.includes('--warn');
|
|
46
47
|
|
|
48
|
+
// allowDirArgs: this script used to take file paths only (no directory-arg
|
|
49
|
+
// support, unlike size-audit/a11y-ratchet), but a positional directory
|
|
50
|
+
// argument wasn't rejected — it fell into resolveScanFiles' "explicit path"
|
|
51
|
+
// branch, got handed straight to fs.readFileSync, threw EISDIR, and the
|
|
52
|
+
// per-file try/catch below swallowed that as if the file just couldn't be
|
|
53
|
+
// read. `bads-a11y-lint <directory>` printed "no AAA violations found"
|
|
54
|
+
// having read zero files (found 2026-09-15, from a real consumer fork run —
|
|
55
|
+
// the exact false-green class this scan-roots module exists to prevent, just
|
|
56
|
+
// via a different door: an EXPLICIT arg treated as a file, not a missing
|
|
57
|
+
// default root). Turning this on makes a directory arg behave the same way
|
|
58
|
+
// it already does for size-audit and a11y-ratchet.
|
|
59
|
+
|
|
47
60
|
// Client-owned mode (.client-identity.json → sourceOfTruth.components ===
|
|
48
61
|
// "client") downgrades the AAA and house-opinion rules below to warnings —
|
|
49
62
|
// still reported, never silently dropped — while every Level A rule keeps
|
|
@@ -67,7 +80,7 @@ function isDowngraded(it) {
|
|
|
67
80
|
return CLIENT_OWNED && WARN_IN_CLIENT_MODE.has(it.sc);
|
|
68
81
|
}
|
|
69
82
|
|
|
70
|
-
const scan = resolveScanFiles({ root: ROOT, argv: process.argv.slice(2) });
|
|
83
|
+
const scan = resolveScanFiles({ root: ROOT, argv: process.argv.slice(2), allowDirArgs: true });
|
|
71
84
|
const files = scan.files;
|
|
72
85
|
|
|
73
86
|
const issues = [];
|
|
@@ -165,9 +178,24 @@ const VAGUE_LINK_TEXT = /^(?:click here|here|read more|learn more|more|click)\.?
|
|
|
165
178
|
// comment), so the violation only ever exists in this one upstream copy.
|
|
166
179
|
const SATORI_TOKEN_EXEMPT_FILE = /\bopengraph-image\.tsx$/;
|
|
167
180
|
|
|
181
|
+
// A file discovered via walk() (scan.mode 'default' | 'dir-args' | 'env') was
|
|
182
|
+
// just confirmed to exist and be a regular file by readdirSync moments ago —
|
|
183
|
+
// it cannot fail the read below. The only paths that can are explicit ones a
|
|
184
|
+
// user typed (scan.mode 'explicit'): a typo, a path that doesn't exist, a
|
|
185
|
+
// permissions error. Report those instead of silently dropping them — the
|
|
186
|
+
// same "explicit path silently produces zero findings" failure class as the
|
|
187
|
+
// directory-arg bug above, just triggered by a bad path instead of a good
|
|
188
|
+
// directory.
|
|
189
|
+
const unreadableExplicitPaths = [];
|
|
190
|
+
|
|
168
191
|
for (const file of files) {
|
|
169
192
|
let src;
|
|
170
|
-
try {
|
|
193
|
+
try {
|
|
194
|
+
src = fs.readFileSync(file, 'utf8');
|
|
195
|
+
} catch (err) {
|
|
196
|
+
if (scan.mode === 'explicit') unreadableExplicitPaths.push({ file, message: err.message });
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
171
199
|
// Skip generated files.
|
|
172
200
|
if (src.startsWith('/* GENERATED FROM tokens.json')) continue;
|
|
173
201
|
// Skip tests + e2e specs.
|
|
@@ -314,6 +342,17 @@ for (const file of files) {
|
|
|
314
342
|
|
|
315
343
|
// ---- output ------------------------------------------------------------
|
|
316
344
|
|
|
345
|
+
if (unreadableExplicitPaths.length) {
|
|
346
|
+
console.error(
|
|
347
|
+
`a11y-lint: ${unreadableExplicitPaths.length} path argument${unreadableExplicitPaths.length === 1 ? '' : 's'} ` +
|
|
348
|
+
`could not be read — nothing under ${unreadableExplicitPaths.length === 1 ? 'it was' : 'them was'} scanned:\n\n` +
|
|
349
|
+
unreadableExplicitPaths.map((p) => ` ${p.file} — ${p.message}`).join('\n') +
|
|
350
|
+
`\n\nA directory argument is walked automatically now — this means the path doesn't exist, ` +
|
|
351
|
+
`isn't readable, or is neither a file nor a directory.`
|
|
352
|
+
);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
}
|
|
355
|
+
|
|
317
356
|
if (issues.length === 0) {
|
|
318
357
|
if (guardEmptyScan(scan, 'a11y-lint')) { /* exited */ }
|
|
319
358
|
console.log(
|
|
@@ -201,8 +201,22 @@ function main() {
|
|
|
201
201
|
}
|
|
202
202
|
if (showcase === null) {
|
|
203
203
|
penalties.push({ source: "showcase", points: 0, why: "showcase-presence signal unavailable (showcase page not found locally or in the package)" });
|
|
204
|
-
} else
|
|
205
|
-
|
|
204
|
+
} else {
|
|
205
|
+
// The registry key is not always the JSX tag rendered in the showcase
|
|
206
|
+
// (TreeView's primitive exports as <Tree>, not <TreeView> — same alias
|
|
207
|
+
// gap as corrections.md #009/#010, caught 2026-10-05 when TreeView
|
|
208
|
+
// scored a false "not demonstrated" despite a full showcase section
|
|
209
|
+
// titled "Tree View"). Check every costModel.jsxNames alias too, and
|
|
210
|
+
// loosen the title match to ignore case/spacing so "Tree View" matches
|
|
211
|
+
// "TreeView".
|
|
212
|
+
const aliases = [name, ...(e.costModel?.jsxNames ?? [])];
|
|
213
|
+
const looseTitle = new RegExp(`title=["']${name.replace(/\s+/g, "")}["']`, "i");
|
|
214
|
+
const demonstrated =
|
|
215
|
+
aliases.some((a) => showcase.includes(`<${a}`) || showcase.includes(`${a}Showcase`)) ||
|
|
216
|
+
looseTitle.test(showcase.replace(/\s+/g, ""));
|
|
217
|
+
if (!demonstrated) {
|
|
218
|
+
penalties.push({ source: "showcase", points: 5, why: "not demonstrated in the components showcase" });
|
|
219
|
+
}
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
|
package/scripts/lint-slop.mjs
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
* pnpm lint:slop # report, exit 1 on any finding
|
|
69
69
|
* pnpm lint:slop:warn # report, exit 0 (advisory; used in the a11y umbrella)
|
|
70
70
|
* node packages/core/scripts/lint-slop.mjs path/to.tsx # scan a specific file
|
|
71
|
+
* node packages/core/scripts/lint-slop.mjs path/to/dir # scan every file under a directory
|
|
71
72
|
*/
|
|
72
73
|
|
|
73
74
|
import fs from "node:fs";
|
|
@@ -91,10 +92,20 @@ const advisory = process.argv.includes("--warn");
|
|
|
91
92
|
// a11y-lint.cjs, size-audit.cjs, a11y-ratchet.mjs and lint-token-intent.mjs
|
|
92
93
|
// used to each keep a drifted copy of the same root list. Set
|
|
93
94
|
// BADS_LINT_ROOTS to point this at a non-standard tree.
|
|
95
|
+
//
|
|
96
|
+
// allowDirArgs: without this, a directory positional argument fell into
|
|
97
|
+
// resolveScanFiles' "explicit path" branch, went straight to fs.readFileSync,
|
|
98
|
+
// threw EISDIR, and the per-file try/catch below silently swallowed it —
|
|
99
|
+
// `node lint-slop.mjs <directory>` reported clean having read zero files.
|
|
100
|
+
// Same bug, same fix, as a11y-lint.cjs (found 2026-09-15 from a real consumer
|
|
101
|
+
// fork run scanning a11y-lint specifically; lint-slop shared the identical
|
|
102
|
+
// scan-roots call shape so it carried the same gap even though nobody had
|
|
103
|
+
// hit it yet).
|
|
94
104
|
const scan = resolveScanFiles({
|
|
95
105
|
root: ROOT,
|
|
96
106
|
argv: process.argv.slice(2),
|
|
97
107
|
excludeStories: true,
|
|
108
|
+
allowDirArgs: true,
|
|
98
109
|
});
|
|
99
110
|
|
|
100
111
|
function fileList() {
|
|
@@ -102,12 +113,14 @@ function fileList() {
|
|
|
102
113
|
}
|
|
103
114
|
|
|
104
115
|
const findings = [];
|
|
116
|
+
const unreadableExplicitPaths = [];
|
|
105
117
|
|
|
106
118
|
for (const file of fileList()) {
|
|
107
119
|
let src;
|
|
108
120
|
try {
|
|
109
121
|
src = fs.readFileSync(file, "utf8");
|
|
110
|
-
} catch {
|
|
122
|
+
} catch (err) {
|
|
123
|
+
if (scan.mode === "explicit") unreadableExplicitPaths.push({ file, message: err.message });
|
|
111
124
|
continue;
|
|
112
125
|
}
|
|
113
126
|
const lines = src.split("\n");
|
|
@@ -171,6 +184,17 @@ for (const file of fileList()) {
|
|
|
171
184
|
}
|
|
172
185
|
}
|
|
173
186
|
|
|
187
|
+
if (unreadableExplicitPaths.length) {
|
|
188
|
+
console.error(
|
|
189
|
+
`lint-slop: ${unreadableExplicitPaths.length} path argument${unreadableExplicitPaths.length === 1 ? "" : "s"} ` +
|
|
190
|
+
`could not be read — nothing under ${unreadableExplicitPaths.length === 1 ? "it was" : "them was"} scanned:\n\n` +
|
|
191
|
+
unreadableExplicitPaths.map((p) => ` ${p.file} — ${p.message}`).join("\n") +
|
|
192
|
+
`\n\nA directory argument is walked automatically now — this means the path doesn't exist, ` +
|
|
193
|
+
`isn't readable, or is neither a file nor a directory.`
|
|
194
|
+
);
|
|
195
|
+
process.exit(1);
|
|
196
|
+
}
|
|
197
|
+
|
|
174
198
|
if (findings.length === 0) {
|
|
175
199
|
if (guardEmptyScan(scan, "lint-slop")) { /* exited */ }
|
|
176
200
|
console.log(
|
package/scripts/wcag-audit.cjs
CHANGED
|
@@ -236,13 +236,49 @@ function toHex([r, g, b]) {
|
|
|
236
236
|
|
|
237
237
|
const tokens = JSON.parse(fs.readFileSync(TOKENS, 'utf8'));
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
// Walk a dotted DTCG path ("theme.light.card", "color.semantic.action.primary")
|
|
240
|
+
// against the FULL tokens tree, not just the current mode — an alias can
|
|
241
|
+
// point anywhere in tokens.json, e.g. a dark-mode slot aliasing back to
|
|
242
|
+
// {theme.light.card}, or either mode aliasing a {color.semantic.*} value.
|
|
243
|
+
// Returns the node at that path (which may itself carry a $value to resolve
|
|
244
|
+
// further), or undefined if the path doesn't exist.
|
|
245
|
+
function resolveDottedPath(dotted) {
|
|
246
|
+
let node = tokens;
|
|
247
|
+
for (const part of dotted.split('.')) {
|
|
248
|
+
if (node == null || typeof node !== 'object') return undefined;
|
|
249
|
+
node = node[part];
|
|
250
|
+
}
|
|
251
|
+
return node;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// resolveValue is recursive (var(--x) can point at another var(--x); a
|
|
255
|
+
// {dotted.path} alias can point at another alias). A cycle in a broken
|
|
256
|
+
// consumer's tokens.json would recurse forever without a depth guard — this
|
|
257
|
+
// isn't a hypothetical, it's exactly the kind of malformed input a
|
|
258
|
+
// third-party fork's tokens.json can contain, and this script is not a
|
|
259
|
+
// build-time gate a bad tokens.json would ever get caught by first.
|
|
260
|
+
function resolveValue(value, modeTokens, depth) {
|
|
261
|
+
depth = depth || 0;
|
|
262
|
+
if (depth > 10) return null;
|
|
240
263
|
if (typeof value !== 'string') return null;
|
|
241
264
|
// var(--name) — look up in same-mode tokens
|
|
242
265
|
const varMatch = value.match(/^var\(--([^)]+)\)$/);
|
|
243
266
|
if (varMatch) {
|
|
244
267
|
const ref = modeTokens[varMatch[1]];
|
|
245
|
-
return ref ? resolveValue(ref.$value, modeTokens) : null;
|
|
268
|
+
return ref ? resolveValue(ref.$value, modeTokens, depth + 1) : null;
|
|
269
|
+
}
|
|
270
|
+
// {dotted.path} — DTCG alias syntax (see e.g. tokens.composites.surface.card.background
|
|
271
|
+
// -> {theme.light.card} for the convention already used elsewhere in tokens.json).
|
|
272
|
+
// theme.light/theme.dark never used this themselves in upstream BADS, which is exactly
|
|
273
|
+
// why this branch didn't exist until a consumer fork's tokens.json used one directly in
|
|
274
|
+
// a theme slot and every pair depending on it silently vanished from the audit instead
|
|
275
|
+
// of failing or being counted as skipped (found 2026-09-15, from a real client fork).
|
|
276
|
+
const aliasMatch = value.match(/^\{([\w.-]+)\}$/);
|
|
277
|
+
if (aliasMatch) {
|
|
278
|
+
const node = resolveDottedPath(aliasMatch[1]);
|
|
279
|
+
if (node === undefined) return null;
|
|
280
|
+
const nextValue = node && typeof node === 'object' ? node.$value : node;
|
|
281
|
+
return resolveValue(nextValue, modeTokens, depth + 1);
|
|
246
282
|
}
|
|
247
283
|
// oklch(from var(--x) calc(l + 0.1) c h) etc — too complex to evaluate, skip.
|
|
248
284
|
if (value.includes('oklch(from')) return null;
|
|
@@ -321,7 +357,10 @@ function audit(modeName, modeTokens) {
|
|
|
321
357
|
for (const [fgKey, bgKey, label, opts] of PAIRS) {
|
|
322
358
|
const fgTok = modeTokens[fgKey];
|
|
323
359
|
const bgTok = modeTokens[bgKey];
|
|
324
|
-
if (!fgTok || !bgTok)
|
|
360
|
+
if (!fgTok || !bgTok) {
|
|
361
|
+
results.push({ mode: modeName, fgKey, bgKey, label, status: 'skipped', reason: 'missing-token' });
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
325
364
|
const fgRaw = resolveValue(fgTok.$value, modeTokens);
|
|
326
365
|
const bgRaw = resolveValue(bgTok.$value, modeTokens);
|
|
327
366
|
if (!fgRaw || !bgRaw) {
|
|
@@ -352,10 +391,23 @@ function audit(modeName, modeTokens) {
|
|
|
352
391
|
for (const [fgKey, bgKey, label, opts] of NON_TEXT_PAIRS) {
|
|
353
392
|
const fgTok = modeTokens[fgKey];
|
|
354
393
|
const bgTok = modeTokens[bgKey];
|
|
355
|
-
if (!fgTok || !bgTok)
|
|
394
|
+
if (!fgTok || !bgTok) {
|
|
395
|
+
results.push({ mode: modeName, fgKey, bgKey, label, kind: 'non-text', status: 'skipped', reason: 'missing-token' });
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
356
398
|
const fgRaw = resolveValue(fgTok.$value, modeTokens);
|
|
357
399
|
const bgRaw = resolveValue(bgTok.$value, modeTokens);
|
|
358
|
-
if (!fgRaw || !bgRaw)
|
|
400
|
+
if (!fgRaw || !bgRaw) {
|
|
401
|
+
// Previously a bare `continue` here — non-text pairs (border/ring/chart
|
|
402
|
+
// colors) vanished from the report with NO trace at all when a value
|
|
403
|
+
// failed to resolve, unlike the PAIRS loop above which at least counted
|
|
404
|
+
// it as "skipped". This is the more severe half of the bug: not
|
|
405
|
+
// miscounted, just gone. Found 2026-09-15 alongside the {token.reference}
|
|
406
|
+
// alias-resolution gap — the two compounded, since an unresolved alias in
|
|
407
|
+
// a non-text slot (e.g. a border color) produced zero signal anywhere.
|
|
408
|
+
results.push({ mode: modeName, fgKey, bgKey, label, kind: 'non-text', status: 'skipped', reason: 'unresolvable' });
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
359
411
|
const bg = flattenOver(bgRaw, [1, 1, 1]);
|
|
360
412
|
const fg = flattenOver(fgRaw, bg);
|
|
361
413
|
const ratio = contrast(fg, bg);
|
|
@@ -537,6 +589,21 @@ if (json) {
|
|
|
537
589
|
for (const mode of ['light', 'dark']) {
|
|
538
590
|
console.log(`▸ ${mode}`);
|
|
539
591
|
for (const r of all.filter((x) => x.mode === mode)) {
|
|
592
|
+
// A skipped row never computed ratio/fgHex/bgHex — printing it through
|
|
593
|
+
// the normal line format below would render literal "undefined"s, which
|
|
594
|
+
// reads as broken output rather than as the diagnostic it should be.
|
|
595
|
+
// This was the second half of the {token.reference} bug: even the ONE
|
|
596
|
+
// loop that did push a `skipped` row (PAIRS) rendered it as garbage, so
|
|
597
|
+
// the tally at the bottom was the only intact signal — found 2026-09-15.
|
|
598
|
+
if (r.status === 'skipped') {
|
|
599
|
+
const kind = r.kind === 'non-text' ? ' [non-text]' : '';
|
|
600
|
+
const why = r.reason === 'missing-token'
|
|
601
|
+
? `token "${r.fgKey}" or "${r.bgKey}" not found in this mode`
|
|
602
|
+
: `"${r.fgKey}" or "${r.bgKey}" has a value this script can't resolve to a color ` +
|
|
603
|
+
`(check for a {dotted.path} alias pointing at a missing token, or an unsupported value shape)`;
|
|
604
|
+
console.log(` · ${r.label.padEnd(34)} skipped — ${why}${kind}`);
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
540
607
|
const mark =
|
|
541
608
|
r.status === 'pass' ? '✓' :
|
|
542
609
|
r.status === 'exception' ? '!' :
|
|
@@ -30,6 +30,8 @@ export default function OpengraphImage() {
|
|
|
30
30
|
return new ImageResponse(
|
|
31
31
|
(
|
|
32
32
|
<div
|
|
33
|
+
// allow-inline-style: Satori (next/og) can't resolve var(--token) —
|
|
34
|
+
// see the file-header note above. Literal colors are deliberate.
|
|
33
35
|
style={{
|
|
34
36
|
height: "100%",
|
|
35
37
|
width: "100%",
|
|
@@ -51,6 +53,7 @@ export default function OpengraphImage() {
|
|
|
51
53
|
background: accent,
|
|
52
54
|
}}
|
|
53
55
|
/>
|
|
56
|
+
{/* allow-inline-style: Satori rendering context, see the note above */}
|
|
54
57
|
<div
|
|
55
58
|
style={{
|
|
56
59
|
fontSize: "28px",
|
|
@@ -70,10 +73,12 @@ export default function OpengraphImage() {
|
|
|
70
73
|
gap: "28px",
|
|
71
74
|
}}
|
|
72
75
|
>
|
|
76
|
+
{/* allow-inline-style: Satori rendering context, see the note above */}
|
|
73
77
|
<div style={{ fontSize: "116px", lineHeight: 1, color: "#ffffff" }}>
|
|
74
78
|
{brand.name}
|
|
75
79
|
</div>
|
|
76
80
|
{description ? (
|
|
81
|
+
// allow-inline-style: Satori rendering context, see the note above
|
|
77
82
|
<div
|
|
78
83
|
style={{
|
|
79
84
|
fontSize: "40px",
|