basalt-ui 1.1.0 → 1.2.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 (191) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +37 -0
  3. package/README.md +47 -5
  4. package/agent/rules/basalt-app.md +126 -0
  5. package/agent/rules/basalt-content.md +3 -1
  6. package/agent/skills/basalt-app/SKILL.md +32 -10
  7. package/configs/check.yml +3 -1
  8. package/configs/oxlint.json +1 -1
  9. package/dist/agent/part-list.d.ts.map +1 -1
  10. package/dist/agent/part-list.js +17 -7
  11. package/dist/agent/stick-to-bottom.js +2 -2
  12. package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
  13. package/dist/agent-chat/thread-detail-panel.js +37 -33
  14. package/dist/agent-chat/thread-message.d.ts.map +1 -1
  15. package/dist/agent-chat/thread-message.js +8 -5
  16. package/dist/agent-chat/thread-outcome-card.js +3 -3
  17. package/dist/agent-chat/thread-workspace.js +1 -1
  18. package/dist/charts/primitives/ChartLegend.js +2 -0
  19. package/dist/charts/primitives/ChartTooltip.js +2 -1
  20. package/dist/cli/index.d.ts +21 -1
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +50 -12
  23. package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
  24. package/dist/connectivity/connectivity-indicator.js +3 -3
  25. package/dist/content/article-card.module.css +7 -5
  26. package/dist/content/article-layout.module.css +16 -12
  27. package/dist/content/callout.module.css +4 -4
  28. package/dist/content/code-block.module.css +8 -7
  29. package/dist/content/guide.module.css +3 -3
  30. package/dist/content/mermaid.module.css +2 -2
  31. package/dist/content/prose.module.css +59 -29
  32. package/dist/content/reading-progress.module.css +2 -0
  33. package/dist/content/toc.module.css +6 -3
  34. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  35. package/dist/dashboard/delta-badge.js +10 -2
  36. package/dist/dashboard/empty-state.d.ts.map +1 -1
  37. package/dist/dashboard/empty-state.js +3 -16
  38. package/dist/dashboard/settings-section.js +2 -2
  39. package/dist/dashboard/settings-section.module.css +2 -2
  40. package/dist/dashboard/stat-card.js +2 -1
  41. package/dist/data/virtual-list.d.ts.map +1 -1
  42. package/dist/data/virtual-list.js +12 -2
  43. package/dist/forms/FormErrorSummary.js +2 -2
  44. package/dist/guard/index.d.ts +20 -4
  45. package/dist/guard/index.d.ts.map +1 -1
  46. package/dist/guard/index.js +250 -37
  47. package/dist/guard/types.d.ts +24 -3
  48. package/dist/guard/types.d.ts.map +1 -1
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/provider/index.d.ts +30 -1
  52. package/dist/provider/index.d.ts.map +1 -1
  53. package/dist/provider/index.js +32 -7
  54. package/dist/provider/lab-theme.d.ts +39 -0
  55. package/dist/provider/lab-theme.d.ts.map +1 -0
  56. package/dist/provider/lab-theme.js +52 -0
  57. package/dist/shell/app-header.module.css +2 -2
  58. package/dist/shell/app-mobile-nav.module.css +1 -1
  59. package/dist/shell/app-sidebar-account.d.ts.map +1 -1
  60. package/dist/shell/app-sidebar-account.js +4 -2
  61. package/dist/shell/app-sidebar.d.ts.map +1 -1
  62. package/dist/shell/app-sidebar.js +4 -2
  63. package/dist/shell/app-sidebar.module.css +36 -26
  64. package/dist/shell/index.d.ts.map +1 -1
  65. package/dist/shell/index.js +11 -4
  66. package/dist/shell/sidebar-search.module.css +16 -4
  67. package/dist/styles.css +1 -1
  68. package/dist/surfaces.d.ts +16 -12
  69. package/dist/surfaces.d.ts.map +1 -1
  70. package/dist/surfaces.js +12 -4
  71. package/dist/theme/controls.module.css +1 -1
  72. package/dist/theme/floating.module.css +1 -1
  73. package/dist/theme/index.d.ts +116 -11
  74. package/dist/theme/index.d.ts.map +1 -1
  75. package/dist/theme/index.js +703 -566
  76. package/dist/theme/nav-link.module.css +1 -1
  77. package/dist/theme/use-basalt-spacing.d.ts +3 -0
  78. package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
  79. package/dist/theme/use-basalt-spacing.js +8 -0
  80. package/dist/theme-lab/derive-controls.d.ts +13 -0
  81. package/dist/theme-lab/derive-controls.d.ts.map +1 -0
  82. package/dist/theme-lab/derive-controls.js +137 -0
  83. package/dist/theme-lab/derive-state.d.ts +55 -0
  84. package/dist/theme-lab/derive-state.d.ts.map +1 -0
  85. package/dist/theme-lab/derive-state.js +81 -0
  86. package/dist/theme-lab/index.d.ts +12 -2
  87. package/dist/theme-lab/index.d.ts.map +1 -1
  88. package/dist/theme-lab/index.js +13 -62
  89. package/dist/theme-toggle/index.d.ts.map +1 -1
  90. package/dist/theme-toggle/index.js +3 -2
  91. package/dist/tokens/derive.d.ts +89 -0
  92. package/dist/tokens/derive.d.ts.map +1 -0
  93. package/dist/tokens/derive.js +250 -0
  94. package/dist/tokens/hct.d.ts +34 -0
  95. package/dist/tokens/hct.d.ts.map +1 -0
  96. package/dist/tokens/hct.js +159 -0
  97. package/dist/tokens/index.d.ts +71 -7
  98. package/dist/tokens/index.d.ts.map +1 -1
  99. package/dist/tokens/index.js +284 -46
  100. package/dist/tokens/palette.d.ts +984 -167
  101. package/dist/tokens/palette.d.ts.map +1 -1
  102. package/dist/tokens/palette.js +617 -119
  103. package/dist/vite-color-mix.d.ts +30 -0
  104. package/dist/vite-color-mix.d.ts.map +1 -0
  105. package/dist/vite-color-mix.js +80 -0
  106. package/dist/vite.d.ts +82 -1
  107. package/dist/vite.d.ts.map +1 -1
  108. package/dist/vite.js +312 -0
  109. package/llms.txt +5 -4
  110. package/package.json +24 -9
  111. package/src/agent/part-list.tsx +13 -7
  112. package/src/agent/stick-to-bottom.tsx +2 -2
  113. package/src/agent-chat/thread-detail-panel.tsx +13 -10
  114. package/src/agent-chat/thread-message.tsx +8 -5
  115. package/src/agent-chat/thread-outcome-card.tsx +2 -2
  116. package/src/agent-chat/thread-workspace.tsx +2 -2
  117. package/src/charts/primitives/ChartLegend.tsx +2 -2
  118. package/src/charts/primitives/ChartTooltip.tsx +2 -2
  119. package/src/cli/check-theme.test.ts +18 -0
  120. package/src/cli/index.ts +112 -20
  121. package/src/cli/init-sync.test.ts +68 -0
  122. package/src/connectivity/connectivity-indicator.tsx +8 -2
  123. package/src/content/article-card.module.css +7 -5
  124. package/src/content/article-layout.module.css +16 -12
  125. package/src/content/callout.module.css +4 -4
  126. package/src/content/code-block.module.css +8 -7
  127. package/src/content/guide.module.css +3 -3
  128. package/src/content/mermaid.module.css +2 -2
  129. package/src/content/prose.module.css +59 -29
  130. package/src/content/prose.module.css.test.ts +55 -0
  131. package/src/content/reading-progress.module.css +2 -0
  132. package/src/content/toc.module.css +6 -3
  133. package/src/dashboard/delta-badge.tsx +10 -4
  134. package/src/dashboard/empty-state.tsx +3 -16
  135. package/src/dashboard/settings-section.module.css +2 -2
  136. package/src/dashboard/settings-section.tsx +2 -2
  137. package/src/dashboard/stat-card.tsx +2 -2
  138. package/src/data/virtual-list.tsx +12 -2
  139. package/src/forms/FormErrorSummary.tsx +1 -1
  140. package/src/guard/check-source.test.ts +416 -5
  141. package/src/guard/index.ts +367 -45
  142. package/src/guard/types.ts +24 -2
  143. package/src/index.ts +1 -0
  144. package/src/provider/index.test.tsx +100 -0
  145. package/src/provider/index.tsx +79 -7
  146. package/src/provider/lab-theme.test.ts +147 -0
  147. package/src/provider/lab-theme.ts +166 -0
  148. package/src/shell/app-header.module.css +2 -2
  149. package/src/shell/app-mobile-nav.module.css +1 -1
  150. package/src/shell/app-sidebar-account.tsx +9 -2
  151. package/src/shell/app-sidebar.module.css +36 -26
  152. package/src/shell/app-sidebar.tsx +12 -2
  153. package/src/shell/index.tsx +14 -3
  154. package/src/shell/sidebar-search.module.css +16 -4
  155. package/src/styles.css +1 -1
  156. package/src/surfaces.ts +25 -11
  157. package/src/theme/contrast.test.ts +19 -3
  158. package/src/theme/controls.module.css +1 -1
  159. package/src/theme/density-option.test.ts +96 -0
  160. package/src/theme/density-relations.test.ts +428 -0
  161. package/src/theme/derive-theme.test.ts +101 -0
  162. package/src/theme/floating.module.css +1 -1
  163. package/src/theme/fonts-option.test.ts +69 -0
  164. package/src/theme/index.ts +930 -563
  165. package/src/theme/nav-link.module.css +1 -1
  166. package/src/theme/radius-option.test.ts +86 -0
  167. package/src/theme/radius.test.ts +132 -0
  168. package/src/theme/spacing.test.ts +432 -0
  169. package/src/theme/use-basalt-spacing.test.tsx +51 -0
  170. package/src/theme/use-basalt-spacing.ts +38 -0
  171. package/src/theme-lab/derive-controls.test.ts +94 -0
  172. package/src/theme-lab/derive-controls.tsx +227 -0
  173. package/src/theme-lab/derive-state.test.ts +71 -0
  174. package/src/theme-lab/derive-state.ts +163 -0
  175. package/src/theme-lab/index.tsx +29 -68
  176. package/src/theme-lab/theme-lab.test.ts +4 -18
  177. package/src/theme-toggle/index.tsx +9 -4
  178. package/src/tokens/build-fonts-css.test.ts +51 -0
  179. package/src/tokens/build-radius-css.test.ts +25 -0
  180. package/src/tokens/density.test.ts +274 -0
  181. package/src/tokens/derive-radius.test.ts +62 -0
  182. package/src/tokens/derive.test.ts +30 -0
  183. package/src/tokens/derive.ts +481 -0
  184. package/src/tokens/hct.ts +231 -0
  185. package/src/tokens/index.ts +395 -45
  186. package/src/tokens/palette.test.ts +114 -0
  187. package/src/tokens/palette.ts +1118 -180
  188. package/src/vite-color-mix.test.ts +46 -0
  189. package/src/vite-color-mix.ts +137 -0
  190. package/src/vite.test.ts +192 -0
  191. package/src/vite.ts +502 -1
@@ -76,8 +76,8 @@ const LazyStickToBottom = lazy(() =>
76
76
  justifyContent: 'center',
77
77
  width: 30,
78
78
  height: 30,
79
- margin: '8px auto 0',
80
- borderRadius: 999,
79
+ margin: 'var(--vx-space-agent-scroll-button-gap-top) auto 0',
80
+ borderRadius: 'var(--vx-radius-pill)',
81
81
  border: 'none',
82
82
  cursor: 'pointer',
83
83
  backgroundColor: 'var(--vx-surface-panel)',
@@ -20,7 +20,7 @@
20
20
  * onClose={() => select(null)}
21
21
  * />
22
22
  */
23
- import { ActionIcon, Alert, Box, Button, Divider, Stack, Text } from '@mantine/core'
23
+ import { ActionIcon, Alert, Box, Button, Divider, Flex, Stack, Text } from '@mantine/core'
24
24
  import { useReducedMotion } from '@mantine/hooks'
25
25
  import { motion } from 'motion/react'
26
26
  import type { JSX } from 'react'
@@ -113,11 +113,8 @@ export function ThreadDetailPanel({
113
113
  const streaming = runStatus === 'streaming'
114
114
 
115
115
  const panel = (
116
- <Box style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
117
- <Box
118
- p="sm"
119
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
120
- >
116
+ <Flex direction="column" h="100%">
117
+ <Flex p="sm" align="center" justify="space-between">
121
118
  <Text
122
119
  fw={550}
123
120
  lineClamp={1}
@@ -132,11 +129,17 @@ export function ThreadDetailPanel({
132
129
  <ActionIcon variant="subtle" color="gray" onClick={onClose} aria-label="Close thread">
133
130
  <CloseGlyph />
134
131
  </ActionIcon>
135
- </Box>
132
+ </Flex>
136
133
  <Divider color="var(--vx-divider)" />
137
134
  <Box style={{ flex: 1, minHeight: 0 }}>
138
- {/* theme-allow — BasaltStickToBottom owns this scroll node (see stick-to-bottom.tsx). */}
139
- <BasaltStickToBottom style={{ height: '100%', overflowY: 'auto', padding: 16 }}>
135
+ <BasaltStickToBottom
136
+ style={{
137
+ height: '100%',
138
+ // theme-allow — BasaltStickToBottom owns this scroll node (see stick-to-bottom.tsx).
139
+ overflowY: 'auto',
140
+ padding: 'var(--vx-space-agent-transcript-inset)',
141
+ }}
142
+ >
140
143
  <ThreadTranscript
141
144
  messages={thread.messages}
142
145
  {...(liveParts !== undefined ? { liveParts } : {})}
@@ -172,7 +175,7 @@ export function ThreadDetailPanel({
172
175
  )}
173
176
  </Stack>
174
177
  </Box>
175
- </Box>
178
+ </Flex>
176
179
  )
177
180
 
178
181
  if (reduceMotion) return panel
@@ -72,14 +72,17 @@ function TextRenderer({ part }: { part: TextPart; index: number }): JSX.Element
72
72
 
73
73
  // Tool-call/reasoning parts (docs/DESIGN-SPEC.md §5): a mono micro-label header with a faint left
74
74
  // divider rail — quieter than the card idiom, since these are transcript asides, not surfaces.
75
- const RAIL_STYLE = { borderLeft: `2px solid ${VX.divider}`, paddingLeft: 10 } as const
75
+ const RAIL_STYLE = {
76
+ borderLeft: `2px solid ${VX.divider}`,
77
+ paddingLeft: 'var(--vx-space-agent-rail-inset-x)',
78
+ } as const
76
79
  const CODE_BLOCK_STYLE = {
77
80
  margin: 0,
78
- marginTop: 6,
81
+ marginTop: 'var(--vx-space-agent-part-gap-top)',
79
82
  fontFamily: 'var(--basalt-font-mono)',
80
83
  backgroundColor: alpha(VX.ink, 0.06),
81
- borderRadius: 8,
82
- padding: 8,
84
+ borderRadius: 'var(--vx-radius-card)',
85
+ padding: 'var(--vx-space-agent-code-inset)',
83
86
  whiteSpace: 'pre-wrap',
84
87
  overflowWrap: 'anywhere',
85
88
  } as const
@@ -192,7 +195,7 @@ function MessageBlock({
192
195
  return (
193
196
  <Box
194
197
  style={{
195
- padding: '10px 12px',
198
+ padding: 'var(--vx-space-agent-message-inset-y) var(--vx-space-agent-message-inset-x)',
196
199
  backgroundColor: author === 'user' ? VX.surface.subtle : VX.surface.panel,
197
200
  borderRadius: VX.radiusCard,
198
201
  boxShadow: VX.shadowCard,
@@ -107,12 +107,12 @@ function OutcomeBody({ thread }: { thread: AgentThread }): JSX.Element {
107
107
  {badge !== undefined && (
108
108
  <Badge
109
109
  size="xs"
110
- radius={6}
111
110
  styles={{
112
111
  root: {
113
112
  backgroundColor: alpha(badge.statusToken, 0.13),
114
- padding: '2px 7px',
113
+ padding: 'var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x)',
115
114
  height: 'auto',
115
+ borderRadius: 'var(--vx-radius-ctrl)',
116
116
  },
117
117
  label: {
118
118
  fontFamily: 'var(--basalt-font-mono)',
@@ -128,7 +128,7 @@ export function ThreadWorkspace({
128
128
  // A plain pane, NOT a card — the feed's own rows carry the card idiom (docs/DESIGN-SPEC.md §5),
129
129
  // so this pane stays flush with the page and the feed/detail split reads via the divider token.
130
130
  const feed = (
131
- <Box style={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}>
131
+ <Flex direction="column" h="100%" style={{ overflow: 'hidden' }}>
132
132
  <Box style={{ flex: 1, minHeight: 0 }}>
133
133
  {store.threads.length === 0 ? (
134
134
  (emptyState ?? <FeedEmptyState />)
@@ -143,7 +143,7 @@ export function ThreadWorkspace({
143
143
  {...(newThreadPlaceholder !== undefined ? { placeholder: newThreadPlaceholder } : {})}
144
144
  />
145
145
  </Box>
146
- </Box>
146
+ </Flex>
147
147
  )
148
148
 
149
149
  const detail = (
@@ -147,7 +147,7 @@ function LegendSwatch({ item, idPrefix }: { item: LegendEntry; idPrefix: string
147
147
  style={{
148
148
  width: 11,
149
149
  height: 11,
150
- borderRadius: 3,
150
+ borderRadius: 3, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
151
151
  backgroundColor: item.color,
152
152
  opacity: item.fillOpacity ?? 0.7,
153
153
  flexShrink: 0,
@@ -192,7 +192,7 @@ function LegendChildSwatch({ item }: { item: LegendEntry }) {
192
192
  style={{
193
193
  width: 10,
194
194
  height: 10,
195
- borderRadius: 2,
195
+ borderRadius: 2, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
196
196
  backgroundColor: item.color,
197
197
  opacity: item.fillOpacity ?? 0.7,
198
198
  flexShrink: 0,
@@ -10,7 +10,7 @@ const TOOLTIP_STYLES: CSSProperties = {
10
10
  pointerEvents: 'none',
11
11
  zIndex: 9999,
12
12
  backgroundColor: VX.surface.panel,
13
- borderRadius: 8,
13
+ borderRadius: 'var(--vx-radius-floating)',
14
14
  padding: '0',
15
15
  fontSize: VX.text.xs,
16
16
  lineHeight: '18px',
@@ -138,7 +138,7 @@ export function TooltipRow({
138
138
  style={{
139
139
  width: 8,
140
140
  height: 8,
141
- borderRadius: 2,
141
+ borderRadius: 2, // theme-allow: sub-scale tooltip micro-corner, below the 4px radius floor
142
142
  backgroundColor: color,
143
143
  flexShrink: 0,
144
144
  }}
@@ -636,6 +636,24 @@ describe('check-theme roots fail-loud', () => {
636
636
  })
637
637
  })
638
638
 
639
+ describe('check-theme scans .css', () => {
640
+ it('flags a raw hex in a CSS module the walker collects', () => {
641
+ fixtureAt('theme/controls.module.css', '.input {\n color: #ff0000;\n}\n')
642
+ const { code, err } = run()
643
+ expect(code).toBe(1)
644
+ expect(err).toContain('raw-hex')
645
+ expect(err).toContain('controls.module.css')
646
+ })
647
+
648
+ it('does NOT false-positive a JSX-shaped rule on genuine CSS', () => {
649
+ fixtureAt('theme/controls.module.css', '.foo {\n display: flex;\n border-radius: 8px;\n}\n')
650
+ const { code, err } = run()
651
+ expect(code).toBe(0)
652
+ expect(err).not.toContain('inline-display')
653
+ expect(err).not.toContain('raw-html-layout')
654
+ })
655
+ })
656
+
639
657
  describe('check-theme comment skipping', () => {
640
658
  it('does NOT flag a banned element mentioned in a pure line comment', () => {
641
659
  fixtureAt(
package/src/cli/index.ts CHANGED
@@ -135,27 +135,71 @@ export type BasaltConfig = {
135
135
  * `sub-16-input-font` check.
136
136
  */
137
137
  sub16InputFont?: boolean
138
- /** Path of the consumer's guard-exempt series file, for DESIGN.md `{{SERIES_MODULE_PATH}}`. Default: `src/lib/series.ts`. */
138
+ /**
139
+ * Path of the consumer's guard-exempt series file, for DESIGN.md `{{SERIES_MODULE_PATH}}`.
140
+ * Default: `<first basalt.root>/lib/series.ts` — see `resolveSeriesModulePath`.
141
+ */
139
142
  seriesModulePath?: string
143
+ /**
144
+ * Per-rule, per-path exemptions — complements whole-file `exempt` (which skips ALL rules for a
145
+ * file) and the hardcoded per-kind `appliesTo` scoping (e.g. `raw-visx-axis` → chart files
146
+ * only). Each value is a list of path-segment patterns matched against a finding's relative
147
+ * path: a pattern matches when the path split on `/` includes it as a WHOLE segment (`'agent'`
148
+ * matches `src/agent/x.tsx` but not `src/agenting.ts`; a trailing `/` is stripped, so `'agent'`
149
+ * and `'agent/'` are equivalent). Default: `{}` (no exemptions).
150
+ *
151
+ * @example
152
+ * { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
153
+ */
154
+ exemptRules?: Partial<Record<GuardKind, string[]>>
140
155
  }
141
156
 
142
- const DEFAULT_ROOTS = ['src']
157
+ const DEFAULT_ROOT = 'src'
158
+ const DEFAULT_ROOTS = [DEFAULT_ROOT]
159
+
160
+ /**
161
+ * The configured source roots, or the built-in default. The ONE resolution every roots-derived seed
162
+ * reads — an empty `roots: []` falls back rather than resolving to nothing, because a bare `??`
163
+ * would let `[]` through and render an empty oxfmt glob into the seeded CI, reproducing the exact
164
+ * "matches zero files" break this derivation exists to prevent.
165
+ */
166
+ function resolveRoots(cfg: BasaltConfig): string[] {
167
+ return cfg.roots?.length ? cfg.roots : DEFAULT_ROOTS
168
+ }
169
+
170
+ /**
171
+ * The one consumer series path — the DESIGN.md template's `{{SERIES_MODULE_PATH}}`, the default
172
+ * scan exemption, and the skills' prose all resolve through this single function.
173
+ *
174
+ * Derived from the FIRST configured root (argo's convention: `<root>/lib/series.ts`), not a fixed
175
+ * `src/lib/series.ts` — a monorepo that correctly sets `roots: ['apps/web/src']` has no top-level
176
+ * `src/`, so a hardcoded default would seed a DESIGN.md pointing at a path that cannot exist and
177
+ * silently exempt nothing. `seriesModulePath` still overrides for a layout that isn't `<root>/lib/`.
178
+ */
179
+ function resolveSeriesModulePath(cfg: BasaltConfig): string {
180
+ if (cfg.seriesModulePath !== undefined) return cfg.seriesModulePath
181
+ const [firstRoot = DEFAULT_ROOT] = resolveRoots(cfg)
182
+ return `${firstRoot}/lib/series.ts`
183
+ }
143
184
 
144
185
  /**
145
- * The one default consumer series path — the DESIGN.md template's `{{SERIES_MODULE_PATH}}`, the
146
- * default scan exemption, and the skills' prose all point at this same file, so it lives in a
147
- * single constant (argo's convention: `<root>/lib/series.ts`).
186
+ * A root as a single-quoted oxfmt glob for the seeded CI `run:` step. POSIX-escapes any embedded
187
+ * quote (`'` → `'\''`) — `roots` is consumer-authored, and an unescaped apostrophe would break out
188
+ * of the quoting and emit a workflow that fails on a syntax error the consumer can't trace back
189
+ * here. Not a privilege boundary (it's their own config rendering into their own CI), just a file
190
+ * this CLI generates and therefore owes valid quoting.
148
191
  */
149
- const DEFAULT_SERIES_MODULE_PATH = 'src/lib/series.ts'
192
+ function toRootGlob(root: string): string {
193
+ return `'${root.replace(/'/g, `'\\''`)}/**'`
194
+ }
150
195
 
151
196
  /**
152
- * Default scan exemption — a bare consumer's only palette source is its configured series module
153
- * (the doctrine directs every consumer to put raw hex series colors in `seriesModulePath`; default
154
- * `src/lib/series.ts`). Derived from the same config resolution `buildTemplateVars` uses for
155
- * `{{SERIES_MODULE_PATH}}`, so overriding `seriesModulePath` keeps the exemption in sync.
197
+ * Default scan exemption — a bare consumer's only palette source is its series module (the doctrine
198
+ * directs every consumer to put raw hex series colors there). Shares `resolveSeriesModulePath` with
199
+ * `buildTemplateVars`'s `{{SERIES_MODULE_PATH}}`, so the seeded path and the exemption can't drift.
156
200
  */
157
201
  function defaultExempt(cfg: BasaltConfig): string[] {
158
- return [cfg.seriesModulePath ?? DEFAULT_SERIES_MODULE_PATH]
202
+ return [resolveSeriesModulePath(cfg)]
159
203
  }
160
204
 
161
205
  const SKIP = /\.gen\.ts$|\.test\.[tj]sx?$|\.d\.ts$/
@@ -173,8 +217,13 @@ function readBasaltConfig(cwd: string): BasaltConfig {
173
217
  }
174
218
  }
175
219
 
176
- /** Recursively collect .ts/.tsx files under a root, skipping dependency/build dirs. Node+Bun-safe. */
177
- function walkTsFiles(dir: string, out: string[] = []): string[] {
220
+ /**
221
+ * Recursively collect .ts/.tsx/.css files under a root, skipping dependency/build dirs.
222
+ * Node+Bun-safe. `.css` is included so the theme guard reaches CSS modules / `styles.css` —
223
+ * `checkSource` is already syntax-aware per extension (`guardSyntaxFor`); the walker was the only
224
+ * gap.
225
+ */
226
+ function walkSourceFiles(dir: string, out: string[] = []): string[] {
178
227
  let entries: string[]
179
228
  try {
180
229
  entries = readdirSync(dir)
@@ -190,8 +239,8 @@ function walkTsFiles(dir: string, out: string[] = []): string[] {
190
239
  } catch {
191
240
  continue
192
241
  }
193
- if (isDir) walkTsFiles(abs, out)
194
- else if (/\.tsx?$/.test(name)) out.push(abs)
242
+ if (isDir) walkSourceFiles(abs, out)
243
+ else if (/\.(?:tsx?|css)$/.test(name)) out.push(abs)
195
244
  }
196
245
  return out
197
246
  }
@@ -242,6 +291,9 @@ const GUARD_KIND_EXPLANATIONS: Partial<Record<GuardKind, string>> = {
242
291
  'sub-16-input-font':
243
292
  'sub-16-input-font: fontSize below 16 on a form control is dead code against the `!important` ' +
244
293
  'iOS floor in styles.css — drop the override or be honest about 16px.',
294
+ 'raw-font-family':
295
+ 'raw-font-family: route the font stack through createBasaltTheme(overrides, { fonts }) / the ' +
296
+ '--basalt-font-sans|head|mono vars instead of a hardcoded fontFamily literal.',
245
297
  }
246
298
 
247
299
  /**
@@ -271,12 +323,13 @@ export function checkTheme(cwd: string = process.cwd()): number {
271
323
  rawFormControl: cfg.rawFormControl ?? DEFAULT_GUARD_CONFIG.rawFormControl,
272
324
  sub16InputFont: cfg.sub16InputFont ?? DEFAULT_GUARD_CONFIG.sub16InputFont,
273
325
  allowComment: 'theme-allow',
326
+ exemptRules: cfg.exemptRules ?? DEFAULT_GUARD_CONFIG.exemptRules,
274
327
  }
275
328
 
276
329
  const findings: Finding[] = []
277
330
  let scannedCount = 0
278
331
  for (const root of roots) {
279
- for (const f of walkTsFiles(resolve(cwd, root))) {
332
+ for (const f of walkSourceFiles(resolve(cwd, root))) {
280
333
  // Normalize to forward slashes so path matching (SKIP, exempt, isChartFile) is
281
334
  // identical on Windows (where `relative` yields backslashes) and POSIX.
282
335
  const rel = relative(cwd, f).replace(/\\/g, '/')
@@ -409,6 +462,8 @@ type TemplateVars = {
409
462
  BASALT_VERSION: string
410
463
  ACCENT_HUE: string
411
464
  SERIES_MODULE_PATH: string
465
+ /** The consumer's configured roots as space-separated quoted oxfmt globs, e.g. `'apps/web/src/**'`. */
466
+ ROOTS_GLOBS: string
412
467
  }
413
468
 
414
469
  // The block markers the CLAUDE.md template emits. The begin marker carries the framework version
@@ -459,7 +514,8 @@ function buildTemplateVars(pkgRoot: string, cwd: string, cfg: BasaltConfig): Tem
459
514
  APP_NAME: readPackageName(cwd),
460
515
  BASALT_VERSION: readFrameworkVersion(pkgRoot),
461
516
  ACCENT_HUE: cfg.accentHue ?? 'blue',
462
- SERIES_MODULE_PATH: cfg.seriesModulePath ?? DEFAULT_SERIES_MODULE_PATH,
517
+ SERIES_MODULE_PATH: resolveSeriesModulePath(cfg),
518
+ ROOTS_GLOBS: resolveRoots(cfg).map(toRootGlob).join(' '),
463
519
  }
464
520
  }
465
521
 
@@ -616,13 +672,20 @@ function managedFiles(peers: PeerFlags): ManagedFile[] {
616
672
  ' - node_modules/basalt-ui/configs/lefthook.yml\n',
617
673
  }
618
674
 
619
- // CI is inherently repo-shaped (a monorepo's check.yml needs its own globs and scripts), and
620
- // GitHub Actions has no in-repo `extends` — so the workflow seeds as an explicit starting copy.
675
+ // CI is inherently repo-shaped (a monorepo's check.yml needs its own scripts), and GitHub Actions
676
+ // has no in-repo `extends` — so the workflow seeds as an explicit starting copy. Its oxfmt globs
677
+ // come from `{{ROOTS_GLOBS}}` rather than a hardcoded `src/**`: on a monorepo the latter matches
678
+ // nothing and oxfmt exits 2, breaking the consumer's very first CI run for a reason that reads
679
+ // like a basalt bug.
621
680
  const ci: ManagedFile = {
622
681
  dest: '.github/workflows/check.yml',
623
682
  mode: 'seed',
624
683
  source: 'configs/check.yml',
625
- render: (ctx) => readSource(ctx.pkgRoot, 'configs/check.yml'),
684
+ render: (ctx) => {
685
+ const tpl = readSource(ctx.pkgRoot, 'configs/check.yml')
686
+ if (tpl === null) return null
687
+ return fillTemplate(tpl, ctx.vars)
688
+ },
626
689
  }
627
690
 
628
691
  // Seed an `.oxlintrc.json` that extends the shipped preset (written once, then consumer-owned).
@@ -1262,6 +1325,8 @@ type DoctorResult = {
1262
1325
  * stale).
1263
1326
  * 3. The running CLI's own version matches the installed basalt-ui (catches a stale
1264
1327
  * `bunx basalt-ui` npm fetch; best-effort, skipped if node_modules is absent).
1328
+ * 4. `basaltAppPlugin`'s (basalt-ui/vite) default icon filenames exist under public/ (only when
1329
+ * a public/ dir exists at all — skipped otherwise).
1265
1330
  *
1266
1331
  * Returns the exit code: 0 = all good, 1 = one or more hard failures.
1267
1332
  */
@@ -1337,6 +1402,32 @@ export function doctor(cwd: string = process.cwd()): number {
1337
1402
  }
1338
1403
  }
1339
1404
 
1405
+ // ── Warn check 4: basaltAppPlugin's default icon files exist in public/ ────
1406
+ // basalt-ui/vite's basaltAppPlugin (head/manifest metadata) references these filenames by
1407
+ // default (the realfavicongenerator convention). Only runs when a public/ dir exists at all —
1408
+ // apps that don't use the plugin, or don't use Vite's public-dir convention, get no false
1409
+ // warning. Best-effort: a custom `icons.dir` isn't visible here, so this checks the root only.
1410
+ const publicDir = resolve(cwd, 'public')
1411
+ if (existsSync(publicDir)) {
1412
+ const iconFiles = [
1413
+ 'favicon.ico',
1414
+ 'favicon.svg',
1415
+ 'favicon-96x96.png',
1416
+ 'apple-touch-icon.png',
1417
+ 'web-app-manifest-192x192.png',
1418
+ 'web-app-manifest-512x512.png',
1419
+ ]
1420
+ const missingIcons = iconFiles.filter((f) => !existsSync(resolve(publicDir, f)))
1421
+ if (missingIcons.length > 0) {
1422
+ warn(
1423
+ `public/ is missing basaltAppPlugin icon file(s): ${missingIcons.join(', ')} — generate ` +
1424
+ 'them (e.g. via realfavicongenerator.net) and place them at the public/ root.',
1425
+ )
1426
+ } else {
1427
+ pass("public/ has all of basaltAppPlugin's default icon files")
1428
+ }
1429
+ }
1430
+
1340
1431
  // ── Report ──────────────────────────────────────────────────────────────────
1341
1432
  lines.push('')
1342
1433
  if (result.hardFailures === 0 && result.warnings === 0) {
@@ -1536,6 +1627,7 @@ export async function guardHook(cwd: string = process.cwd()): Promise<number> {
1536
1627
  rawFormControl: cfg.rawFormControl ?? DEFAULT_GUARD_CONFIG.rawFormControl,
1537
1628
  sub16InputFont: cfg.sub16InputFont ?? DEFAULT_GUARD_CONFIG.sub16InputFont,
1538
1629
  allowComment: 'theme-allow',
1630
+ exemptRules: cfg.exemptRules ?? DEFAULT_GUARD_CONFIG.exemptRules,
1539
1631
  }
1540
1632
 
1541
1633
  // Honor the consumer's roots / exempt / skip config so the hook never blocks edits to exempted
@@ -158,3 +158,71 @@ describe('init — first-run hint', () => {
158
158
  expect(log.toLowerCase()).toContain('basalt.*')
159
159
  })
160
160
  })
161
+
162
+ describe('seeds derive from basalt.roots', () => {
163
+ // A monorepo sets `roots` because it has no top-level `src/`. Both the CI oxfmt globs and the
164
+ // DESIGN.md series path used to hardcode `src`, so a consumer that configured roots CORRECTLY
165
+ // still got a CI run that matched zero files (oxfmt exits 2) and a series path that can't exist.
166
+ const MONOREPO = { name: 'fixture', basalt: { roots: ['apps/web/src'] } }
167
+
168
+ it('renders the CI oxfmt globs from roots', () => {
169
+ writeFixture('package.json', JSON.stringify(MONOREPO))
170
+ init(dir)
171
+ const ci = readFileSync(resolve(dir, '.github/workflows/check.yml'), 'utf8')
172
+ expect(ci).toContain("bunx oxfmt 'apps/web/src/**' '!**/dist/**' --check")
173
+ expect(ci).not.toContain('{{ROOTS_GLOBS}}')
174
+ })
175
+
176
+ it('renders every root, not just the first', () => {
177
+ writeFixture(
178
+ 'package.json',
179
+ JSON.stringify({ name: 'f', basalt: { roots: ['a/src', 'b/src'] } }),
180
+ )
181
+ init(dir)
182
+ const ci = readFileSync(resolve(dir, '.github/workflows/check.yml'), 'utf8')
183
+ expect(ci).toContain("bunx oxfmt 'a/src/**' 'b/src/**' '!**/dist/**' --check")
184
+ })
185
+
186
+ it("falls back to 'src/**' when roots is unset", () => {
187
+ writeFixture('package.json', JSON.stringify({ name: 'fixture' }))
188
+ init(dir)
189
+ const ci = readFileSync(resolve(dir, '.github/workflows/check.yml'), 'utf8')
190
+ expect(ci).toContain("bunx oxfmt 'src/**' '!**/dist/**' --check")
191
+ })
192
+
193
+ it('seeds DESIGN.md with a series path under the first root', () => {
194
+ writeFixture('package.json', JSON.stringify(MONOREPO))
195
+ init(dir)
196
+ const design = readFileSync(resolve(dir, 'DESIGN.md'), 'utf8')
197
+ expect(design).toContain('apps/web/src/lib/series.ts')
198
+ })
199
+
200
+ it('falls back to the default root when roots is an explicit empty array', () => {
201
+ // `[]` is nonsense config, but a bare `??` would let it through and render an empty oxfmt glob
202
+ // into CI — the exact "matches zero files" break this derivation exists to prevent.
203
+ writeFixture('package.json', JSON.stringify({ name: 'f', basalt: { roots: [] } }))
204
+ init(dir)
205
+ const ci = readFileSync(resolve(dir, '.github/workflows/check.yml'), 'utf8')
206
+ expect(ci).toContain("bunx oxfmt 'src/**' '!**/dist/**' --check")
207
+ expect(readFileSync(resolve(dir, 'DESIGN.md'), 'utf8')).toContain('src/lib/series.ts')
208
+ })
209
+
210
+ it('POSIX-escapes a quote in a root instead of breaking out of the CI shell quoting', () => {
211
+ writeFixture('package.json', JSON.stringify({ name: 'f', basalt: { roots: ["it's/src"] } }))
212
+ init(dir)
213
+ const ci = readFileSync(resolve(dir, '.github/workflows/check.yml'), 'utf8')
214
+ expect(ci).toContain("'it'\\''s/src/**'")
215
+ })
216
+
217
+ it('lets seriesModulePath override the roots-derived default', () => {
218
+ writeFixture(
219
+ 'package.json',
220
+ JSON.stringify({
221
+ name: 'f',
222
+ basalt: { roots: ['apps/web/src'], seriesModulePath: 'custom/p.ts' },
223
+ }),
224
+ )
225
+ init(dir)
226
+ expect(readFileSync(resolve(dir, 'DESIGN.md'), 'utf8')).toContain('custom/p.ts')
227
+ })
228
+ })
@@ -195,7 +195,13 @@ export function ConnectivityIndicator() {
195
195
  <ActionIcon
196
196
  variant="transparent"
197
197
  color={ICON_COLOR[status]}
198
- size="md"
198
+ // A numeric size, not the named `"md"` — the theme's `ActionIcon.extend` `vars` (see
199
+ // `theme/index.ts`) now re-points a `size="md"` ActionIcon at the density-tracking control-
200
+ // height anchor (for a `size="md"` ActionIcon meant to match a `size="md"` Input/Button), so
201
+ // this plain toolbar icon must opt OUT with an explicit number to keep Mantine's own static
202
+ // `--ai-size-md` (28px at the 16px root) — unaffected by that override (`props.size` is a
203
+ // number here, never the literal string `'md'`) and by the density knob.
204
+ size={28}
199
205
  onClick={toggle}
200
206
  onMouseEnter={scheduleOpen}
201
207
  onMouseLeave={scheduleClose}
@@ -221,7 +227,6 @@ export function ConnectivityIndicator() {
221
227
  </Text>
222
228
  <Badge
223
229
  size="sm"
224
- radius={6}
225
230
  styles={{
226
231
  root: {
227
232
  backgroundColor: alpha(statusCfg.token, 0.13),
@@ -229,6 +234,7 @@ export function ConnectivityIndicator() {
229
234
  fontFamily: 'var(--basalt-font-mono)',
230
235
  fontWeight: 600,
231
236
  fontSize: VX.text.xs,
237
+ borderRadius: 'var(--vx-radius-ctrl)',
232
238
  },
233
239
  }}
234
240
  >
@@ -7,7 +7,7 @@
7
7
  .card {
8
8
  display: flex;
9
9
  flex-direction: column;
10
- gap: 8px;
10
+ gap: var(--vx-space-stack-sm);
11
11
  text-decoration: none;
12
12
  color: inherit;
13
13
  }
@@ -50,6 +50,8 @@
50
50
  }
51
51
 
52
52
  .clickable:focus-visible {
53
+ /* Focus-ring width/offset — paired with (and sized off) the outline's own 2px stroke, not a
54
+ * spacing gap; out of scope like a border-shorthand width. */
53
55
  outline: 2px solid var(--vx-accent);
54
56
  outline-offset: 2px;
55
57
  }
@@ -83,12 +85,12 @@
83
85
  .tags {
84
86
  display: flex;
85
87
  flex-wrap: wrap;
86
- gap: 4px;
88
+ gap: var(--vx-space-article-card-tags-gap);
87
89
  }
88
90
 
89
91
  .tag {
90
- padding: 1px 6px;
91
- border-radius: 4px;
92
+ padding: var(--vx-space-article-card-tag-inset-y) var(--vx-space-article-card-tag-inset-x);
93
+ border-radius: var(--vx-radius-fine);
92
94
  background-color: color-mix(in srgb, var(--vx-ink) 6%, transparent);
93
95
  color: var(--vx-muted);
94
96
  font-size: var(--vx-text-micro);
@@ -100,7 +102,7 @@
100
102
  * meta baseline regardless of how many lines each description clamps to. */
101
103
  .meta {
102
104
  margin-top: auto;
103
- padding-top: 2px;
105
+ padding-top: var(--vx-space-article-card-meta-gap-top);
104
106
  font-family: var(--basalt-font-mono);
105
107
  font-size: var(--vx-text-micro);
106
108
  letter-spacing: 0.06em;
@@ -8,9 +8,9 @@
8
8
 
9
9
  .root {
10
10
  display: grid;
11
- grid-template-columns: minmax(0, var(--vx-prose-measure)) 220px;
11
+ grid-template-columns: minmax(0, var(--vx-prose-measure)) var(--vx-space-article-toc-rail-width);
12
12
  justify-content: center;
13
- column-gap: 56px;
13
+ column-gap: var(--vx-space-article-column-gap);
14
14
  }
15
15
 
16
16
  .root.noToc {
@@ -31,9 +31,9 @@
31
31
  grid-column: 1;
32
32
  display: flex;
33
33
  flex-direction: column;
34
- gap: 10px;
35
- padding-bottom: 20px;
36
- margin-bottom: 28px;
34
+ gap: var(--vx-space-article-header-gap);
35
+ padding-bottom: var(--vx-space-article-header-padding-bottom);
36
+ margin-bottom: var(--vx-space-article-header-margin-bottom);
37
37
  border-bottom: 1px solid var(--vx-divider);
38
38
  }
39
39
 
@@ -56,7 +56,7 @@
56
56
  .metaRow {
57
57
  display: flex;
58
58
  align-items: center;
59
- gap: 6px;
59
+ gap: var(--vx-space-article-meta-row-gap);
60
60
  font-family: var(--basalt-font-mono);
61
61
  font-size: var(--vx-text-micro);
62
62
  letter-spacing: 0.06em;
@@ -72,7 +72,11 @@
72
72
  .tocRail {
73
73
  grid-column: 2;
74
74
  position: sticky;
75
- top: 84px;
75
+ /* DESKTOP-only value on purpose (no `< sm` override needed): the rail is already `display: none`
76
+ * below the 1200px `@media` breakpoint just above, well above the `sm` (48em/768px) breakpoint
77
+ * that switches BasaltShell's header — and, by extension, this clearance — to its mobile value
78
+ * (see `content/prose.module.css` for the responsive split; docs/CONTENT-SPEC.md §5). */
79
+ top: var(--vx-space-sticky-header-clearance);
76
80
  align-self: start;
77
81
  }
78
82
 
@@ -80,9 +84,9 @@
80
84
  grid-column: 1;
81
85
  display: grid;
82
86
  grid-template-columns: 1fr 1fr;
83
- gap: 12px;
84
- margin-top: 40px;
85
- padding-top: 20px;
87
+ gap: var(--vx-space-article-footer-gap);
88
+ margin-top: var(--vx-space-article-footer-margin-top);
89
+ padding-top: var(--vx-space-article-footer-padding-top);
86
90
  border-top: 1px solid var(--vx-divider);
87
91
  }
88
92
 
@@ -96,7 +100,7 @@
96
100
  .navCell {
97
101
  display: flex;
98
102
  flex-direction: column;
99
- gap: 4px;
103
+ gap: var(--vx-space-stack-xs);
100
104
  text-decoration: none;
101
105
  color: inherit;
102
106
  }
@@ -117,7 +121,7 @@
117
121
  .navTarget {
118
122
  display: flex;
119
123
  align-items: center;
120
- gap: 6px;
124
+ gap: var(--vx-space-article-nav-target-gap);
121
125
  font-family: var(--basalt-font-head);
122
126
  font-stretch: 88%;
123
127
  font-weight: 550;