basalt-ui 2.20.0 → 2.22.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 (289) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/MIGRATING.md +394 -12
  3. package/agent/agents/basalt-design-reviewer.md +22 -5
  4. package/agent/rules/basalt-tokens.md +3 -3
  5. package/agent/skills/basalt-design/SKILL.md +10 -23
  6. package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
  7. package/agent/skills/basalt-design/references/catalogue.md +49 -0
  8. package/agent/skills/basalt-design/references/concept.md +36 -0
  9. package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
  10. package/agent/skills/basalt-design/references/stat-tile.md +24 -0
  11. package/agent/templates/AGENTS-block.md.tpl +3 -3
  12. package/configs/oxlint-plugin.js +1 -0
  13. package/dist/charts/BandStrip.d.ts.map +1 -1
  14. package/dist/charts/BandStrip.js +27 -3
  15. package/dist/charts/Bars.d.ts.map +1 -1
  16. package/dist/charts/Bars.js +5 -0
  17. package/dist/charts/CartesianChart.d.ts +8 -0
  18. package/dist/charts/CartesianChart.d.ts.map +1 -1
  19. package/dist/charts/CartesianChart.js +8 -5
  20. package/dist/charts/ChartCard.d.ts +17 -4
  21. package/dist/charts/ChartCard.d.ts.map +1 -1
  22. package/dist/charts/ChartCard.js +33 -8
  23. package/dist/charts/DualPanel.d.ts.map +1 -1
  24. package/dist/charts/DualPanel.js +5 -8
  25. package/dist/charts/Heatmap.d.ts +12 -1
  26. package/dist/charts/Heatmap.d.ts.map +1 -1
  27. package/dist/charts/Heatmap.js +34 -5
  28. package/dist/charts/Lines.d.ts +3 -0
  29. package/dist/charts/Lines.d.ts.map +1 -1
  30. package/dist/charts/Lines.js +29 -6
  31. package/dist/charts/MirroredBars.d.ts.map +1 -1
  32. package/dist/charts/MirroredBars.js +4 -6
  33. package/dist/charts/Sparkline.d.ts +7 -1
  34. package/dist/charts/Sparkline.d.ts.map +1 -1
  35. package/dist/charts/Sparkline.js +39 -14
  36. package/dist/charts/StackedArea.d.ts +4 -1
  37. package/dist/charts/StackedArea.d.ts.map +1 -1
  38. package/dist/charts/StackedArea.js +9 -3
  39. package/dist/charts/band-fold.d.ts +20 -1
  40. package/dist/charts/band-fold.d.ts.map +1 -1
  41. package/dist/charts/band-fold.js +9 -0
  42. package/dist/charts/chart-box.module.css +19 -0
  43. package/dist/charts/chart-card.module.css +25 -0
  44. package/dist/charts/chart-legend.module.css +7 -0
  45. package/dist/charts/compile.d.ts +17 -6
  46. package/dist/charts/compile.d.ts.map +1 -1
  47. package/dist/charts/compile.js +145 -74
  48. package/dist/charts/labels.d.ts +15 -4
  49. package/dist/charts/labels.d.ts.map +1 -1
  50. package/dist/charts/labels.js +34 -10
  51. package/dist/charts/legend.d.ts +2 -0
  52. package/dist/charts/legend.d.ts.map +1 -1
  53. package/dist/charts/legend.js +7 -21
  54. package/dist/charts/marks.js +1 -1
  55. package/dist/charts/panel.d.ts +0 -6
  56. package/dist/charts/panel.d.ts.map +1 -1
  57. package/dist/charts/panel.js +1 -10
  58. package/dist/charts/ref-label.d.ts +26 -0
  59. package/dist/charts/ref-label.d.ts.map +1 -0
  60. package/dist/charts/ref-label.js +63 -0
  61. package/dist/charts/scales.d.ts +4 -1
  62. package/dist/charts/scales.d.ts.map +1 -1
  63. package/dist/charts/scales.js +14 -3
  64. package/dist/charts/sparkline.module.css +10 -11
  65. package/dist/charts/sparkline.module.css.d.ts +1 -2
  66. package/dist/charts/state.d.ts +7 -0
  67. package/dist/charts/state.d.ts.map +1 -1
  68. package/dist/charts/state.js +4 -1
  69. package/dist/charts/types.d.ts +14 -5
  70. package/dist/charts/types.d.ts.map +1 -1
  71. package/dist/cli/check-theme.d.ts.map +1 -1
  72. package/dist/cli/check-theme.js +3 -0
  73. package/dist/cli/doctor-upgrade.d.ts +1 -0
  74. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  75. package/dist/cli/doctor-upgrade.js +1 -0
  76. package/dist/cli/help.d.ts.map +1 -1
  77. package/dist/cli/help.js +3 -2
  78. package/dist/cli/index.d.ts +4 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +27 -15
  81. package/dist/cli/init.d.ts +2 -0
  82. package/dist/cli/init.d.ts.map +1 -1
  83. package/dist/cli/init.js +71 -6
  84. package/dist/cli/shot/capture.d.ts +21 -2
  85. package/dist/cli/shot/capture.d.ts.map +1 -1
  86. package/dist/cli/shot/capture.js +200 -33
  87. package/dist/cli/shot/detect.d.ts +51 -0
  88. package/dist/cli/shot/detect.d.ts.map +1 -0
  89. package/dist/cli/shot/detect.js +409 -0
  90. package/dist/cli/shot/index.d.ts.map +1 -1
  91. package/dist/cli/shot/index.js +7 -4
  92. package/dist/cli/shot/measure.d.ts +2 -0
  93. package/dist/cli/shot/measure.d.ts.map +1 -1
  94. package/dist/cli/shot/measure.js +2 -0
  95. package/dist/cli/shot/playwright.d.ts +5 -2
  96. package/dist/cli/shot/playwright.d.ts.map +1 -1
  97. package/dist/cli/shot/types.d.ts +6 -1
  98. package/dist/cli/shot/types.d.ts.map +1 -1
  99. package/dist/cli/shot/types.js +4 -0
  100. package/dist/cli/sync.d.ts +2 -0
  101. package/dist/cli/sync.d.ts.map +1 -1
  102. package/dist/cli/sync.js +2 -2
  103. package/dist/common/retry-button.d.ts +12 -0
  104. package/dist/common/retry-button.d.ts.map +1 -0
  105. package/dist/common/retry-button.js +22 -0
  106. package/dist/common/retry-button.module.css +58 -0
  107. package/dist/common/retry-button.module.css.d.ts +8 -0
  108. package/dist/controls/controls.module.css +11 -1
  109. package/dist/controls/filter-pill.d.ts.map +1 -1
  110. package/dist/controls/filter-pill.js +1 -0
  111. package/dist/controls/sync-button.d.ts.map +1 -1
  112. package/dist/controls/sync-button.js +22 -3
  113. package/dist/controls/sync-button.module.css +34 -2
  114. package/dist/controls/sync-button.module.css.d.ts +1 -0
  115. package/dist/dashboard/bar-list.d.ts +5 -2
  116. package/dist/dashboard/bar-list.d.ts.map +1 -1
  117. package/dist/dashboard/bar-list.js +9 -10
  118. package/dist/dashboard/bar-list.module.css +53 -0
  119. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  120. package/dist/dashboard/index.d.ts +1 -0
  121. package/dist/dashboard/index.d.ts.map +1 -1
  122. package/dist/dashboard/index.js +2 -0
  123. package/dist/dashboard/meter-model.d.ts +108 -6
  124. package/dist/dashboard/meter-model.d.ts.map +1 -1
  125. package/dist/dashboard/meter-model.js +123 -19
  126. package/dist/dashboard/meter-parts.d.ts +8 -0
  127. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  128. package/dist/dashboard/meter-parts.js +345 -146
  129. package/dist/dashboard/meter.d.ts +50 -63
  130. package/dist/dashboard/meter.d.ts.map +1 -1
  131. package/dist/dashboard/meter.js +24 -3
  132. package/dist/dashboard/meter.module.css +79 -65
  133. package/dist/dashboard/meter.module.css.d.ts +7 -7
  134. package/dist/dashboard/page-summary.d.ts +20 -0
  135. package/dist/dashboard/page-summary.d.ts.map +1 -0
  136. package/dist/dashboard/page-summary.js +28 -0
  137. package/dist/dashboard/page-summary.module.css +89 -0
  138. package/dist/dashboard/page-summary.module.css.d.ts +15 -0
  139. package/dist/dashboard/query-state.d.ts +1 -1
  140. package/dist/dashboard/query-state.d.ts.map +1 -1
  141. package/dist/dashboard/query-state.js +3 -2
  142. package/dist/dashboard/section.d.ts +25 -2
  143. package/dist/dashboard/section.d.ts.map +1 -1
  144. package/dist/dashboard/section.js +10 -5
  145. package/dist/dashboard/section.module.css +23 -0
  146. package/dist/dashboard/section.module.css.d.ts +1 -0
  147. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  148. package/dist/dashboard/stat-card-parts.js +1 -1
  149. package/dist/dashboard/stat-card.d.ts +4 -2
  150. package/dist/dashboard/stat-card.d.ts.map +1 -1
  151. package/dist/dashboard/stat-card.js +7 -4
  152. package/dist/dashboard/stat-card.module.css +17 -0
  153. package/dist/dashboard/stat-strip.d.ts +24 -1
  154. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  155. package/dist/dashboard/stat-strip.js +97 -39
  156. package/dist/dashboard/stat-strip.module.css +147 -17
  157. package/dist/dashboard/stat-strip.module.css.d.ts +8 -0
  158. package/dist/dashboard/visual-slot.d.ts +8 -0
  159. package/dist/dashboard/visual-slot.d.ts.map +1 -0
  160. package/dist/dashboard/visual-slot.js +7 -0
  161. package/dist/guard/index.d.ts +15 -2
  162. package/dist/guard/index.d.ts.map +1 -1
  163. package/dist/guard/index.js +14 -0
  164. package/dist/guard/palette.d.ts +51 -0
  165. package/dist/guard/palette.d.ts.map +1 -0
  166. package/dist/guard/palette.js +190 -0
  167. package/dist/guard/series-file.d.ts +15 -0
  168. package/dist/guard/series-file.d.ts.map +1 -0
  169. package/dist/guard/series-file.js +29 -0
  170. package/dist/guard/types.d.ts +3 -3
  171. package/dist/guard/types.d.ts.map +1 -1
  172. package/dist/guard/vx-names.d.ts.map +1 -1
  173. package/dist/guard/vx-names.js +2 -0
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +3 -1
  177. package/dist/styles.css +34 -2
  178. package/dist/surfaces.d.ts +1 -1
  179. package/dist/surfaces.d.ts.map +1 -1
  180. package/dist/surfaces.js +2 -0
  181. package/dist/theme/chrome-vars.d.ts +20 -5
  182. package/dist/theme/chrome-vars.d.ts.map +1 -1
  183. package/dist/theme/chrome-vars.js +46 -3
  184. package/dist/theme/controls.module.css +33 -0
  185. package/dist/theme/controls.module.css.d.ts +1 -0
  186. package/dist/theme/index.d.ts.map +1 -1
  187. package/dist/theme/index.js +11 -5
  188. package/dist/tokens/core.d.ts +2 -1
  189. package/dist/tokens/core.d.ts.map +1 -1
  190. package/dist/tokens/core.js +6 -1
  191. package/dist/tokens/derive.d.ts +3 -1
  192. package/dist/tokens/derive.d.ts.map +1 -1
  193. package/dist/tokens/derive.js +16 -1
  194. package/dist/tokens/oklab.d.ts +28 -0
  195. package/dist/tokens/oklab.d.ts.map +1 -0
  196. package/dist/tokens/oklab.js +73 -0
  197. package/dist/tokens/palette.d.ts +4 -0
  198. package/dist/tokens/palette.d.ts.map +1 -1
  199. package/dist/tokens/palette.js +4 -0
  200. package/dist/tokens/status-text.d.ts.map +1 -1
  201. package/dist/tokens/status-text.js +3 -1
  202. package/llms.txt +43 -23
  203. package/package.json +1 -1
  204. package/src/charts/BandStrip.tsx +33 -3
  205. package/src/charts/Bars.tsx +6 -0
  206. package/src/charts/CartesianChart.tsx +16 -3
  207. package/src/charts/ChartCard.tsx +43 -7
  208. package/src/charts/DualPanel.tsx +3 -6
  209. package/src/charts/Heatmap.tsx +54 -5
  210. package/src/charts/Lines.tsx +56 -10
  211. package/src/charts/MirroredBars.tsx +3 -5
  212. package/src/charts/Sparkline.tsx +50 -13
  213. package/src/charts/StackedArea.tsx +14 -4
  214. package/src/charts/band-fold.ts +31 -1
  215. package/src/charts/chart-box.module.css +19 -0
  216. package/src/charts/chart-card.module.css +25 -0
  217. package/src/charts/chart-legend.module.css +7 -0
  218. package/src/charts/compile.ts +210 -85
  219. package/src/charts/labels.ts +48 -14
  220. package/src/charts/legend.tsx +10 -20
  221. package/src/charts/marks.ts +1 -1
  222. package/src/charts/panel.tsx +1 -16
  223. package/src/charts/ref-label.ts +104 -0
  224. package/src/charts/scales.ts +22 -2
  225. package/src/charts/sparkline.module.css +10 -11
  226. package/src/charts/sparkline.module.css.d.ts +1 -2
  227. package/src/charts/state.tsx +12 -1
  228. package/src/charts/types.ts +14 -5
  229. package/src/cli/check-theme.ts +3 -0
  230. package/src/cli/doctor-upgrade.ts +1 -1
  231. package/src/cli/help.ts +18 -1
  232. package/src/cli/index.ts +48 -17
  233. package/src/cli/init.ts +102 -4
  234. package/src/cli/shot/capture.ts +266 -34
  235. package/src/cli/shot/detect.ts +550 -0
  236. package/src/cli/shot/index.ts +8 -4
  237. package/src/cli/shot/measure.ts +4 -0
  238. package/src/cli/shot/playwright.ts +2 -2
  239. package/src/cli/shot/types.ts +8 -1
  240. package/src/cli/sync.ts +4 -2
  241. package/src/common/retry-button.module.css +58 -0
  242. package/src/common/retry-button.module.css.d.ts +8 -0
  243. package/src/common/retry-button.tsx +29 -0
  244. package/src/controls/controls.module.css +11 -1
  245. package/src/controls/filter-pill.tsx +2 -0
  246. package/src/controls/sync-button.module.css +34 -2
  247. package/src/controls/sync-button.module.css.d.ts +1 -0
  248. package/src/controls/sync-button.tsx +40 -4
  249. package/src/dashboard/bar-list.module.css +53 -0
  250. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  251. package/src/dashboard/bar-list.tsx +88 -76
  252. package/src/dashboard/index.ts +1 -0
  253. package/src/dashboard/meter-model.ts +265 -28
  254. package/src/dashboard/meter-parts.tsx +424 -163
  255. package/src/dashboard/meter.module.css +79 -65
  256. package/src/dashboard/meter.module.css.d.ts +7 -7
  257. package/src/dashboard/meter.tsx +77 -17
  258. package/src/dashboard/page-summary.module.css +89 -0
  259. package/src/dashboard/page-summary.module.css.d.ts +15 -0
  260. package/src/dashboard/page-summary.tsx +95 -0
  261. package/src/dashboard/query-state.tsx +4 -7
  262. package/src/dashboard/section.module.css +23 -0
  263. package/src/dashboard/section.module.css.d.ts +1 -0
  264. package/src/dashboard/section.tsx +59 -11
  265. package/src/dashboard/stat-card-parts.tsx +5 -1
  266. package/src/dashboard/stat-card.module.css +17 -0
  267. package/src/dashboard/stat-card.tsx +14 -5
  268. package/src/dashboard/stat-strip.module.css +147 -17
  269. package/src/dashboard/stat-strip.module.css.d.ts +8 -0
  270. package/src/dashboard/stat-strip.tsx +182 -56
  271. package/src/dashboard/visual-slot.ts +17 -0
  272. package/src/guard/index.ts +16 -4
  273. package/src/guard/palette.ts +261 -0
  274. package/src/guard/series-file.ts +51 -0
  275. package/src/guard/types.ts +3 -2
  276. package/src/guard/vx-names.ts +2 -0
  277. package/src/index.ts +2 -0
  278. package/src/styles.css +34 -2
  279. package/src/surfaces.ts +2 -0
  280. package/src/theme/__snapshots__/plain-theme.test.ts.snap +220 -60
  281. package/src/theme/chrome-vars.ts +77 -8
  282. package/src/theme/controls.module.css +33 -0
  283. package/src/theme/controls.module.css.d.ts +1 -0
  284. package/src/theme/index.ts +18 -5
  285. package/src/tokens/core.ts +4 -1
  286. package/src/tokens/derive.ts +32 -3
  287. package/src/tokens/oklab.ts +97 -0
  288. package/src/tokens/palette.ts +4 -0
  289. package/src/tokens/status-text.ts +2 -0
@@ -110,12 +110,17 @@ export function inkVars(props: {
110
110
  return INK_BY_VARIANT[variant as keyof typeof INK_BY_VARIANT] ?? {}
111
111
  }
112
112
 
113
+ /** The selected `pills` Tab: one ink step over the panel, the same neutral the SegmentedControl indicator uses. */
114
+ const PILL_FILL = 'color-mix(in srgb, var(--vx-ink) 12%, var(--vx-surface-panel))'
115
+
113
116
  /**
114
- * Tabs vars: the on-color re-point plus the active underline in ink (SPEC § 6.12). Only the
115
- * underline `default` variant takes ink (`pills` fills with the colour); an explicit `color=` opts
116
- * out. The return type lists `--tabs-text-color` and `--tabs-radius` because Mantine's
117
- * `TabsCssVariables` type declares only `--tabs-color` / `--tabs-radius` while Tabs' OWN
118
- * varsResolver writes `--tabs-text-color` (an upstream type gap).
117
+ * Tabs vars: the selected tab reads by ink and weight, never the accent (SPEC § 6.12; DESIGN-CORE
118
+ * § Accent discipline). `default` and `outline` paint their active underline/border from
119
+ * `--tabs-color`, so that is ink; `pills` fills the tab with it, so the fill is an ink-mixed panel
120
+ * and the label (`--tabs-text-color`) is ink, not the on-accent white. An explicit `color=` opts out
121
+ * of all three and keeps the on-color text var. The return type lists `--tabs-text-color` and
122
+ * `--tabs-radius` because Mantine's `TabsCssVariables` type declares only `--tabs-color` /
123
+ * `--tabs-radius` while Tabs' OWN varsResolver writes `--tabs-text-color` (an upstream type gap).
119
124
  */
120
125
  export function tabsVars(
121
126
  theme: MantineTheme,
@@ -125,12 +130,76 @@ export function tabsVars(
125
130
  autoContrast?: boolean | undefined
126
131
  },
127
132
  ): { root: Record<'--tabs-color' | '--tabs-radius' | '--tabs-text-color', string | undefined> } {
128
- const underline = !hasExplicitColor(props.color) && (props.variant ?? 'default') === 'default'
133
+ if (hasExplicitColor(props.color)) {
134
+ return {
135
+ root: {
136
+ '--tabs-text-color': onColorFor(theme, props),
137
+ '--tabs-color': undefined,
138
+ '--tabs-radius': undefined,
139
+ },
140
+ }
141
+ }
142
+ const pills = props.variant === 'pills'
129
143
  return {
130
144
  root: {
131
- '--tabs-text-color': onColorFor(theme, props),
132
- '--tabs-color': underline ? 'var(--vx-ink)' : undefined,
145
+ '--tabs-text-color': pills ? INK : onColorFor(theme, props),
146
+ '--tabs-color': pills ? PILL_FILL : INK,
133
147
  '--tabs-radius': undefined,
134
148
  },
135
149
  }
136
150
  }
151
+
152
+ /** The dot's colour: a theme colour's fill, an indexed shade's own var (`red.6`), or the caller's literal (hex, var). */
153
+ function dotColor(theme: MantineTheme, color: string): string {
154
+ if (Object.hasOwn(theme.colors, color)) return `var(--mantine-color-${color}-filled)`
155
+ const [name, shade] = color.split('.')
156
+ if (
157
+ name !== undefined &&
158
+ shade !== undefined &&
159
+ /^\d$/.test(shade) &&
160
+ Object.hasOwn(theme.colors, name)
161
+ ) {
162
+ return `var(--mantine-color-${name}-${shade})`
163
+ }
164
+ return color
165
+ }
166
+
167
+ /**
168
+ * Badge vars (SPEC § 6.10): the status chip is the neutral surface with an ink word, and a named
169
+ * colour is a leading status dot, not a tinted slab (W36 r3/r6 "tinted status Badges"). Only the
170
+ * `light` variant (the theme default); `filled`, `outline`, `dot` and `default` keep their meaning —
171
+ * a `filled` accent count is the one tinted-chrome case that stays. Any colour the caller gives (theme name, indexed shade, hex, var) becomes the dot; `gray` is the
172
+ * no-signal chip. A `leftSection` glyph replaces the dot.
173
+ */
174
+ export function badgeVars(
175
+ theme: MantineTheme,
176
+ props: { color?: string | null | undefined; variant?: string | undefined },
177
+ ): {
178
+ root: Record<
179
+ '--badge-bg' | '--badge-color' | '--badge-dot' | '--badge-dot-content' | '--badge-dot-cols',
180
+ string | undefined
181
+ >
182
+ } {
183
+ const none = {
184
+ '--badge-bg': undefined,
185
+ '--badge-color': undefined,
186
+ '--badge-dot': undefined,
187
+ '--badge-dot-content': undefined,
188
+ '--badge-dot-cols': undefined,
189
+ }
190
+ if ((props.variant ?? 'light') !== 'light') return { root: none }
191
+ const name = props.color ?? 'gray'
192
+ const dot = name === 'gray' ? undefined : dotColor(theme, name)
193
+ return {
194
+ root: {
195
+ ...none,
196
+ '--badge-bg': SUBTLE,
197
+ '--badge-color': INK,
198
+ ...(dot !== undefined && {
199
+ '--badge-dot': dot,
200
+ '--badge-dot-content': "''",
201
+ '--badge-dot-cols': 'auto 1fr',
202
+ }),
203
+ },
204
+ }
205
+ }
@@ -135,6 +135,16 @@ html[data-mantine-color-scheme] .inputWrapper[data-variant='default']:not([data-
135
135
  transition: box-shadow 120ms ease;
136
136
  }
137
137
 
138
+ /* Section-side inset on the stack scale (`buttonSectionX`, theme/index.ts) — beats Mantine's
139
+ * zero-specificity `:where([data-with-*-section])` `padding-x / 1.5`. */
140
+ .buttonRoot[data-with-left-section] {
141
+ padding-inline-start: var(--button-section-padding-x, calc(var(--button-padding-x) / 1.5));
142
+ }
143
+
144
+ .buttonRoot[data-with-right-section] {
145
+ padding-inline-end: var(--button-section-padding-x, calc(var(--button-padding-x) / 1.5));
146
+ }
147
+
138
148
  .buttonRoot[data-variant='default'],
139
149
  .buttonRoot[data-variant='filled'],
140
150
  .buttonRoot[data-variant='light'] {
@@ -190,6 +200,11 @@ html[data-mantine-color-scheme] .inputWrapper[data-variant='default']:not([data-
190
200
  .actionIconRoot:disabled:not([data-loading]),
191
201
  .actionIconRoot[data-disabled]:not([data-loading]) {
192
202
  --ctrl-depth: 0 0 transparent;
203
+
204
+ /* One surface in both schemes. Mantine's disabled fill is a gray step that is the PANEL itself in
205
+ * dark, so a disabled Button there read as the subtle variant with dimmer text; an ink-mixed panel
206
+ * is visible on either page, and the state is told apart by more than ink. */
207
+ background: color-mix(in srgb, var(--vx-ink) 8%, var(--vx-surface-panel));
193
208
  }
194
209
 
195
210
  /*
@@ -308,6 +323,24 @@ html .tableRoot tbody tr:last-of-type {
308
323
  border-bottom: none;
309
324
  }
310
325
 
326
+ /*
327
+ * Badge status dot: a coloured `light` Badge is the neutral surface + ink word with a leading dot in the
328
+ * status colour (`badgeVars` writes the `--badge-dot*` vars; nothing here without them). The dot is a
329
+ * grid item, so the root takes two columns while it is shown. A section (left or right) replaces it.
330
+ */
331
+ .badgeRoot[data-variant='light']:not([data-with-left-section], [data-with-right-section]) {
332
+ grid-template-columns: var(--badge-dot-cols, none);
333
+ column-gap: calc(0.25rem * var(--mantine-scale));
334
+ }
335
+
336
+ .badgeRoot[data-variant='light']:not([data-with-left-section], [data-with-right-section])::before {
337
+ content: var(--badge-dot-content, none);
338
+ width: calc(0.375rem * var(--mantine-scale));
339
+ height: calc(0.375rem * var(--mantine-scale));
340
+ border-radius: 50%;
341
+ background: var(--badge-dot);
342
+ }
343
+
311
344
  /*
312
345
  * Badge leading glyph (`leftSection`): the state encoded by shape. 12px on a 20px chip, 4px gap
313
346
  * (Mantine's own section margin is spacing.xs / 2 = 4), centred on the label.
@@ -13,6 +13,7 @@ declare const classes: {
13
13
  readonly accordionItem: string
14
14
  readonly tabsRoot: string
15
15
  readonly tableRoot: string
16
+ readonly badgeRoot: string
16
17
  readonly badgeSection: string
17
18
  }
18
19
  export default classes
@@ -86,7 +86,7 @@ import { CTL_HEIGHT_VARS } from '../tokens/ctl-vars'
86
86
  import type { CtlHeightVar } from '../tokens/ctl-vars'
87
87
  import { SIZE_CLASS_BREAKPOINTS } from '../tokens/size-classes'
88
88
  import type { BasaltFontsConfig } from '../tokens/core'
89
- import { onColor, onColorFor, inkVars, tabsVars } from './chrome-vars'
89
+ import { badgeVars, onColor, onColorFor, inkVars, tabsVars } from './chrome-vars'
90
90
  import cardInsetClasses from './card-inset.module.css'
91
91
  import controlsClasses from './controls.module.css'
92
92
  import floatingClasses from './floating.module.css'
@@ -505,10 +505,12 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
505
505
  },
506
506
  }),
507
507
  // Status chip (SPEC § 6.10): `light` + `tight`, neutral until `color=` opts in (the accent is
508
- // never a status chip's default); a `leftSection` glyph is sized in `badgeSection`.
508
+ // never a status chip's default). The neutral surface + ink word is the chip; a named colour is
509
+ // a leading dot (`badgeVars`); a `leftSection` glyph is sized in `badgeSection`.
509
510
  Badge: ext<typeof Badge>({
510
511
  defaultProps: { variant: 'light', color: 'gray', radius: radius.tight },
511
- classNames: { section: controlsClasses.badgeSection },
512
+ classNames: { root: controlsClasses.badgeRoot, section: controlsClasses.badgeSection },
513
+ vars: badgeVars,
512
514
  }),
513
515
  // Alert renders its title in the body font by default; bring it onto the head-font idiom
514
516
  // (docs/DESIGN-SPEC.md §5) like every other titled surface. Radius/padding/color tint are
@@ -690,6 +692,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
690
692
  ? 'calc(var(--vx-space-control-height) * var(--mantine-scale))'
691
693
  : undefined,
692
694
  '--button-padding-x': buttonPaddingX(props.size),
695
+ '--button-section-padding-x': buttonSectionX(props.size),
693
696
  '--button-color': ink.color,
694
697
  '--button-hover': ink.hover,
695
698
  '--button-bg': ink.bg,
@@ -1080,8 +1083,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
1080
1083
  // The tab-list bottom rule (and the inactive-tab hover underline) is a layout separator, not
1081
1084
  // control chrome — it reads the divider token instead of the heavy gray-3/dark-4 line
1082
1085
  // (controls.module.css; custom properties are stripped from `styles` objects). The active tab
1083
- // underline takes ink, not the accent (SPEC § 6.12; DESIGN-CORE § Accent discipline);
1084
- // `color=` opts back in. Only the underline `default` variant — `pills` fills with the colour.
1086
+ // underline, outline border and pill fill take ink, not the accent (SPEC § 6.12; DESIGN-CORE
1087
+ // § Accent discipline); `color=` opts back in.
1085
1088
  Tabs: ext<typeof Tabs>({
1086
1089
  classNames: { root: controlsClasses.tabsRoot },
1087
1090
  vars: tabsVars,
@@ -1255,6 +1258,16 @@ function buttonPaddingX(size: unknown): string | undefined {
1255
1258
  return steps === undefined ? undefined : `calc((${steps}) * var(--mantine-scale))`
1256
1259
  }
1257
1260
 
1261
+ /**
1262
+ * The inset on a Button's section side EQUALS its text side, so an icon Button is balanced (Mantine
1263
+ * derives it as `--button-padding-x / 1.5`, which also left the icon side one step tighter than the
1264
+ * text side: 8/12, 12/16, 12/20). `ctl` has its own `--button-padding-x-ctl`; undefined sizes keep
1265
+ * Mantine's value.
1266
+ */
1267
+ function buttonSectionX(size: unknown): string | undefined {
1268
+ return size === 'ctl' ? 'var(--button-padding-x-ctl)' : buttonPaddingX(size)
1269
+ }
1270
+
1258
1271
  /**
1259
1272
  * The `ctl` tier's horizontal inset — one number for a Button, a `FilterPill`, a SegmentedControl
1260
1273
  * segment and a `kind: 'custom'` Badge, so a home's row reads as one control family
@@ -165,7 +165,6 @@ export const VX = {
165
165
  // "dev slider/production JS defaultProps" gap as Timeline's `bulletSize` — see `deriveSpacing`'s
166
166
  // doc in tokens/palette.ts).
167
167
  legendGap: SPACE_STEP.chartLegendGap,
168
- legendFontSize: TEXT.sm,
169
168
 
170
169
  // The type scale (px numbers — see TEXT above). Use in inline styles and visx SVG props;
171
170
  // use `var(--vx-text-*)` in CSS modules.
@@ -273,6 +272,8 @@ export const VX = {
273
272
  bg: 'var(--vx-surface-bg)',
274
273
  panel: 'var(--vx-surface-panel)',
275
274
  panelHover: 'var(--vx-surface-panel-hover)',
275
+ rowHover: 'var(--vx-surface-row-hover)', // a hovered row on a panel, visible in both schemes
276
+ rowSelected: 'var(--vx-surface-row-selected)', // a selected row on a panel
276
277
  elevated: 'var(--vx-surface-elevated)',
277
278
  subtle: 'var(--vx-surface-subtle)',
278
279
  overlay: 'var(--vx-surface-overlay)', // floating layer (menus, popovers, modals, drawers)
@@ -414,6 +415,8 @@ function frameworkPrimitives(side: Side, data: PaletteData): string {
414
415
  decl('surface-bg', su.bg[side]),
415
416
  decl('surface-panel', su.panel[side]),
416
417
  decl('surface-panel-hover', su.panelHover[side]),
418
+ decl('surface-row-hover', su.rowHover[side]),
419
+ decl('surface-row-selected', su.rowSelected[side]),
417
420
  decl('surface-elevated', su.elevated[side]),
418
421
  decl('surface-subtle', su.subtle[side]),
419
422
  decl('surface-overlay', su.overlay[side]),
@@ -279,8 +279,12 @@ export type SurfaceKey =
279
279
  | 'field'
280
280
  | 'border'
281
281
  | 'hairline'
282
+ | RowSurfaceKey
282
283
 
283
- const SURFACE_TONE: Record<Side, Record<SurfaceKey, number>> = {
284
+ /** The row surfaces: the panel mixed toward the ink, not a tone stop of their own. */
285
+ export type RowSurfaceKey = 'rowHover' | 'rowSelected'
286
+
287
+ const SURFACE_TONE: Record<Side, Record<Exclude<SurfaceKey, RowSurfaceKey>, number>> = {
284
288
  light: {
285
289
  bg: 93.45,
286
290
  panel: 96.21,
@@ -303,6 +307,22 @@ const SURFACE_TONE: Record<Side, Record<SurfaceKey, number>> = {
303
307
  },
304
308
  }
305
309
 
310
+ // Ink share of a row surface, per scheme. Hover must clear the `panelHover` step's contrast against the
311
+ // panel (the dark step is the larger, 5.7 tones vs 2.1); selected sits one step above. Light stays
312
+ // shallow so tertiary text and status text keep their margin on a selected row.
313
+ const ROW_INK_MIX: Record<RowSurfaceKey, Record<Side, number>> = {
314
+ rowHover: { light: 0.05, dark: 0.07 },
315
+ rowSelected: { light: 0.075, dark: 0.09 },
316
+ }
317
+
318
+ /** `a` toward `b` by `t` per sRGB channel — the hex twin of `color-mix(in srgb, b t%, a)`. */
319
+ function mixHex(a: string, b: string, t: number): string {
320
+ const channel = (hex: string, i: number): number =>
321
+ Number.parseInt(hex.slice(1 + 2 * i, 3 + 2 * i), 16)
322
+ const out = [0, 1, 2].map((i) => Math.round(channel(a, i) * (1 - t) + channel(b, i) * t))
323
+ return `#${out.map((c) => c.toString(16).padStart(2, '0')).join('')}`
324
+ }
325
+
306
326
  // Ink ramp tone stops (achromatic). NOT shifted by lightLevel/darkLevel — text tone stays stable
307
327
  // while surfaces move around it.
308
328
  export type InkKey = 'ink' | 'ink2' | 'muted' | 'faint'
@@ -311,7 +331,7 @@ const INK_TONE: Record<Side, Record<InkKey, number>> = {
311
331
  // light `faint` is tone 44.5 so tertiary text clears WCAG AA (4.5:1) on every text surface
312
332
  // (bg / panel / subtle / field); 48.44 landed at 4.23–4.31:1 on bg and subtle.
313
333
  light: { ink: 15.16, ink2: 27.09, muted: 34.88, faint: 44.5 },
314
- dark: { ink: 90.94, ink2: 88.12, muted: 84.91, faint: 66.24 },
334
+ dark: { ink: 90.94, ink2: 88.12, muted: 84.91, faint: 68.5 },
315
335
  }
316
336
 
317
337
  // ── Status/semantic — three baked hues, each with its own calibrated tone+chroma stop per scheme.
@@ -437,7 +457,7 @@ export function deriveTokensRaw(
437
457
  }
438
458
 
439
459
  const surface = {} as Record<SurfaceKey, ColorPair>
440
- for (const key of Object.keys(SURFACE_TONE.light) as SurfaceKey[]) {
460
+ for (const key of Object.keys(SURFACE_TONE.light) as Exclude<SurfaceKey, RowSurfaceKey>[]) {
441
461
  surface[key] = {
442
462
  light: hctToHex({
443
463
  hue: neutral.hue,
@@ -460,6 +480,15 @@ export function deriveTokensRaw(
460
480
  }
461
481
  }
462
482
 
483
+ // Row hover/selected: the panel one ink step along, so both read in both schemes (`panelHover`
484
+ // is LIGHTER than `panel` in light and vanishes on it). `row-surfaces.test.ts` pins the floor.
485
+ for (const key of Object.keys(ROW_INK_MIX) as RowSurfaceKey[]) {
486
+ surface[key] = {
487
+ light: mixHex(surface.panel.light, ink.ink.light, ROW_INK_MIX[key].light),
488
+ dark: mixHex(surface.panel.dark, ink.ink.dark, ROW_INK_MIX[key].dark),
489
+ }
490
+ }
491
+
463
492
  const status = deriveStatusHexes(surface)
464
493
 
465
494
  return {
@@ -0,0 +1,97 @@
1
+ /**
2
+ * OKLab / OKLCH and colour-vision-deficiency simulation — Mantine-free, dependency-free.
3
+ *
4
+ * OKLab is Ottosson's definition (https://bottosson.github.io/posts/oklab/); the CVD matrices are
5
+ * Machado, Oliveira & Fernandes (2009), "A Physiologically-based Model for Simulation of Color
6
+ * Vision Deficiency", severity 1.0, applied to LINEAR sRGB. `deltaEOk` is the Euclidean OKLab
7
+ * distance ×100, the unit the series-palette guard's thresholds are written in.
8
+ */
9
+
10
+ export type Oklab = { L: number; a: number; b: number }
11
+ export type Oklch = { L: number; C: number; h: number }
12
+ export type CvdKind = 'protan' | 'deutan'
13
+
14
+ type Rgb = readonly [number, number, number]
15
+ type Matrix = readonly [Rgb, Rgb, Rgb]
16
+
17
+ const MACHADO: Record<CvdKind, Matrix> = {
18
+ protan: [
19
+ [0.152286, 1.052583, -0.204868],
20
+ [0.114503, 0.786281, 0.099216],
21
+ [-0.003882, -0.048116, 1.051998],
22
+ ],
23
+ deutan: [
24
+ [0.367322, 0.860646, -0.227968],
25
+ [0.280085, 0.672501, 0.047413],
26
+ [-0.01182, 0.04294, 0.968881],
27
+ ],
28
+ }
29
+
30
+ function hexToLinear(hex: string): Rgb {
31
+ const raw = hex.replace('#', '')
32
+ const full = raw.length === 3 ? [...raw].map((c) => c + c).join('') : raw.slice(0, 6)
33
+ const channel = (i: number) => {
34
+ const c = Number.parseInt(full.slice(i, i + 2), 16) / 255
35
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
36
+ }
37
+ return [channel(0), channel(2), channel(4)]
38
+ }
39
+
40
+ function linearToHex([r, g, b]: Rgb): string {
41
+ const encode = (c: number) => {
42
+ const v = Math.min(1, Math.max(0, c))
43
+ const s = v <= 0.0031308 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055
44
+ return Math.round(s * 255)
45
+ .toString(16)
46
+ .padStart(2, '0')
47
+ }
48
+ return `#${encode(r)}${encode(g)}${encode(b)}`
49
+ }
50
+
51
+ function linearToOklab([r, g, b]: Rgb): Oklab {
52
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
53
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
54
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
55
+ return {
56
+ L: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
57
+ a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
58
+ b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
59
+ }
60
+ }
61
+
62
+ export function hexToOklab(hex: string): Oklab {
63
+ return linearToOklab(hexToLinear(hex))
64
+ }
65
+
66
+ export function hexToOklch(hex: string): Oklch {
67
+ const { L, a, b } = hexToOklab(hex)
68
+ const h = (Math.atan2(b, a) * 180) / Math.PI
69
+ return { L, C: Math.hypot(a, b), h: h < 0 ? h + 360 : h }
70
+ }
71
+
72
+ /** Euclidean OKLab distance ×100 between two hex colours. */
73
+ export function deltaEOk(hexA: string, hexB: string): number {
74
+ const x = hexToOklab(hexA)
75
+ const y = hexToOklab(hexB)
76
+ return 100 * Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b)
77
+ }
78
+
79
+ /** What a dichromat sees for `hex`, still in clamped linear RGB (Machado 2009, severity 1.0). */
80
+ function simulateCvdLinear(hex: string, kind: CvdKind): Rgb {
81
+ const [r, g, b] = hexToLinear(hex)
82
+ const [row0, row1, row2] = MACHADO[kind]
83
+ const mix = (row: Rgb) => Math.min(1, Math.max(0, row[0] * r + row[1] * g + row[2] * b))
84
+ return [mix(row0), mix(row1), mix(row2)]
85
+ }
86
+
87
+ /** The hex a dichromat sees for `hex` — for display and tests; the checks stay in linear RGB. */
88
+ export function simulateCvd(hex: string, kind: CvdKind): string {
89
+ return linearToHex(simulateCvdLinear(hex, kind))
90
+ }
91
+
92
+ /** OKLab ΔE×100 between two colours as a dichromat sees them — no 8-bit round trip. */
93
+ export function deltaEOkCvd(hexA: string, hexB: string, kind: CvdKind): number {
94
+ const x = linearToOklab(simulateCvdLinear(hexA, kind))
95
+ const y = linearToOklab(simulateCvdLinear(hexB, kind))
96
+ return 100 * Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b)
97
+ }
@@ -1332,6 +1332,10 @@ function buildPaletteDataUncached(config: DeriveConfig) {
1332
1332
  bg: DERIVED.surface.bg, // page background
1333
1333
  panel: DERIVED.surface.panel, // cards, controls
1334
1334
  panelHover: DERIVED.surface.panelHover,
1335
+ // Row hover / selected on a panel — the panel one ink step along (`derive.ts`), visible in both
1336
+ // schemes where `panelHover` (lighter than `panel` in light) is not.
1337
+ rowHover: DERIVED.surface.rowHover,
1338
+ rowSelected: DERIVED.surface.rowSelected,
1335
1339
  // Elevated surface (chart area, `--mantine-color-default-hover`) — same lift as panel-hover.
1336
1340
  elevated: DERIVED.surface.elevated,
1337
1341
  border: DERIVED.surface.border, // "line" — strong border (layout/control chrome, NOT the card ring)
@@ -34,6 +34,8 @@ export const STATUS_TEXT_SURFACES: Readonly<Record<SurfaceKey, boolean>> = {
34
34
  field: true,
35
35
  border: false,
36
36
  hairline: false,
37
+ rowHover: true,
38
+ rowSelected: true,
37
39
  }
38
40
 
39
41
  export const STATUS_TEXT_CONTRAST_MIN = 4.5