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
@@ -14,10 +14,6 @@
14
14
  --basalt-meter-caption: var(--vx-text-micro);
15
15
  }
16
16
 
17
- .root.zoned {
18
- position: relative;
19
- }
20
-
21
17
  .track {
22
18
  position: relative;
23
19
  display: flex;
@@ -32,6 +28,26 @@
32
28
  position: relative;
33
29
  }
34
30
 
31
+ /* A `stops` track is one gradient through the consumer's colours; the reading is a marker on it. */
32
+ .track[data-meter-stops] {
33
+ background: linear-gradient(var(--basalt-stop-dir, to right), var(--basalt-stops));
34
+ }
35
+
36
+ .trackBox:dir(rtl) {
37
+ --basalt-stop-dir: to left;
38
+ }
39
+
40
+ /* `track={false}`: no drawn track, still in the accessibility tree (the role and value stay). */
41
+ .trackHidden {
42
+ position: absolute;
43
+ width: 1px;
44
+ height: 1px;
45
+ margin: -1px;
46
+ overflow: hidden;
47
+ clip-path: inset(50%);
48
+ white-space: nowrap;
49
+ }
50
+
35
51
  .fill {
36
52
  flex: none;
37
53
  height: 100%;
@@ -57,56 +73,46 @@
57
73
  }
58
74
 
59
75
  /*
60
- * Zone names under the band: absolutely placed at each band start so they stay on the band. When
61
- * they would collide the band collapses (hidden but still laid out, so it can be re-measured) and the
62
- * same names wrap as a list. The holding zone is ink, the rest muted.
76
+ * The one label row under (or, for a plain tick Meter, above) the track: zone names centred on their
77
+ * spans, labelled ticks hugging their marks, all absolutely placed on one baseline. A label that does
78
+ * not fit is hidden but stays laid out, so a resize can measure it again.
63
79
  */
64
- .zoneBand {
80
+ .labelRow {
81
+ --basalt-reading-dir: 1;
65
82
  position: relative;
66
- /* Labels are absolutely placed, so the row needs its own line height. */
83
+ /* A hidden name keeps its box (so it can be measured again) and may sit past the row's end. */
84
+ overflow-x: clip;
67
85
  height: 1.25em;
86
+ /* Read by the layout: the least two captions keep apart (one gap step). */
87
+ column-gap: var(--vx-space-control-gap, 0.375rem);
68
88
  font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
69
89
  font-variant-numeric: lining-nums;
70
90
  font-size: var(--basalt-meter-caption);
71
91
  color: var(--vx-muted);
72
92
  }
73
93
 
74
- /*
75
- * Hidden but laid out, so a resize can measure it again. Absolute against `.root.zoned`, which has
76
- * no inline padding, so `inset-inline: 0` gives the band the same width as when it was in flow.
77
- */
78
- .zoneBand[data-collapsed] {
79
- position: absolute;
80
- top: 0;
81
- inset-inline: 0;
82
- visibility: hidden;
83
- pointer-events: none;
94
+ .labelRow:dir(rtl) {
95
+ --basalt-reading-dir: -1;
84
96
  }
85
97
 
86
- .zoneLabel {
98
+ .rowLabel {
87
99
  position: absolute;
88
100
  top: 0;
89
101
  white-space: nowrap;
90
102
  }
91
103
 
92
- .zoneLabelHolding {
93
- font-weight: 500;
94
- color: var(--vx-ink);
104
+ .rowLabel[data-hidden] {
105
+ visibility: hidden;
95
106
  }
96
107
 
97
- .zoneList {
98
- display: flex;
99
- flex-wrap: wrap;
100
- gap: var(--vx-space-stack-xs) var(--vx-space-stack-sm);
101
- font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
102
- font-variant-numeric: lining-nums;
103
- font-size: var(--basalt-meter-caption);
104
- color: var(--vx-muted);
108
+ /* A zone name is centred on its span: the physical `translate` flips sign in RTL. */
109
+ .zoneLabel {
110
+ translate: calc(-50% * var(--basalt-reading-dir)) 0;
105
111
  }
106
112
 
107
- .zoneListItem {
108
- min-width: 0;
109
- overflow-wrap: anywhere;
113
+ .zoneLabelHolding {
114
+ font-weight: 500;
115
+ color: var(--vx-ink);
110
116
  }
111
117
 
112
118
  /* The reading under the band, centred on the marker. Clipped so it never widens the row before the first measure. */
@@ -180,6 +186,20 @@
180
186
  color: var(--vx-muted);
181
187
  }
182
188
 
189
+ /* Captions at their marks: each is placed (inline `inset-inline-start`) by the measured layout. */
190
+ .captionsAnchored {
191
+ position: relative;
192
+ display: block;
193
+ height: 1lh;
194
+ }
195
+
196
+ .captionsAnchored > * {
197
+ position: absolute;
198
+ top: 0;
199
+ margin: 0;
200
+ white-space: nowrap;
201
+ }
202
+
183
203
  /* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
184
204
  .caption {
185
205
  min-width: 0;
@@ -223,6 +243,20 @@
223
243
  overflow-wrap: anywhere;
224
244
  }
225
245
 
246
+ /* Every part's caption fits under its own segment: the list is positioned, not wrapped. */
247
+ .partCaptionsUnder {
248
+ position: relative;
249
+ display: block;
250
+ height: 1lh;
251
+ }
252
+
253
+ /* Under its segment a caption is one line by construction: it was measured to fit as one. */
254
+ .partCaptionsUnder > .partCaption {
255
+ position: absolute;
256
+ top: 0;
257
+ white-space: nowrap;
258
+ }
259
+
226
260
  /* A shape cue beside the name, so the part never reads by colour alone. */
227
261
  .swatch {
228
262
  flex: none;
@@ -281,6 +315,17 @@
281
315
  stroke: var(--vx-line);
282
316
  }
283
317
 
318
+ /* A ring tick: an ink mark with a track-coloured halo, so it reads over the arc and the track. */
319
+ .ringTick {
320
+ stroke: var(--vx-ink);
321
+ stroke-width: 1.5;
322
+ }
323
+
324
+ .ringTickHalo {
325
+ stroke: var(--vx-surface-subtle);
326
+ stroke-width: 3;
327
+ }
328
+
284
329
  .ringValue {
285
330
  position: relative;
286
331
  font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
@@ -295,37 +340,6 @@
295
340
  height: 5rem;
296
341
  }
297
342
 
298
- /* ── tick captions ───────────────────────────────────────────────────────────────────────────── */
299
-
300
- /* Above the track, so they never share a row with the zone names or the captions below it. */
301
- .tickLabels {
302
- position: relative;
303
- }
304
-
305
- .tickBand {
306
- position: relative;
307
- height: 1.25em;
308
- font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
309
- font-variant-numeric: lining-nums;
310
- font-size: var(--basalt-meter-caption);
311
- color: var(--vx-muted);
312
- }
313
-
314
- /* Hidden but laid out, so a resize can measure it again. */
315
- .tickBand[data-collapsed] {
316
- position: absolute;
317
- top: 0;
318
- inset-inline: 0;
319
- visibility: hidden;
320
- pointer-events: none;
321
- }
322
-
323
- .tickLabel {
324
- position: absolute;
325
- top: 0;
326
- white-space: nowrap;
327
- }
328
-
329
343
  /* ── size="row" ──────────────────────────────────────────────────────────────────────────────── */
330
344
 
331
345
  .row {
@@ -5,17 +5,16 @@
5
5
  declare const classes: {
6
6
  readonly root: string
7
7
  readonly summary: string
8
- readonly zoned: string
9
8
  readonly track: string
10
9
  readonly trackBox: string
10
+ readonly trackHidden: string
11
11
  readonly fill: string
12
12
  readonly forecastFill: string
13
13
  readonly zone: string
14
- readonly zoneBand: string
14
+ readonly labelRow: string
15
+ readonly rowLabel: string
15
16
  readonly zoneLabel: string
16
17
  readonly zoneLabelHolding: string
17
- readonly zoneList: string
18
- readonly zoneListItem: string
19
18
  readonly zoneReadingRow: string
20
19
  readonly zoneReading: string
21
20
  readonly marker: string
@@ -24,8 +23,10 @@ declare const classes: {
24
23
  readonly captions: string
25
24
  readonly caption: string
26
25
  readonly captionEnd: string
26
+ readonly captionsAnchored: string
27
27
  readonly partCaptions: string
28
28
  readonly partCaption: string
29
+ readonly partCaptionsUnder: string
29
30
  readonly swatch: string
30
31
  readonly empty: string
31
32
  readonly skeletonTrack: string
@@ -34,11 +35,10 @@ declare const classes: {
34
35
  readonly ring: string
35
36
  readonly ringTrack: string
36
37
  readonly ringArc: string
38
+ readonly ringTick: string
39
+ readonly ringTickHalo: string
37
40
  readonly ringValue: string
38
41
  readonly skeletonRing: string
39
- readonly tickLabels: string
40
- readonly tickBand: string
41
- readonly tickLabel: string
42
42
  readonly row: string
43
43
  }
44
44
  export default classes
@@ -4,9 +4,10 @@
4
4
  * along is this against a limit"; choose `BarList` for a ranking and a chart for a trend. An HTML/CSS
5
5
  * primitive, not a chart kind (no scale, axis or tooltip).
6
6
  *
7
- * Colour law: the fill is neutral (`VX.line`). `color` is for a VERDICT only (over budget, below
8
- * target) and is a status colour the consumer passes; categorical `segments` take the consumer's
9
- * series colours. Committed vs forecast is the same neutral at two strengths — never colour alone: a
7
+ * Colour law: a plain `value` bar's fill is neutral (`--vx-muted` at a strength that holds 3:1 on
8
+ * the track; `tone="ink"` for full ink); `segments` and `zones` keep their own fills. `color` is
9
+ * for a VERDICT only (over budget, below target) and is a status colour the consumer passes;
10
+ * categorical `segments` take the consumer's series colours. Committed vs forecast is the same neutral at two strengths — never colour alone: a
10
11
  * tick marks the boundary and a caption names the forecast. A value past `max` clamps the fill at the
11
12
  * track end; the caption still states the real value.
12
13
  *
@@ -50,12 +51,15 @@
50
51
  * />
51
52
  * <Meter shape="ring" label="Cache hit rate" value={87} max={100} format={(v) => `${v}%`} />
52
53
  */
54
+ import { useContext } from 'react'
53
55
  import type { ReactNode } from 'react'
54
56
  import type { BasaltProps } from '../common/props'
57
+ import { VX } from '../tokens'
55
58
  import { isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
56
59
  import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
57
60
  import { MeterBar, MeterEmpty, MeterLoading, MeterRing } from './meter-parts'
58
61
  import { asText } from './scale'
62
+ import { VisualSlotContext } from './visual-slot'
59
63
 
60
64
  type Common = BasaltProps & {
61
65
  /** Accessible name (`aria-label`). Required: a meter without one is announced as a bare number. */
@@ -78,26 +82,40 @@ type BarCommon = Common & {
78
82
  target?: number
79
83
  /**
80
84
  * More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
81
- * above the track, wrapping to a list when two collide. A tick outside `[min, max]` is dropped, not
85
+ * above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends). A
86
+ * caption that would collide with another hides. A tick outside `[min, max]` is dropped, not
82
87
  * clamped. All are listed in the accessible description. Works with `value`, `zones`, `segments`
83
88
  * and `target`.
84
89
  */
85
90
  ticks?: readonly MeterTick[]
86
91
  /**
87
- * `'muted'`: a non-verdict fill (a load, not a verdict) in `--vx-muted` at a strength that holds
88
- * 3:1 against the track in both schemes — the neutral fill is near-white in dark. A `color` wins.
92
+ * `'muted'` (default for a plain `value` bar; `segments` and `zones` keep their fills): a
93
+ * non-verdict fill (a load, not a verdict) in `--vx-muted` at a strength that holds 3:1 against
94
+ * the track in both schemes — the ink fill is near-white in dark. `'ink'` restores the full-ink
95
+ * `--vx-line` fill. A `color` wins over both.
89
96
  */
90
- tone?: 'muted'
97
+ tone?: 'muted' | 'ink'
91
98
  /**
92
99
  * `'row'`: in-line use — a track one text line tall and no caption rows (reading, target, forecast,
93
- * part, zone and tick captions). The label stays as `aria-label`; the described-by text keeps the
94
- * rest. Put the value beside it in your own layout.
100
+ * zone and tick captions). Categorical `segments` keep their per-part captions (swatch, name, value)
101
+ * so the parts stay named. The label stays as `aria-label`; the described-by text keeps the rest.
102
+ * Put the value beside it in your own layout.
95
103
  */
96
104
  size?: 'row'
97
- /** Start caption (default: the formatted reading). `null` drops it. */
105
+ /** Start caption (default: the formatted reading). `null` drops it; zone labels stay. */
98
106
  startCaption?: ReactNode
99
- /** End caption (default: `Target <target>`). `null` drops it. */
107
+ /**
108
+ * End caption (default: `Target <target>`, drawn at the target's tick rather than the track end
109
+ * when it fits). `null` drops it; zone labels stay.
110
+ */
100
111
  endCaption?: ReactNode
112
+ /**
113
+ * The reading printed at the marker of a zoned bar. Default `true`, and `false` inside a basalt host
114
+ * (`StatCard`, a strip cell's `visual`) that already states the value. Pass `false` when YOUR
115
+ * headline states it: the marker stays and keeps its `aria-valuenow` / `aria-valuetext`. Pass `true`
116
+ * to print it inside a host. A `stops` track prints it only when `true`.
117
+ */
118
+ reading?: boolean
101
119
  }
102
120
 
103
121
  /**
@@ -105,7 +123,9 @@ type BarCommon = Common & {
105
123
  * - Bar `value` (+ `target`, `color`): one reading on a neutral track.
106
124
  * - Bar `segments`: ordered parts that sum to the reading (committed/forecast, part of a whole).
107
125
  * - Bar `value` + `zones`: the reading is a marker against contiguous bands.
108
- * - Ring (`shape: 'ring'`) `value` (+ `color`): one headline ratio; no target, captions, segments or zones.
126
+ * - Bar `value` + `stops`: the reading is a marker on one gradient track.
127
+ * - Ring (`shape: 'ring'`) `value` (+ `color`, `target`, `ticks`): one headline ratio; no captions,
128
+ * segments or zones.
109
129
  */
110
130
  export type MeterProps =
111
131
  | (BarCommon & {
@@ -113,6 +133,17 @@ export type MeterProps =
113
133
  value?: number | null | undefined
114
134
  /** A status colour, for a verdict only. Omit for the neutral fill. */
115
135
  color?: string
136
+ /**
137
+ * `false` draws no track for a value with nothing to compare against (no `target`, no `ticks`):
138
+ * the track stays in the accessibility tree and the captions remain. A `target` or `ticks` keep it.
139
+ */
140
+ track?: boolean
141
+ /**
142
+ * Draws the track as ONE gradient through these colours (the consumer's: tokens or its own
143
+ * values, `at` in the reading's units) and the reading as a marker on it. Not a zone: no names,
144
+ * and no labels unless `ticks` are given. Use it for a scale whose hue IS the quantity.
145
+ */
146
+ stops?: readonly { at: number; color: string }[]
116
147
  segments?: never
117
148
  zones?: never
118
149
  })
@@ -124,6 +155,8 @@ export type MeterProps =
124
155
  value?: never
125
156
  color?: never
126
157
  zones?: never
158
+ stops?: never
159
+ track?: never
127
160
  })
128
161
  | (BarCommon & {
129
162
  value?: number | null | undefined
@@ -134,20 +167,27 @@ export type MeterProps =
134
167
  zones: readonly MeterZone[]
135
168
  segments?: never
136
169
  color?: never
170
+ stops?: never
171
+ track?: never
137
172
  })
138
173
  | (Common & {
139
174
  shape: 'ring'
140
175
  value?: number | null | undefined
141
176
  /** A status colour, for a verdict only. */
142
177
  color?: string
178
+ /** A short radial mark at this value (a limit to compare the arc against); the value stays centred. */
179
+ target?: number
180
+ /** More radial marks, each at its `at`; a `label` is for the accessible text only. */
181
+ ticks?: readonly MeterTick[]
143
182
  segments?: never
144
183
  zones?: never
145
- target?: never
146
- ticks?: never
147
184
  tone?: never
148
185
  size?: never
149
186
  startCaption?: never
150
187
  endCaption?: never
188
+ reading?: never
189
+ stops?: never
190
+ track?: never
151
191
  })
152
192
 
153
193
  let warnedTrack = false
@@ -160,12 +200,20 @@ function warnInvalidTrack(min: number, max: number) {
160
200
  )
161
201
  }
162
202
 
203
+ /** Muted is the default for a plain `value` bar only; `segments`/`zones` keep their fills unless asked. */
204
+ function barTone(tone: 'muted' | 'ink' | undefined, plain: boolean): 'muted' | undefined {
205
+ if (tone === 'ink') return undefined
206
+ return tone === 'muted' || plain ? 'muted' : undefined
207
+ }
208
+
163
209
  export function Meter(props: MeterProps) {
164
210
  const { label, min = 0, max = 100, format = asText, className, style } = props
165
211
  const row = props.size === 'row'
166
212
  const shell = { className, style, row }
167
213
  const ring = props.shape === 'ring'
168
214
  warnInvalidTrack(min, max)
215
+ const hostTone = useContext(VisualSlotContext)?.tone
216
+ const hostColor = hostTone === undefined ? undefined : VX.status[hostTone]
169
217
 
170
218
  if (props.loading === true) return <MeterLoading label={label} ring={ring} shell={shell} />
171
219
 
@@ -178,17 +226,29 @@ export function Meter(props: MeterProps) {
178
226
  }
179
227
 
180
228
  if (props.shape === 'ring') {
181
- return <MeterRing {...{ label, reading, min, max, format, shell }} color={props.color} />
229
+ return (
230
+ <MeterRing
231
+ {...{ label, reading, min, max, format, shell }}
232
+ color={props.color ?? hostColor}
233
+ target={isReading(props.target) ? props.target : undefined}
234
+ ticks={props.ticks}
235
+ />
236
+ )
182
237
  }
238
+ const plain =
239
+ props.segments === undefined && props.zones === undefined && props.stops === undefined
183
240
  return (
184
241
  <MeterBar
185
242
  {...{ label, reading, min, max, format, shell }}
186
- color={props.color}
243
+ color={props.color ?? (props.tone === undefined && plain ? hostColor : undefined)}
187
244
  segments={segments}
188
245
  zones={props.zones}
246
+ stops={props.stops}
247
+ track={props.track}
248
+ markerReading={props.reading}
189
249
  target={isReading(props.target) ? props.target : undefined}
190
250
  ticks={props.ticks}
191
- tone={props.tone}
251
+ tone={barTone(props.tone, plain)}
192
252
  forecastCaption={props.segments === undefined ? undefined : props.forecastCaption}
193
253
  startCaption={props.startCaption}
194
254
  endCaption={props.endCaption}
@@ -0,0 +1,89 @@
1
+ /*
2
+ * PageSummary (SPEC § 6.9). A page's opening: headline, then one facts line. No surface of its own —
3
+ * it sits on the page background above the first Section.
4
+ */
5
+ .root {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--vx-space-stack-xs);
9
+ min-width: 0;
10
+ }
11
+
12
+ .top {
13
+ display: flex;
14
+ align-items: baseline;
15
+ justify-content: space-between;
16
+ gap: var(--vx-space-stack-md);
17
+ min-width: 0;
18
+ }
19
+
20
+ /* `h1` step, head face, tight tracking (SPEC row "Page headline"). Sans with lining figures: the
21
+ * sentence carries the live number, and D33 keeps figures proportional. */
22
+ .sentence {
23
+ margin: 0;
24
+ min-width: 0;
25
+ font-family: var(--basalt-font-head);
26
+ font-size: var(--vx-text-h1);
27
+ font-weight: 550;
28
+ font-stretch: 88%;
29
+ letter-spacing: -0.02em;
30
+ line-height: 1.2;
31
+ color: var(--vx-ink);
32
+ text-wrap: balance;
33
+ }
34
+
35
+ .aside {
36
+ flex: none;
37
+ font-size: var(--vx-text-xs);
38
+ color: var(--vx-muted);
39
+ white-space: nowrap;
40
+ }
41
+
42
+ /*
43
+ * The facts line: sans `xs`, muted, `·`-separated. A wrapping flex list, `--facts-gap` between facts.
44
+ * Each fact draws its own dot one gap to its inline-start, centred in it, and the list clips inline overflow: the fact
45
+ * that opens a line starts at the list's left edge, so its dot lands outside the clip and a wrapped
46
+ * line never leads with `·` (argo UPSTREAM § Wave 26). Clip, not hidden — the block axis stays free.
47
+ */
48
+ .facts {
49
+ --facts-gap: var(--vx-space-stack-md);
50
+
51
+ display: flex;
52
+ flex-wrap: wrap;
53
+ column-gap: var(--facts-gap);
54
+ row-gap: 0;
55
+ margin: 0;
56
+ overflow-x: clip;
57
+ font-size: var(--vx-text-xs);
58
+ line-height: 1.4;
59
+ color: var(--vx-muted);
60
+ }
61
+
62
+ .fact {
63
+ position: relative;
64
+ min-width: 0;
65
+ }
66
+
67
+ .fact::before {
68
+ content: '·';
69
+ position: absolute;
70
+ inset-inline-start: calc(-1 * var(--facts-gap));
71
+ width: var(--facts-gap);
72
+ text-align: center;
73
+ color: var(--vx-faint);
74
+ }
75
+
76
+ /* The list clips inline overflow, so a focus ring on a link inside a fact is drawn inward: an
77
+ * outset ring would be cut at the list's edges. */
78
+ .fact :where(a, button, [tabindex]):focus-visible {
79
+ outline-offset: -2px;
80
+ }
81
+
82
+ /* Skeleton: the headline bar is one h1 line, the facts bar one xs line. */
83
+ .sentenceSkeleton {
84
+ height: calc(var(--vx-text-h1) * 1.2);
85
+ }
86
+
87
+ .factsSkeleton {
88
+ height: calc(var(--vx-text-xs) * 1.4);
89
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
3
+ * signature — so dot access stays verbatim under the package's strict flags.
4
+ */
5
+ declare const classes: {
6
+ readonly root: string
7
+ readonly top: string
8
+ readonly sentence: string
9
+ readonly aside: string
10
+ readonly facts: string
11
+ readonly fact: string
12
+ readonly sentenceSkeleton: string
13
+ readonly factsSkeleton: string
14
+ }
15
+ export default classes
@@ -0,0 +1,95 @@
1
+ /**
2
+ * PageSummary — a page's opening (docs/waves/design-parity/SPEC.md § 6.9): one headline sentence
3
+ * that carries at least one live number, an optional facts line under it, and an optional `aside`
4
+ * right of the headline. It renders an `h2` at the `h1` type step (head face, −0.02em): the page's own
5
+ * h1 is the shell breadcrumb's / `PageTitle`'s, and a second one would split the outline. The facts
6
+ * are the proportional sans at `xs`, muted, `·`-separated — a time fact may take mono itself, the line does
7
+ * not (D33).
8
+ *
9
+ * The sentence MUST state a live fact — "12 open, 3 need you", never "Overview of your tickets".
10
+ * A sentence without a number is the page restating its own name, which the breadcrumb already does.
11
+ * That is the reviewer's rule too: a page summary without a number is a defect.
12
+ *
13
+ * `null` / `false` / `undefined` / `''` facts drop, so conditional facts pass inline. A facts line
14
+ * that wraps never opens a line with `·`: each fact owns its separator as a pseudo-element in the gap
15
+ * before it (logical, so RTL mirrors), and the list clips inline overflow, so the dot of the fact that starts a line falls
16
+ * outside the clip.
17
+ *
18
+ * `loading` renders a skeleton of the same shape — the headline bar, plus a facts bar when `facts`
19
+ * is passed — so the page does not jump when the numbers arrive.
20
+ *
21
+ * @example
22
+ * import { PageSummary } from 'basalt-ui'
23
+ *
24
+ * <PageSummary
25
+ * sentence={`${open} open, ${needYou} need you`}
26
+ * facts={[oldest && `oldest ${oldest}`, `${runs} runs today`]}
27
+ * aside="Today"
28
+ * />
29
+ *
30
+ * @example
31
+ * <PageSummary loading facts={[]} />
32
+ */
33
+ import { Skeleton } from '@mantine/core'
34
+ import type { ReactNode } from 'react'
35
+ import { cx } from '../common/props'
36
+ import type { BasaltProps } from '../common/props'
37
+ import classes from './page-summary.module.css'
38
+
39
+ type Fact = ReactNode | null | false | undefined
40
+
41
+ type PageSummaryContent = {
42
+ /** The headline sentence. It must state a live number — never describe the page. */
43
+ sentence: ReactNode
44
+ /** Short facts under the headline, e.g. `['3 need you', oldest && `oldest ${oldest}`]`. */
45
+ facts?: readonly Fact[]
46
+ /** Right of the headline: a date or a freshness word. */
47
+ aside?: ReactNode
48
+ loading?: false
49
+ }
50
+
51
+ /** While the sentence's data loads: a skeleton of the same shape, no content props needed. */
52
+ type PageSummaryLoading = Partial<Omit<PageSummaryContent, 'loading'>> & { loading: true }
53
+
54
+ export type PageSummaryProps = BasaltProps & (PageSummaryContent | PageSummaryLoading)
55
+
56
+ const NO_FACTS: readonly Fact[] = []
57
+
58
+ const isShown = (fact: Fact): boolean =>
59
+ fact !== null && fact !== false && fact !== undefined && fact !== ''
60
+
61
+ export function PageSummary(props: PageSummaryProps) {
62
+ const { className, style } = props
63
+ const common = { className: cx(classes.root, className), 'data-page-summary': '', style }
64
+
65
+ if (props.loading === true) {
66
+ return (
67
+ <div {...common} aria-busy="true">
68
+ <Skeleton className={classes.sentenceSkeleton} width="55%" radius="sm" />
69
+ {props.facts !== undefined && (
70
+ <Skeleton className={classes.factsSkeleton} width="35%" radius="sm" />
71
+ )}
72
+ </div>
73
+ )
74
+ }
75
+
76
+ const { sentence, facts = NO_FACTS, aside } = props
77
+ const shown = facts.filter(isShown)
78
+ return (
79
+ <div {...common}>
80
+ <div className={classes.top}>
81
+ <h2 className={classes.sentence}>{sentence}</h2>
82
+ {aside !== undefined && <span className={classes.aside}>{aside}</span>}
83
+ </div>
84
+ {shown.length > 0 && (
85
+ <p className={classes.facts} data-page-summary-facts>
86
+ {shown.map((fact, i) => (
87
+ <span key={i} className={classes.fact} data-page-summary-fact>
88
+ {fact}
89
+ </span>
90
+ ))}
91
+ </p>
92
+ )}
93
+ </div>
94
+ )
95
+ }