basalt-ui 1.4.1 → 1.6.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +27 -2
  3. package/agent/rules/basalt-mantine.md +1 -1
  4. package/agent/rules/basalt-tokens.md +2 -2
  5. package/agent/skills/basalt-design/SKILL.md +1 -1
  6. package/dist/agent/stick-to-bottom.d.ts.map +1 -1
  7. package/dist/agent/stick-to-bottom.js +2 -1
  8. package/dist/agent-chat/composer.d.ts.map +1 -1
  9. package/dist/agent-chat/composer.js +5 -4
  10. package/dist/charts/kinds/Donut.js +1 -0
  11. package/dist/charts/theme.js +6 -6
  12. package/dist/cli/index.d.ts.map +1 -1
  13. package/dist/cli/index.js +8 -3
  14. package/dist/content/article-card.module.css +1 -1
  15. package/dist/content/callout.module.css +3 -3
  16. package/dist/content/prose.module.css +1 -1
  17. package/dist/content/reading-progress.module.css +2 -2
  18. package/dist/guard/guard-hook.js +1 -1
  19. package/dist/guard/index.d.ts.map +1 -1
  20. package/dist/guard/index.js +22 -4
  21. package/dist/guard/types.d.ts +6 -0
  22. package/dist/guard/types.d.ts.map +1 -1
  23. package/dist/shell/app-sidebar.module.css +4 -6
  24. package/dist/shell/sidebar-search.module.css +4 -2
  25. package/dist/theme/controls.module.css +162 -23
  26. package/dist/theme/index.d.ts.map +1 -1
  27. package/dist/theme/index.js +40 -23
  28. package/dist/theme/nav-link.module.css +10 -10
  29. package/dist/theme/timeline.module.css +3 -3
  30. package/dist/theme-lab/index.js +1 -1
  31. package/dist/tokens/index.d.ts +26 -16
  32. package/dist/tokens/index.d.ts.map +1 -1
  33. package/dist/tokens/index.js +88 -46
  34. package/dist/tokens/palette.d.ts +31 -0
  35. package/dist/tokens/palette.d.ts.map +1 -1
  36. package/dist/tokens/palette.js +31 -0
  37. package/dist/tokens.css +104 -51
  38. package/llms.txt +2 -2
  39. package/package.json +71 -17
  40. package/src/agent/stick-to-bottom.tsx +2 -1
  41. package/src/agent-chat/composer.tsx +6 -5
  42. package/src/charts/kinds/Donut.tsx +1 -1
  43. package/src/charts/theme.tsx +6 -6
  44. package/src/cli/index.ts +10 -2
  45. package/src/cli/tokens-css.test.ts +17 -0
  46. package/src/content/article-card.module.css +1 -1
  47. package/src/content/callout.module.css +3 -3
  48. package/src/content/prose.module.css +1 -1
  49. package/src/content/reading-progress.module.css +2 -2
  50. package/src/guard/check-source.test.ts +77 -0
  51. package/src/guard/guard-hook.ts +1 -1
  52. package/src/guard/index.ts +45 -7
  53. package/src/guard/types.ts +6 -0
  54. package/src/shell/app-sidebar.module.css +4 -6
  55. package/src/shell/sidebar-search.module.css +4 -2
  56. package/src/theme/contrast.test.ts +23 -5
  57. package/src/theme/controls.module.css +162 -23
  58. package/src/theme/index.ts +55 -24
  59. package/src/theme/nav-link.module.css +10 -10
  60. package/src/theme/shadow-surfaces.test.ts +72 -33
  61. package/src/theme/timeline.module.css +3 -3
  62. package/src/theme-lab/index.tsx +2 -2
  63. package/src/tokens/index.ts +110 -46
  64. package/src/tokens/palette.ts +33 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "1.4.1",
3
+ "version": "1.6.0",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
@@ -132,10 +132,18 @@
132
132
  "prepack": "bun run build",
133
133
  "clean": "rm -rf dist"
134
134
  },
135
- "dependencies": {
135
+ "devDependencies": {
136
+ "@arethetypeswrong/cli": "0.18.3",
136
137
  "@fontsource-variable/hubot-sans": "5.2.8",
137
138
  "@fontsource-variable/jetbrains-mono": "5.2.8",
138
139
  "@fontsource-variable/nunito-sans": "5.2.7",
140
+ "@shikijs/langs": "^4.3.1",
141
+ "@shikijs/themes": "^4.3.1",
142
+ "@tanstack/react-hotkeys": "0.10.0",
143
+ "@types/bun": "^1.3.14",
144
+ "@types/hast": "^3.0.4",
145
+ "@types/react": "^19.2.17",
146
+ "@types/react-dom": "^19.2.3",
139
147
  "@visx/axis": "4.0.0",
140
148
  "@visx/curve": "4.0.0",
141
149
  "@visx/event": "4.0.0",
@@ -145,23 +153,13 @@
145
153
  "@visx/scale": "4.0.0",
146
154
  "@visx/shape": "4.0.0",
147
155
  "@visx/threshold": "4.0.0",
148
- "motion": "12.42.0",
149
- "remend": "1.3.0"
150
- },
151
- "devDependencies": {
152
- "@arethetypeswrong/cli": "0.18.3",
153
- "@shikijs/langs": "^4.3.1",
154
- "@shikijs/themes": "^4.3.1",
155
- "@tanstack/react-hotkeys": "0.10.0",
156
- "@types/bun": "^1.3.14",
157
- "@types/hast": "^3.0.4",
158
- "@types/react": "^19.2.17",
159
- "@types/react-dom": "^19.2.3",
160
156
  "ai": "^7.0.15",
161
157
  "beautiful-mermaid": "^1.1.3",
158
+ "motion": "12.42.0",
162
159
  "publint": "0.3.21",
163
160
  "react-markdown": "^10.1.0",
164
161
  "remark-gfm": "^4.0.1",
162
+ "remend": "1.3.0",
165
163
  "shiki": "^4.3.1",
166
164
  "tsup": "^8.5.1",
167
165
  "typescript": "^6.0.3",
@@ -170,6 +168,9 @@
170
168
  "vite-plugin-pwa": "^1.3.0"
171
169
  },
172
170
  "peerDependencies": {
171
+ "@fontsource-variable/hubot-sans": "5.2.8",
172
+ "@fontsource-variable/jetbrains-mono": "5.2.8",
173
+ "@fontsource-variable/nunito-sans": "5.2.7",
173
174
  "@mantine/core": "^9.3.0",
174
175
  "@mantine/form": "^9.3.0",
175
176
  "@mantine/hooks": "^9.3.0",
@@ -184,18 +185,38 @@
184
185
  "@tanstack/react-router": "^1.170.0",
185
186
  "@tanstack/react-table": ">=8 <9",
186
187
  "@tanstack/react-virtual": ">=3 <4",
188
+ "@visx/axis": "4.0.0",
189
+ "@visx/curve": "4.0.0",
190
+ "@visx/event": "4.0.0",
191
+ "@visx/grid": "4.0.0",
192
+ "@visx/group": "4.0.0",
193
+ "@visx/responsive": "4.0.0",
194
+ "@visx/scale": "4.0.0",
195
+ "@visx/shape": "4.0.0",
196
+ "@visx/threshold": "4.0.0",
187
197
  "ai": "^7.0.15",
188
198
  "beautiful-mermaid": "^1.1.0",
199
+ "motion": "12.42.0",
189
200
  "react": "^19.2.7",
190
201
  "react-dom": "^19.2.7",
191
202
  "react-markdown": "^10.1.0",
192
203
  "remark-gfm": "^4.0.1",
204
+ "remend": "1.3.0",
193
205
  "shiki": "^4.3.0",
194
206
  "use-stick-to-bottom": "^1.1.6",
195
207
  "vite": "^7 || ^8",
196
208
  "vite-plugin-pwa": "^1.3.0"
197
209
  },
198
210
  "peerDependenciesMeta": {
211
+ "@fontsource-variable/hubot-sans": {
212
+ "optional": true
213
+ },
214
+ "@fontsource-variable/jetbrains-mono": {
215
+ "optional": true
216
+ },
217
+ "@fontsource-variable/nunito-sans": {
218
+ "optional": true
219
+ },
199
220
  "@mantine/core": {
200
221
  "optional": true
201
222
  },
@@ -238,12 +259,42 @@
238
259
  "@tanstack/react-virtual": {
239
260
  "optional": true
240
261
  },
262
+ "@visx/axis": {
263
+ "optional": true
264
+ },
265
+ "@visx/curve": {
266
+ "optional": true
267
+ },
268
+ "@visx/event": {
269
+ "optional": true
270
+ },
271
+ "@visx/grid": {
272
+ "optional": true
273
+ },
274
+ "@visx/group": {
275
+ "optional": true
276
+ },
277
+ "@visx/responsive": {
278
+ "optional": true
279
+ },
280
+ "@visx/scale": {
281
+ "optional": true
282
+ },
283
+ "@visx/shape": {
284
+ "optional": true
285
+ },
286
+ "@visx/threshold": {
287
+ "optional": true
288
+ },
241
289
  "ai": {
242
290
  "optional": true
243
291
  },
244
292
  "beautiful-mermaid": {
245
293
  "optional": true
246
294
  },
295
+ "motion": {
296
+ "optional": true
297
+ },
247
298
  "react": {
248
299
  "optional": true
249
300
  },
@@ -256,6 +307,9 @@
256
307
  "remark-gfm": {
257
308
  "optional": true
258
309
  },
310
+ "remend": {
311
+ "optional": true
312
+ },
259
313
  "shiki": {
260
314
  "optional": true
261
315
  },
@@ -285,15 +339,15 @@
285
339
  "rawRadius": true,
286
340
  "exemptRules": {
287
341
  "inline-spacing": [
288
- "charts"
342
+ "primitives"
289
343
  ],
290
344
  "inline-display": [
291
345
  "agent",
292
- "charts"
346
+ "primitives"
293
347
  ],
294
348
  "raw-html-layout": [
295
349
  "agent",
296
- "charts"
350
+ "primitives"
297
351
  ]
298
352
  }
299
353
  }
@@ -81,7 +81,8 @@ const LazyStickToBottom = lazy(() =>
81
81
  border: 'none',
82
82
  cursor: 'pointer',
83
83
  backgroundColor: 'var(--vx-surface-panel)',
84
- boxShadow: 'var(--vx-shadow-card)',
84
+ // Control depth, not panel depth — this is a real <button> (DESIGN-SPEC §2).
85
+ boxShadow: 'var(--vx-shadow-raised)',
85
86
  color: 'var(--vx-faint)',
86
87
  fontFamily: 'var(--basalt-font-mono)',
87
88
  fontSize: VX.text.md,
@@ -76,13 +76,14 @@ export function Composer({
76
76
  disabled,
77
77
  onChange: (event) => setValue(event.currentTarget.value),
78
78
  onKeyDown: handleKeyDown,
79
- // Composer input surface (docs/DESIGN-SPEC.md §5): panel + shadow-card, control radius (6px,
80
- // VX.radiusCtrl) — the ring
81
- // lives in the shadow, so the input carries no separate border.
79
+ // Composer input surface (docs/DESIGN-SPEC.md §5): panel + control radius (6px, VX.radiusCtrl);
80
+ // the ring lives in the shadow, so the input carries no separate border. Depth is deliberately
81
+ // NOT set here — it arrives from the themed `.input` class (theme/controls.module.css), which
82
+ // also grounds it when disabled. A `boxShadow` in this `styles` object renders as an INLINE
83
+ // style and would beat that class unconditionally, leaving a disabled composer raised.
82
84
  styles: {
83
85
  input: {
84
86
  backgroundColor: 'var(--vx-surface-panel)',
85
- boxShadow: 'var(--vx-shadow-card)',
86
87
  borderRadius: VX.radiusCtrl,
87
88
  border: 'none',
88
89
  },
@@ -103,7 +104,7 @@ export function Composer({
103
104
  disabled={disabled || value.trim().length === 0}
104
105
  aria-label="Send message"
105
106
  // Send action (docs/DESIGN-SPEC.md §5): the one accent-filled control. It needs no color
106
- // override — `filled` resolves through the theme to `--vx-accentFill` / `--vx-onAccent`.
107
+ // override — `filled` resolves through the theme to `--vx-accent-fill` / `--vx-on-accent`.
107
108
  // (It used to hand-wire those two vars inline, which is why this was the ONLY filled
108
109
  // control that stayed legible while the rest of the chrome went through Mantine's
109
110
  // scheme-blind autoContrast. The theme owns it now, and hover works again — an inline
@@ -194,7 +194,7 @@ function DonutPlot<K extends string = SeriesKey>(props: DonutPlotProps<K>) {
194
194
  style={{
195
195
  position: 'absolute',
196
196
  inset: 0,
197
- display: 'flex',
197
+ display: 'flex', // theme-allow: centering over the donut hole — charts/ is Mantine-free, so Center is unavailable here
198
198
  alignItems: 'center',
199
199
  justifyContent: 'center',
200
200
  pointerEvents: 'none',
@@ -25,12 +25,12 @@ const REFS = {
25
25
  line: 'var(--vx-line)',
26
26
  line2: 'var(--vx-line2)',
27
27
  axis: 'var(--vx-axis)',
28
- axisStroke: 'var(--vx-axisStroke)',
29
- tooltipBg: 'var(--vx-tooltipBg)',
30
- tooltipText: 'var(--vx-tooltipText)',
31
- tooltipMuted: 'var(--vx-tooltipMuted)',
32
- tooltipBorder: 'var(--vx-tooltipBorder)',
33
- tooltipShadow: 'var(--vx-tooltipShadow)',
28
+ axisStroke: 'var(--vx-axis-stroke)',
29
+ tooltipBg: 'var(--vx-tooltip-bg)',
30
+ tooltipText: 'var(--vx-tooltip-text)',
31
+ tooltipMuted: 'var(--vx-tooltip-muted)',
32
+ tooltipBorder: 'var(--vx-tooltip-border)',
33
+ tooltipShadow: 'var(--vx-tooltip-shadow)',
34
34
  } as const
35
35
 
36
36
  const VxThemeContext = createContext<VxTheme | null>(null)
package/src/cli/index.ts CHANGED
@@ -419,7 +419,7 @@ export function checkTheme(cwd: string = process.cwd()): number {
419
419
  for (const [file, vs] of [...byFile].toSorted()) {
420
420
  console.error(file)
421
421
  for (const v of vs.toSorted((a, b) => a.line - b.line)) {
422
- console.error(` ${String(v.line).padStart(4)} ${v.kind.padEnd(22)} ${v.token}`)
422
+ console.error(` ${String(v.line).padStart(4)} ${v.kind.padEnd(22)} ${v.text}`)
423
423
  }
424
424
  console.error('')
425
425
  }
@@ -1765,6 +1765,11 @@ export function tokensCss(flags: string[], cwd: string = process.cwd()): number
1765
1765
  : { defaultScheme: defaultScheme as 'dark' | 'light' | 'none' }),
1766
1766
  ...(flags.includes('--media-fallback') ? { mediaFallback: true } : {}),
1767
1767
  ...(only === undefined ? {} : { only: only as 'core' | 'all' }),
1768
+ // The tokens-only consumer is exactly the one who writes these names by hand, so they are also
1769
+ // the one who wants the deprecated camelCase aliases gone — and this command is their only
1770
+ // entry point. Without the flag the CLI and the API could disagree about what basalt's tokens
1771
+ // are, which is the one thing this command is documented never to allow.
1772
+ ...(flags.includes('--no-legacy-aliases') ? { legacyAliases: false } : {}),
1768
1773
  })
1769
1774
 
1770
1775
  const out = flagValue(flags, '--out')
@@ -1880,7 +1885,10 @@ const USAGE =
1880
1885
  'check-theme | check-coverage | info [--json] | doctor | guard-hook | tokens:css | help>\n\n' +
1881
1886
  'tokens:css [--out <path>] [--selector-attribute <attr>] [--dark-value <v>] [--light-value <v>]\n' +
1882
1887
  ' [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n' +
1883
- ' Emit the --vx-* stylesheet (stdout unless --out). Defaults reproduce basalt-ui/tokens.css.\n\n' +
1888
+ ' [--no-legacy-aliases]\n' +
1889
+ ' Emit the --vx-* stylesheet (stdout unless --out). Defaults reproduce basalt-ui/tokens.css.\n' +
1890
+ ' --no-legacy-aliases drops the deprecated camelCase spellings (--vx-accentFill and friends),\n' +
1891
+ ' which are emitted by default as aliases of the canonical kebab-case names.\n\n' +
1884
1892
  'Every subcommand accepts --help / -h to print this message and exit without running.'
1885
1893
 
1886
1894
  /**
@@ -73,6 +73,23 @@ describe('tokens:css', () => {
73
73
  expect(existsSync(resolve(dir, 'out.css'))).toBe(false)
74
74
  })
75
75
 
76
+ it('--no-legacy-aliases drops every deprecated camelCase spelling while the canonical kebab names still resolve', () => {
77
+ const css = emit(['--no-legacy-aliases'])
78
+ expect(css).not.toContain('--vx-accentFill')
79
+ expect(css).not.toContain('--vx-tooltipBg')
80
+ expect(css).not.toContain('--vx-fillHover-')
81
+ expect(css).not.toContain('--vx-goodSoft')
82
+ expect(css).not.toContain('Deprecated camelCase aliases')
83
+ expect(css).toContain('--vx-accent-fill:')
84
+ expect(css).toContain('--vx-tooltip-bg:')
85
+ expect(css).toContain('--vx-fill-hover-')
86
+ expect(css).toContain('--vx-good-soft:')
87
+ })
88
+
89
+ it('--no-legacy-aliases output is byte-identical to buildPaletteCss({ legacyAliases: false }) — the CLI holds no emission logic of its own', () => {
90
+ expect(emit(['--no-legacy-aliases'])).toBe(buildPaletteCss({ legacyAliases: false }))
91
+ })
92
+
76
93
  it('`--help` short-circuits before the command runs — no file written', () => {
77
94
  const originalLog = console.log
78
95
  let log = ''
@@ -41,7 +41,7 @@
41
41
 
42
42
  .clickable:hover,
43
43
  .clickable:focus-visible {
44
- background-color: var(--vx-surface-panelHover);
44
+ background-color: var(--vx-surface-panel-hover);
45
45
  }
46
46
 
47
47
  .clickable:hover .title,
@@ -24,15 +24,15 @@
24
24
  }
25
25
 
26
26
  .good {
27
- --callout-ink: var(--vx-goodSolid);
27
+ --callout-ink: var(--vx-good-solid);
28
28
  }
29
29
 
30
30
  .warn {
31
- --callout-ink: var(--vx-warnSolid);
31
+ --callout-ink: var(--vx-warn-solid);
32
32
  }
33
33
 
34
34
  .bad {
35
- --callout-ink: var(--vx-badSolid);
35
+ --callout-ink: var(--vx-bad-solid);
36
36
  }
37
37
 
38
38
  .titleRow {
@@ -143,7 +143,7 @@
143
143
  }
144
144
 
145
145
  .root a:hover {
146
- color: var(--vx-accentHover);
146
+ color: var(--vx-accent-hover);
147
147
  text-decoration: underline;
148
148
  }
149
149
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ReadingProgress — a fixed 2px top bar. The outer bar stays transparent; `.fill` carries the
3
- * `--vx-accentFill` band token (the FILL surface, never the ink `--vx-accent` — docs/DESIGN-SPEC.md
3
+ * `--vx-accent-fill` band token (the FILL surface, never the ink `--vx-accent` — docs/DESIGN-SPEC.md
4
4
  * §7's fill-band rule) and is scaled via `transform: scaleX()` from JS.
5
5
  */
6
6
 
@@ -18,7 +18,7 @@
18
18
  .fill {
19
19
  height: 100%;
20
20
  width: 100%;
21
- background: var(--vx-accentFill);
21
+ background: var(--vx-accent-fill);
22
22
  transform-origin: left;
23
23
  will-change: transform;
24
24
  }
@@ -385,6 +385,50 @@ describe('inline-spacing', () => {
385
385
  })
386
386
  })
387
387
 
388
+ // ── 10b. Finding.text ─────────────────────────────────────────────────────────
389
+ //
390
+ // `token` stays the regex match (e.g. the unit-less numeric part of a spacing declaration);
391
+ // `text` is the full trimmed source line, so a human reading the report sees `padding: 0.75rem;`
392
+ // rather than the confusing partial match `padding: 0.75`.
393
+
394
+ describe('Finding.text', () => {
395
+ it('reports text as the full trimmed source line while token stays the truncated match', () => {
396
+ const f = checkSource(
397
+ '.foo {\n padding: 0.75rem;\n}\n',
398
+ 'src/Card.module.css',
399
+ DEFAULT_GUARD_CONFIG,
400
+ )
401
+ const hit = f.find((x) => x.kind === 'inline-spacing')
402
+ expect(hit?.token).toBe('padding: 0.75')
403
+ expect(hit?.text).toBe('padding: 0.75rem;')
404
+ })
405
+
406
+ it('reports the whole declaration including the unit for a CSS padding-left finding', () => {
407
+ const f = checkSource('padding-left: 1.25rem;', 'src/Card.module.css', DEFAULT_GUARD_CONFIG)
408
+ const hit = f.find((x) => x.kind === 'inline-spacing')
409
+ expect(hit?.token).toBe('padding-left: 1.25')
410
+ expect(hit?.text).toBe('padding-left: 1.25rem;')
411
+ })
412
+
413
+ it('truncates a line over 100 characters with a trailing …', () => {
414
+ const filler = 'x'.repeat(200)
415
+ const f = checkSource(
416
+ `padding: 16px; /* ${filler} */`,
417
+ 'src/Card.module.css',
418
+ DEFAULT_GUARD_CONFIG,
419
+ )
420
+ const hit = f.find((x) => x.kind === 'inline-spacing')
421
+ expect(hit?.text.length).toBe(101)
422
+ expect(hit?.text.endsWith('…')).toBe(true)
423
+ })
424
+
425
+ it('trims a leading-indented line', () => {
426
+ const f = checkSource(' padding: 16px;', 'src/Card.module.css', DEFAULT_GUARD_CONFIG)
427
+ const hit = f.find((x) => x.kind === 'inline-spacing')
428
+ expect(hit?.text).toBe('padding: 16px;')
429
+ })
430
+ })
431
+
388
432
  // ── 11. inline-display ───────────────────────────────────────────────────────
389
433
 
390
434
  describe('inline-display', () => {
@@ -623,6 +667,39 @@ describe('chart-missing-aria-label', () => {
623
667
  })
624
668
  expect(kinds(f)).not.toContain('chart-missing-aria-label')
625
669
  })
670
+
671
+ // ── reported line: the tag's OPENING line, not the end of the match ─────────
672
+ //
673
+ // The scan used to compute its line from the END of the matched tag, so on a multi-line-
674
+ // formatted chart element the reported line was the closing `/>` rather than the `<Bars` line
675
+ // that is actually missing the prop. Invisible while the report only printed `token`; visible
676
+ // the moment `Finding.text` started quoting the reported source line back.
677
+
678
+ it('reports the OPENING tag line (and quotes it in text) for a multi-line-formatted chart element', () => {
679
+ const text = ['<Bars', ' data={points}', ' height={240}', '/>'].join('\n')
680
+ const f = find(text)
681
+ const hit = f.find((x) => x.kind === 'chart-missing-aria-label')
682
+ expect(hit?.line).toBe(1)
683
+ expect(hit?.text).toBe('<Bars')
684
+ })
685
+
686
+ it('reports the same line as before for a single-line chart element (no regression)', () => {
687
+ const f = find(`<ZonedLine data={points} height={240} chartId="x" />`)
688
+ const hit = f.find((x) => x.kind === 'chart-missing-aria-label')
689
+ expect(hit?.line).toBe(1)
690
+ })
691
+
692
+ it('a theme-allow comment on the CLOSING line of a multi-line tag still suppresses the finding (back-compat)', () => {
693
+ const text = ['<Bars', ' data={points}', ' height={240}', '/> // theme-allow'].join('\n')
694
+ const f = find(text)
695
+ expect(kinds(f)).not.toContain('chart-missing-aria-label')
696
+ })
697
+
698
+ it('a theme-allow comment on the OPENING line of a multi-line tag also suppresses the finding', () => {
699
+ const text = ['<Bars // theme-allow', ' data={points}', ' height={240}', '/>'].join('\n')
700
+ const f = find(text)
701
+ expect(kinds(f)).not.toContain('chart-missing-aria-label')
702
+ })
626
703
  })
627
704
 
628
705
  // ── 16. card-with-border ─────────────────────────────────────────────────────
@@ -115,7 +115,7 @@ export function evaluateGuardHook(
115
115
  if (findings.length === 0) return { permissionDecision: 'allow' }
116
116
 
117
117
  const shown = findings.slice(0, 10)
118
- const lines = shown.map((f) => `${f.kind} @ ${f.line}: ${f.token}`)
118
+ const lines = shown.map((f) => `${f.kind} @ ${f.line}: ${f.text}`)
119
119
  const extra = findings.length > 10 ? ` (+${findings.length - 10} more)` : ''
120
120
  const reason =
121
121
  `basalt theme-guard: ${findings.length} off-palette/off-system violation(s) in ${target.relPath}\n` +
@@ -280,6 +280,22 @@ function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity {
280
280
  return cfg.severity?.[kind] ?? (kind in GRACE_PERIOD_KINDS ? 'warn' : 'error')
281
281
  }
282
282
 
283
+ /** The `Finding.text` cap, in characters — a minified CSS line must not blow up the report. */
284
+ const FINDING_TEXT_MAX_LENGTH = 100
285
+
286
+ /**
287
+ * A finding's `text`: the trimmed source line it sits on, capped at {@link FINDING_TEXT_MAX_LENGTH}
288
+ * with a trailing `…`. Falls back to `fallbackToken` when `line` is out of range for the source
289
+ * (should not happen in practice, but a Finding's own `line` must never crash the render).
290
+ */
291
+ function textForFinding(sourceLine: string | undefined, fallbackToken: string): string {
292
+ if (sourceLine === undefined) return fallbackToken
293
+ const trimmed = sourceLine.trim()
294
+ return trimmed.length > FINDING_TEXT_MAX_LENGTH
295
+ ? `${trimmed.slice(0, FINDING_TEXT_MAX_LENGTH)}…`
296
+ : trimmed
297
+ }
298
+
283
299
  // ── Path predicate ────────────────────────────────────────────────────────────────────────────────
284
300
 
285
301
  function isChartFile(relPath: string): boolean {
@@ -742,9 +758,10 @@ function ruleApplies(kind: GuardKind, relPath: string): boolean {
742
758
  * if (findings.some((f) => f.kind === 'raw-hex')) { ... }
743
759
  */
744
760
  export function checkSource(text: string, relPath: string, cfg: GuardConfig): Finding[] {
745
- // Severity is stamped once at the end rather than at each of the ~20 push sites — it is a
746
- // property of the KIND and the config, never of the match.
747
- const findings: Omit<Finding, 'severity'>[] = []
761
+ // Severity and text are stamped once at the end rather than at each of the ~20 push sites — both
762
+ // are derived from state the push sites don't need: severity from the KIND and the config, text
763
+ // from the finding's own `line` against the source split below.
764
+ const findings: Omit<Finding, 'severity' | 'text'>[] = []
748
765
 
749
766
  // Derive the 3 dynamic regexes via GUARD_RULES pattern builders.
750
767
  const forbiddenAccentRe = (
@@ -894,6 +911,11 @@ export function checkSource(text: string, relPath: string, cfg: GuardConfig): Fi
894
911
 
895
912
  // chart-missing-aria-label — full-text tag-scoped scan (same shape as unframed-chart above).
896
913
  // A tag is a violation only when its own (possibly multi-line) prop list has no `ariaLabel=`.
914
+ // Reports at the tag's OPENING line, like card-with-border below and unlike the end-of-match
915
+ // arithmetic this used to do: on a multi-line-formatted chart the end lands on the closing `/>`,
916
+ // which is what `Finding.text` would then quote back — the closing bracket rather than the tag
917
+ // that is missing the prop. The allow-comment is honored anywhere in the tag's span, so a
918
+ // `theme-allow` that used to sit on the closing line keeps working.
897
919
  if (
898
920
  GUARD_RULES['chart-missing-aria-label'].enabled!(cfg) &&
899
921
  ruleApplies('chart-missing-aria-label', relPath)
@@ -901,11 +923,19 @@ export function checkSource(text: string, relPath: string, cfg: GuardConfig): Fi
901
923
  for (const m of codeText.matchAll(CHART_ENTRY_POINT_TAG)) {
902
924
  const tagText = m[0]
903
925
  if (HAS_ARIA_LABEL_PROP.test(tagText)) continue
904
- const lineNo = codeText.slice(0, (m.index ?? 0) + tagText.length).split('\n').length
905
- if (isSkippedLine(lines[lineNo - 1] ?? '', cfg)) continue
926
+ const startLine = codeText.slice(0, m.index ?? 0).split('\n').length
927
+ const endLine = startLine + (tagText.split('\n').length - 1)
928
+ let skipped = false
929
+ for (let n = startLine; n <= endLine; n++) {
930
+ if (isSkippedLine(lines[n - 1] ?? '', cfg)) {
931
+ skipped = true
932
+ break
933
+ }
934
+ }
935
+ if (skipped) continue
906
936
  findings.push({
907
937
  relPath,
908
- line: lineNo,
938
+ line: startLine,
909
939
  token: tagText.slice(0, 40),
910
940
  kind: 'chart-missing-aria-label',
911
941
  })
@@ -957,7 +987,15 @@ export function checkSource(text: string, relPath: string, cfg: GuardConfig): Fi
957
987
  // Per-rule, per-path exemption post-filter (§exemptRules) — applied once here so it uniformly
958
988
  // covers every kind regardless of whether it was emitted via the GUARD_RULES registry loop above
959
989
  // or one of the inline-handled kinds (raw-surface, raw-html-layout, sub-16-input-font, …).
990
+ //
991
+ // `text` is stamped here too, in the same single post-pass, off the ORIGINAL (unstripped) `lines`
992
+ // split — never `codeLines` — so a finding on a line whose comment was stripped still reports the
993
+ // real source text a human would read.
960
994
  return findings
961
995
  .filter((f) => !isRuleExempt(f.kind, f.relPath, cfg.exemptRules))
962
- .map((f) => ({ ...f, severity: severityOf(f.kind, cfg) }))
996
+ .map((f) => ({
997
+ ...f,
998
+ text: textForFinding(lines[f.line - 1], f.token),
999
+ severity: severityOf(f.kind, cfg),
1000
+ }))
963
1001
  }
@@ -56,6 +56,12 @@ export type Finding = {
56
56
  readonly relPath: string
57
57
  readonly line: number
58
58
  readonly token: string
59
+ /**
60
+ * The trimmed source line the finding sits on — what a human should read; `token` stays the
61
+ * matched substring for programmatic use. Truncated to 100 characters (with a trailing `…`) so
62
+ * a minified line can't blow up the report.
63
+ */
64
+ readonly text: string
59
65
  readonly kind: GuardKind
60
66
  /** Resolved per kind from {@link GuardConfig.severity} over the shipped default. */
61
67
  readonly severity: GuardSeverity
@@ -6,7 +6,7 @@
6
6
  * line is the child-list left guide (`--vx-divider`). Never reintroduce brand/section/footer
7
7
  * borders.
8
8
  *
9
- * The active fill, shadow-card depth and icon-accent color live in the Mantine theme
9
+ * The active tint and icon-accent color live in the Mantine theme
10
10
  * (`NavLink.extend` + `theme/nav-link.module.css`) so they apply to EVERY render path, including a
11
11
  * consumer's router `<Link>` via `renderNavLink` (which never sees this CSS module). This module
12
12
  * owns the shell-local layout (docs/DESIGN-SPEC.md §5) and the INACTIVE state (muted text, faint
@@ -50,7 +50,7 @@
50
50
  }
51
51
 
52
52
  /* Hover — ink-6% tint + ink text, for inactive rows only (an active row already carries the
53
- * theme's panel/shadow-card treatment and keeps its own hover via `--nl-hover`). */
53
+ * theme's stronger ink-9% tint and keeps its own hover via `--nl-hover`). */
54
54
  @media (hover: hover) {
55
55
  .link:not([data-active]):not([aria-current='page']):hover {
56
56
  background-color: color-mix(in srgb, var(--vx-ink) 6%, transparent) !important;
@@ -316,16 +316,14 @@
316
316
 
317
317
  /*
318
318
  * Active child = accent text, weight 600, NO fill (docs/DESIGN-SPEC.md §5) — unlike a top-level
319
- * active row (panel + shadow-card). Overrides the `--nl-*` custom properties the theme sets
320
- * inline on the SAME NavLink root, so `!important` is required; `box-shadow` cancels the theme
321
- * module's active shadow-card.
319
+ * active row (ink-9% tint). Overrides the `--nl-*` custom properties the theme sets inline on the
320
+ * SAME NavLink root, so `!important` is required.
322
321
  */
323
322
  .childList :global(.mantine-NavLink-root[data-active]),
324
323
  .childList :global(.mantine-NavLink-root[aria-current='page']) {
325
324
  --nl-color: var(--vx-accent) !important;
326
325
  --nl-bg: transparent !important;
327
326
  --nl-hover: color-mix(in srgb, var(--vx-ink) 5%, transparent) !important;
328
- box-shadow: none !important;
329
327
  }
330
328
 
331
329
  /* Child hover (inactive) — ink-5% + ink, one step quieter than the parent rows' 6%. Outranks the
@@ -1,6 +1,8 @@
1
1
  /*
2
2
  * Sidebar search trigger — replicates the former header search trigger (panel surface +
3
- * shadow-card, control radius, faint icon/label, mono Kbd) at full width inside the sidebar.
3
+ * shadow-raised, control radius, faint icon/label, mono Kbd) at full width inside the sidebar.
4
+ * `shadow-raised` is the shared CONTROL depth — §5 specifies this trigger and the header icon
5
+ * button as a matched pair, so the two must never drift onto different depth tokens.
4
6
  */
5
7
 
6
8
  .trigger {
@@ -12,7 +14,7 @@
12
14
  padding: 0 var(--vx-space-row-inset-x);
13
15
  border-radius: var(--vx-radius-ctrl);
14
16
  background-color: var(--vx-surface-panel);
15
- box-shadow: var(--vx-shadow-card);
17
+ box-shadow: var(--vx-shadow-raised);
16
18
  color: var(--vx-faint);
17
19
  }
18
20