basalt-ui 2.21.0 → 2.23.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 (254) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/MIGRATING.md +452 -12
  3. package/agent/agents/basalt-design-reviewer.md +1 -1
  4. package/agent/rules/basalt-tokens.md +1 -1
  5. package/agent/skills/basalt-design/SKILL.md +1 -1
  6. package/agent/skills/basalt-design/references/anti-defaults.md +1 -1
  7. package/agent/skills/basalt-design/references/catalogue.md +1 -0
  8. package/dist/charts/BandStrip.d.ts.map +1 -1
  9. package/dist/charts/BandStrip.js +73 -3
  10. package/dist/charts/Bars.d.ts.map +1 -1
  11. package/dist/charts/Bars.js +6 -0
  12. package/dist/charts/CartesianChart.d.ts +10 -0
  13. package/dist/charts/CartesianChart.d.ts.map +1 -1
  14. package/dist/charts/CartesianChart.js +8 -5
  15. package/dist/charts/ChartCard.d.ts +12 -3
  16. package/dist/charts/ChartCard.d.ts.map +1 -1
  17. package/dist/charts/ChartCard.js +39 -8
  18. package/dist/charts/DualPanel.d.ts.map +1 -1
  19. package/dist/charts/DualPanel.js +5 -8
  20. package/dist/charts/Heatmap.d.ts +12 -1
  21. package/dist/charts/Heatmap.d.ts.map +1 -1
  22. package/dist/charts/Heatmap.js +34 -5
  23. package/dist/charts/Lines.d.ts +3 -0
  24. package/dist/charts/Lines.d.ts.map +1 -1
  25. package/dist/charts/Lines.js +29 -6
  26. package/dist/charts/MirroredBars.d.ts.map +1 -1
  27. package/dist/charts/MirroredBars.js +4 -6
  28. package/dist/charts/Sparkline.d.ts +14 -2
  29. package/dist/charts/Sparkline.d.ts.map +1 -1
  30. package/dist/charts/Sparkline.js +101 -22
  31. package/dist/charts/StackedArea.d.ts +4 -1
  32. package/dist/charts/StackedArea.d.ts.map +1 -1
  33. package/dist/charts/StackedArea.js +9 -3
  34. package/dist/charts/band-fold.d.ts +38 -1
  35. package/dist/charts/band-fold.d.ts.map +1 -1
  36. package/dist/charts/band-fold.js +18 -1
  37. package/dist/charts/chart-box.module.css +19 -0
  38. package/dist/charts/chart-card.module.css +25 -0
  39. package/dist/charts/chart-dates.d.ts +12 -0
  40. package/dist/charts/chart-dates.d.ts.map +1 -0
  41. package/dist/charts/chart-dates.js +16 -0
  42. package/dist/charts/chart-legend.module.css +7 -0
  43. package/dist/charts/compile.d.ts +25 -6
  44. package/dist/charts/compile.d.ts.map +1 -1
  45. package/dist/charts/compile.js +152 -72
  46. package/dist/charts/date-tick-format.d.ts +5 -5
  47. package/dist/charts/date-tick-format.d.ts.map +1 -1
  48. package/dist/charts/date-tick-format.js +3 -7
  49. package/dist/charts/labels.d.ts +21 -6
  50. package/dist/charts/labels.d.ts.map +1 -1
  51. package/dist/charts/labels.js +52 -17
  52. package/dist/charts/legend.d.ts +2 -0
  53. package/dist/charts/legend.d.ts.map +1 -1
  54. package/dist/charts/legend.js +7 -21
  55. package/dist/charts/marks.js +1 -1
  56. package/dist/charts/panel.d.ts +0 -6
  57. package/dist/charts/panel.d.ts.map +1 -1
  58. package/dist/charts/panel.js +1 -10
  59. package/dist/charts/ref-label.d.ts +43 -0
  60. package/dist/charts/ref-label.d.ts.map +1 -0
  61. package/dist/charts/ref-label.js +75 -0
  62. package/dist/charts/scales.d.ts +4 -1
  63. package/dist/charts/scales.d.ts.map +1 -1
  64. package/dist/charts/scales.js +14 -3
  65. package/dist/charts/sparkline.module.css +13 -17
  66. package/dist/charts/sparkline.module.css.d.ts +1 -2
  67. package/dist/charts/state.d.ts +2 -0
  68. package/dist/charts/state.d.ts.map +1 -1
  69. package/dist/charts/state.js +5 -2
  70. package/dist/charts/types.d.ts +18 -8
  71. package/dist/charts/types.d.ts.map +1 -1
  72. package/dist/cli/doctor-upgrade.d.ts +1 -0
  73. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  74. package/dist/cli/doctor-upgrade.js +1 -0
  75. package/dist/cli/init.d.ts +2 -0
  76. package/dist/cli/init.d.ts.map +1 -1
  77. package/dist/cli/init.js +68 -4
  78. package/dist/cli/shot/capture.d.ts +21 -2
  79. package/dist/cli/shot/capture.d.ts.map +1 -1
  80. package/dist/cli/shot/capture.js +202 -36
  81. package/dist/cli/shot/detect.d.ts.map +1 -1
  82. package/dist/cli/shot/detect.js +17 -1
  83. package/dist/cli/shot/playwright.d.ts +13 -2
  84. package/dist/cli/shot/playwright.d.ts.map +1 -1
  85. package/dist/cli/shot/playwright.js +5 -1
  86. package/dist/cli/shot/types.d.ts +4 -0
  87. package/dist/cli/shot/types.d.ts.map +1 -1
  88. package/dist/cli/shot/types.js +2 -0
  89. package/dist/cli/tokens-css.d.ts +5 -7
  90. package/dist/cli/tokens-css.d.ts.map +1 -1
  91. package/dist/cli/tokens-css.js +11 -12
  92. package/dist/controls/controls.module.css +11 -1
  93. package/dist/controls/filter-pill.d.ts.map +1 -1
  94. package/dist/controls/filter-pill.js +1 -0
  95. package/dist/controls/sync-button.d.ts.map +1 -1
  96. package/dist/controls/sync-button.js +22 -3
  97. package/dist/controls/sync-button.module.css +34 -2
  98. package/dist/controls/sync-button.module.css.d.ts +1 -0
  99. package/dist/dashboard/bar-list.d.ts +6 -1
  100. package/dist/dashboard/bar-list.d.ts.map +1 -1
  101. package/dist/dashboard/bar-list.js +15 -8
  102. package/dist/dashboard/bar-list.module.css +83 -0
  103. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  104. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  105. package/dist/dashboard/delta-badge.js +2 -2
  106. package/dist/dashboard/index.d.ts +1 -0
  107. package/dist/dashboard/index.d.ts.map +1 -1
  108. package/dist/dashboard/index.js +2 -0
  109. package/dist/dashboard/meter-model.d.ts +84 -5
  110. package/dist/dashboard/meter-model.d.ts.map +1 -1
  111. package/dist/dashboard/meter-model.js +100 -15
  112. package/dist/dashboard/meter-parts.d.ts +9 -1
  113. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  114. package/dist/dashboard/meter-parts.js +276 -74
  115. package/dist/dashboard/meter.d.ts +54 -65
  116. package/dist/dashboard/meter.d.ts.map +1 -1
  117. package/dist/dashboard/meter.js +21 -4
  118. package/dist/dashboard/meter.module.css +76 -0
  119. package/dist/dashboard/meter.module.css.d.ts +6 -0
  120. package/dist/dashboard/page-summary.d.ts +20 -0
  121. package/dist/dashboard/page-summary.d.ts.map +1 -0
  122. package/dist/dashboard/page-summary.js +28 -0
  123. package/dist/dashboard/page-summary.module.css +89 -0
  124. package/dist/dashboard/page-summary.module.css.d.ts +15 -0
  125. package/dist/dashboard/query-state.d.ts.map +1 -1
  126. package/dist/dashboard/query-state.js +1 -1
  127. package/dist/dashboard/section.d.ts +25 -2
  128. package/dist/dashboard/section.d.ts.map +1 -1
  129. package/dist/dashboard/section.js +10 -5
  130. package/dist/dashboard/section.module.css +23 -0
  131. package/dist/dashboard/section.module.css.d.ts +1 -0
  132. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  133. package/dist/dashboard/stat-card-parts.js +1 -1
  134. package/dist/dashboard/stat-card.d.ts +4 -2
  135. package/dist/dashboard/stat-card.d.ts.map +1 -1
  136. package/dist/dashboard/stat-card.js +7 -5
  137. package/dist/dashboard/stat-card.module.css +36 -0
  138. package/dist/dashboard/stat-group.module.css +7 -0
  139. package/dist/dashboard/stat-strip.d.ts +22 -6
  140. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  141. package/dist/dashboard/stat-strip.js +104 -60
  142. package/dist/dashboard/stat-strip.module.css +122 -53
  143. package/dist/dashboard/stat-strip.module.css.d.ts +4 -0
  144. package/dist/dashboard/visual-slot.d.ts +7 -1
  145. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  146. package/dist/dashboard/visual-slot.js +3 -1
  147. package/dist/guard/index.d.ts.map +1 -1
  148. package/dist/guard/index.js +0 -5
  149. package/dist/guard/vx-names.d.ts.map +1 -1
  150. package/dist/guard/vx-names.js +2 -0
  151. package/dist/index.d.ts +1 -1
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +3 -1
  154. package/dist/styles.css +43 -4
  155. package/dist/theme/chrome-vars.d.ts +20 -5
  156. package/dist/theme/chrome-vars.d.ts.map +1 -1
  157. package/dist/theme/chrome-vars.js +46 -3
  158. package/dist/theme/controls.module.css +37 -0
  159. package/dist/theme/controls.module.css.d.ts +2 -0
  160. package/dist/theme/index.d.ts.map +1 -1
  161. package/dist/theme/index.js +18 -27
  162. package/dist/theme/status-verdict.d.ts.map +1 -1
  163. package/dist/theme/status-verdict.js +9 -1
  164. package/dist/tokens/core.d.ts +2 -1
  165. package/dist/tokens/core.d.ts.map +1 -1
  166. package/dist/tokens/core.js +6 -1
  167. package/dist/tokens/derive.d.ts +3 -1
  168. package/dist/tokens/derive.d.ts.map +1 -1
  169. package/dist/tokens/derive.js +16 -1
  170. package/dist/tokens/palette.d.ts +11 -10
  171. package/dist/tokens/palette.d.ts.map +1 -1
  172. package/dist/tokens/palette.js +11 -10
  173. package/dist/tokens/status-text.d.ts.map +1 -1
  174. package/dist/tokens/status-text.js +3 -1
  175. package/llms.txt +42 -22
  176. package/package.json +1 -1
  177. package/src/charts/BandStrip.tsx +83 -3
  178. package/src/charts/Bars.tsx +7 -0
  179. package/src/charts/CartesianChart.tsx +18 -3
  180. package/src/charts/ChartCard.tsx +54 -13
  181. package/src/charts/DualPanel.tsx +3 -6
  182. package/src/charts/Heatmap.tsx +54 -5
  183. package/src/charts/Lines.tsx +56 -10
  184. package/src/charts/MirroredBars.tsx +3 -5
  185. package/src/charts/Sparkline.tsx +135 -25
  186. package/src/charts/StackedArea.tsx +14 -4
  187. package/src/charts/band-fold.ts +50 -1
  188. package/src/charts/chart-box.module.css +19 -0
  189. package/src/charts/chart-card.module.css +25 -0
  190. package/src/charts/chart-dates.ts +30 -0
  191. package/src/charts/chart-legend.module.css +7 -0
  192. package/src/charts/compile.ts +253 -87
  193. package/src/charts/date-tick-format.ts +10 -13
  194. package/src/charts/labels.ts +81 -26
  195. package/src/charts/legend.tsx +10 -20
  196. package/src/charts/marks.ts +1 -1
  197. package/src/charts/panel.tsx +1 -16
  198. package/src/charts/ref-label.ts +131 -0
  199. package/src/charts/scales.ts +22 -2
  200. package/src/charts/sparkline.module.css +13 -17
  201. package/src/charts/sparkline.module.css.d.ts +1 -2
  202. package/src/charts/state.tsx +9 -4
  203. package/src/charts/types.ts +18 -8
  204. package/src/cli/doctor-upgrade.ts +1 -1
  205. package/src/cli/init.ts +100 -3
  206. package/src/cli/shot/capture.ts +266 -35
  207. package/src/cli/shot/detect.ts +18 -1
  208. package/src/cli/shot/playwright.ts +20 -4
  209. package/src/cli/shot/types.ts +5 -0
  210. package/src/cli/tokens-css.ts +18 -20
  211. package/src/controls/controls.module.css +11 -1
  212. package/src/controls/filter-pill.tsx +2 -0
  213. package/src/controls/sync-button.module.css +34 -2
  214. package/src/controls/sync-button.module.css.d.ts +1 -0
  215. package/src/controls/sync-button.tsx +40 -4
  216. package/src/dashboard/bar-list.module.css +83 -0
  217. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  218. package/src/dashboard/bar-list.tsx +107 -69
  219. package/src/dashboard/delta-badge.tsx +6 -2
  220. package/src/dashboard/index.ts +1 -0
  221. package/src/dashboard/meter-model.ts +207 -24
  222. package/src/dashboard/meter-parts.tsx +349 -67
  223. package/src/dashboard/meter.module.css +76 -0
  224. package/src/dashboard/meter.module.css.d.ts +6 -0
  225. package/src/dashboard/meter.tsx +72 -18
  226. package/src/dashboard/page-summary.module.css +89 -0
  227. package/src/dashboard/page-summary.module.css.d.ts +15 -0
  228. package/src/dashboard/page-summary.tsx +95 -0
  229. package/src/dashboard/query-state.tsx +1 -1
  230. package/src/dashboard/section.module.css +23 -0
  231. package/src/dashboard/section.module.css.d.ts +1 -0
  232. package/src/dashboard/section.tsx +59 -11
  233. package/src/dashboard/stat-card-parts.tsx +5 -1
  234. package/src/dashboard/stat-card.module.css +36 -0
  235. package/src/dashboard/stat-card.tsx +12 -6
  236. package/src/dashboard/stat-group.module.css +7 -0
  237. package/src/dashboard/stat-strip.module.css +122 -53
  238. package/src/dashboard/stat-strip.module.css.d.ts +4 -0
  239. package/src/dashboard/stat-strip.tsx +176 -91
  240. package/src/dashboard/visual-slot.ts +12 -3
  241. package/src/guard/index.ts +0 -5
  242. package/src/guard/vx-names.ts +2 -0
  243. package/src/index.ts +2 -0
  244. package/src/styles.css +43 -4
  245. package/src/theme/__snapshots__/plain-theme.test.ts.snap +200 -68
  246. package/src/theme/chrome-vars.ts +77 -8
  247. package/src/theme/controls.module.css +37 -0
  248. package/src/theme/controls.module.css.d.ts +2 -0
  249. package/src/theme/index.ts +22 -32
  250. package/src/theme/status-verdict.tsx +5 -1
  251. package/src/tokens/core.ts +4 -1
  252. package/src/tokens/derive.ts +32 -3
  253. package/src/tokens/palette.ts +11 -10
  254. package/src/tokens/status-text.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/charts/Lines.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAOzC,OAAO,KAAK,EACV,mBAAmB,EAEnB,MAAM,EAGN,SAAS,EACV,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAChG;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,SAAS,EAAE,CAAA;CACjE,CAAA;AAID,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CA8DzF"}
1
+ {"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/charts/Lines.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQzC,OAAO,KAAK,EACV,mBAAmB,EAGnB,MAAM,EAGN,SAAS,EACV,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAChG;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,SAAS,EAAE,CAAA;IAChE;sCACkC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;CACrD,CAAA;AAoBD,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAoFzF"}
@@ -10,9 +10,24 @@ import { endLabelMarks, endLabelPlan } from "./labels.js";
10
10
  import { drawnRows, lineMark, loneDots, markersOf, yScaleOf } from "./marks.js";
11
11
  import { rowX } from "./types.js";
12
12
  const hasValue = (r) => r.y !== null;
13
+ function lastIsPlaceable(props, s) {
14
+ const last = props.data.findLast((d) => s.getValue(d) !== null);
15
+ if (last === void 0) return false;
16
+ const { xDomain } = props;
17
+ if (xDomain === void 0) return true;
18
+ const at = +props.x(last);
19
+ return Number.isNaN(at) || at >= +xDomain[0] && at <= +xDomain[1];
20
+ }
21
+ const AUTO_END_LABELS = 3;
13
22
  function Lines(props) {
14
- const { thresholds, ...rest } = props;
23
+ const { thresholds, naming = "auto", ...rest } = props;
15
24
  const { series } = props;
25
+ const labelled = series.filter((s) => s.role !== "reference");
26
+ const namedByLabels = props.y2 === void 0 && series.every((s) => s.legend === false || s.role !== "reference") && !(props.refLines ?? []).some((r) => r.legend !== void 0);
27
+ const effective = namedByLabels ? naming : "legend";
28
+ const placeable = labelled.every((s) => lastIsPlaceable(props, s));
29
+ const labelsOnly = effective === "endLabels";
30
+ const hideAtWide = effective === "auto" && placeable && labelled.length > 0 && labelled.length <= AUTO_END_LABELS;
16
31
  const marks = useCallback(
17
32
  (plot) => {
18
33
  const indexOf = new Map(series.map((s, i) => [s.key, i]));
@@ -51,7 +66,7 @@ function Lines(props) {
51
66
  y1: () => 0,
52
67
  fill: `url(#${areaGradientId(indexOf.get(s.key) ?? 0)})`,
53
68
  fillOpacity: 1,
54
- curve: chartCurve(s.curve ?? "monotone"),
69
+ curve: chartCurve(s.curve ?? "linear"),
55
70
  ...yScaleOf(plot, s) !== void 0 && { yScale: "y2" }
56
71
  })
57
72
  )
@@ -63,13 +78,21 @@ function Lines(props) {
63
78
  out.push(...loneDots(s, drawnRows(plot, s), yScale, plot.highlighted));
64
79
  out.push(...markersOf(s, plot.rows(s.key), yScale));
65
80
  }
66
- const labelled = plotted.filter((s) => s.role !== "reference");
67
- out.push(...endLabelMarks(endLabelPlan(plot, labelled)));
81
+ const labelled2 = plotted.filter((s) => s.role !== "reference");
82
+ out.push(...endLabelMarks(endLabelPlan(plot, labelled2, effective)));
68
83
  return out;
69
84
  },
70
- [series, thresholds]
85
+ [series, thresholds, effective]
86
+ );
87
+ return /* @__PURE__ */ jsx(
88
+ CartesianRung,
89
+ {
90
+ ...rest,
91
+ marks,
92
+ ...labelsOnly && { legend: false },
93
+ ...hideAtWide && { hideLegendAtWide: true }
94
+ }
71
95
  );
72
- return /* @__PURE__ */ jsx(CartesianRung, { ...rest, marks });
73
96
  }
74
97
  export {
75
98
  Lines
@@ -1 +1 @@
1
- {"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAUzC,OAAO,KAAK,EAAE,mB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A;IAClD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;IAC3B,6FAA6F;IAC7F,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IAC9C;;;OAGG;IACH,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;KAAE,GAAG,SAAS,CAAA;IAC/E,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAA;CAC7E,CAAA;AAsCD,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAClF,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAChC,YAAY,CAkNd"}
@@ -8,7 +8,7 @@ import { VX, alpha } from "../tokens/index.js";
8
8
  import { resolveContainerClass } from "../tokens/size-classes.js";
9
9
  import { defaultNumberFormat, seriesRow, visibleSeries } from "./compile.js";
10
10
  import { barMark, emphasis } from "./marks.js";
11
- import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
11
+ import { PanelRung, paneX, paneY, rowsOf } from "./panel.js";
12
12
  import { xScaleFor } from "./scales.js";
13
13
  import { foldBands, resolveNamedState } from "./band-fold.js";
14
14
  import { rowX } from "./types.js";
@@ -87,9 +87,8 @@ function MirroredBars(props) {
87
87
  const downMax = paneMax(down, downSeries, drawn, downOn);
88
88
  const bandWidth = 2 * model.halfStep * BAND_FILL;
89
89
  const bandScale = () => xScaleFor(drawn.map(x), "flush").scale;
90
- const pane = (side, cfg, s, on, max) => ({ width: w, height: h }) => {
90
+ const pane = (side, cfg, s, on, max) => ({ width: w }) => {
91
91
  const cls = resolveContainerClass(w);
92
- const whole = chartHeightOf(h, side === "up" ? upFraction : 1 - upFraction, 0);
93
92
  const domain = side === "up" ? [0, max] : [max, 0];
94
93
  const rows = on ? rowsOf(drawn, x, s) : [];
95
94
  const opacity = (d) => (getBarOpacity?.(d) ?? BAR_OPACITY) * emphasis(highlighted, s);
@@ -156,14 +155,13 @@ function MirroredBars(props) {
156
155
  )
157
156
  ],
158
157
  scales: {
159
- x: side === "down" ? paneX({ scale: bandScale(), model, format, cls, height: whole }) : { scale: bandScale(), axis: false },
158
+ x: side === "down" ? paneX({ scale: bandScale(), model, format, cls }) : { scale: bandScale(), axis: false },
160
159
  y: paneY({
161
160
  scale: scaleLinear().domain(domain),
162
161
  domain,
163
162
  format: cfg.format,
164
163
  ticks: cfg.ticks ?? DEFAULT_PANE_TICKS,
165
- cls,
166
- height: whole
164
+ cls
167
165
  }),
168
166
  zx: { channel: "x", scale: scaleLinear().domain([0, 1]), axis: false }
169
167
  }
@@ -4,7 +4,12 @@ import type { ChartState } from './types.js';
4
4
  export type SparklineProps = BasaltProps & {
5
5
  /** The accessible name. Required: a chart without one is an unlabeled image. */
6
6
  ariaLabel: string;
7
- data: readonly number[];
7
+ /** The values, or `{ at, value }` points: `at` (a Date, epoch ms or ISO string) names the point in
8
+ * the readout, as a day or, within one day, an hour, in the page's format locale. */
9
+ data: readonly number[] | readonly {
10
+ at: Date | number | string;
11
+ value: number;
12
+ }[];
8
13
  /** Height in px. */
9
14
  height: number;
10
15
  /** Width in px. Default: the container's, measured by the host. */
@@ -13,6 +18,8 @@ export type SparklineProps = BasaltProps & {
13
18
  mark?: 'line' | 'bar' | undefined;
14
19
  /** A `VX.*` ref or a series token. Default `VX.faint`. */
15
20
  color?: string | undefined;
21
+ /** `'muted'`: the quiet trend line (a muted ink at low alpha). An explicit `color` wins. */
22
+ tone?: 'muted' | undefined;
16
23
  /** Paints the last point in `emphasisColor` — the one reading a trend beside a KPI is for.
17
24
  * Default `true`; pass `false` for a bare line. */
18
25
  emphasizeLast?: boolean | undefined;
@@ -25,9 +32,14 @@ export type SparklineProps = BasaltProps & {
25
32
  /** A quiet dashed hairline at a value, or at the mean of the plotted values (`'mean'`). The y
26
33
  * domain widens to include it. Not a legend item, never a status colour. */
27
34
  reference?: number | 'mean' | undefined;
35
+ /** A short caption for the `reference` line (`PR`, `30 d mean`), drawn at the plot start just
36
+ * above the line. */
37
+ referenceLabel?: string | undefined;
28
38
  /** Formats the readout's value. Default: the compact number format. */
29
39
  format?: ((value: number) => string) | undefined;
30
- /** The readout's x label per point, index-aligned with `data`. Omitted: the value alone. */
40
+ /** The readout's x label per point, index-aligned with `data`: pass the point's day ("12 Oct"),
41
+ * and the readout reads `3 items · 12 Oct` beside the point. Omitted: the moment of an `{ at }`
42
+ * point, else the value alone. */
31
43
  labels?: readonly string[] | undefined;
32
44
  };
33
45
  type Point = {
@@ -1 +1 @@
1
- {"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/charts/Sparkline.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA2C,YAAY,EAAE,MAAM,OAAO,CAAA;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAUlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;IACjC,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B;uDACmD;IACnD,aAAa,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ment, jsx, jsxs } from "react/jsx-runtime";
1
+ 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
5
  import { ruleY } from "@tanstack/charts/rule";
6
6
  import { scaleBand } from "@tanstack/charts/scales/band";
7
7
  import { scaleLinear } from "@tanstack/charts/scales/linear";
8
+ import { text } from "@tanstack/charts/text";
8
9
  import { useId, useMemo, useState } from "react";
9
10
  import { cx } from "../common/props.js";
10
- import { VX } from "../tokens/index.js";
11
+ import { VX, alpha } from "../tokens/index.js";
11
12
  import { chartCurve } from "./curves.js";
12
13
  import { barMark } from "./marks.js";
13
- import { defaultNumberFormat } from "./compile.js";
14
+ import { bucketDay, dayGranular, defaultNumberFormat } from "./compile.js";
15
+ import { referenceLabelPlacement } from "./ref-label.js";
16
+ import { readoutClock, readoutDay } from "./chart-dates.js";
17
+ import { toDate } from "../format/shared.js";
14
18
  import { ChartEngine, idPrefixOf } from "./host.js";
15
19
  import classes from "./sparkline.module.css";
16
20
  import { ChartPlaceholder, resolveChartState } from "./state.js";
@@ -18,10 +22,38 @@ import { CHART_THEME, DASH } from "./theme.js";
18
22
  const LINE_WIDTH = 1.5;
19
23
  const DOT_R = 2.5;
20
24
  const BAR_GAP = 0.15;
25
+ const READOUT_GAP = 8;
26
+ const LINE_INSET = 3;
27
+ const MUTED_LINE = alpha(VX.muted, 0.35);
28
+ const REFERENCE_LABEL_DX = 3;
21
29
  const LINE_PX_PER_POINT = 1;
22
30
  const BAR_PX_PER_BAR = 2;
23
31
  const LINE_POOL_MIN = 4;
32
+ const DAY_MS = 864e5;
24
33
  const finite = (v) => Number.isFinite(v) ? v : null;
34
+ function momentsOf(data) {
35
+ const dates = [];
36
+ for (const d of data) {
37
+ if (typeof d !== "object" || d === null) return void 0;
38
+ dates.push(toDate(d.at));
39
+ }
40
+ const known = dates.filter((d) => d !== null);
41
+ if (known.length === 0) return void 0;
42
+ let lo = Number.POSITIVE_INFINITY;
43
+ let hi = Number.NEGATIVE_INFINITY;
44
+ for (const d of known) {
45
+ const day = Math.floor(d.getTime() / DAY_MS);
46
+ if (day < lo) lo = day;
47
+ if (day > hi) hi = day;
48
+ }
49
+ const oneDay = lo === hi;
50
+ const byDay = dayGranular(known);
51
+ return dates.map((d) => {
52
+ if (d === null) return void 0;
53
+ if (byDay) return readoutDay(bucketDay(d));
54
+ return oneDay ? readoutClock(d) : `${readoutDay(d)} ${readoutClock(d)}`;
55
+ });
56
+ }
25
57
  function extent(rows) {
26
58
  let lo = Number.POSITIVE_INFINITY;
27
59
  let hi = Number.NEGATIVE_INFINITY;
@@ -96,25 +128,49 @@ function frameOf([lo, hi], mark, count, hasEnd) {
96
128
  const xPad = hasEnd ? (count - 1) * 0.04 || 0.5 : 0;
97
129
  return { x: [-xPad, Math.max(count - 1, 1) + xPad], y: [lo - pad, hi + pad] };
98
130
  }
99
- function compileSparkline(source, extentOf, mark, color, emphasisColor, reference) {
131
+ function compileSparkline(source, extentOf, mark, color, emphasisColor, reference, referenceLabel) {
100
132
  const frame = frameOf(extentOf, mark, source.length, emphasisColor !== null);
101
- const referenceMark = () => reference === null ? [] : [
133
+ const referenceMark = (height) => reference === null ? [] : [
102
134
  ruleY([reference], {
103
135
  id: "reference",
104
136
  stroke: VX.line,
105
137
  strokeOpacity: 1,
106
138
  strokeWidth: 1,
107
139
  strokeDasharray: DASH
108
- })
140
+ }),
141
+ ...referenceLabel === void 0 ? [] : [
142
+ decorative(
143
+ text([reference], {
144
+ id: "reference-label",
145
+ x: () => mark === "bar" ? 0 : frame.x[0],
146
+ y: (v) => v,
147
+ text: () => referenceLabel,
148
+ fill: VX.ink2,
149
+ fontSize: VX.text.micro,
150
+ anchor: "start",
151
+ dx: REFERENCE_LABEL_DX,
152
+ dy: referenceLabelPlacement({
153
+ value: reference,
154
+ domain: frame.y,
155
+ height,
156
+ inset: mark === "bar" ? 0 : LINE_INSET,
157
+ fontSize: VX.text.micro
158
+ }).dy
159
+ })
160
+ )
161
+ ]
109
162
  ];
110
163
  return {
111
- chart: ({ width }) => {
164
+ // A bar's hover is the bar and the readout chip: no engine point marker (bar chrome only, as
165
+ // `Bars`).
166
+ ...mark === "bar" && { focusRing: false },
167
+ chart: ({ width, height }) => {
112
168
  const rows = poolSparkline(source, width, mark);
113
169
  const last = rows.at(-1);
114
170
  if (mark === "bar") {
115
171
  return {
116
172
  marks: [
117
- ...referenceMark(),
173
+ ...referenceMark(height),
118
174
  barMark(rows, {
119
175
  id: "bars",
120
176
  x: "i",
@@ -139,7 +195,7 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
139
195
  }
140
196
  return {
141
197
  marks: [
142
- ...referenceMark(),
198
+ ...referenceMark(height),
143
199
  lineY(rows, {
144
200
  id: "line",
145
201
  x: "i",
@@ -163,7 +219,7 @@ function compileSparkline(source, extentOf, mark, color, emphasisColor, referenc
163
219
  },
164
220
  theme: CHART_THEME,
165
221
  guides: false,
166
- margin: 0
222
+ margin: LINE_INSET
167
223
  };
168
224
  }
169
225
  };
@@ -194,11 +250,13 @@ function Sparkline(props) {
194
250
  height,
195
251
  width,
196
252
  mark = "line",
197
- color = VX.faint,
253
+ tone,
254
+ color = tone === "muted" ? MUTED_LINE : VX.faint,
198
255
  emphasizeLast = true,
199
256
  emphasisColor = VX.line,
200
257
  state,
201
258
  reference,
259
+ referenceLabel,
202
260
  format = defaultNumberFormat,
203
261
  labels,
204
262
  className,
@@ -209,7 +267,10 @@ function Sparkline(props) {
209
267
  const [keyed, setKeyed] = useState(null);
210
268
  const active = hover ?? keyed;
211
269
  const model = useMemo(() => {
212
- const rows2 = data.map((v, i) => ({ i, v: finite(v) }));
270
+ const rows2 = data.map((d, i) => ({
271
+ i,
272
+ v: finite(typeof d === "object" && d !== null ? d.value : d)
273
+ }));
213
274
  const range = extent(rows2);
214
275
  if (range === null) return null;
215
276
  const at2 = reference === "mean" ? meanOf(rows2) : reference ?? null;
@@ -218,10 +279,11 @@ function Sparkline(props) {
218
279
  const end = emphasizeLast ? emphasisColor : null;
219
280
  return {
220
281
  rows: rows2,
282
+ moments: momentsOf(data),
221
283
  frame: frameOf(full, mark, rows2.length, end !== null),
222
- definition: compileSparkline(rows2, full, mark, color, end, ref)
284
+ definition: compileSparkline(rows2, full, mark, color, end, ref, referenceLabel)
223
285
  };
224
- }, [data, mark, color, emphasizeLast, emphasisColor, reference]);
286
+ }, [data, mark, color, emphasizeLast, emphasisColor, reference, referenceLabel]);
225
287
  const resolved = resolveChartState(state);
226
288
  const rows = model?.rows;
227
289
  const interactive = resolved === null && model !== null;
@@ -248,13 +310,26 @@ function Sparkline(props) {
248
310
  if (!interactive || rows === void 0 || keyed !== null || hidden(e.currentTarget)) return;
249
311
  setKeyed(lastFinite(rows));
250
312
  };
313
+ const inset = mark === "line" ? LINE_INSET : 0;
314
+ const layerStyle = { inset };
251
315
  const value = active === null ? null : rows?.[active]?.v ?? null;
252
316
  const at = interactive && active !== null && value !== null ? {
253
317
  value,
254
318
  fx: mark === "bar" ? (active + 0.5) / model.rows.length : (active - model.frame.x[0]) / (model.frame.x[1] - model.frame.x[0]),
255
319
  fy: (model.frame.y[1] - value) / (model.frame.y[1] - model.frame.y[0]),
256
- label: labels?.[active]
320
+ label: labels?.[active] ?? model.moments?.[active]
257
321
  } : null;
322
+ const beside = at === null ? null : at.fx > 0.5 ? "left" : "right";
323
+ const readoutStyle = at === null ? void 0 : {
324
+ ...beside === "right" ? {
325
+ left: `calc(${at.fx * 100}% + ${READOUT_GAP}px)`,
326
+ maxWidth: `calc(${(1 - at.fx) * 100}% - ${READOUT_GAP}px)`
327
+ } : {
328
+ right: `calc(${(1 - at.fx) * 100}% + ${READOUT_GAP}px)`,
329
+ maxWidth: `calc(${at.fx * 100}% - ${READOUT_GAP}px)`
330
+ },
331
+ ...at.fy > 0.5 ? { top: 0 } : { bottom: 0 }
332
+ };
258
333
  return /* @__PURE__ */ jsxs(
259
334
  "div",
260
335
  {
@@ -282,8 +357,11 @@ function Sparkline(props) {
282
357
  coarse: false
283
358
  }
284
359
  ),
285
- at !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
286
- /* @__PURE__ */ jsx(
360
+ at !== null && // One layer on the plot rect (inside a line's margin): the dot and the readout take their
361
+ // fractions of the same box, so both land where the mark did. A bar has no dot: the bar
362
+ // is the marker.
363
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: classes.layer, style: layerStyle, children: [
364
+ mark === "line" && /* @__PURE__ */ jsx(
287
365
  "span",
288
366
  {
289
367
  "data-basalt-sparkline-dot": "",
@@ -296,13 +374,14 @@ function Sparkline(props) {
296
374
  {
297
375
  "data-basalt-sparkline-readout": "",
298
376
  "aria-live": hover === null ? "polite" : "off",
299
- className: cx(classes.readout, at.fx > 0.5 ? classes.start : classes.end),
377
+ className: classes.readout,
378
+ style: readoutStyle,
300
379
  children: [
380
+ format(at.value),
301
381
  at.label !== void 0 && /* @__PURE__ */ jsxs("span", { className: classes.label, children: [
302
- at.label,
303
- " "
304
- ] }),
305
- format(at.value)
382
+ " \xB7 ",
383
+ at.label
384
+ ] })
306
385
  ]
307
386
  }
308
387
  )
@@ -2,12 +2,15 @@ import type { ReactElement } from 'react';
2
2
  import type { CartesianChartProps, ChartSeries, ChartX } from './types.js';
3
3
  /** A band. Stacked areas read the left axis and draw no line, so the line fields are absent. */
4
4
  export type StackedAreaBand<T> = Pick<ChartSeries<T>, 'key' | 'label' | 'color' | 'getValue' | 'formatValue' | 'tooltip' | 'legend' | 'role' | 'note'> & {
5
- /** Default 0.85. */
5
+ /** Default: the chart's `fillOpacity` (0.85). */
6
6
  fillOpacity?: number | undefined;
7
7
  };
8
8
  export type StackedAreaProps<T, X extends ChartX = ChartX> = Omit<CartesianChartProps<T, X>, 'marks' | 'y' | 'y2' | 'series'> & {
9
9
  /** The bands, bottom to top. */
10
10
  series: readonly StackedAreaBand<T>[];
11
+ /** Every band's fill opacity, 0–1 (default 0.85: full-opacity bands read saturated). A band's own
12
+ * `fillOpacity` wins. The legend swatch wears the same shade. */
13
+ fillOpacity?: number | undefined;
11
14
  /** No `scale`: a log axis has no additive zero to stack from. */
12
15
  y?: Omit<NonNullable<CartesianChartProps<T, X>['y']>, 'scale'> | undefined;
13
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StackedArea.d.ts","sourceRoot":"","sources":["../../src/charts/StackedArea.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAKzC,OAAO,KAAK,EAAE,mBAAmB,EAAc,WAAW,EAAE,MAAM,EAAe,MAAM,SAAS,CAAA;AAIhG,gGAAgG;AAChG,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CACnC,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChG,GAAG;IACF,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAC/D,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,QAAQ,CAChC,GAAG;IACF,gCAAgC;IAChC,MAAM,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IACrC,iEAAiE;IACjE,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC3E,CAAA;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EACtD,KAAK,EAAE,gBAAgB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asis } from "./marks.js";
8
8
  import { rowX } from "./types.js";
9
9
  const DEFAULT_BAND_OPACITY = 0.85;
10
10
  function StackedArea(props) {
11
- const { series: bands, ...rest } = props;
11
+ const { series: bands, fillOpacity, ...rest } = props;
12
12
  const series = useMemo(
13
- () => bands.map((s) => ({ ...s, mark: "bar" })),
14
- [bands]
13
+ () => bands.map((s) => ({
14
+ ...s,
15
+ mark: "bar",
16
+ ...(s.fillOpacity ?? fillOpacity) !== void 0 && {
17
+ fillOpacity: s.fillOpacity ?? fillOpacity
18
+ }
19
+ })),
20
+ [bands, fillOpacity]
15
21
  );
16
22
  const marks = useCallback((plot) => {
17
23
  const visible = plot.visible;
@@ -4,7 +4,43 @@ import type { ChartSeries } from './types.js';
4
4
  * the key, its legend label and color, its fill opacity, and the legend / tooltip / note switches.
5
5
  * One base so a field means the same thing on every kind.
6
6
  */
7
- export type NamedChartState = Pick<ChartSeries<never>, 'key' | 'label' | 'color' | 'tooltip' | 'legend' | 'note' | 'fillOpacity'>;
7
+ export type NamedChartState = Pick<ChartSeries<never>, 'key' | 'label' | 'color' | 'tooltip' | 'legend' | 'note' | 'fillOpacity'> & {
8
+ /**
9
+ * A short mark (`!`, `×`) drawn in the middle of each cell in this state, so a state is not told
10
+ * apart by hue alone; `''` opts out of the default. Default: `!` for a `warn` state and `×` for a
11
+ * `bad` one (by `tone`, or by a `color` that is `VX.status.warn` / `VX.status.bad`); none
12
+ * otherwise. Skipped on a cell too narrow to hold it.
13
+ */
14
+ glyph?: string | undefined;
15
+ /** The status this state means. `Heatmap` also fills from it; on `BandStrip` it only picks the
16
+ * default `glyph` (the fill is `color`). */
17
+ tone?: StatusTone | undefined;
18
+ };
19
+ /** The status inks a state can name: `VX.status.*`. */
20
+ export type StatusTone = 'good' | 'warn' | 'bad' | 'neutral';
21
+ type ToneSource = Pick<NamedChartState, 'glyph' | 'tone'> & {
22
+ color?: string | undefined;
23
+ };
24
+ /** A state's status tone: its own, else the one its status colour names. */
25
+ export declare function toneOf(s: ToneSource): StatusTone | undefined;
26
+ /** The glyph a state draws: its own, else its status tone's default, else none. */
27
+ export declare function glyphOf(s: ToneSource): string | undefined;
28
+ /** A heat cell narrower than this (px) draws no glyph: it would not fit inside the fill. */
29
+ export declare const GLYPH_MIN_PX = 12;
30
+ /**
31
+ * A `BandStrip` cell narrower than this (px) draws no glyph: its fill is full-height, so the glyph
32
+ * is set at the xs size (a 16 px line), and a `!` or `×` is unreadable in less. Such a cell draws a
33
+ * notch instead, see {@link NOTCH_PX}. A `Heatmap` keeps {@link GLYPH_MIN_PX}.
34
+ */
35
+ export declare const BAND_GLYPH_MIN_PX = 16;
36
+ /**
37
+ * The height (px) of the bottom notch a glyph state draws where the glyph does not fit: a warn
38
+ * notch is shorter than a bad one, so the state is never told by hue alone.
39
+ */
40
+ export declare const NOTCH_PX: {
41
+ readonly warn: 3;
42
+ readonly bad: 6;
43
+ };
8
44
  /** A run of adjacent slots drawn as one band; `items` are the source data it stands for. */
9
45
  export type Group<T> = {
10
46
  start: number;
@@ -25,4 +61,5 @@ export declare function foldBands<T>(data: readonly T[], cap: number, merge: (gr
25
61
  * in production the chart degrades to the unset behaviour.
26
62
  */
27
63
  export declare function resolveNamedState<K extends string>(component: string, prop: string, requested: K | undefined, known: readonly string[]): K | undefined;
64
+ export {};
28
65
  //# sourceMappingURL=band-fold.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"band-fold.d.ts","sourceRoot":"","sources":["../../src/charts/band-fold.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,WAAW,CAAC,KAAK,CAAC,EAClB,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAC1E,CAAA;AAED,4FAA4F;AAC5F,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,KAAK,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neOf(s) {
5
+ return s.tone ?? (s.color === VX.status.warn ? "warn" : s.color === VX.status.bad ? "bad" : void 0);
6
+ }
7
+ function glyphOf(s) {
8
+ const tone = toneOf(s);
9
+ return s.glyph ?? (tone === void 0 ? void 0 : TONE_GLYPH[tone]);
10
+ }
11
+ const GLYPH_MIN_PX = 12;
12
+ const BAND_GLYPH_MIN_PX = 16;
13
+ const NOTCH_PX = { warn: 3, bad: 6 };
2
14
  function groupsOf(data, cap) {
3
15
  const size = Math.max(1, Math.ceil(data.length / Math.max(cap, 1)));
4
16
  const out = [];
@@ -23,7 +35,12 @@ function resolveNamedState(component, prop, requested, known) {
23
35
  return void 0;
24
36
  }
25
37
  export {
38
+ BAND_GLYPH_MIN_PX,
39
+ GLYPH_MIN_PX,
40
+ NOTCH_PX,
26
41
  foldBands,
42
+ glyphOf,
27
43
  groupsOf,
28
- resolveNamedState
44
+ resolveNamedState,
45
+ toneOf
29
46
  };
@@ -92,3 +92,22 @@
92
92
  height: auto;
93
93
  min-height: inherit;
94
94
  }
95
+
96
+ /*
97
+ * The engine paints its tooltip rows as a grid of `.55rem | minmax(0, 1fr) | auto` with inline
98
+ * styles and `overflow-wrap: anywhere` on the card, so a narrow tooltip (a 390 viewport, a pointer
99
+ * near an edge) squeezes the name column to one character per line. The name keeps a floor and
100
+ * never wraps; a long name ends in an ellipsis, the value stays right-aligned. The tooltip is
101
+ * portalled out of the chart's tree, hence the global class names. `!important` because the
102
+ * engine's own values are inline.
103
+ */
104
+ :global(.ts-chart-tooltip__row) {
105
+ grid-template-columns: 0.55rem minmax(6rem, max-content) auto !important;
106
+ }
107
+
108
+ :global(.ts-chart-tooltip__row > span:nth-child(2)) {
109
+ max-width: 14rem;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ }
@@ -70,3 +70,28 @@
70
70
  .factsBasis {
71
71
  margin: var(--vx-space-stack-xs) 0 0;
72
72
  }
73
+
74
+ /*
75
+ * A fact's tone is INK only (the value and its trailing text), never a fill. The status solids are
76
+ * the text-safe ones (`status-text.ts`). `stale` is the strip cell's dimmed value, verbatim
77
+ * (`stat-strip.module.css` `.cell[data-stale]`).
78
+ */
79
+ .fact[data-tone='good'] :is(.factValue, .factUnit, .factPeriod) {
80
+ color: var(--vx-status-good);
81
+ }
82
+
83
+ .fact[data-tone='warn'] :is(.factValue, .factUnit, .factPeriod) {
84
+ color: var(--vx-status-warn);
85
+ }
86
+
87
+ .fact[data-tone='bad'] :is(.factValue, .factUnit, .factPeriod) {
88
+ color: var(--vx-status-bad);
89
+ }
90
+
91
+ .fact[data-tone='muted'] :is(.factValue, .factUnit, .factPeriod) {
92
+ color: var(--vx-muted);
93
+ }
94
+
95
+ .factsRow[data-stale] {
96
+ opacity: 0.55;
97
+ }
@@ -0,0 +1,12 @@
1
+ /** An axis tick's day: `4 Oct` (the page locale's own order). */
2
+ export declare const axisDay: (d: Date) => string;
3
+ /** {@link axisDay} with a two-digit year. */
4
+ export declare const axisDayYear: (d: Date) => string;
5
+ export declare const monthName: (d: Date) => string;
6
+ /** The tooltip header's date: weekday, day, month and year. */
7
+ export declare const headerDay: (d: Date) => string;
8
+ /** A day written out for a readout (`12 Oct`): the same format as an axis tick. */
9
+ export declare const readoutDay: (d: Date) => string;
10
+ /** A clock time for a readout, `HH:MM` in the page locale's digits. */
11
+ export declare const readoutClock: (d: Date) => string;
12
+ //# sourceMappingURL=chart-dates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-dates.d.ts","sourceRoot":"","sources":["../../src/charts/chart-dates.ts"],"names":[],"mappings":"AAWA,iEAAiE;AACjE,eAAO,MAAM,OAAO,GAAI,GAAG,IAAI,KAAG,MAA0D,CAAA;AAE5F,6CAA6C;AAC7C,eAAO,MAAM,WAAW,GAAI,GAAG,IAAI,KAAG,MAC6B,CAAA;AAEnE,eAAO,MAAM,SAAS,GAAI,GAAG,IAAI,KAAG,MAA0C,CAAA;AAE9E,+DAA+D;AAC/D,eAAO,MAAM,SAAS,GAAI,GAAG,IAAI,KAAG,MACiD,CAAA;AAErF,mFAAmF;AACnF,eAAO,MAAM,UAAU,MAbI,IAAI,KAAG,MAaD,CAAA;AAEjC,uEAAuE;AACvE,eAAO,MAAM,YAAY,GAAI,GAAG,IAAI,KAAG,MACiC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { dateFormat } from "../format/shared.js";
2
+ const utcFormat = (options, d) => dateFormat(void 0, { ...options, timeZone: "UTC" }).format(d);
3
+ const axisDay = (d) => utcFormat({ day: "numeric", month: "short" }, d);
4
+ const axisDayYear = (d) => utcFormat({ day: "numeric", month: "short", year: "2-digit" }, d);
5
+ const monthName = (d) => utcFormat({ month: "short" }, d);
6
+ const headerDay = (d) => utcFormat({ weekday: "short", day: "numeric", month: "short", year: "numeric" }, d);
7
+ const readoutDay = axisDay;
8
+ const readoutClock = (d) => utcFormat({ hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, d);
9
+ export {
10
+ axisDay,
11
+ axisDayYear,
12
+ headerDay,
13
+ monthName,
14
+ readoutClock,
15
+ readoutDay
16
+ };
@@ -36,3 +36,10 @@
36
36
  display: inline-flex;
37
37
  }
38
38
  }
39
+
40
+ /* Lines' `naming="auto"`: from the wide class the end labels name the lines, so the legend goes. */
41
+ @container (min-width: 800px) {
42
+ .auto[data-hide-wide] {
43
+ display: none;
44
+ }
45
+ }