basalt-ui 2.27.2 → 2.28.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 (238) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/MIGRATING.md +168 -12
  3. package/agent/rules/basalt-batteries.md +1 -1
  4. package/agent/rules/basalt-mantine.md +1 -1
  5. package/agent/rules/basalt-tokens.md +2 -2
  6. package/agent/skills/basalt-design/SKILL.md +1 -1
  7. package/agent/skills/basalt-design/references/catalogue.md +40 -36
  8. package/agent/skills/basalt-design/references/recipes.md +47 -0
  9. package/configs/oxlint-basalt.json +2 -1
  10. package/configs/oxlint-plugin.js +110 -2
  11. package/configs/oxlint-plugin.test.ts +99 -4
  12. package/dist/agent/chat/thread-message.d.ts +1 -160
  13. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  14. package/dist/agent/chat/thread-message.js +7 -162
  15. package/dist/agent/chat/virtualize.d.ts +5 -5
  16. package/dist/charts/ChartCard.d.ts +5 -2
  17. package/dist/charts/ChartCard.d.ts.map +1 -1
  18. package/dist/charts/ChartCard.js +46 -13
  19. package/dist/charts/Lines.d.ts.map +1 -1
  20. package/dist/charts/Lines.js +11 -4
  21. package/dist/charts/Sparkline.d.ts +9 -2
  22. package/dist/charts/Sparkline.d.ts.map +1 -1
  23. package/dist/charts/Sparkline.js +104 -41
  24. package/dist/charts/chart-box.module.css +50 -0
  25. package/dist/charts/chart-box.module.css.d.ts +5 -0
  26. package/dist/charts/chart-card.module.css +12 -4
  27. package/dist/charts/chart-card.module.css.d.ts +1 -0
  28. package/dist/charts/compile.d.ts.map +1 -1
  29. package/dist/charts/compile.js +20 -18
  30. package/dist/charts/labels.d.ts +13 -3
  31. package/dist/charts/labels.d.ts.map +1 -1
  32. package/dist/charts/labels.js +131 -20
  33. package/dist/charts/legend.d.ts.map +1 -1
  34. package/dist/charts/legend.js +1 -1
  35. package/dist/charts/ref-label.d.ts +31 -8
  36. package/dist/charts/ref-label.d.ts.map +1 -1
  37. package/dist/charts/ref-label.js +40 -9
  38. package/dist/charts/sparkline.module.css +6 -0
  39. package/dist/charts/state.d.ts +3 -3
  40. package/dist/charts/state.d.ts.map +1 -1
  41. package/dist/charts/state.js +20 -2
  42. package/dist/cli/shot/capture.d.ts +6 -1
  43. package/dist/cli/shot/capture.d.ts.map +1 -1
  44. package/dist/cli/shot/capture.js +18 -5
  45. package/dist/common/empty-copy.d.ts +16 -0
  46. package/dist/common/empty-copy.d.ts.map +1 -0
  47. package/dist/common/empty-copy.js +9 -0
  48. package/dist/common/virtual-rows.d.ts +196 -0
  49. package/dist/common/virtual-rows.d.ts.map +1 -0
  50. package/dist/common/virtual-rows.js +290 -0
  51. package/dist/controls/controls.module.css +33 -1
  52. package/dist/controls/controls.module.css.d.ts +2 -0
  53. package/dist/controls/enum-filter.d.ts.map +1 -1
  54. package/dist/controls/enum-filter.js +8 -2
  55. package/dist/controls/filter-pill.d.ts +27 -3
  56. package/dist/controls/filter-pill.d.ts.map +1 -1
  57. package/dist/controls/filter-pill.js +15 -4
  58. package/dist/controls/form-layout.d.ts +9 -3
  59. package/dist/controls/form-layout.d.ts.map +1 -1
  60. package/dist/controls/form-layout.js +74 -12
  61. package/dist/controls/form-layout.module.css +112 -7
  62. package/dist/controls/form-layout.module.css.d.ts +1 -0
  63. package/dist/controls/multi-select-filter.d.ts +2 -2
  64. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  65. package/dist/controls/multi-select-filter.js +12 -6
  66. package/dist/controls/range-filter.d.ts +1 -1
  67. package/dist/controls/range-filter.d.ts.map +1 -1
  68. package/dist/controls/range-filter.js +8 -2
  69. package/dist/dashboard/bar-list.d.ts +1 -1
  70. package/dist/dashboard/bar-list.d.ts.map +1 -1
  71. package/dist/dashboard/bar-list.js +6 -2
  72. package/dist/dashboard/bar-list.module.css +0 -2
  73. package/dist/dashboard/board-nav.d.ts +22 -0
  74. package/dist/dashboard/board-nav.d.ts.map +1 -0
  75. package/dist/dashboard/board-nav.js +49 -0
  76. package/dist/dashboard/board.d.ts +52 -0
  77. package/dist/dashboard/board.d.ts.map +1 -0
  78. package/dist/dashboard/board.js +228 -0
  79. package/dist/dashboard/board.module.css +160 -0
  80. package/dist/dashboard/board.module.css.d.ts +26 -0
  81. package/dist/dashboard/empty-state.d.ts +3 -3
  82. package/dist/dashboard/empty-state.d.ts.map +1 -1
  83. package/dist/dashboard/empty-state.js +13 -6
  84. package/dist/dashboard/event-list-model.d.ts +51 -0
  85. package/dist/dashboard/event-list-model.d.ts.map +1 -0
  86. package/dist/dashboard/event-list-model.js +72 -0
  87. package/dist/dashboard/event-list-rows.d.ts +23 -0
  88. package/dist/dashboard/event-list-rows.d.ts.map +1 -0
  89. package/dist/dashboard/event-list-rows.js +93 -0
  90. package/dist/dashboard/event-list-scroll.d.ts +27 -0
  91. package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
  92. package/dist/dashboard/event-list-scroll.js +103 -0
  93. package/dist/dashboard/event-list-skeleton.d.ts +10 -0
  94. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
  95. package/dist/dashboard/event-list-skeleton.js +36 -0
  96. package/dist/dashboard/event-list.d.ts +65 -0
  97. package/dist/dashboard/event-list.d.ts.map +1 -0
  98. package/dist/dashboard/event-list.js +178 -0
  99. package/dist/dashboard/event-list.module.css +283 -0
  100. package/dist/dashboard/event-list.module.css.d.ts +33 -0
  101. package/dist/dashboard/index.d.ts +2 -0
  102. package/dist/dashboard/index.d.ts.map +1 -1
  103. package/dist/dashboard/index.js +4 -0
  104. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  105. package/dist/dashboard/meter-parts.js +5 -3
  106. package/dist/dashboard/meter.module.css +2 -1
  107. package/dist/dashboard/query-state.js +1 -1
  108. package/dist/dashboard/settings-section.d.ts +4 -1
  109. package/dist/dashboard/settings-section.d.ts.map +1 -1
  110. package/dist/dashboard/settings-section.js +1 -1
  111. package/dist/dashboard/settings-section.module.css +19 -4
  112. package/dist/dashboard/stat-card-parts.d.ts +5 -1
  113. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  114. package/dist/dashboard/stat-card-parts.js +8 -3
  115. package/dist/dashboard/stat-card.d.ts.map +1 -1
  116. package/dist/dashboard/stat-card.js +25 -6
  117. package/dist/dashboard/stat-card.module.css +31 -7
  118. package/dist/dashboard/stat-card.module.css.d.ts +3 -0
  119. package/dist/dashboard/stat-strip.module.css +4 -1
  120. package/dist/dashboard/widget-header.module.css +17 -1
  121. package/dist/guard/index.d.ts.map +1 -1
  122. package/dist/guard/index.js +2 -0
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +4 -0
  126. package/dist/shell/app-main.module.css +18 -0
  127. package/dist/styles.css +46 -0
  128. package/dist/surfaces.d.ts +2 -2
  129. package/dist/surfaces.d.ts.map +1 -1
  130. package/dist/surfaces.js +8 -2
  131. package/dist/table/cell-kinds.d.ts +44 -0
  132. package/dist/table/cell-kinds.d.ts.map +1 -0
  133. package/dist/table/cell-kinds.js +169 -0
  134. package/dist/table/cell-kinds.module.css +55 -0
  135. package/dist/table/cell-kinds.module.css.d.ts +15 -0
  136. package/dist/table/data-table-fold.d.ts +147 -0
  137. package/dist/table/data-table-fold.d.ts.map +1 -0
  138. package/dist/table/data-table-fold.js +288 -0
  139. package/dist/table/data-table-state.d.ts +10 -3
  140. package/dist/table/data-table-state.d.ts.map +1 -1
  141. package/dist/table/data-table-state.js +11 -6
  142. package/dist/table/data-table.d.ts +11 -26
  143. package/dist/table/data-table.d.ts.map +1 -1
  144. package/dist/table/data-table.js +354 -254
  145. package/dist/table/data-table.module.css +210 -3
  146. package/dist/table/data-table.module.css.d.ts +12 -0
  147. package/dist/table/table-features.d.ts +34 -4
  148. package/dist/table/table-features.d.ts.map +1 -1
  149. package/dist/table/table-features.js +10 -0
  150. package/dist/theme/card-inset.module.css +35 -0
  151. package/dist/theme/controls.module.css +32 -0
  152. package/dist/theme/ctl-theme.d.ts.map +1 -1
  153. package/dist/theme/ctl-theme.js +5 -0
  154. package/dist/theme/index.d.ts.map +1 -1
  155. package/dist/theme/index.js +14 -10
  156. package/dist/tokens/core.d.ts +1 -0
  157. package/dist/tokens/core.d.ts.map +1 -1
  158. package/dist/tokens/core.js +1 -0
  159. package/dist/tokens/derive.js +1 -1
  160. package/dist/tokens/palette.d.ts +2 -1
  161. package/dist/tokens/palette.d.ts.map +1 -1
  162. package/llms.txt +34 -5
  163. package/package.json +1 -1
  164. package/src/agent/chat/thread-message.tsx +10 -403
  165. package/src/agent/chat/virtualize.ts +5 -5
  166. package/src/charts/ChartCard.tsx +79 -17
  167. package/src/charts/Lines.tsx +13 -4
  168. package/src/charts/Sparkline.tsx +131 -45
  169. package/src/charts/chart-box.module.css +50 -0
  170. package/src/charts/chart-box.module.css.d.ts +5 -0
  171. package/src/charts/chart-card.module.css +12 -4
  172. package/src/charts/chart-card.module.css.d.ts +1 -0
  173. package/src/charts/compile.ts +22 -18
  174. package/src/charts/labels.ts +175 -24
  175. package/src/charts/legend.tsx +3 -2
  176. package/src/charts/ref-label.ts +86 -17
  177. package/src/charts/sparkline.module.css +6 -0
  178. package/src/charts/state.tsx +36 -7
  179. package/src/cli/shot/capture.ts +29 -6
  180. package/src/common/empty-copy.ts +17 -0
  181. package/src/common/virtual-rows.tsx +682 -0
  182. package/src/controls/controls.module.css +33 -1
  183. package/src/controls/controls.module.css.d.ts +2 -0
  184. package/src/controls/enum-filter.tsx +8 -2
  185. package/src/controls/filter-pill.tsx +80 -27
  186. package/src/controls/form-layout.module.css +112 -7
  187. package/src/controls/form-layout.module.css.d.ts +1 -0
  188. package/src/controls/form-layout.tsx +115 -22
  189. package/src/controls/multi-select-filter.tsx +22 -11
  190. package/src/controls/range-filter.tsx +9 -3
  191. package/src/dashboard/bar-list.module.css +0 -2
  192. package/src/dashboard/bar-list.tsx +8 -5
  193. package/src/dashboard/board-nav.ts +67 -0
  194. package/src/dashboard/board.module.css +160 -0
  195. package/src/dashboard/board.module.css.d.ts +26 -0
  196. package/src/dashboard/board.tsx +394 -0
  197. package/src/dashboard/empty-state.tsx +16 -9
  198. package/src/dashboard/event-list-model.ts +113 -0
  199. package/src/dashboard/event-list-rows.tsx +120 -0
  200. package/src/dashboard/event-list-scroll.ts +145 -0
  201. package/src/dashboard/event-list-skeleton.tsx +58 -0
  202. package/src/dashboard/event-list.module.css +283 -0
  203. package/src/dashboard/event-list.module.css.d.ts +33 -0
  204. package/src/dashboard/event-list.tsx +309 -0
  205. package/src/dashboard/index.ts +2 -0
  206. package/src/dashboard/meter-parts.tsx +9 -2
  207. package/src/dashboard/meter.module.css +2 -1
  208. package/src/dashboard/query-state.tsx +1 -1
  209. package/src/dashboard/settings-section.module.css +19 -4
  210. package/src/dashboard/settings-section.tsx +7 -2
  211. package/src/dashboard/stat-card-parts.tsx +20 -3
  212. package/src/dashboard/stat-card.module.css +31 -7
  213. package/src/dashboard/stat-card.module.css.d.ts +3 -0
  214. package/src/dashboard/stat-card.tsx +24 -5
  215. package/src/dashboard/stat-strip.module.css +4 -1
  216. package/src/dashboard/widget-header.module.css +17 -1
  217. package/src/guard/index.ts +2 -0
  218. package/src/index.ts +4 -0
  219. package/src/shell/app-main.module.css +18 -0
  220. package/src/styles.css +46 -0
  221. package/src/surfaces.ts +7 -1
  222. package/src/table/cell-kinds.module.css +55 -0
  223. package/src/table/cell-kinds.module.css.d.ts +15 -0
  224. package/src/table/cell-kinds.tsx +234 -0
  225. package/src/table/data-table-fold.tsx +514 -0
  226. package/src/table/data-table-state.ts +24 -13
  227. package/src/table/data-table.module.css +210 -3
  228. package/src/table/data-table.module.css.d.ts +12 -0
  229. package/src/table/data-table.tsx +406 -359
  230. package/src/table/table-features.ts +44 -4
  231. package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
  232. package/src/theme/card-inset.module.css +35 -0
  233. package/src/theme/controls.module.css +32 -0
  234. package/src/theme/ctl-theme.tsx +8 -0
  235. package/src/theme/index.ts +12 -8
  236. package/src/tokens/core.ts +1 -0
  237. package/src/tokens/derive.ts +1 -1
  238. package/src/tokens/palette.ts +4 -1
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { dot } from "@tanstack/charts/dot";
3
3
  import { decorative } from "@tanstack/charts/mark/decorative";
4
4
  import { lineY } from "@tanstack/charts/line";
5
+ import { rect } from "@tanstack/charts/rect";
5
6
  import { ruleY } from "@tanstack/charts/rule";
6
7
  import { scaleBand } from "@tanstack/charts/scales/band";
7
8
  import { scaleLinear } from "@tanstack/charts/scales/linear";
@@ -27,6 +28,10 @@ const READOUT_GAP = 8;
27
28
  const LINE_INSET = 3;
28
29
  const SHORT_BOX = 36;
29
30
  const MUTED_LINE = alpha(VX.muted, 0.35);
31
+ const ZONE_X = {
32
+ zx: { channel: "x", scale: scaleLinear().domain([0, 1]), axis: false }
33
+ };
34
+ const BAND_FILL = alpha(VX.neutral, 0.2);
30
35
  const REFERENCE_LABEL_DX = 3;
31
36
  const LINE_PX_PER_POINT = 1;
32
37
  const BAR_PX_PER_BAR = 2;
@@ -124,44 +129,67 @@ function poolSparkline(rows, width, mark) {
124
129
  if (width <= 0 || rows.length <= Math.max(cap, mark === "bar" ? 1 : 2)) return rows;
125
130
  return mark === "bar" ? poolBar(rows, cap) : poolLine(rows, cap);
126
131
  }
127
- function frameOf([lo, hi], mark, count, hasEnd) {
132
+ function frameOf([lo, hi], mark, count, hasEnd, banded = false) {
128
133
  if (mark === "bar") return { x: [0, count], y: [Math.min(lo, 0), Math.max(hi, 0) || 1] };
129
- const pad = (hi - lo) * 0.1 || 1;
134
+ const pad = (hi - lo) * (banded ? 0.25 : 0.1) || 1;
130
135
  const xPad = hasEnd ? (count - 1) * 0.04 || 0.5 : 0;
131
136
  return { x: [-xPad, Math.max(count - 1, 1) + xPad], y: [lo - pad, hi + pad] };
132
137
  }
133
- function compileSparkline(source, extentOf, mark, color, emphasisColor, reference, referenceLabel) {
134
- const frame = frameOf(extentOf, mark, source.length, emphasisColor !== null);
135
- const referenceMark = (height) => reference === null ? [] : [
136
- ruleY([reference], {
137
- id: "reference",
138
- stroke: VX.line,
139
- strokeOpacity: 1,
140
- strokeWidth: 1,
141
- strokeDasharray: DASH
142
- }),
143
- ...referenceLabel === void 0 ? [] : [
144
- decorative(
145
- text([reference], {
146
- id: "reference-label",
147
- x: () => mark === "bar" ? 0 : frame.x[0],
148
- y: (v) => v,
149
- text: () => referenceLabel,
150
- fill: VX.ink2,
151
- fontSize: VX.text.micro,
152
- anchor: "start",
153
- dx: REFERENCE_LABEL_DX,
154
- dy: referenceLabelPlacement({
155
- value: reference,
156
- domain: frame.y,
157
- height,
158
- inset: mark === "bar" ? 0 : LINE_INSET,
159
- fontSize: VX.text.micro
160
- }).dy
161
- })
162
- )
163
- ]
138
+ function compileSparkline(source, extentOf, mark, color, emphasisColor, reference, referenceLabel, band, bandEdges) {
139
+ const frame = frameOf(extentOf, mark, source.length, emphasisColor !== null, bandEdges);
140
+ const bandMark = () => band === null ? [] : [
141
+ decorative(
142
+ rect([band], {
143
+ id: "band",
144
+ x1: () => 0,
145
+ x2: () => 1,
146
+ xScale: "zx",
147
+ y1: "from",
148
+ y2: "to",
149
+ fill: BAND_FILL,
150
+ inset: 0
151
+ })
152
+ )
164
153
  ];
154
+ const referenceMark = (height, width, rows) => {
155
+ if (reference === null) return [];
156
+ const place = referenceLabel === void 0 ? null : referenceLabelPlacement({
157
+ value: reference,
158
+ domain: frame.y,
159
+ height,
160
+ width,
161
+ inset: mark === "bar" ? 0 : LINE_INSET,
162
+ fontSize: VX.text.micro,
163
+ label: referenceLabel,
164
+ line: mark === "bar" ? void 0 : rows.flatMap(
165
+ (r) => r.v === null ? [] : [{ fx: (r.i - frame.x[0]) / (frame.x[1] - frame.x[0]), y: r.v }]
166
+ )
167
+ });
168
+ return [
169
+ ruleY([reference], {
170
+ id: "reference",
171
+ stroke: VX.line,
172
+ strokeOpacity: 1,
173
+ strokeWidth: 1,
174
+ strokeDasharray: DASH
175
+ }),
176
+ ...referenceLabel === void 0 || place === null ? [] : [
177
+ decorative(
178
+ text([reference], {
179
+ id: "reference-label",
180
+ x: () => place.end === "end" ? frame.x[1] : mark === "bar" ? 0 : frame.x[0],
181
+ y: (v) => v,
182
+ text: () => referenceLabel,
183
+ fill: VX.ink2,
184
+ fontSize: VX.text.micro,
185
+ anchor: place.end,
186
+ dx: place.end === "end" ? -REFERENCE_LABEL_DX : REFERENCE_LABEL_DX,
187
+ dy: place.dy
188
+ })
189
+ )
190
+ ]
191
+ ];
192
+ };
165
193
  return {
166
194
  // A bar's hover is the bar and the readout chip: no engine point marker (bar chrome only, as
167
195
  // `Bars`).
@@ -172,7 +200,8 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
172
200
  if (mark === "bar") {
173
201
  return {
174
202
  marks: [
175
- ...referenceMark(height),
203
+ ...bandMark(),
204
+ ...referenceMark(height, width, rows),
176
205
  barMark(rows, {
177
206
  id: "bars",
178
207
  x: "i",
@@ -185,6 +214,8 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
185
214
  scale: scaleBand().domain(rows.map((r) => r.i)).padding(BAR_GAP),
186
215
  axis: false
187
216
  },
217
+ // The band spans the whole plot, outer half-bars included: a unit scale, not the band x.
218
+ ...ZONE_X,
188
219
  y: {
189
220
  scale: scaleLinear().domain(frame.y),
190
221
  axis: false
@@ -197,7 +228,8 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
197
228
  }
198
229
  return {
199
230
  marks: [
200
- ...referenceMark(height),
231
+ ...bandMark(),
232
+ ...referenceMark(height, width, rows),
201
233
  lineY(rows, {
202
234
  id: "line",
203
235
  x: "i",
@@ -217,6 +249,7 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
217
249
  scale: scaleLinear().domain(frame.x),
218
250
  axis: false
219
251
  },
252
+ ...ZONE_X,
220
253
  y: { scale: scaleLinear().domain(frame.y), axis: false }
221
254
  },
222
255
  theme: CHART_THEME,
@@ -369,6 +402,7 @@ function Sparkline(props) {
369
402
  state,
370
403
  reference,
371
404
  referenceLabel,
405
+ band,
372
406
  format = defaultNumberFormat,
373
407
  labels,
374
408
  className,
@@ -380,6 +414,8 @@ function Sparkline(props) {
380
414
  const [keyed, setKeyed] = useState(null);
381
415
  const active = hover ?? keyed;
382
416
  const readoutRef = useRef(null);
417
+ const bandFrom = band?.from;
418
+ const bandTo = band?.to;
383
419
  const model = useMemo(() => {
384
420
  const rows2 = data.map((d, i) => ({
385
421
  i,
@@ -389,15 +425,33 @@ function Sparkline(props) {
389
425
  if (range === null) return null;
390
426
  const at2 = reference === "mean" ? meanOf(rows2) : reference ?? null;
391
427
  const ref = at2 !== null && Number.isFinite(at2) ? at2 : null;
392
- const full = ref === null ? range : [Math.min(range[0], ref), Math.max(range[1], ref)];
428
+ const bandSpan = bandFrom !== void 0 && bandTo !== void 0 && Number.isFinite(bandFrom + bandTo) && bandFrom !== bandTo ? { from: Math.min(bandFrom, bandTo), to: Math.max(bandFrom, bandTo) } : null;
429
+ const edges = [ref, bandSpan?.from, bandSpan?.to].filter(
430
+ (v) => typeof v === "number"
431
+ );
432
+ const full = [
433
+ Math.min(range[0], ...edges),
434
+ Math.max(range[1], ...edges)
435
+ ];
393
436
  const end = emphasizeLast ? emphasisColor : null;
437
+ const bandEdges = full[0] < range[0] || full[1] > range[1];
394
438
  return {
395
439
  rows: rows2,
396
440
  moments: momentsOf(data),
397
- frame: frameOf(full, mark, rows2.length, end !== null),
398
- definition: compileSparkline(rows2, full, mark, color, end, ref, referenceLabel)
441
+ frame: frameOf(full, mark, rows2.length, end !== null, bandSpan !== null && bandEdges),
442
+ definition: compileSparkline(
443
+ rows2,
444
+ full,
445
+ mark,
446
+ color,
447
+ end,
448
+ ref,
449
+ referenceLabel,
450
+ bandSpan,
451
+ bandSpan !== null && bandEdges
452
+ )
399
453
  };
400
- }, [data, mark, color, emphasizeLast, emphasisColor, reference, referenceLabel]);
454
+ }, [data, mark, color, emphasizeLast, emphasisColor, reference, referenceLabel, bandFrom, bandTo]);
401
455
  const resolved = resolveChartState(state);
402
456
  const rows = model?.rows;
403
457
  const interactive = resolved === null && model !== null;
@@ -478,6 +532,7 @@ function Sparkline(props) {
478
532
  {
479
533
  "data-basalt-sparkline": "",
480
534
  ...hosted && { "data-basalt-hosted": "" },
535
+ ...shown && { "data-basalt-readout": "" },
481
536
  role: "presentation",
482
537
  className: cx(classes.root, className),
483
538
  style: { width: width ?? "100%", height, minWidth: 0, ...style },
@@ -490,7 +545,15 @@ function Sparkline(props) {
490
545
  setKeyed(null);
491
546
  },
492
547
  children: [
493
- resolved !== null && /* @__PURE__ */ jsx(ChartPlaceholder, { state, height, compact: true }),
548
+ resolved !== null && /* @__PURE__ */ jsx(
549
+ ChartPlaceholder,
550
+ {
551
+ state,
552
+ height,
553
+ compact: true,
554
+ ghost: mark === "bar" ? "bars" : "line"
555
+ }
556
+ ),
494
557
  resolved === null && model !== null && /* @__PURE__ */ jsx(
495
558
  ChartEngine,
496
559
  {
@@ -501,7 +564,7 @@ function Sparkline(props) {
501
564
  coarse: false
502
565
  }
503
566
  ),
504
- at !== null && // One layer on the plot rect (inside a line's margin): the dot and the readout take their
567
+ shown && at !== null && // One layer on the plot rect (inside a line's margin): the dot and the readout take their
505
568
  // fractions of the same box, so both land where the mark did. A bar has no dot: the bar
506
569
  // is the marker.
507
570
  /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: classes.layer, style: layerStyle, children: [
@@ -125,6 +125,16 @@
125
125
  stroke-linejoin: round;
126
126
  }
127
127
 
128
+ .ghostBand {
129
+ flex: 1 1 0;
130
+ min-width: 0;
131
+ align-self: stretch;
132
+ /* The loaded strip is one row above its axis labels: the row keeps their room. */
133
+ margin-bottom: var(--basalt-ghost-band-axis, 1.5rem);
134
+ border-radius: 3px;
135
+ background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
136
+ }
137
+
128
138
  .ghostBar {
129
139
  flex: 1 1 0;
130
140
  min-width: 0;
@@ -132,6 +142,46 @@
132
142
  background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
133
143
  }
134
144
 
145
+ /*
146
+ * The empty body (SPEC § 6.11): a ring-edged tile (one inset ring, set inline in `state.tsx` so the divider ledger does not read it as a rule; card radius) filling the chart's
147
+ * own box, so the D37 height holds, with its copy centred: the title at `sm` 500, the size of the
148
+ * host's own title in every chart host, and one muted line. `EmptyState`'s section anatomy, in plain CSS
149
+ * because `src/charts/**` is Mantine-free.
150
+ */
151
+ .emptyTile {
152
+ box-sizing: border-box;
153
+ display: flex;
154
+ flex-direction: column;
155
+ align-items: center;
156
+ justify-content: center;
157
+ gap: var(--vx-space-stack-xs, 0.25rem);
158
+ width: 100%;
159
+ height: 100%;
160
+ padding: var(--vx-space-stack-md) var(--vx-space-stack-lg);
161
+ overflow: hidden;
162
+ text-align: center;
163
+ border-radius: var(--vx-radius-card);
164
+ }
165
+
166
+ .emptyCopy {
167
+ display: flex;
168
+ flex-direction: column;
169
+ align-items: center;
170
+ gap: var(--vx-space-stack-xs, 0.25rem);
171
+ }
172
+
173
+ .emptyTitle {
174
+ font-size: var(--vx-text-sm);
175
+ font-weight: 500;
176
+ color: var(--vx-ink);
177
+ }
178
+
179
+ .emptyText {
180
+ max-width: 22.5rem;
181
+ font-size: var(--vx-text-sm);
182
+ color: var(--vx-muted);
183
+ }
184
+
135
185
  /*
136
186
  * The engine paints its tooltip rows as a grid of `.55rem | minmax(0, 1fr) | auto` with inline
137
187
  * styles and `overflow-wrap: anywhere` on the card, so a narrow tooltip (a 390 viewport, a pointer
@@ -11,6 +11,11 @@ declare const classes: {
11
11
  readonly grow: string
12
12
  readonly ghost: string
13
13
  readonly ghostLine: string
14
+ readonly ghostBand: string
14
15
  readonly ghostBar: string
16
+ readonly emptyTile: string
17
+ readonly emptyCopy: string
18
+ readonly emptyTitle: string
19
+ readonly emptyText: string
15
20
  }
16
21
  export default classes
@@ -1,9 +1,8 @@
1
1
  /*
2
2
  * ChartCard's header inset, by the card's own inline size (W10 SSR contract). A card under 480px
3
- * trims the header's top inset: the subtitle has already folded into the info glyph there, and the
4
- * chart below is sized by the 160–420px law, so a narrow card is a short one. Decided in CSS, not
5
- * from a post-hydration height measurement, so the server HTML is the hydrated header. The literal
6
- * is CONTAINER_CLASSES.regular (`breakpoint-literals.test.ts`).
3
+ * trims the header's top inset: the chart below is sized by the 160–420px law, so a narrow card is
4
+ * a short one. Decided in CSS, not from a post-hydration height measurement, so the server HTML is
5
+ * the hydrated header. The literal is CONTAINER_CLASSES.regular (`breakpoint-literals.test.ts`).
7
6
  */
8
7
 
9
8
  .header {
@@ -129,3 +128,12 @@
129
128
  border-radius: 3px;
130
129
  background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
131
130
  }
131
+
132
+ /* A pending `BandStrip` card keeps the room of the legend row the loaded strip carries under its box:
133
+ * the chart root's 6px gap plus one legend line (`micro` x 1.35 and the 2px entry border, `legend.tsx`).
134
+ * The legend shows from 240px, the same container class the chart picks it by. */
135
+ @container basalt-card (min-width: 240px) {
136
+ .legendReserve {
137
+ padding-bottom: calc(6px + var(--vx-text-micro) * 1.35 + 2px);
138
+ }
139
+ }
@@ -13,5 +13,6 @@ declare const classes: {
13
13
  readonly factPeriod: string
14
14
  readonly skeletonFigure: string
15
15
  readonly skeletonBasis: string
16
+ readonly legendReserve: string
16
17
  }
17
18
  export default classes
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAGV,aAAa,EAEb,yBAAyB,EACzB,eAAe,IAAI,gBAAgB,EACnC,UAAU,EACV,yBAAyB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAO5D,OAAO,KAAK,EAAE,SAAS,EAA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
  import { bucketTicks, strideEvery } from "./ticks.js";
17
17
  import { MAIN_PANE, plotAccess, plotContext } from "./plot-context.js";
18
+ import { claimedLabelBoxes } from "./labels.js";
18
19
  import { refLabelPosition } from "./ref-label.js";
19
20
  import { resolveContainerClass } from "../tokens/size-classes.js";
20
21
  import { resolveYDomain, xScaleFor, xZoneFractions, yScaleFor } from "./scales.js";
@@ -454,7 +455,8 @@ const refLabelMark = (r, i, ctx) => {
454
455
  plotHeight: ctx.plotHeight,
455
456
  label: r.label ?? "",
456
457
  fontSize: VX.text.micro,
457
- series: ctx.lines(r.axis)
458
+ series: ctx.lines(r.axis),
459
+ claimed: startFirst ? [] : ctx.claimed
458
460
  });
459
461
  const atStart = position.startsWith("start");
460
462
  return decorative(
@@ -800,24 +802,23 @@ function compileCartesian(input) {
800
802
  const cls = resolveContainerClass(width);
801
803
  const axes = axesAt(cls);
802
804
  const access = plotAccess(definition, input.plot, MAIN_PANE);
803
- const kindMarks = input.marks(
804
- plotContext(
805
- {
806
- rows,
807
- visible,
808
- highlighted: input.highlighted ?? null,
809
- containerClass: cls,
810
- width,
811
- height,
812
- data: input.data,
813
- xFraction: model.fraction,
814
- y2: axes.right ? "y2" : void 0,
815
- yDomain: axes.left.domain,
816
- y2Domain: axes.right?.domain
817
- },
818
- access
819
- )
805
+ const plot = plotContext(
806
+ {
807
+ rows,
808
+ visible,
809
+ highlighted: input.highlighted ?? null,
810
+ containerClass: cls,
811
+ width,
812
+ height,
813
+ data: input.data,
814
+ xFraction: model.fraction,
815
+ y2: axes.right ? "y2" : void 0,
816
+ yDomain: axes.left.domain,
817
+ y2Domain: axes.right?.domain
818
+ },
819
+ access
820
820
  );
821
+ const kindMarks = input.marks(plot);
821
822
  const under = underlayMarks(input, model, axes);
822
823
  const over = refLineMarks(input, axes, () => {
823
824
  access.read();
@@ -826,6 +827,7 @@ function compileCartesian(input) {
826
827
  plotWidth: size?.width ?? width,
827
828
  plotHeight: size?.height ?? height,
828
829
  lines: linesOn,
830
+ claimed: claimedLabelBoxes(plot),
829
831
  axes,
830
832
  model
831
833
  };
@@ -1,3 +1,4 @@
1
+ import type { LabelBox } from './ref-label.js';
1
2
  import type { ChartMarks, ChartSeries, ChartX, PlotContext, PlotRow } from './types.js';
2
3
  export type EndLabelAnchor = 'start' | 'end';
3
4
  /** Which side of its line a flipped label sits: away from the line's last segment. */
@@ -23,13 +24,20 @@ export type EndLabel<T, X extends ChartX> = {
23
24
  anchor: EndLabelAnchor;
24
25
  /** Only a flipped label (left of its point) can meet its own line; it takes the clear side. */
25
26
  side: EndLabelSide;
26
- /** A vertical shift in px (negative is up) that keeps this label clear of its neighbours. */
27
+ /** A vertical shift in px (negative is up) that keeps this label clear of its neighbours and the lines. */
27
28
  nudge: number;
29
+ /** The room the drawn label takes, for a reference caption to keep clear of. */
30
+ box: LabelBox;
28
31
  };
32
+ /** Records the boxes the end labels of `plot` take (once per plot, by `Lines`). */
33
+ export declare function claimLabelBoxes(plot: object, boxes: readonly LabelBox[]): void;
34
+ /** The boxes {@link claimLabelBoxes} recorded for `plot`: what a reference caption avoids. */
35
+ export declare function claimedLabelBoxes(plot: object): readonly LabelBox[];
29
36
  /**
30
37
  * Pushes labels apart: `ys` are the labels' heights in px from the plot's bottom, returned as the
31
38
  * shift each needs (positive is up) so no two sit closer than {@link END_LABEL_MIN_GAP} and the
32
- * lowest and the topmost stay {@link END_LABEL_EDGE} inside the plot. Order is kept.
39
+ * lowest and the topmost stay {@link END_LABEL_EDGE} inside the plot; a stack too tall for the plot
40
+ * shrinks its gap to fit. Order is kept.
33
41
  */
34
42
  export declare function spreadLabels(ys: readonly number[], plotHeight: number): number[];
35
43
  /**
@@ -39,7 +47,9 @@ export declare function spreadLabels(ys: readonly number[], plotHeight: number):
39
47
  * dropped. A series whose last point the plot's own x scale cannot place, or places outside the plot
40
48
  * (`plot.xFraction` outside [0, 1]: clipped by a narrower `xDomain`), has no label.
41
49
  */
42
- export declare function endLabelPlan<T, X extends ChartX>(plot: PlotContext<T, X>, lines: readonly ChartSeries<T>[], naming?: LinesNaming): EndLabel<T, X>[];
50
+ export declare function endLabelPlan<T, X extends ChartX>(plot: PlotContext<T, X>, lines: readonly ChartSeries<T>[], naming?: LinesNaming,
51
+ /** The values of the reference lines on the left axis: rules a label must not sit on. */
52
+ rules?: readonly number[]): EndLabel<T, X>[];
43
53
  /** The offset of a label from its point: right of it, level; or left of it, above or below. */
44
54
  export declare function endLabelOffset(anchor: EndLabelAnchor, side?: EndLabelSide): {
45
55
  dx: number;
@@ -1 +1 @@
1
- {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/charts/labels.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAmBpF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,CAAA;AAC5C,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,CAAA;AAE5C;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,cAAc,CAIjB;AAED,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEzD,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI;IAC1C,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IACtB,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClB,MAAM,EAAE,cAAc,CAAA;IACtB,+FAA+F;IAC/F,IAAI,EAAE,YAAY,CAAA;IAClB,6FAA6F;IAC7F,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAWD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