ngwr 16.4.0 → 16.5.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 (258) hide show
  1. package/charts/bar-chart/styles/_index.scss +494 -305
  2. package/charts/boxplot-chart/styles/_index.scss +114 -48
  3. package/charts/bullet-chart/styles/_index.scss +113 -42
  4. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  5. package/charts/candlestick-chart/styles/_index.scss +61 -26
  6. package/charts/chart-legend/styles/_index.scss +119 -1
  7. package/charts/core/styles/_index.scss +201 -5
  8. package/charts/donut-chart/styles/_index.scss +76 -21
  9. package/charts/funnel-chart/styles/_index.scss +66 -38
  10. package/charts/gauge/styles/_index.scss +12 -1
  11. package/charts/heatmap-chart/styles/_index.scss +90 -53
  12. package/charts/line-chart/styles/_index.scss +143 -139
  13. package/charts/meter-group/styles/_index.scss +87 -25
  14. package/charts/radar-chart/styles/_index.scss +82 -40
  15. package/charts/scatter-chart/styles/_index.scss +117 -44
  16. package/charts/sparkline/styles/_index.scss +7 -1
  17. package/charts/treemap-chart/styles/_index.scss +94 -42
  18. package/charts/waterfall-chart/styles/_index.scss +150 -87
  19. package/color-picker/styles/_index.scss +7 -3
  20. package/copy-value/styles/_index.scss +21 -2
  21. package/date-stamp/styles/_index.scss +2 -1
  22. package/dialog/styles/_index.scss +6 -0
  23. package/drawer/styles/_index.scss +5 -1
  24. package/fesm2022/ngwr-carousel-testing.mjs +4 -1
  25. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  26. package/fesm2022/ngwr-carousel.mjs +21 -2
  27. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  28. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-cascader.mjs +48 -4
  30. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  31. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  32. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  33. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  34. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  35. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  36. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  37. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  38. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  39. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  40. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  41. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  42. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  43. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  44. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  45. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  46. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  47. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  48. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  49. package/fesm2022/ngwr-charts-core.mjs +299 -18
  50. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  51. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  52. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  53. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  54. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  55. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  56. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  57. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  58. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  59. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  60. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  61. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  62. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  63. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  64. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  65. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  66. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  67. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  68. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  69. package/fesm2022/ngwr-charts-meter-group.mjs +223 -31
  70. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  71. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  72. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  73. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  74. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  75. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  76. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  77. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  78. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  79. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  80. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  81. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  82. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  83. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  84. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  85. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  86. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  87. package/fesm2022/ngwr-color-picker.mjs +44 -4
  88. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  89. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  90. package/fesm2022/ngwr-context-menu.mjs +47 -19
  91. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  92. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  93. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  94. package/fesm2022/ngwr-copy-value.mjs +38 -2
  95. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  96. package/fesm2022/ngwr-date-picker.mjs +56 -8
  97. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  98. package/fesm2022/ngwr-dialog.mjs +13 -5
  99. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  100. package/fesm2022/ngwr-drawer.mjs +19 -3
  101. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  102. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  103. package/fesm2022/ngwr-dropdown.mjs +35 -6
  104. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  105. package/fesm2022/ngwr-editor.mjs +1 -0
  106. package/fesm2022/ngwr-editor.mjs.map +1 -1
  107. package/fesm2022/ngwr-graph.mjs +81 -13
  108. package/fesm2022/ngwr-graph.mjs.map +1 -1
  109. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  110. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  111. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  112. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  113. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  114. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  115. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  116. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  117. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  118. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  119. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  120. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  121. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  122. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  123. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  124. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  125. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  126. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  127. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  128. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  129. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  130. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  131. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  132. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  133. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  134. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  135. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  136. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  137. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  138. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  139. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  140. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  153. package/fesm2022/ngwr-lightbox.mjs +20 -3
  154. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  155. package/fesm2022/ngwr-overlay.mjs +21 -2
  156. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  157. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  158. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  159. package/fesm2022/ngwr-popconfirm.mjs +41 -5
  160. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  161. package/fesm2022/ngwr-popover.mjs +67 -12
  162. package/fesm2022/ngwr-popover.mjs.map +1 -1
  163. package/fesm2022/ngwr-schema-form.mjs +2 -0
  164. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  165. package/fesm2022/ngwr-table.mjs +2 -0
  166. package/fesm2022/ngwr-table.mjs.map +1 -1
  167. package/fesm2022/ngwr-tour.mjs +14 -9
  168. package/fesm2022/ngwr-tour.mjs.map +1 -1
  169. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  170. package/fesm2022/ngwr-tree.mjs +49 -16
  171. package/fesm2022/ngwr-tree.mjs.map +1 -1
  172. package/fesm2022/ngwr-version.mjs +1 -1
  173. package/fesm2022/ngwr-version.mjs.map +1 -1
  174. package/fesm2022/ngwr-window.mjs +16 -9
  175. package/fesm2022/ngwr-window.mjs.map +1 -1
  176. package/i18n/ar.json +5 -0
  177. package/i18n/cs.json +5 -0
  178. package/i18n/de.json +5 -0
  179. package/i18n/en.json +5 -0
  180. package/i18n/es.json +5 -0
  181. package/i18n/fr.json +5 -0
  182. package/i18n/he.json +5 -0
  183. package/i18n/hi.json +5 -0
  184. package/i18n/id.json +5 -0
  185. package/i18n/it.json +5 -0
  186. package/i18n/ja.json +5 -0
  187. package/i18n/ko.json +5 -0
  188. package/i18n/nl.json +5 -0
  189. package/i18n/pl.json +5 -0
  190. package/i18n/pt.json +5 -0
  191. package/i18n/ru.json +5 -0
  192. package/i18n/sv.json +5 -0
  193. package/i18n/tr.json +5 -0
  194. package/i18n/uk.json +5 -0
  195. package/i18n/vi.json +5 -0
  196. package/i18n/zh-TW.json +5 -0
  197. package/i18n/zh.json +5 -0
  198. package/llms-full.txt +8 -8
  199. package/llms.txt +7 -3
  200. package/package.json +1 -1
  201. package/popconfirm/styles/_index.scss +6 -0
  202. package/popover/styles/_index.scss +24 -13
  203. package/schematics/use/symbol-map.json +1 -0
  204. package/skills/ngwr/references/catalog.md +1 -1
  205. package/tour/styles/_index.scss +6 -0
  206. package/types/ngwr-carousel-testing.d.ts +6 -4
  207. package/types/ngwr-carousel.d.ts +14 -3
  208. package/types/ngwr-cascader-testing.d.ts +4 -3
  209. package/types/ngwr-cascader.d.ts +27 -3
  210. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  211. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  212. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  213. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  214. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  215. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  216. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  217. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  218. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  219. package/types/ngwr-charts-core.d.ts +259 -21
  220. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  221. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  222. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  223. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  224. package/types/ngwr-charts-gauge.d.ts +72 -10
  225. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  226. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  227. package/types/ngwr-charts-line-chart.d.ts +215 -86
  228. package/types/ngwr-charts-meter-group.d.ts +96 -7
  229. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  230. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  231. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  232. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  233. package/types/ngwr-charts-sparkline.d.ts +26 -4
  234. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  235. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  236. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  237. package/types/ngwr-color-picker.d.ts +27 -0
  238. package/types/ngwr-context-menu-testing.d.ts +10 -9
  239. package/types/ngwr-context-menu.d.ts +17 -0
  240. package/types/ngwr-copy-value.d.ts +8 -0
  241. package/types/ngwr-date-picker.d.ts +34 -2
  242. package/types/ngwr-dialog.d.ts +30 -10
  243. package/types/ngwr-drawer.d.ts +32 -1
  244. package/types/ngwr-dropdown-testing.d.ts +8 -5
  245. package/types/ngwr-dropdown.d.ts +29 -6
  246. package/types/ngwr-graph.d.ts +22 -6
  247. package/types/ngwr-lightbox.d.ts +15 -0
  248. package/types/ngwr-overlay.d.ts +16 -1
  249. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  250. package/types/ngwr-popconfirm.d.ts +28 -1
  251. package/types/ngwr-popover.d.ts +59 -9
  252. package/types/ngwr-table.d.ts +1 -1
  253. package/types/ngwr-tour.d.ts +21 -2
  254. package/types/ngwr-tree-testing.d.ts +1 -2
  255. package/types/ngwr-tree.d.ts +33 -2
  256. package/types/ngwr-version.d.ts +1 -1
  257. package/types/ngwr-window.d.ts +14 -11
  258. package/window/styles/_index.scss +5 -10
@@ -1,11 +1,12 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, DestroyRef, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, inject, input, signal, viewChild } from "@angular/core";
2
+ import { Component, DestroyRef, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, effect, inject, input, signal, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
- import { isPlatformBrowser } from "@angular/common";
4
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
5
5
  import { wrCheckStyles, wrClamp } from "ngwr/utils";
6
6
  import { useI18nText } from "ngwr/i18n";
7
- import { WrChartTable, useChartNumbers } from "ngwr/charts/core";
8
- import { useChartTooltip } from "ngwr/popover";
7
+ import { WrChartScale } from "ngwr/charts/chart-legend";
8
+ import { WrChartState, WrChartTable, useChartNumbers, useChartSize, useChartState, wrChartNumberFormat, wrChartRound } from "ngwr/charts/core";
9
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
9
10
  /**
10
11
  * @license
11
12
  *
@@ -16,18 +17,35 @@ const ALL_NAMES = {
16
17
  every: 1,
17
18
  last: Number.POSITIVE_INFINITY
18
19
  };
20
+ const STEPS = [
21
+ "var(--wr-heatmap-chart-step-1)",
22
+ "var(--wr-heatmap-chart-step-2)",
23
+ "var(--wr-heatmap-chart-step-3)",
24
+ "var(--wr-heatmap-chart-step-4)",
25
+ "var(--wr-heatmap-chart-step-5)"
26
+ ];
27
+ function paintAt(place) {
28
+ const at = wrClamp(place, 0, 1) * (STEPS.length - 1);
29
+ const lower = Math.min(STEPS.length - 2, Math.floor(at + 1e-9));
30
+ const share = wrChartRound((at - lower) * 100, 2);
31
+ const from = STEPS[lower];
32
+ const to = STEPS[lower + 1];
33
+ if (share <= 0) return from;
34
+ if (share >= 100) return to;
35
+ return `color-mix(in srgb, ${to} ${share}%, ${from})`;
36
+ }
19
37
  const valueOf = (raw) => typeof raw === "number" && Number.isFinite(raw) ? raw : null;
20
38
  const boundOf = (v) => {
21
39
  if (v === null || v === void 0 || v === "") return null;
22
40
  const value = coerceNumberProperty(v, NaN);
23
41
  return Number.isFinite(value) ? value : null;
24
42
  };
25
- const short = (value) => Math.round(value * 1e4) / 1e4 || 0;
43
+ const short = (value) => wrChartRound(value, 4);
26
44
  var WrHeatmapChart = class WrHeatmapChart {
27
45
  data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
28
46
  rows = input([], ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
29
47
  columns = input([], ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
30
- color = input("var(--wr-color-primary)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
48
+ color = input(null, ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
31
49
  min = input(null, {
32
50
  ...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
33
51
  transform: boundOf
@@ -51,9 +69,21 @@ var WrHeatmapChart = class WrHeatmapChart {
51
69
  ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
52
70
  transform: coerceBooleanProperty
53
71
  });
72
+ legendPosition = input("bottom", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
73
+ loading = input(false, {
74
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
75
+ transform: coerceBooleanProperty
76
+ });
77
+ error = input(false, {
78
+ ...ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {},
79
+ transform: coerceBooleanProperty
80
+ });
81
+ emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
82
+ loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
83
+ errorLabel = input(null, ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
54
84
  tooltip = input(true, {
55
85
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
56
- transform: coerceBooleanProperty
86
+ transform: wrCoerceChartTooltip
57
87
  });
58
88
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
59
89
  dataTable = input(false, {
@@ -65,10 +95,10 @@ var WrHeatmapChart = class WrHeatmapChart {
65
95
  resolvedAriaLabel = useI18nText(this.ariaLabel, "heatmapChart.label", "Heatmap chart");
66
96
  resolvedNoDataLabel = useI18nText(this.noDataLabel, "heatmapChart.noData", "No data");
67
97
  numbers = useChartNumbers(this.valueFormat);
68
- positions = new Intl.NumberFormat(inject(LOCALE_ID));
98
+ positions = wrChartNumberFormat(inject(LOCALE_ID));
69
99
  grid = viewChild("grid", ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
70
100
  columnStrip = viewChild("columnStrip", ...ngDevMode ? [{ debugName: "columnStrip" }] : /* istanbul ignore next */ []);
71
- stripWidth = signal(0, ...ngDevMode ? [{ debugName: "stripWidth" }] : /* istanbul ignore next */ []);
101
+ stripSize = useChartSize(this.columnStrip);
72
102
  thinning = signal(ALL_NAMES, {
73
103
  ...ngDevMode ? { debugName: "thinning" } : /* istanbul ignore next */ {},
74
104
  equal: (a, b) => a.every === b.every && a.last === b.last
@@ -124,21 +154,24 @@ var WrHeatmapChart = class WrHeatmapChart {
124
154
  const scale = this.scale();
125
155
  const levels = this.levels();
126
156
  const print = this.showValues();
157
+ const paints = Array.from({ length: levels }, (_, k) => paintAt(k / (levels - 1)));
127
158
  return this.values().flatMap((row, r) => row.map((value, c) => {
128
159
  if (value === null || scale === null) return {
129
160
  row: r,
130
161
  column: c,
131
162
  value,
132
163
  level: null,
164
+ paint: null,
133
165
  text: ""
134
166
  };
135
167
  const span = scale.max - scale.min;
136
- const band = span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9);
168
+ const band = Math.min(levels - 1, span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9));
137
169
  return {
138
170
  row: r,
139
171
  column: c,
140
172
  value,
141
- level: short(Math.min(band, levels - 1) / (levels - 1)),
173
+ level: short(band / (levels - 1)),
174
+ paint: paints[band],
142
175
  text: print ? this.numbers.label(value) : ""
143
176
  };
144
177
  }));
@@ -150,15 +183,32 @@ var WrHeatmapChart = class WrHeatmapChart {
150
183
  if (scale.min === scale.max) return {
151
184
  min: this.numbers.label(scale.min),
152
185
  max: null,
153
- levels: [0]
186
+ steps: [paintAt(0)]
154
187
  };
155
188
  const levels = this.levels();
156
189
  return {
157
190
  min: this.numbers.label(scale.min),
158
191
  max: this.numbers.label(scale.max),
159
- levels: Array.from({ length: levels }, (_, k) => short(k / (levels - 1)))
192
+ steps: Array.from({ length: levels }, (_, k) => paintAt(k / (levels - 1)))
160
193
  };
161
194
  }, ...ngDevMode ? [{ debugName: "legend" }] : /* istanbul ignore next */ []);
195
+ legendShown = computed(() => this.showLegend() && this.legendPosition() !== "none" && (this.legend() !== null || this.hasEmpty()), ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
196
+ legendFirst = computed(() => {
197
+ const position = this.legendPosition();
198
+ return position === "top" || position === "start";
199
+ }, ...ngDevMode ? [{ debugName: "legendFirst" }] : /* istanbul ignore next */ []);
200
+ legendSide = computed(() => {
201
+ const position = this.legendPosition();
202
+ return position === "start" || position === "end";
203
+ }, ...ngDevMode ? [{ debugName: "legendSide" }] : /* istanbul ignore next */ []);
204
+ state = useChartState({
205
+ loading: this.loading,
206
+ error: this.error,
207
+ empty: computed(() => this.shape().rowCount === 0 || this.shape().columnCount === 0),
208
+ emptyLabel: this.emptyLabel,
209
+ loadingLabel: this.loadingLabel,
210
+ errorLabel: this.errorLabel
211
+ });
162
212
  tableData = computed(() => {
163
213
  const empty = this.resolvedNoDataLabel();
164
214
  return {
@@ -191,16 +241,30 @@ var WrHeatmapChart = class WrHeatmapChart {
191
241
  const destroyRef = inject(DestroyRef);
192
242
  if (!isPlatformBrowser(inject(PLATFORM_ID))) return;
193
243
  afterRenderEffect(() => {
194
- this.stripWidth();
244
+ this.stripSize();
195
245
  this.columnLabels();
196
246
  this.thinning.set(this.measureColumnNames());
197
247
  });
198
248
  afterNextRender(() => {
199
- const strip = this.columnStrip()?.nativeElement;
200
- if (!strip || typeof ResizeObserver === "undefined") return;
201
- const observer = new ResizeObserver(([entry]) => this.stripWidth.set(entry.contentRect.width));
202
- observer.observe(strip);
203
- destroyRef.onDestroy(() => observer.disconnect());
249
+ const grid = this.grid()?.nativeElement;
250
+ if (!grid) return;
251
+ const move = (event) => this.onPointerMove(event);
252
+ const leave = (event) => this.tip.leave(event);
253
+ grid.addEventListener("mousemove", move);
254
+ grid.addEventListener("mouseleave", leave);
255
+ destroyRef.onDestroy(() => {
256
+ grid.removeEventListener("mousemove", move);
257
+ grid.removeEventListener("mouseleave", leave);
258
+ });
259
+ });
260
+ let ringed = null;
261
+ effect(() => {
262
+ const active = this.tip.active();
263
+ const next = active === null ? null : this.grid()?.nativeElement.children.item(active) ?? null;
264
+ if (next === ringed) return;
265
+ ringed?.classList.remove("wr-heatmap-chart__cell--active");
266
+ next?.classList.add("wr-heatmap-chart__cell--active");
267
+ ringed = next;
204
268
  });
205
269
  }
206
270
  measureColumnNames() {
@@ -309,6 +373,48 @@ var WrHeatmapChart = class WrHeatmapChart {
309
373
  isRequired: false,
310
374
  transformFunction: null
311
375
  },
376
+ legendPosition: {
377
+ classPropertyName: "legendPosition",
378
+ publicName: "legendPosition",
379
+ isSignal: true,
380
+ isRequired: false,
381
+ transformFunction: null
382
+ },
383
+ loading: {
384
+ classPropertyName: "loading",
385
+ publicName: "loading",
386
+ isSignal: true,
387
+ isRequired: false,
388
+ transformFunction: null
389
+ },
390
+ error: {
391
+ classPropertyName: "error",
392
+ publicName: "error",
393
+ isSignal: true,
394
+ isRequired: false,
395
+ transformFunction: null
396
+ },
397
+ emptyLabel: {
398
+ classPropertyName: "emptyLabel",
399
+ publicName: "emptyLabel",
400
+ isSignal: true,
401
+ isRequired: false,
402
+ transformFunction: null
403
+ },
404
+ loadingLabel: {
405
+ classPropertyName: "loadingLabel",
406
+ publicName: "loadingLabel",
407
+ isSignal: true,
408
+ isRequired: false,
409
+ transformFunction: null
410
+ },
411
+ errorLabel: {
412
+ classPropertyName: "errorLabel",
413
+ publicName: "errorLabel",
414
+ isSignal: true,
415
+ isRequired: false,
416
+ transformFunction: null
417
+ },
312
418
  tooltip: {
313
419
  classPropertyName: "tooltip",
314
420
  publicName: "tooltip",
@@ -346,8 +452,12 @@ var WrHeatmapChart = class WrHeatmapChart {
346
452
  }
347
453
  },
348
454
  host: {
349
- properties: { "style.--wr-heatmap-chart-scale-color": "color()" },
350
- classAttribute: "wr-heatmap-chart"
455
+ properties: {
456
+ "class.wr-chart--legend-side": "legendShown() && legendSide()",
457
+ "class.wr-heatmap-chart--tinted": "color() !== null",
458
+ "style.--wr-heatmap-chart-scale-color": "color()"
459
+ },
460
+ classAttribute: "wr-heatmap-chart wr-chart--legend"
351
461
  },
352
462
  viewQueries: [{
353
463
  propertyName: "grid",
@@ -363,13 +473,43 @@ var WrHeatmapChart = class WrHeatmapChart {
363
473
  isSignal: true
364
474
  }],
365
475
  ngImport: i0,
366
- template: "@let active = tip.active();\n@let key = legend();\n@let thin = thinning();\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <div\n #grid\n class=\"wr-heatmap-chart__cells\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @for (cell of cells(); track $index) {\n <!-- A level's paint is the stylesheet's, from the level written here; an empty cell has\n no level and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [class.wr-heatmap-chart__cell--active]=\"active === $index\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n</div>\n\n@if (showLegend() && (key || hasEmpty())) {\n <!-- Hidden, as an axis' ticks are on every chart: the matrix's name is what is announced,\n and the figures are in the data table. -->\n <div class=\"wr-heatmap-chart__legend\" aria-hidden=\"true\">\n @if (key) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.min }}</span>\n <span class=\"wr-heatmap-chart__scale\">\n @for (level of key.levels; track $index) {\n <span class=\"wr-heatmap-chart__swatch\" [style.--wr-heatmap-chart-level]=\"level\"></span>\n }\n </span>\n <!-- A scale with no span is one level, keyed by one figure. -->\n @if (key.max !== null) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.max }}</span>\n }\n }\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </div>\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
367
- dependencies: [{
368
- kind: "component",
369
- type: WrChartTable,
370
- selector: "wr-chart-table",
371
- inputs: ["data"]
372
- }],
476
+ template: "@let key = legend();\n@let thin = thinning();\n@let shown = state();\n\n<!-- The scale key, drawn before the matrix or after it so it is in the DOM where it is on\n screen. Hidden, as an axis' ticks are on every chart: the matrix's name is what is\n announced, and the figures are in the data table. The shared key every chart with a\n colour scale draws, under the classes this chart drew its own with. -->\n<ng-template #scaleKey>\n <wr-chart-scale\n class=\"wr-heatmap-chart__legend\"\n aria-hidden=\"true\"\n block=\"wr-heatmap-chart\"\n [steps]=\"key?.steps ?? []\"\n [minLabel]=\"key?.min ?? null\"\n [maxLabel]=\"key?.max ?? null\"\n [position]=\"legendPosition()\"\n >\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </wr-chart-scale>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [class.wr-heatmap-chart__matrix--idle]=\"!!shown\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <!-- The pointer is heard here by listeners the component adds itself, and the reading\n cell's ring is set by hand: nothing in this template follows the pointer, so a move\n across the matrix checks no cell. -->\n <div #grid class=\"wr-heatmap-chart__cells\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @for (cell of shown ? [] : cells(); track $index) {\n <!-- A level's paint is written here, a step of the sequential scale, with its place on\n the scale beside it; an empty cell has neither and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [style.--wr-heatmap-chart-fill]=\"cell.paint\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n @if (shown) {\n <!-- Beside the cells' `img`, never inside it: `img` makes everything it holds\n presentational, and the message is a live region. Laid over the cells' own area. -->\n <div class=\"wr-heatmap-chart__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
477
+ dependencies: [
478
+ {
479
+ kind: "directive",
480
+ type: NgTemplateOutlet,
481
+ selector: "[ngTemplateOutlet]",
482
+ inputs: [
483
+ "ngTemplateOutletContext",
484
+ "ngTemplateOutlet",
485
+ "ngTemplateOutletInjector"
486
+ ]
487
+ },
488
+ {
489
+ kind: "component",
490
+ type: WrChartScale,
491
+ selector: "wr-chart-scale",
492
+ inputs: [
493
+ "steps",
494
+ "minLabel",
495
+ "maxLabel",
496
+ "position",
497
+ "block"
498
+ ]
499
+ },
500
+ {
501
+ kind: "component",
502
+ type: WrChartState,
503
+ selector: "wr-chart-state",
504
+ inputs: ["kind", "label"]
505
+ },
506
+ {
507
+ kind: "component",
508
+ type: WrChartTable,
509
+ selector: "wr-chart-table",
510
+ inputs: ["data"]
511
+ }
512
+ ],
373
513
  encapsulation: i0.ViewEncapsulation.None
374
514
  });
375
515
  };
@@ -384,11 +524,18 @@ i0.ɵɵngDeclareClassMetadata({
384
524
  selector: "wr-heatmap-chart",
385
525
  encapsulation: ViewEncapsulation.None,
386
526
  host: {
387
- class: "wr-heatmap-chart",
527
+ class: "wr-heatmap-chart wr-chart--legend",
528
+ "[class.wr-chart--legend-side]": "legendShown() && legendSide()",
529
+ "[class.wr-heatmap-chart--tinted]": "color() !== null",
388
530
  "[style.--wr-heatmap-chart-scale-color]": "color()"
389
531
  },
390
- imports: [WrChartTable],
391
- template: "@let active = tip.active();\n@let key = legend();\n@let thin = thinning();\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <div\n #grid\n class=\"wr-heatmap-chart__cells\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @for (cell of cells(); track $index) {\n <!-- A level's paint is the stylesheet's, from the level written here; an empty cell has\n no level and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [class.wr-heatmap-chart__cell--active]=\"active === $index\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n</div>\n\n@if (showLegend() && (key || hasEmpty())) {\n <!-- Hidden, as an axis' ticks are on every chart: the matrix's name is what is announced,\n and the figures are in the data table. -->\n <div class=\"wr-heatmap-chart__legend\" aria-hidden=\"true\">\n @if (key) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.min }}</span>\n <span class=\"wr-heatmap-chart__scale\">\n @for (level of key.levels; track $index) {\n <span class=\"wr-heatmap-chart__swatch\" [style.--wr-heatmap-chart-level]=\"level\"></span>\n }\n </span>\n <!-- A scale with no span is one level, keyed by one figure. -->\n @if (key.max !== null) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.max }}</span>\n }\n }\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </div>\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
532
+ imports: [
533
+ NgTemplateOutlet,
534
+ WrChartScale,
535
+ WrChartState,
536
+ WrChartTable
537
+ ],
538
+ template: "@let key = legend();\n@let thin = thinning();\n@let shown = state();\n\n<!-- The scale key, drawn before the matrix or after it so it is in the DOM where it is on\n screen. Hidden, as an axis' ticks are on every chart: the matrix's name is what is\n announced, and the figures are in the data table. The shared key every chart with a\n colour scale draws, under the classes this chart drew its own with. -->\n<ng-template #scaleKey>\n <wr-chart-scale\n class=\"wr-heatmap-chart__legend\"\n aria-hidden=\"true\"\n block=\"wr-heatmap-chart\"\n [steps]=\"key?.steps ?? []\"\n [minLabel]=\"key?.min ?? null\"\n [maxLabel]=\"key?.max ?? null\"\n [position]=\"legendPosition()\"\n >\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </wr-chart-scale>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [class.wr-heatmap-chart__matrix--idle]=\"!!shown\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <!-- The pointer is heard here by listeners the component adds itself, and the reading\n cell's ring is set by hand: nothing in this template follows the pointer, so a move\n across the matrix checks no cell. -->\n <div #grid class=\"wr-heatmap-chart__cells\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @for (cell of shown ? [] : cells(); track $index) {\n <!-- A level's paint is written here, a step of the sequential scale, with its place on\n the scale beside it; an empty cell has neither and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [style.--wr-heatmap-chart-fill]=\"cell.paint\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n @if (shown) {\n <!-- Beside the cells' `img`, never inside it: `img` makes everything it holds\n presentational, and the message is a live region. Laid over the cells' own area. -->\n <div class=\"wr-heatmap-chart__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
392
539
  }]
393
540
  }],
394
541
  ctorParameters: () => [],
@@ -465,6 +612,54 @@ i0.ɵɵngDeclareClassMetadata({
465
612
  required: false
466
613
  }]
467
614
  }],
615
+ legendPosition: [{
616
+ type: i0.Input,
617
+ args: [{
618
+ isSignal: true,
619
+ alias: "legendPosition",
620
+ required: false
621
+ }]
622
+ }],
623
+ loading: [{
624
+ type: i0.Input,
625
+ args: [{
626
+ isSignal: true,
627
+ alias: "loading",
628
+ required: false
629
+ }]
630
+ }],
631
+ error: [{
632
+ type: i0.Input,
633
+ args: [{
634
+ isSignal: true,
635
+ alias: "error",
636
+ required: false
637
+ }]
638
+ }],
639
+ emptyLabel: [{
640
+ type: i0.Input,
641
+ args: [{
642
+ isSignal: true,
643
+ alias: "emptyLabel",
644
+ required: false
645
+ }]
646
+ }],
647
+ loadingLabel: [{
648
+ type: i0.Input,
649
+ args: [{
650
+ isSignal: true,
651
+ alias: "loadingLabel",
652
+ required: false
653
+ }]
654
+ }],
655
+ errorLabel: [{
656
+ type: i0.Input,
657
+ args: [{
658
+ isSignal: true,
659
+ alias: "errorLabel",
660
+ required: false
661
+ }]
662
+ }],
468
663
  tooltip: [{
469
664
  type: i0.Input,
470
665
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-heatmap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/heatmap-chart/heatmap-chart.ts","../../../projects/lib/charts/heatmap-chart/heatmap-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapMatrix } from './types';\n\n/** The scale's bounds: the lowest and the highest value a level is drawn for. */\ninterface Scale {\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * Which column names are drawn: every `every`-th, from the first, up to `last`. The rest\n * are in the markup still, drawn nowhere.\n */\ninterface Thinning {\n readonly every: number;\n readonly last: number;\n}\n\n/** Every name drawn: what the chart starts with, and keeps on the server and in jsdom. */\nconst ALL_NAMES: Thinning = { every: 1, last: Number.POSITIVE_INFINITY };\n\n/** One cell as the chart draws it. */\ninterface Cell {\n readonly row: number;\n readonly column: number;\n /** Its value, or `null` for an empty cell: no data, which is not zero. */\n readonly value: number | null;\n /**\n * Its level as a place on the scale, from 0 (the lowest level) to 1 (the colour itself),\n * rounded so the inline style stays short. `null` for an empty cell.\n */\n readonly level: number | null;\n /** The number printed in the cell with `showValues`, compact from a thousand; `''` when it prints none. */\n readonly text: string;\n}\n\n/** A value as the scale reads it: a finite number, or `null` for an empty cell. */\nconst valueOf = (raw: unknown): number | null => (typeof raw === 'number' && Number.isFinite(raw) ? raw : null);\n\n/** A bound input: a finite number, or `null` for \"from the data\". */\nconst boundOf = (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A level to four decimals, with `-0` folded to `0`, so the inline style stays short. */\nconst short = (value: number): number => Math.round(value * 1e4) / 1e4 || 0;\n\n/**\n * Heatmap chart: a matrix of values, a row per category on one side and a column per\n * category on the other, each cell painted a level of one colour by its value. For where\n * two categories meet — weekday by hour, region by month, feature by release. For a year\n * of days, `<wr-calendar-heatmap>` lays them out as a calendar. HTML and CSS only — no\n * external dependency.\n *\n * @example\n * ```html\n * <wr-heatmap-chart\n * [rows]=\"['Mon', 'Tue', 'Wed']\"\n * [columns]=\"['Morning', 'Afternoon', 'Evening']\"\n * [data]=\"[\n * [12, 30, 8],\n * [18, null, 11],\n * [9, 41, 15]\n * ]\"\n * showValues\n * />\n * ```\n *\n * **The scale.** It runs from `min` to `max`, each the data's own unless given, and is cut\n * into `levels` equal bands. A cell takes its band's level: the lowest is a faint tint of\n * `color` and the highest is `color` itself, every level between mixed from the two in\n * OKLab, whose lightness moves evenly, so the levels look evenly spaced in either colour\n * scheme. A value outside a given `min` or `max` takes the end level; the tooltip and the\n * data table still give its own figure. A legend under the matrix keys the levels from the\n * scale's minimum to its maximum. A scale with no span — every value the same, an\n * all-zero matrix included — has one level, the lowest, and the legend keys that one.\n *\n * **An empty cell is no data, never zero.** A `null`, a value that is not a finite number,\n * or one a shorter row does not reach is drawn hatched and outlined, not as the lowest\n * level, and the legend keys it while any cell is empty (`noDataLabel`).\n *\n * **Colour is the only thing that encodes a value here, by nature** — a heatmap is a\n * picture of where the values are high and low, and its levels are told apart by\n * lightness alone. So the value has a second channel in TEXT: `showValues` prints each\n * number in its cell, where it fits, and `dataTable` renders the whole matrix as a table a\n * screen reader walks. With neither, say what the chart shows in `ariaLabel`. A printed\n * value is black or white, whichever reads better on its own cell, the pick the theme's\n * `-contrast` tokens make.\n *\n * **What a screen reader gets.** The cells are one named `role=\"img\"`; the row and column\n * names are real text beside it, and the legend is hidden, as an axis' ticks are on every\n * chart here. The numbers are in text only in the tooltip, which is pointer only, and in\n * the table `dataTable` renders. No part of the chart is a tab stop.\n *\n * **Names that do not fit.** Where the column names are wider than their columns — an hour\n * per column, on a phone — the chart draws every second, third or later name, the first\n * included, each starting at its own column, and leaves the rest out of sight: measured in\n * the browser after render and again whenever the chart is resized. The names left out\n * are still read by a screen reader, and the tooltip and the data table name every column.\n * A row name is cut with an ellipsis at `--wr-heatmap-chart-row-label-max-width`.\n *\n * The matrix follows `direction`, the way a table does: under RTL the row names are on\n * the right and the first column is the rightmost.\n *\n * @see https://ngwr.dev/charts/heatmap-chart\n */\n@Component({\n selector: 'wr-heatmap-chart',\n templateUrl: './heatmap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-heatmap-chart',\n // The highest level's colour, which every lower level is mixed from: read by the cells\n // and the legend's swatches.\n '[style.--wr-heatmap-chart-scale-color]': 'color()',\n },\n imports: [WrChartTable],\n})\nexport class WrHeatmapChart {\n /**\n * The values, rows × columns: one array per row, in the order of `rows`, each with one\n * value per column, in the order of `columns`. A `null`, a value that is not a finite\n * number, or one past the end of a shorter row is an EMPTY cell — no data, drawn hatched\n * and outlined rather than as the lowest level.\n */\n readonly data = input<WrHeatmapMatrix>([]);\n\n /**\n * The rows' names, top to bottom, beside the matrix at inline start. The matrix is as\n * tall as the longer of this list and `data`; a row with no name here is named by its\n * position, from 1. A name wider than `--wr-heatmap-chart-row-label-max-width` (10rem)\n * is cut with an ellipsis, and the tooltip and the data table carry it whole.\n */\n readonly rows = input<readonly string[]>([]);\n\n /**\n * The columns' names, from inline start, above the matrix. The matrix is as wide as the\n * longer of this list and the longest row of `data`; a column with no name here is named\n * by its position, from 1. Where the names are wider than their columns, the chart draws\n * every second, third or later one and leaves the rest out of sight, still read by a\n * screen reader; the tooltip and the data table name every column. A single column too\n * narrow for its name cuts it with an ellipsis.\n */\n readonly columns = input<readonly string[]>([]);\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. Every lower\n * level is mixed from it toward the surface, the lowest a faint tint.\n * @default 'var(--wr-color-primary)'\n */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * The value of the lowest level. `null` takes the lowest value in `data`; a value given\n * holds the scale there, and a cell below it takes the lowest level. @default null\n */\n readonly min = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * The value of the highest level. `null` takes the highest value in `data`; a value given\n * holds the scale there, and a cell above it takes the highest level. Bounds given in the\n * wrong order are swapped. A scale with no span — every value the same, or `min` equal\n * to `max` — has one level, the lowest: every value is drawn on it, an all-zero matrix\n * as a faint tint rather than as the peak, and the legend keys that one level.\n * @default null\n */\n readonly max = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * How many levels the scale is cut into, each an equal share of it from `min` to `max`:\n * whole numbers from 2 to 10. Fewer levels are easier to tell apart; the value text and\n * the data table carry what the levels round. @default 5\n */\n readonly levels = input(5, {\n transform: (v: unknown): number => {\n const value = Math.round(coerceNumberProperty(v, 5));\n return Number.isFinite(value) ? wrClamp(value, 2, 10) : 5;\n },\n });\n\n /**\n * Print each value in its cell, compact from a thousand (`1.2K`). A value is printed\n * whole or not at all: one wider than its cell is left out rather than cut, and the\n * tooltip and the data table still carry it. Black or white, whichever reads better on\n * the cell — picked with CSS relative colour syntax; a browser without it (Firefox\n * before 128) prints the value on a small chip of the surface in the chart's text\n * colour instead, which reads on every level. An empty cell prints nothing.\n * @default false\n */\n readonly showValues = input(false, { transform: coerceBooleanProperty });\n\n /** Show the colour-scale legend under the matrix, from `min` to `max`, with a key for an empty cell while there is one. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the cell under the pointer: its row's name, its column's name and\n * its value, or `noDataLabel` for an empty cell. Pointer only — the data table is where\n * the same numbers are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every number the chart shows: the values in the cells, the legend, the tooltip\n * and the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact in the\n * cells from a thousand up.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per row, headed by its name, and a column per column, every value written the way the\n * tooltip writes it, and an empty cell as `noDataLabel`.\n *\n * The cells are one named `role=\"img\"`, which hides everything inside it, so without the\n * table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * matrix, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the matrix. Its cells carry no text a screen reader reaches, so this\n * is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `heatmapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * What an empty cell is called, in the tooltip, the legend's key and the data table —\n * \"Closed\", \"Not measured\". Falls back to `heatmapChart.noData`.\n */\n readonly noDataLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'heatmapChart.label', 'Heatmap chart');\n\n protected readonly resolvedNoDataLabel = useI18nText(this.noDataLabel, 'heatmapChart.noData', 'No data');\n\n /** The cells' compact text and the full figures, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** A row or column with no name is named by its position, written in `LOCALE_ID`. */\n private readonly positions = new Intl.NumberFormat(inject(LOCALE_ID));\n\n private readonly grid = viewChild<ElementRef<HTMLElement>>('grid');\n\n private readonly columnStrip = viewChild<ElementRef<HTMLElement>>('columnStrip');\n\n /** The column names' strip's width, as last observed: what measures the names again on a resize. */\n private readonly stripWidth = signal(0);\n\n /**\n * Which column names are drawn. Every one until the browser has measured them, so the\n * server and the first paint carry every name, cut where it does not fit.\n */\n protected readonly thinning = signal<Thinning>(ALL_NAMES, {\n equal: (a, b) => a.every === b.every && a.last === b.last,\n });\n\n /** How many rows and columns the matrix has: the longer of the names and the data, each way. */\n protected readonly shape = computed(() => {\n const data = this.data();\n let columnCount = this.columns().length;\n for (const row of data) columnCount = Math.max(columnCount, row?.length ?? 0);\n return { rowCount: Math.max(this.rows().length, data.length), columnCount };\n });\n\n /** Every row's name, its position for a row the names do not reach. */\n protected readonly rowLabels = computed(() => {\n const names = this.rows();\n return Array.from({ length: this.shape().rowCount }, (_, r) => names[r] ?? this.positions.format(r + 1));\n });\n\n /** Every column's name, its position for a column the names do not reach. */\n protected readonly columnLabels = computed(() => {\n const names = this.columns();\n return Array.from({ length: this.shape().columnCount }, (_, c) => names[c] ?? this.positions.format(c + 1));\n });\n\n /** Every cell's value, row by row, `null` where it is empty. */\n private readonly values = computed(() => {\n const data = this.data();\n const { rowCount, columnCount } = this.shape();\n return Array.from({ length: rowCount }, (_, r) =>\n Array.from({ length: columnCount }, (__, c) => valueOf(data[r]?.[c]))\n );\n });\n\n /**\n * The scale: `min` and `max` where given, the data's own lowest and highest value where\n * not, in order. `null` while there is nothing to scale — no value, and a bound missing.\n */\n protected readonly scale = computed<Scale | null>(() => {\n let lo = this.min();\n let hi = this.max();\n if (lo === null || hi === null) {\n // A loop rather than `Math.min(...values)`: a spread passes every cell as an\n // argument, and a large enough matrix overflows the call stack.\n let low = Infinity;\n let high = -Infinity;\n for (const row of this.values()) {\n for (const v of row) {\n if (v === null) continue;\n if (v < low) low = v;\n if (v > high) high = v;\n }\n }\n if (low !== Infinity) {\n lo ??= low;\n hi ??= high;\n }\n }\n if (lo === null || hi === null) return null;\n return lo <= hi ? { min: lo, max: hi } : { min: hi, max: lo };\n });\n\n /**\n * Every cell, row by row: its value, its level, and the text it prints. The level is the\n * value's band — the scale cut into `levels` equal shares — as a place from 0 to 1; a\n * scale with no span has one level, the lowest, and puts every value on it.\n */\n protected readonly cells = computed<readonly Cell[]>(() => {\n const scale = this.scale();\n const levels = this.levels();\n const print = this.showValues();\n return this.values().flatMap((row, r) =>\n row.map((value, c): Cell => {\n if (value === null || scale === null) return { row: r, column: c, value, level: null, text: '' };\n const span = scale.max - scale.min;\n // The epsilon keeps a value ON a band's edge in the band above it: 0.3 × 10 is\n // 2.9999999999999996 in floating point.\n const band = span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9);\n return {\n row: r,\n column: c,\n value,\n level: short(Math.min(band, levels - 1) / (levels - 1)),\n text: print ? this.numbers.label(value) : '',\n };\n })\n );\n });\n\n /** Whether any cell is empty, which is when the legend keys the hatching. */\n protected readonly hasEmpty = computed(() => this.cells().some(cell => cell.value === null));\n\n /**\n * The legend's scale: its two ends, compact from a thousand as the cells print a value,\n * and one swatch per level, each at its place on the scale. A scale with no span has one\n * level, so one swatch and one label, and `max` is `null`. `null` with nothing to scale,\n * when the legend keys an empty cell alone.\n */\n protected readonly legend = computed(() => {\n const scale = this.scale();\n if (scale === null) return null;\n if (scale.min === scale.max) return { min: this.numbers.label(scale.min), max: null, levels: [0] };\n const levels = this.levels();\n return {\n min: this.numbers.label(scale.min),\n max: this.numbers.label(scale.max),\n levels: Array.from({ length: levels }, (_, k) => short(k / (levels - 1))),\n };\n });\n\n /**\n * The figures for `dataTable`: the matrix's name as the caption, a column per column and\n * a row per row, every value written as the tooltip writes it and an empty cell as\n * `noDataLabel`.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const empty = this.resolvedNoDataLabel();\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.columnLabels(),\n groups: [\n {\n rows: this.values().map((row, r) => ({\n header: this.rowLabels()[r],\n cells: row.map(value => (value === null ? empty : this.numbers.value(value))),\n })),\n },\n ],\n };\n });\n\n /**\n * One tooltip for the whole matrix, pointing at the cell under the pointer: the row's\n * name as its heading, and a line with the column's name and the value — the order a\n * table is read in. A listener on the matrix rather than one per cell.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The cells are the container's only children, drawn in `cells()` order.\n const anchor = cell ? this.grid()?.nativeElement.children.item(index) : null;\n if (!cell || !anchor) return null;\n return {\n datum: {\n label: this.rowLabels()[cell.row],\n value: '',\n rows: [\n {\n label: this.columnLabels()[cell.column],\n value: cell.value === null ? this.resolvedNoDataLabel() : this.numbers.value(cell.value),\n },\n ],\n },\n anchor,\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/heatmap-chart');\n const destroyRef = inject(DestroyRef);\n // The names are measured after render, in a browser: again when they change, and when\n // the observer below reports a new width. Never on the server, which keeps every name\n // — said here as well as by the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterRenderEffect(() => {\n this.stripWidth();\n this.columnLabels();\n this.thinning.set(this.measureColumnNames());\n });\n\n // The strip's width is what decides how many names fit. A hidden chart reports 0 and\n // draws every name, and showing it again is a change of width, so it is measured afresh\n // even where its width is the one it was hidden at.\n afterNextRender(() => {\n const strip = this.columnStrip()?.nativeElement;\n if (!strip || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => this.stripWidth.set(entry.contentRect.width));\n observer.observe(strip);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Which column names fit: every name while each fits its own column, else every n-th,\n * the smallest n whose room holds the widest name and half an em beside it.\n *\n * A name is shrunk to its text by the stylesheet, so its `scrollWidth` is the whole text,\n * cut or not. The columns' pitch is read off the first two cells, which the grid sizes\n * whatever the names say. The last name drawn has only the columns left to the end,\n * which can be fewer than n: one that does not fit them is left out rather than spill\n * past the chart or be cut. Anything unmeasurable — one column, no cells, no layout —\n * draws every name.\n */\n private measureColumnNames(): Thinning {\n const strip = this.columnStrip()?.nativeElement;\n const cells = this.grid()?.nativeElement.children;\n const count = this.shape().columnCount;\n if (!strip || !cells || count < 2 || cells.length < 2) return ALL_NAMES;\n const first = cells[0].getBoundingClientRect();\n const pitch = Math.abs(cells[1].getBoundingClientRect().left - first.left);\n if (!(pitch > 0)) return ALL_NAMES;\n const gap = Math.max(0, pitch - first.width);\n const widths = Array.from(strip.children, name => name.scrollWidth);\n const space = Math.max(gap, (Number.parseFloat(getComputedStyle(strip).fontSize) || 0) / 2);\n const every = Math.max(1, Math.ceil((Math.max(0, ...widths) + space) / pitch));\n if (every === 1) return ALL_NAMES;\n let last = Math.floor((count - 1) / every) * every;\n if ((widths[last] ?? 0) > (count - last) * pitch - gap) last -= every;\n return { every, last };\n }\n\n /**\n * The cell under the pointer, heard on the matrix. A MOUSE event, as every chart's is: a\n * tap fires the compatibility `mousemove` and no `pointermove`. Over the gap between two\n * cells it is on none, and the tooltip starts to leave.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const cell = (event.target as Element | null)?.closest?.<HTMLElement>('.wr-heatmap-chart__cell');\n const row = Number(cell?.dataset['row']);\n const column = Number(cell?.dataset['column']);\n if (!cell || !Number.isInteger(row) || !Number.isInteger(column)) this.tip.leave(event);\n else this.tip.enter(row * this.shape().columnCount + column);\n }\n}\n\nexport type { WrHeatmapMatrix } from './types';\n","@let active = tip.active();\n@let key = legend();\n@let thin = thinning();\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <div\n #grid\n class=\"wr-heatmap-chart__cells\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @for (cell of cells(); track $index) {\n <!-- A level's paint is the stylesheet's, from the level written here; an empty cell has\n no level and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [class.wr-heatmap-chart__cell--active]=\"active === $index\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n</div>\n\n@if (showLegend() && (key || hasEmpty())) {\n <!-- Hidden, as an axis' ticks are on every chart: the matrix's name is what is announced,\n and the figures are in the data table. -->\n <div class=\"wr-heatmap-chart__legend\" aria-hidden=\"true\">\n @if (key) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.min }}</span>\n <span class=\"wr-heatmap-chart__scale\">\n @for (level of key.levels; track $index) {\n <span class=\"wr-heatmap-chart__swatch\" [style.--wr-heatmap-chart-level]=\"level\"></span>\n }\n </span>\n <!-- A scale with no span is one level, keyed by one figure. -->\n @if (key.max !== null) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.max }}</span>\n }\n }\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </div>\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAgDA,MAAM,YAAsB;CAAE,OAAO;CAAG,MAAM,OAAO;AAAiB;AAkBtE,MAAM,WAAW,QAAiC,OAAO,QAAQ,YAAY,OAAO,SAAS,GAAG,IAAI,MAAM;AAG1G,MAAM,WAAW,MAA6B;CAC5C,IAAI,MAAM,QAAQ,MAAM,UAAa,MAAM,IAAI,OAAO;CACtD,MAAM,QAAQ,qBAAqB,GAAG,GAAU;CAChD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAGA,MAAM,SAAS,UAA0B,KAAK,MAAM,QAAQ,GAAG,IAAI,OAAO;AAyE1E,IAAa,iBAAb,MAAa,eAAc;CAOhB,OAAO,MAAuB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQjC,OAAO,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAUnC,UAAU,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,QAAQ,MAAc,2BAA0B,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAMhD,MAAM,MAA8B,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,WAAW;CAAO,CAAA;CAU9D,MAAM,MAA8B,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,WAAW;CAAO,CAAA;CAO9D,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA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CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-heatmap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/heatmap-chart/heatmap-chart.ts","../../../projects/lib/charts/heatmap-chart/heatmap-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartScale, type WrChartLegendPosition } from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartNumbers,\n useChartSize,\n useChartState,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapMatrix } from './types';\n\n/** The scale's bounds: the lowest and the highest value a level is drawn for. */\ninterface Scale {\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * Which column names are drawn: every `every`-th, from the first, up to `last`. The rest\n * are in the markup still, drawn nowhere.\n */\ninterface Thinning {\n readonly every: number;\n readonly last: number;\n}\n\n/** Every name drawn: what the chart starts with, and keeps on the server and in jsdom. */\nconst ALL_NAMES: Thinning = { every: 1, last: Number.POSITIVE_INFINITY };\n\n/** One cell as the chart draws it. */\ninterface Cell {\n readonly row: number;\n readonly column: number;\n /** Its value, or `null` for an empty cell: no data, which is not zero. */\n readonly value: number | null;\n /**\n * Its level as a place on the scale, from 0 (the lowest level) to 1 (the colour itself),\n * rounded so the inline style stays short. `null` for an empty cell.\n */\n readonly level: number | null;\n /** Its level's paint, a step of the sequential scale or a mix of two. `null` for an empty cell. */\n readonly paint: string | null;\n /** The number printed in the cell with `showValues`, compact from a thousand; `''` when it prints none. */\n readonly text: string;\n}\n\n/**\n * The steps of the sequential scale a level is painted from, lowest first: the chart's own\n * hooks, which the stylesheet points at `--wr-chart-seq-1` to `-5`. Written out, so each\n * hook is read by name.\n */\nconst STEPS = [\n 'var(--wr-heatmap-chart-step-1)',\n 'var(--wr-heatmap-chart-step-2)',\n 'var(--wr-heatmap-chart-step-3)',\n 'var(--wr-heatmap-chart-step-4)',\n 'var(--wr-heatmap-chart-step-5)',\n] as const;\n\n/**\n * The paint of a level at `place` on the scale, 0 to 1: the step of the sequential scale\n * it lands on, or between two steps a mix of them in the share it sits at. With the five\n * `levels` of the default each level IS a step, `--wr-chart-seq-1` to `-5` unless the\n * chart is given a colour of its own; with more levels than steps the ones between are\n * mixed, so ten levels are still ten paints.\n */\nfunction paintAt(place: number): string {\n const at = wrClamp(place, 0, 1) * (STEPS.length - 1);\n const lower = Math.min(STEPS.length - 2, Math.floor(at + 1e-9));\n const share = wrChartRound((at - lower) * 100, 2);\n const from = STEPS[lower];\n const to = STEPS[lower + 1];\n if (share <= 0) return from;\n if (share >= 100) return to;\n return `color-mix(in srgb, ${to} ${share}%, ${from})`;\n}\n\n/** A value as the scale reads it: a finite number, or `null` for an empty cell. */\nconst valueOf = (raw: unknown): number | null => (typeof raw === 'number' && Number.isFinite(raw) ? raw : null);\n\n/** A bound input: a finite number, or `null` for \"from the data\". */\nconst boundOf = (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A level to four decimals, with `-0` folded to `0`, so the inline style stays short. */\nconst short = (value: number): number => wrChartRound(value, 4);\n\n/**\n * Heatmap chart: a matrix of values, a row per category on one side and a column per\n * category on the other, each cell painted a level of one colour by its value. For where\n * two categories meet — weekday by hour, region by month, feature by release. For a year\n * of days, `<wr-calendar-heatmap>` lays them out as a calendar. HTML and CSS only — no\n * external dependency.\n *\n * @example\n * ```html\n * <wr-heatmap-chart\n * [rows]=\"['Mon', 'Tue', 'Wed']\"\n * [columns]=\"['Morning', 'Afternoon', 'Evening']\"\n * [data]=\"[\n * [12, 30, 8],\n * [18, null, 11],\n * [9, 41, 15]\n * ]\"\n * showValues\n * />\n * ```\n *\n * **The scale.** It runs from `min` to `max`, each the data's own unless given, and is cut\n * into `levels` equal bands. A cell takes its band's level, painted from the chart\n * theme's sequential scale: `--wr-chart-seq-1`, a tint of the first palette colour, for\n * the lowest, up to `--wr-chart-seq-5`, the colour itself, for the highest. Five levels\n * are the five steps; more are mixed between two steps. `color` paints the same five\n * steps from a colour of the chart's own. Every cell carries a faint edge, so the lowest\n * level still reads as a cell on a dark surface. A value outside a given `min` or `max`\n * takes the end level; the tooltip and the data table still give its own figure. A scale\n * key (`legendPosition`: under the matrix, over it or beside it) keys the levels from\n * the scale's minimum to its maximum. A scale with no span — every value the same, an\n * all-zero matrix included — has one level, the lowest, and the key shows that one.\n *\n * **Empty, loading, error.** A matrix with no row or no column keeps a box and says\n * \"No data\"; `loading` and `error` put their own message over the row and column names\n * in place of the cells.\n *\n * **An empty cell is no data, never zero.** A `null`, a value that is not a finite number,\n * or one a shorter row does not reach is drawn hatched and outlined, not as the lowest\n * level, and the legend keys it while any cell is empty (`noDataLabel`).\n *\n * **Colour is the only thing that encodes a value here, by nature** — a heatmap is a\n * picture of where the values are high and low, and its levels are told apart by\n * lightness alone. So the value has a second channel in TEXT: `showValues` prints each\n * number in its cell, where it fits, and `dataTable` renders the whole matrix as a table a\n * screen reader walks. With neither, say what the chart shows in `ariaLabel`. A printed\n * value is black or white, whichever reads better on its own cell, the pick the theme's\n * `-contrast` tokens make.\n *\n * **What a screen reader gets.** The cells are one named `role=\"img\"`; the row and column\n * names are real text beside it, and the legend is hidden, as an axis' ticks are on every\n * chart here. The numbers are in text only in the tooltip, which is pointer only, and in\n * the table `dataTable` renders. No part of the chart is a tab stop.\n *\n * **Names that do not fit.** Where the column names are wider than their columns — an hour\n * per column, on a phone — the chart draws every second, third or later name, the first\n * included, each starting at its own column, and leaves the rest out of sight: measured in\n * the browser after render and again whenever the chart is resized. The names left out\n * are still read by a screen reader, and the tooltip and the data table name every column.\n * A row name is cut with an ellipsis at `--wr-heatmap-chart-row-label-max-width`.\n *\n * The matrix follows `direction`, the way a table does: under RTL the row names are on\n * the right and the first column is the rightmost.\n *\n * @see https://ngwr.dev/charts/heatmap-chart\n */\n@Component({\n selector: 'wr-heatmap-chart',\n templateUrl: './heatmap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the scale key's room from the matrix.\n class: 'wr-heatmap-chart wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n // A colour of the chart's own for the highest level, which the stylesheet then steps\n // the lower ones from. Without one the levels are the chart theme's sequential scale.\n '[class.wr-heatmap-chart--tinted]': 'color() !== null',\n '[style.--wr-heatmap-chart-scale-color]': 'color()',\n },\n imports: [NgTemplateOutlet, WrChartScale, WrChartState, WrChartTable],\n})\nexport class WrHeatmapChart {\n /**\n * The values, rows × columns: one array per row, in the order of `rows`, each with one\n * value per column, in the order of `columns`. A `null`, a value that is not a finite\n * number, or one past the end of a shorter row is an EMPTY cell — no data, drawn hatched\n * and outlined rather than as the lowest level.\n */\n readonly data = input<WrHeatmapMatrix>([]);\n\n /**\n * The rows' names, top to bottom, beside the matrix at inline start. The matrix is as\n * tall as the longer of this list and `data`; a row with no name here is named by its\n * position, from 1. A name wider than `--wr-heatmap-chart-row-label-max-width` (10rem)\n * is cut with an ellipsis, and the tooltip and the data table carry it whole.\n */\n readonly rows = input<readonly string[]>([]);\n\n /**\n * The columns' names, from inline start, above the matrix. The matrix is as wide as the\n * longer of this list and the longest row of `data`; a column with no name here is named\n * by its position, from 1. Where the names are wider than their columns, the chart draws\n * every second, third or later one and leaves the rest out of sight, still read by a\n * screen reader; the tooltip and the data table name every column. A single column too\n * narrow for its name cuts it with an ellipsis.\n */\n readonly columns = input<readonly string[]>([]);\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. Every lower\n * level is stepped from it toward the surface, as the chart theme steps its own scale.\n * `null` paints the levels with the theme's sequential scale, `--wr-chart-seq-1` to\n * `-5`, which an app retints for every chart at once. @default null\n */\n readonly color = input<string | null>(null);\n\n /**\n * The value of the lowest level. `null` takes the lowest value in `data`; a value given\n * holds the scale there, and a cell below it takes the lowest level. @default null\n */\n readonly min = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * The value of the highest level. `null` takes the highest value in `data`; a value given\n * holds the scale there, and a cell above it takes the highest level. Bounds given in the\n * wrong order are swapped. A scale with no span — every value the same, or `min` equal\n * to `max` — has one level, the lowest: every value is drawn on it, an all-zero matrix\n * as a faint tint rather than as the peak, and the legend keys that one level.\n * @default null\n */\n readonly max = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * How many levels the scale is cut into, each an equal share of it from `min` to `max`:\n * whole numbers from 2 to 10. Fewer levels are easier to tell apart; the value text and\n * the data table carry what the levels round. @default 5\n */\n readonly levels = input(5, {\n transform: (v: unknown): number => {\n const value = Math.round(coerceNumberProperty(v, 5));\n return Number.isFinite(value) ? wrClamp(value, 2, 10) : 5;\n },\n });\n\n /**\n * Print each value in its cell, compact from a thousand (`1.2K`). A value is printed\n * whole or not at all: one wider than its cell is left out rather than cut, and the\n * tooltip and the data table still carry it. Black or white, whichever reads better on\n * the cell — picked with CSS relative colour syntax; a browser without it (Firefox\n * before 128) prints the value on a small chip of the surface in the chart's text\n * colour instead, which reads on every level. An empty cell prints nothing.\n * @default false\n */\n readonly showValues = input(false, { transform: coerceBooleanProperty });\n\n /** Show the scale key, from `min` to `max`, with a key for an empty cell while there is one. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Where the scale key sits: `bottom` or `top` of the matrix, `start` or `end` of it, or\n * `none` for no key at all. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the chart's data is in flight: the cells give way to the loading\n * message, beside the row and column names the chart had. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the cells give way to the error message. `loading`\n * wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The message shown for a matrix with no row or no column. Falls back to `chart.empty`,\n * then `'No data'`. An empty CELL is `noDataLabel`'s.\n */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /**\n * Show a tooltip for the cell under the pointer: its row's name, its column's name\n * and its value, or `noDataLabel` for an empty cell. Pointer only — the data table is\n * where the same numbers are for a keyboard or a screen reader.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes every number the chart shows: the values in the cells, the legend, the tooltip\n * and the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact in the\n * cells from a thousand up.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per row, headed by its name, and a column per column, every value written the way the\n * tooltip writes it, and an empty cell as `noDataLabel`.\n *\n * The cells are one named `role=\"img\"`, which hides everything inside it, so without the\n * table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * matrix, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the matrix. Its cells carry no text a screen reader reaches, so this\n * is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `heatmapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * What an empty cell is called, in the tooltip, the legend's key and the data table —\n * \"Closed\", \"Not measured\". Falls back to `heatmapChart.noData`.\n */\n readonly noDataLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'heatmapChart.label', 'Heatmap chart');\n\n protected readonly resolvedNoDataLabel = useI18nText(this.noDataLabel, 'heatmapChart.noData', 'No data');\n\n /** The cells' compact text and the full figures, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** A row or column with no name is named by its position, written in `LOCALE_ID`. */\n private readonly positions = wrChartNumberFormat(inject(LOCALE_ID));\n\n private readonly grid = viewChild<ElementRef<HTMLElement>>('grid');\n\n private readonly columnStrip = viewChild<ElementRef<HTMLElement>>('columnStrip');\n\n /**\n * The column names' strip's box, as last observed: what measures the names again on a\n * resize. On the observer every chart shares.\n */\n private readonly stripSize = useChartSize(this.columnStrip);\n\n /**\n * Which column names are drawn. Every one until the browser has measured them, so the\n * server and the first paint carry every name, cut where it does not fit.\n */\n protected readonly thinning = signal<Thinning>(ALL_NAMES, {\n equal: (a, b) => a.every === b.every && a.last === b.last,\n });\n\n /** How many rows and columns the matrix has: the longer of the names and the data, each way. */\n protected readonly shape = computed(() => {\n const data = this.data();\n let columnCount = this.columns().length;\n for (const row of data) columnCount = Math.max(columnCount, row?.length ?? 0);\n return { rowCount: Math.max(this.rows().length, data.length), columnCount };\n });\n\n /** Every row's name, its position for a row the names do not reach. */\n protected readonly rowLabels = computed(() => {\n const names = this.rows();\n return Array.from({ length: this.shape().rowCount }, (_, r) => names[r] ?? this.positions.format(r + 1));\n });\n\n /** Every column's name, its position for a column the names do not reach. */\n protected readonly columnLabels = computed(() => {\n const names = this.columns();\n return Array.from({ length: this.shape().columnCount }, (_, c) => names[c] ?? this.positions.format(c + 1));\n });\n\n /** Every cell's value, row by row, `null` where it is empty. */\n private readonly values = computed(() => {\n const data = this.data();\n const { rowCount, columnCount } = this.shape();\n return Array.from({ length: rowCount }, (_, r) =>\n Array.from({ length: columnCount }, (__, c) => valueOf(data[r]?.[c]))\n );\n });\n\n /**\n * The scale: `min` and `max` where given, the data's own lowest and highest value where\n * not, in order. `null` while there is nothing to scale — no value, and a bound missing.\n */\n protected readonly scale = computed<Scale | null>(() => {\n let lo = this.min();\n let hi = this.max();\n if (lo === null || hi === null) {\n // A loop rather than `Math.min(...values)`: a spread passes every cell as an\n // argument, and a large enough matrix overflows the call stack.\n let low = Infinity;\n let high = -Infinity;\n for (const row of this.values()) {\n for (const v of row) {\n if (v === null) continue;\n if (v < low) low = v;\n if (v > high) high = v;\n }\n }\n if (low !== Infinity) {\n lo ??= low;\n hi ??= high;\n }\n }\n if (lo === null || hi === null) return null;\n return lo <= hi ? { min: lo, max: hi } : { min: hi, max: lo };\n });\n\n /**\n * Every cell, row by row: its value, its level, and the text it prints. The level is the\n * value's band — the scale cut into `levels` equal shares — as a place from 0 to 1; a\n * scale with no span has one level, the lowest, and puts every value on it.\n */\n protected readonly cells = computed<readonly Cell[]>(() => {\n const scale = this.scale();\n const levels = this.levels();\n const print = this.showValues();\n // One paint per level, shared by every cell on it: a string built `levels` times, not\n // once a cell.\n const paints = Array.from({ length: levels }, (_, k) => paintAt(k / (levels - 1)));\n return this.values().flatMap((row, r) =>\n row.map((value, c): Cell => {\n if (value === null || scale === null) {\n return { row: r, column: c, value, level: null, paint: null, text: '' };\n }\n const span = scale.max - scale.min;\n // The epsilon keeps a value ON a band's edge in the band above it: 0.3 × 10 is\n // 2.9999999999999996 in floating point.\n const band = Math.min(\n levels - 1,\n span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9)\n );\n return {\n row: r,\n column: c,\n value,\n level: short(band / (levels - 1)),\n paint: paints[band],\n text: print ? this.numbers.label(value) : '',\n };\n })\n );\n });\n\n /** Whether any cell is empty, which is when the legend keys the hatching. */\n protected readonly hasEmpty = computed(() => this.cells().some(cell => cell.value === null));\n\n /**\n * The legend's scale: its two ends, compact from a thousand as the cells print a value,\n * and one swatch per level, each at its place on the scale. A scale with no span has one\n * level, so one swatch and one label, and `max` is `null`. `null` with nothing to scale,\n * when the legend keys an empty cell alone.\n */\n protected readonly legend = computed(() => {\n const scale = this.scale();\n if (scale === null) return null;\n if (scale.min === scale.max) return { min: this.numbers.label(scale.min), max: null, steps: [paintAt(0)] };\n const levels = this.levels();\n return {\n min: this.numbers.label(scale.min),\n max: this.numbers.label(scale.max),\n steps: Array.from({ length: levels }, (_, k) => paintAt(k / (levels - 1))),\n };\n });\n\n /**\n * Whether the chart draws its scale key: with `showLegend`, unless `legendPosition` is\n * `none`, and while there is a scale or an empty cell to key.\n */\n protected readonly legendShown = computed(\n () => this.showLegend() && this.legendPosition() !== 'none' && (this.legend() !== null || this.hasEmpty())\n );\n\n /** Whether the key comes before the matrix, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the key sits beside the matrix rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** What the chart shows in place of its cells, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.shape().rowCount === 0 || this.shape().columnCount === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n /**\n * The figures for `dataTable`: the matrix's name as the caption, a column per column and\n * a row per row, every value written as the tooltip writes it and an empty cell as\n * `noDataLabel`.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const empty = this.resolvedNoDataLabel();\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.columnLabels(),\n groups: [\n {\n rows: this.values().map((row, r) => ({\n header: this.rowLabels()[r],\n cells: row.map(value => (value === null ? empty : this.numbers.value(value))),\n })),\n },\n ],\n };\n });\n\n /**\n * One tooltip for the whole matrix, pointing at the cell under the pointer: the row's\n * name as its heading, and a line with the column's name and the value — the order a\n * table is read in. A listener on the matrix rather than one per cell.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The cells are the container's only children, drawn in `cells()` order.\n const anchor = cell ? this.grid()?.nativeElement.children.item(index) : null;\n if (!cell || !anchor) return null;\n return {\n datum: {\n label: this.rowLabels()[cell.row],\n value: '',\n rows: [\n {\n label: this.columnLabels()[cell.column],\n value: cell.value === null ? this.resolvedNoDataLabel() : this.numbers.value(cell.value),\n },\n ],\n },\n anchor,\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/heatmap-chart');\n const destroyRef = inject(DestroyRef);\n // The names are measured after render, in a browser: again when they change, and when\n // the observer below reports a new width. Never on the server, which keeps every name\n // — said here as well as by the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterRenderEffect(() => {\n // The strip's width is what decides how many names fit. A hidden chart reports 0\n // and draws every name, and showing it again is a change of width, so it is\n // measured afresh even where its width is the one it was hidden at.\n this.stripSize();\n this.columnLabels();\n this.thinning.set(this.measureColumnNames());\n });\n\n // The pointer, heard on the matrix by two listeners of the chart's own rather than the\n // template's: a template listener checks the whole chart again on every event, and a\n // move across a cell is hundreds of them. These run nothing unless the cell changes.\n afterNextRender(() => {\n const grid = this.grid()?.nativeElement;\n if (!grid) return;\n const move = (event: MouseEvent): void => this.onPointerMove(event);\n const leave = (event: MouseEvent): void => this.tip.leave(event);\n grid.addEventListener('mousemove', move);\n grid.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n grid.removeEventListener('mousemove', move);\n grid.removeEventListener('mouseleave', leave);\n });\n });\n\n // The ring round the cell the tooltip reads, set by hand on that one element. Bound as\n // a class on every cell, it was compared again for every cell on every hover change:\n // 2,500 compares a move on a 50 × 50 matrix.\n let ringed: Element | null = null;\n effect(() => {\n const active = this.tip.active();\n const next = active === null ? null : (this.grid()?.nativeElement.children.item(active) ?? null);\n if (next === ringed) return;\n ringed?.classList.remove('wr-heatmap-chart__cell--active');\n next?.classList.add('wr-heatmap-chart__cell--active');\n ringed = next;\n });\n }\n\n /**\n * Which column names fit: every name while each fits its own column, else every n-th,\n * the smallest n whose room holds the widest name and half an em beside it.\n *\n * A name is shrunk to its text by the stylesheet, so its `scrollWidth` is the whole text,\n * cut or not. The columns' pitch is read off the first two cells, which the grid sizes\n * whatever the names say. The last name drawn has only the columns left to the end,\n * which can be fewer than n: one that does not fit them is left out rather than spill\n * past the chart or be cut. Anything unmeasurable — one column, no cells, no layout —\n * draws every name.\n */\n private measureColumnNames(): Thinning {\n const strip = this.columnStrip()?.nativeElement;\n const cells = this.grid()?.nativeElement.children;\n const count = this.shape().columnCount;\n if (!strip || !cells || count < 2 || cells.length < 2) return ALL_NAMES;\n const first = cells[0].getBoundingClientRect();\n const pitch = Math.abs(cells[1].getBoundingClientRect().left - first.left);\n if (!(pitch > 0)) return ALL_NAMES;\n const gap = Math.max(0, pitch - first.width);\n const widths = Array.from(strip.children, name => name.scrollWidth);\n const space = Math.max(gap, (Number.parseFloat(getComputedStyle(strip).fontSize) || 0) / 2);\n const every = Math.max(1, Math.ceil((Math.max(0, ...widths) + space) / pitch));\n if (every === 1) return ALL_NAMES;\n let last = Math.floor((count - 1) / every) * every;\n if ((widths[last] ?? 0) > (count - last) * pitch - gap) last -= every;\n return { every, last };\n }\n\n /**\n * The cell under the pointer, heard on the matrix. A MOUSE event, as every chart's is: a\n * tap fires the compatibility `mousemove` and no `pointermove`. Over the gap between two\n * cells it is on none, and the tooltip starts to leave.\n */\n private onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const cell = (event.target as Element | null)?.closest?.<HTMLElement>('.wr-heatmap-chart__cell');\n const row = Number(cell?.dataset['row']);\n const column = Number(cell?.dataset['column']);\n if (!cell || !Number.isInteger(row) || !Number.isInteger(column)) this.tip.leave(event);\n else this.tip.enter(row * this.shape().columnCount + column);\n }\n}\n\nexport type { WrHeatmapMatrix } from './types';\n","@let key = legend();\n@let thin = thinning();\n@let shown = state();\n\n<!-- The scale key, drawn before the matrix or after it so it is in the DOM where it is on\n screen. Hidden, as an axis' ticks are on every chart: the matrix's name is what is\n announced, and the figures are in the data table. The shared key every chart with a\n colour scale draws, under the classes this chart drew its own with. -->\n<ng-template #scaleKey>\n <wr-chart-scale\n class=\"wr-heatmap-chart__legend\"\n aria-hidden=\"true\"\n block=\"wr-heatmap-chart\"\n [steps]=\"key?.steps ?? []\"\n [minLabel]=\"key?.min ?? null\"\n [maxLabel]=\"key?.max ?? null\"\n [position]=\"legendPosition()\"\n >\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </wr-chart-scale>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [class.wr-heatmap-chart__matrix--idle]=\"!!shown\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <!-- The pointer is heard here by listeners the component adds itself, and the reading\n cell's ring is set by hand: nothing in this template follows the pointer, so a move\n across the matrix checks no cell. -->\n <div #grid class=\"wr-heatmap-chart__cells\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @for (cell of shown ? [] : cells(); track $index) {\n <!-- A level's paint is written here, a step of the sequential scale, with its place on\n the scale beside it; an empty cell has neither and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [style.--wr-heatmap-chart-fill]=\"cell.paint\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n @if (shown) {\n <!-- Beside the cells' `img`, never inside it: `img` makes everything it holds\n presentational, and the message is a live region. Laid over the cells' own area. -->\n <div class=\"wr-heatmap-chart__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"scaleKey\" />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <w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