ngwr 16.3.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 (295) hide show
  1. package/carousel/styles/_index.scss +53 -1
  2. package/charts/bar-chart/styles/_index.scss +494 -305
  3. package/charts/boxplot-chart/styles/_index.scss +114 -48
  4. package/charts/bullet-chart/styles/_index.scss +113 -42
  5. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  6. package/charts/candlestick-chart/styles/_index.scss +61 -26
  7. package/charts/chart-legend/styles/_index.scss +119 -1
  8. package/charts/core/styles/_index.scss +201 -5
  9. package/charts/donut-chart/styles/_index.scss +76 -21
  10. package/charts/funnel-chart/styles/_index.scss +66 -38
  11. package/charts/gauge/styles/_index.scss +12 -1
  12. package/charts/heatmap-chart/styles/_index.scss +90 -53
  13. package/charts/line-chart/styles/_index.scss +143 -139
  14. package/charts/meter-group/styles/_index.scss +87 -25
  15. package/charts/radar-chart/styles/_index.scss +82 -40
  16. package/charts/scatter-chart/styles/_index.scss +117 -44
  17. package/charts/sparkline/styles/_index.scss +7 -1
  18. package/charts/treemap-chart/styles/_index.scss +94 -42
  19. package/charts/waterfall-chart/styles/_index.scss +150 -87
  20. package/color-picker/styles/_index.scss +7 -3
  21. package/copy-value/styles/_index.scss +21 -2
  22. package/date-stamp/styles/_index.scss +2 -1
  23. package/dialog/styles/_index.scss +6 -0
  24. package/drawer/styles/_index.scss +5 -1
  25. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  26. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/ngwr-carousel-testing.mjs +27 -1
  28. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-carousel.mjs +86 -4
  30. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  31. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  32. package/fesm2022/ngwr-cascader.mjs +56 -25
  33. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  34. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  35. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  36. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  37. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  38. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  39. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  40. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  41. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  42. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  43. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  44. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  45. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  46. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  47. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  48. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  49. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  50. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  51. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  52. package/fesm2022/ngwr-charts-core.mjs +299 -18
  53. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  54. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  55. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  56. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  57. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  58. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  59. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  60. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  61. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  62. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  63. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  64. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  65. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  67. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  69. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  71. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-meter-group.mjs +223 -31
  73. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  75. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  77. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  79. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  81. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  83. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  85. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  87. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  89. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  90. package/fesm2022/ngwr-color-picker.mjs +44 -4
  91. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  92. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  93. package/fesm2022/ngwr-context-menu.mjs +60 -17
  94. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  95. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  96. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  97. package/fesm2022/ngwr-copy-value.mjs +38 -2
  98. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  99. package/fesm2022/ngwr-date-picker.mjs +56 -8
  100. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  101. package/fesm2022/ngwr-dialog.mjs +13 -5
  102. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  103. package/fesm2022/ngwr-drawer.mjs +19 -3
  104. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  105. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  106. package/fesm2022/ngwr-dropdown.mjs +49 -6
  107. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  108. package/fesm2022/ngwr-editor.mjs +1 -0
  109. package/fesm2022/ngwr-editor.mjs.map +1 -1
  110. package/fesm2022/ngwr-file-upload.mjs +7 -3
  111. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  112. package/fesm2022/ngwr-graph-testing.mjs +27 -0
  113. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  114. package/fesm2022/ngwr-graph.mjs +643 -14
  115. package/fesm2022/ngwr-graph.mjs.map +1 -1
  116. package/fesm2022/ngwr-i18n-ar.mjs +13 -4
  117. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  118. package/fesm2022/ngwr-i18n-cs.mjs +13 -4
  119. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  120. package/fesm2022/ngwr-i18n-de.mjs +13 -4
  121. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  122. package/fesm2022/ngwr-i18n-en.mjs +13 -4
  123. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  124. package/fesm2022/ngwr-i18n-es.mjs +13 -4
  125. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  126. package/fesm2022/ngwr-i18n-fr.mjs +13 -4
  127. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  128. package/fesm2022/ngwr-i18n-he.mjs +13 -4
  129. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  130. package/fesm2022/ngwr-i18n-hi.mjs +13 -4
  131. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  132. package/fesm2022/ngwr-i18n-id.mjs +13 -4
  133. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  134. package/fesm2022/ngwr-i18n-it.mjs +13 -4
  135. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  136. package/fesm2022/ngwr-i18n-ja.mjs +13 -4
  137. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  138. package/fesm2022/ngwr-i18n-ko.mjs +13 -4
  139. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  140. package/fesm2022/ngwr-i18n-nl.mjs +13 -4
  141. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  142. package/fesm2022/ngwr-i18n-pl.mjs +13 -4
  143. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  144. package/fesm2022/ngwr-i18n-pt.mjs +13 -4
  145. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  146. package/fesm2022/ngwr-i18n-ru.mjs +13 -4
  147. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  148. package/fesm2022/ngwr-i18n-sv.mjs +13 -4
  149. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  150. package/fesm2022/ngwr-i18n-tr.mjs +13 -4
  151. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  152. package/fesm2022/ngwr-i18n-uk.mjs +13 -4
  153. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  154. package/fesm2022/ngwr-i18n-vi.mjs +13 -4
  155. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  156. package/fesm2022/ngwr-i18n-zh-tw.mjs +13 -4
  157. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  158. package/fesm2022/ngwr-i18n-zh.mjs +13 -4
  159. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  160. package/fesm2022/ngwr-lightbox.mjs +22 -5
  161. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  162. package/fesm2022/ngwr-list.mjs +2 -2
  163. package/fesm2022/ngwr-list.mjs.map +1 -1
  164. package/fesm2022/ngwr-overlay.mjs +21 -2
  165. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  166. package/fesm2022/ngwr-pagination.mjs +1 -0
  167. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  168. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  169. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  170. package/fesm2022/ngwr-popconfirm.mjs +41 -5
  171. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  172. package/fesm2022/ngwr-popover.mjs +67 -12
  173. package/fesm2022/ngwr-popover.mjs.map +1 -1
  174. package/fesm2022/ngwr-schema-form.mjs +3 -0
  175. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  176. package/fesm2022/ngwr-select.mjs +100 -3
  177. package/fesm2022/ngwr-select.mjs.map +1 -1
  178. package/fesm2022/ngwr-sortable-list.mjs +2 -2
  179. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  180. package/fesm2022/ngwr-table-testing.mjs +71 -3
  181. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  182. package/fesm2022/ngwr-table.mjs +173 -11
  183. package/fesm2022/ngwr-table.mjs.map +1 -1
  184. package/fesm2022/ngwr-tour-testing.mjs +13 -1
  185. package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
  186. package/fesm2022/ngwr-tour.mjs +25 -16
  187. package/fesm2022/ngwr-tour.mjs.map +1 -1
  188. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  189. package/fesm2022/ngwr-tree.mjs +52 -8
  190. package/fesm2022/ngwr-tree.mjs.map +1 -1
  191. package/fesm2022/ngwr-utils.mjs +64 -1
  192. package/fesm2022/ngwr-utils.mjs.map +1 -1
  193. package/fesm2022/ngwr-version.mjs +1 -1
  194. package/fesm2022/ngwr-version.mjs.map +1 -1
  195. package/fesm2022/ngwr-window.mjs +16 -9
  196. package/fesm2022/ngwr-window.mjs.map +1 -1
  197. package/graph/styles/_index.scss +87 -0
  198. package/i18n/ar.json +13 -4
  199. package/i18n/cs.json +13 -4
  200. package/i18n/de.json +13 -4
  201. package/i18n/en.json +13 -4
  202. package/i18n/es.json +13 -4
  203. package/i18n/fr.json +13 -4
  204. package/i18n/he.json +13 -4
  205. package/i18n/hi.json +13 -4
  206. package/i18n/id.json +13 -4
  207. package/i18n/it.json +13 -4
  208. package/i18n/ja.json +13 -4
  209. package/i18n/ko.json +13 -4
  210. package/i18n/nl.json +13 -4
  211. package/i18n/pl.json +13 -4
  212. package/i18n/pt.json +13 -4
  213. package/i18n/ru.json +13 -4
  214. package/i18n/sv.json +13 -4
  215. package/i18n/tr.json +13 -4
  216. package/i18n/uk.json +13 -4
  217. package/i18n/vi.json +13 -4
  218. package/i18n/zh-TW.json +13 -4
  219. package/i18n/zh.json +13 -4
  220. package/llms-full.txt +12 -12
  221. package/llms.txt +64 -27
  222. package/package.json +1 -1
  223. package/popconfirm/styles/_index.scss +6 -0
  224. package/popover/styles/_index.scss +24 -13
  225. package/schematics/collection.json +5 -0
  226. package/schematics/eject/index.js +158 -0
  227. package/schematics/eject/schema.js +8 -0
  228. package/schematics/eject/schema.json +24 -0
  229. package/schematics/eject/source.js +295 -0
  230. package/schematics/use/symbol-map.json +2 -0
  231. package/select/styles/_index.scss +13 -0
  232. package/skills/ngwr/SKILL.md +30 -3
  233. package/skills/ngwr/references/catalog.md +2 -2
  234. package/table/styles/_index.scss +24 -0
  235. package/theme/styles/_focus.scss +11 -1
  236. package/tour/styles/_index.scss +6 -0
  237. package/types/ngwr-carousel-testing.d.ts +29 -6
  238. package/types/ngwr-carousel.d.ts +52 -5
  239. package/types/ngwr-cascader-testing.d.ts +4 -3
  240. package/types/ngwr-cascader.d.ts +29 -7
  241. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  242. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  243. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  244. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  245. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  246. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  247. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  248. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  249. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  250. package/types/ngwr-charts-core.d.ts +259 -21
  251. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  252. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  253. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  254. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  255. package/types/ngwr-charts-gauge.d.ts +72 -10
  256. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  257. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  258. package/types/ngwr-charts-line-chart.d.ts +215 -86
  259. package/types/ngwr-charts-meter-group.d.ts +96 -7
  260. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  261. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  262. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  263. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  264. package/types/ngwr-charts-sparkline.d.ts +26 -4
  265. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  266. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  267. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  268. package/types/ngwr-color-picker.d.ts +27 -0
  269. package/types/ngwr-context-menu-testing.d.ts +10 -9
  270. package/types/ngwr-context-menu.d.ts +19 -0
  271. package/types/ngwr-copy-value.d.ts +8 -0
  272. package/types/ngwr-date-picker.d.ts +34 -2
  273. package/types/ngwr-dialog.d.ts +30 -10
  274. package/types/ngwr-drawer.d.ts +32 -1
  275. package/types/ngwr-dropdown-testing.d.ts +8 -5
  276. package/types/ngwr-dropdown.d.ts +31 -6
  277. package/types/ngwr-file-upload.d.ts +8 -2
  278. package/types/ngwr-graph-testing.d.ts +28 -0
  279. package/types/ngwr-graph.d.ts +263 -91
  280. package/types/ngwr-lightbox.d.ts +15 -0
  281. package/types/ngwr-overlay.d.ts +16 -1
  282. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  283. package/types/ngwr-popconfirm.d.ts +28 -1
  284. package/types/ngwr-popover.d.ts +59 -9
  285. package/types/ngwr-select.d.ts +37 -0
  286. package/types/ngwr-table-testing.d.ts +52 -1
  287. package/types/ngwr-table.d.ts +102 -10
  288. package/types/ngwr-tour-testing.d.ts +10 -0
  289. package/types/ngwr-tour.d.ts +32 -4
  290. package/types/ngwr-tree-testing.d.ts +1 -2
  291. package/types/ngwr-tree.d.ts +35 -2
  292. package/types/ngwr-utils.d.ts +79 -1
  293. package/types/ngwr-version.d.ts +1 -1
  294. package/types/ngwr-window.d.ts +14 -11
  295. package/window/styles/_index.scss +5 -10
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-treemap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/treemap-chart/internal/squarify.ts","../../../projects/lib/charts/treemap-chart/treemap-chart.ts","../../../projects/lib/charts/treemap-chart/treemap-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\n/**\n * A rectangle in the layout's own units: `x` from the inline-start edge, `y` from the\n * top. The treemap chart lays out in pixels and draws in percentages of its plot.\n *\n * @internal\n */\ninterface WrTreemapRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One value to place, by its position in the caller's list, with its share of the box as an area. */\ninterface Item {\n readonly index: number;\n readonly area: number;\n}\n\n/**\n * The worst aspect ratio in a row of `items[start..end)` laid along a side `side` long,\n * `sum` being their total area: the row is `sum / side` deep, and each item as long as\n * its area over that depth. The ratio is the longer side over the shorter, so a square\n * scores 1 and every other shape more.\n */\nfunction worst(items: readonly Item[], start: number, end: number, sum: number, side: number): number {\n let largest = 0;\n let smallest = Number.POSITIVE_INFINITY;\n for (let k = start; k < end; k++) {\n largest = Math.max(largest, items[k].area);\n smallest = Math.min(smallest, items[k].area);\n }\n const s2 = sum * sum;\n const w2 = side * side;\n return Math.max((w2 * largest) / s2, s2 / (w2 * smallest));\n}\n\n/**\n * Cuts `box` into one rectangle per value, each with an area in proportion to its value,\n * by the squarified algorithm — Bruls, Huizing and van Wijk, \"Squarified Treemaps\"\n * (2000) — which keeps every rectangle as close to a square as it can, so that areas are\n * easy to compare and labels have room.\n *\n * The values are placed IN THE ORDER GIVEN, and the result is in that order too: the\n * algorithm assumes the largest first, so sort them descending for the squarest result.\n * It fills the box in rows. A row runs along the shorter side of the space still free,\n * starting at its inline-start or top edge, and takes values while adding one does not\n * make its worst aspect ratio worse; then it is fixed, and the space beyond it is the\n * next row's. So the first value sits in the inline-start top corner — mirrored with the\n * writing direction when the caller positions by `inset-inline-start`.\n *\n * The last rectangle of every row, and the whole of the last row, take what is left of\n * the space exactly, so floating point leaves no hairline uncovered: the rectangles tile\n * the box with nothing over and nothing under.\n *\n * A value that is not a finite number above zero has no area and gets `null`, as does\n * every value when the box has no area or nothing has a value.\n *\n * @example\n * ```ts\n * squarify([1, 1], { x: 0, y: 0, width: 2, height: 1 });\n * // [{ x: 0, y: 0, width: 1, height: 1 }, { x: 1, y: 0, width: 1, height: 1 }]\n * ```\n *\n * @internal\n */\nexport function squarify(values: readonly number[], box: WrTreemapRect): (WrTreemapRect | null)[] {\n const out: (WrTreemapRect | null)[] = values.map(() => null);\n const positive = values.flatMap((value, index) => (Number.isFinite(value) && value > 0 ? [{ index, value }] : []));\n const total = positive.reduce((sum, item) => sum + item.value, 0);\n if (positive.length === 0 || !(total > 0) || !(box.width > 0) || !(box.height > 0)) return out;\n\n const scale = (box.width * box.height) / total;\n const items: Item[] = positive.map(({ index, value }) => ({ index, area: value * scale }));\n\n let { x, y, width, height } = box;\n let start = 0;\n while (start < items.length) {\n const side = Math.min(width, height);\n // Grow the row while the next value does not make its worst ratio worse.\n let end = start + 1;\n let sum = items[start].area;\n let ratio = worst(items, start, end, sum, side);\n while (end < items.length) {\n const next = worst(items, start, end + 1, sum + items[end].area, side);\n if (next > ratio) break;\n ratio = next;\n sum += items[end].area;\n end++;\n }\n\n const last = end === items.length;\n if (width >= height) {\n // The shorter side is the height: the row is a column at the inline-start edge.\n const depth = last ? width : Math.min(width, sum / height);\n let top = y;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? y + height - top : items[k].area / depth;\n out[items[k].index] = { x, y: top, width: depth, height: length };\n top += length;\n }\n x += depth;\n width = Math.max(0, width - depth);\n } else {\n // The shorter side is the width: the row is a strip along the top.\n const depth = last ? height : Math.min(height, sum / width);\n let left = x;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? x + width - left : items[k].area / depth;\n out[items[k].index] = { x: left, y, width: length, height: depth };\n left += length;\n }\n y += depth;\n height = Math.max(0, height - depth);\n }\n start = end;\n }\n return out;\n}\n\nexport type { WrTreemapRect };\n","/**\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 {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, wrChartColor, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { type WrTreemapRect, squarify } from './internal/squarify';\nimport type { WrTreemapNode } from './types';\n\n/**\n * The width the layout assumes until the plot has been measured — on the server, and\n * in the first render in a browser. The tiles are drawn in percentages of the plot, so\n * they fill it either way; only their shapes are squarer once the real width is known.\n */\nconst FALLBACK_WIDTH = 640;\n\n/**\n * The height of the strip a group's name is written in, in px: one line of the label's\n * type and a little room. The stylesheet sizes the strip from the same number, written\n * on it inline, so the two cannot disagree; a larger type than the default's is clipped\n * rather than spilling into the tiles under it.\n */\nconst HEADER = 20;\n\n/** The space between a group's edge and the tiles inside it, in px, on the sides and below. */\nconst PAD = 3;\n\n/** The smallest room, in px either way, that a group draws its children in. Smaller, it is drawn as one block. */\nconst MIN_INNER = 12;\n\n/** The smallest tile, in px, that a name is written in: about three letters and an ellipsis on one line. */\nconst LABEL_MIN_WIDTH = 36;\nconst LABEL_MIN_HEIGHT = 22;\n\n/** The smallest tile height, in px, that holds the value under the name. */\nconst VALUE_MIN_HEIGHT = 38;\n\n/** Between the names of a path, in the tooltip and the data table. */\nconst SEPARATOR = ' / ';\n\n/**\n * The relative difference below which a group's value and its children's sum are the same\n * number. Decimal data rarely adds up exactly in binary — 0.1 + 0.2 + 0.3 is\n * 0.6000000000000001 — so an exact comparison would call a group of 0.6 smaller than its\n * children and leave a remainder of a few ulps to lay out.\n */\nconst SUM_TOLERANCE = 1e-9;\n\n/** A percentage to three decimals, so a style stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/** A node of the data, resolved: where it sits in the tree, its colour, its figure and its area. */\ninterface ResolvedNode {\n /** Its position in the tree, `0.2.1`: unique, and stable while the data keeps its shape. */\n readonly key: string;\n readonly label: string;\n /** Every name from the top-level node down to this one. */\n readonly path: readonly string[];\n readonly color: string;\n /** Its own `value`, when that is a finite number. */\n readonly own: number | null;\n /**\n * The figure the tooltip and the data table show: its own value, or for a group with\n * none the sum of its children's areas. `null` for a leaf with no value.\n */\n readonly value: number | null;\n /** The weight its rectangle is drawn with. `0` draws nothing. */\n readonly size: number;\n /** What its children's areas add up to. */\n readonly childSize: number;\n readonly children: readonly ResolvedNode[];\n}\n\n/** A node as drawn: its rectangle in px and what it has room to show. */\ninterface PlacedTile {\n readonly node: ResolvedNode;\n readonly rect: WrTreemapRect;\n /** Its children are drawn inside it. */\n readonly group: boolean;\n /** A strip at its top carries its name and, with `showValues`, its figure. */\n readonly header: boolean;\n /** Its name is written inside it, as on a leaf. */\n readonly labelled: boolean;\n /** Its figure is written under its name. */\n readonly valued: boolean;\n}\n\n/** The fit rules {@link placeTiles} applies. */\ninterface PlaceOptions {\n readonly labels: boolean;\n readonly values: boolean;\n}\n\n/**\n * Every node of `nodes`, resolved: paths and colours handed down, values summed up. A\n * top-level node with no `color` takes the palette colour of its position, and a nested\n * one its parent's.\n */\nfunction resolveNodes(\n nodes: readonly WrTreemapNode[],\n path: readonly string[],\n inherited: string | null,\n key: string\n): ResolvedNode[] {\n return nodes.map((node, i) => {\n const color = node.color ?? inherited ?? wrChartColor(i);\n const own = typeof node.value === 'number' && Number.isFinite(node.value) ? node.value : null;\n const ownSize = own !== null && own > 0 ? own : 0;\n const nodePath = [...path, node.label];\n const children = resolveNodes(node.children ?? [], nodePath, color, `${key}${i}.`);\n const childSize = children.reduce((sum, child) => sum + child.size, 0);\n const group = children.length > 0;\n return {\n key: `${key}${i}`,\n label: node.label,\n path: nodePath,\n color,\n own,\n value: group ? (own ?? childSize) : own,\n // A group is never smaller than its children, whatever it is given: they have to fit.\n size: group ? Math.max(ownSize, childSize) : ownSize,\n childSize,\n children,\n };\n });\n}\n\n/** Every node, parents before their children, in the data's own order: the data table's rows. */\nfunction flatten(nodes: readonly ResolvedNode[]): ResolvedNode[] {\n return nodes.flatMap(node => [node, ...flatten(node.children)]);\n}\n\n/**\n * The tiles for `nodes` inside `box`, parents before their children so a child is drawn\n * over its parent. Siblings are squarified largest first, ties in the data's order, and a\n * group's `remainder` — the part of its value its children do not account for — is laid\n * out last and left empty.\n */\nfunction placeTiles(\n nodes: readonly ResolvedNode[],\n remainder: number,\n box: WrTreemapRect,\n options: PlaceOptions,\n out: PlacedTile[]\n): void {\n const order = nodes\n .map((node, index) => ({ node, index }))\n .filter(({ node }) => node.size > 0)\n .sort((a, b) => b.node.size - a.node.size || a.index - b.index);\n const sizes = order.map(({ node }) => node.size);\n if (remainder > 0) sizes.push(remainder);\n const rects = squarify(sizes, box);\n\n order.forEach(({ node }, k) => {\n const rect = rects[k];\n if (!rect) return;\n const roomForHeader = options.labels && rect.height >= HEADER * 2 && rect.width >= LABEL_MIN_WIDTH;\n const top = roomForHeader ? HEADER : PAD;\n const inner: WrTreemapRect = {\n x: rect.x + PAD,\n y: rect.y + top,\n width: rect.width - 2 * PAD,\n height: rect.height - top - PAD,\n };\n const group = node.childSize > 0 && inner.width >= MIN_INNER && inner.height >= MIN_INNER;\n const labelled = !group && options.labels && rect.width >= LABEL_MIN_WIDTH && rect.height >= LABEL_MIN_HEIGHT;\n out.push({\n node,\n rect,\n group,\n header: group && roomForHeader,\n labelled,\n valued: labelled && options.values && rect.height >= VALUE_MIN_HEIGHT,\n });\n if (group) {\n const rest = node.size - node.childSize;\n placeTiles(node.children, rest > node.size * SUM_TOLERANCE ? rest : 0, inner, options, out);\n }\n });\n}\n\n/**\n * Treemap chart: a hierarchy as nested rectangles, each with an area in proportion to its\n * value. For the parts of a whole when there are too many for a donut, or when they come\n * in groups — a budget by department and team, a disk by folder. HTML only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-treemap-chart\n * ariaLabel=\"Budget by department\"\n * [data]=\"[\n * { label: 'Engineering', children: [{ label: 'Web', value: 310 }, { label: 'Mobile', value: 260 }] },\n * { label: 'Sales', children: [{ label: 'EMEA', value: 280 }, { label: 'APAC', value: 150 }] },\n * { label: 'Legal', value: 60 }\n * ]\"\n * />\n * ```\n *\n * **The layout** is the squarified algorithm (Bruls, Huizing and van Wijk, 2000): each\n * set of siblings is cut largest first into rectangles as close to square as it allows,\n * so areas can be compared and names have room. It starts in the inline-start top corner,\n * so under RTL the largest node sits at the top right — the tiles are positioned by\n * `inset-inline-start`, and the whole drawing mirrors with the writing direction.\n *\n * **Groups.** A node with children is drawn as a rectangle with its children inside it,\n * a few pixels in from its edge, under a strip carrying its name when it is tall enough.\n * Its value is the sum of its children's unless it is given one, and a value above that\n * sum leaves the rest of its rectangle empty: what the children do not account for. A\n * group too small to hold its children is drawn as one block.\n *\n * **Colour is the top-level node's**, from the chart's palette, and every node inside it\n * takes it unless it has a `color` of its own. It is never the only thing that tells two\n * groups apart: each carries its name where there is room, and its tiles sit inside its\n * own rectangle; the tooltip and the data table name the ones too small to write in. The\n * gap round every tile is a faint separator in the surface colour, not a boundary drawn\n * to be read on its own; under `prefers-contrast: more` it is a line at 3:1 or more\n * against the tints, and under forced colours an outline in the text colour. With more\n * than five top-level nodes the palette repeats, and the names are what tell neighbours\n * of one colour apart.\n *\n * **Names are written inside the tiles that have room** — a group's in its strip, a\n * leaf's in its corner with its value under it — and ellipsised past the tile's width.\n * A tile smaller than about 36 × 22 px writes nothing; the tooltip and the data table\n * name every node in full, with its whole path. A value is never cut: one wider than its\n * tile, or than the room its group's name leaves in the strip, is left out, since `$12…`\n * reads as another number, and the tooltip and the data table carry it whole.\n *\n * **What a screen reader gets.** The drawing is one named `role=\"img\"`, and nothing in it\n * is announced. The tooltip is pointer only, so say what the chart shows in `ariaLabel`,\n * or turn on `dataTable`, which lists every node by its path with its value and its share\n * of the whole. No part of the chart is a tab stop.\n *\n * **No drill-down.** Every level is drawn at once and nothing zooms into a group; a\n * deep tree is better split into several charts, or given one level at a time by the host.\n *\n * The tiles are laid out for the plot's measured size, so on the server and in the first\n * render they are cut for an assumed width and squared up once the plot is measured.\n *\n * @see https://ngwr.dev/charts/treemap-chart\n */\n@Component({\n selector: 'wr-treemap-chart',\n templateUrl: './treemap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-treemap-chart' },\n imports: [WrChartTable],\n})\nexport class WrTreemapChart {\n /**\n * The nodes, top level first. A node with `children` is a group drawn round them, and\n * one without is a leaf drawn at its `value`. Top-level nodes with no `color` take the\n * palette's colours in order.\n */\n readonly data = input<readonly WrTreemapNode[]>([]);\n\n /**\n * Accessible name of the drawing. The tiles carry no text a screen reader reaches, so\n * this is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `treemapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'treemapChart.label', 'Treemap chart');\n\n /**\n * What the values measure — revenue, size on disk — as the heading of the data table's\n * value column. Falls back to `treemapChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n protected readonly valueName = useI18nText(this.valueLabel, 'treemapChart.value', 'Value');\n\n /** The heading of the share column and the name of the tooltip's share row. */\n protected readonly shareName = wrReadI18nText('treemapChart.share', 'Share');\n\n /** The plot's height in px, at least 80. Its width is the container's. @default 280 */\n readonly height = input(280, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 280);\n return Number.isFinite(value) ? Math.max(80, value) : 280;\n },\n });\n\n /**\n * Write the names inside the tiles that have room for them, a group's in a strip along\n * its top. Off, no tile carries text and no group reserves a strip. @default true\n */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /** Write each value under its name, and each group's beside its name, where there is room. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the tile under the pointer: its path from the top-level node, its\n * value, and its share of the whole. Pointer only — the data table is where the same\n * figures are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value the chart shows: inside the tiles, in the tooltip and in the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact inside the tiles\n * (`1.2K`). A value wider than its tile is left out of it rather than cut. Shares are\n * `percentFormat`'s.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every share the chart shows, given as a RATIO — `0.25` for a quarter — the\n * number `Intl.NumberFormat`'s `percent` style takes, so one of those can be passed as\n * it is: in the tooltip and in the data table. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a sliver is not\n * printed as `0%`.\n */\n readonly percentFormat = input<((ratio: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per node, parents before their children in the data's order, headed by its path —\n * `Engineering / Web` — with its value and its share of the whole. A node with no area\n * is listed with an empty share, and a leaf with no value with an empty value too.\n *\n * The drawing is one named `role=\"img\"`, which hides everything inside it, so without\n * the table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * drawing, 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 /** The exact figures and the tiles' compact ones, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** Shares from one percent up, to one decimal: `12.5 %`, `3 %`. */\n private readonly shares = new Intl.NumberFormat(inject(LOCALE_ID), { style: 'percent', maximumFractionDigits: 1 });\n\n /** Shares below one percent, to two significant digits, so a sliver does not read `0 %`. */\n private readonly smallShares = new Intl.NumberFormat(inject(LOCALE_ID), {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly tileEls = viewChildren<ElementRef<HTMLElement>>('tile');\n\n /** The plot's measured content box, once a browser has laid it out. */\n private readonly box = signal<{ readonly width: number; readonly height: number } | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/treemap-chart');\n const destroyRef = inject(DestroyRef);\n // The layout is cut for the plot's real proportions: squares at 640 × 280 are slabs\n // at 320 × 280. Measured after render, so the server and the first paint draw the\n // fallback and nothing here touches the DOM before a browser has one.\n afterNextRender(() => {\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => {\n const { width, height } = entry.contentRect;\n // A hidden chart measures nothing; keep the last layout rather than collapse it.\n if (width <= 0 || height <= 0) return;\n const last = this.box();\n if (last?.width === width && last.height === height) return;\n this.box.set({ width, height });\n });\n observer.observe(this.plot().nativeElement);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n // Two things in the data the drawing cannot honour, and that look like nothing at all\n // on screen: a missing tile, and a group drawn larger than it was told to be.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n for (const node of this.nodes()) {\n const path = node.path.join(SEPARATOR);\n let problem: string | null = null;\n if (node.own !== null && node.own < 0) {\n // A negative value adds no area of its own, so whatever such a node is drawn at\n // is its children's total — a group is still drawn round them.\n const drawn =\n node.size > 0\n ? `It is drawn at the ${node.childSize} its children add up to, which has to fit.`\n : 'It draws no tile, and the data table still lists it.';\n problem = `\"${path}\" has a negative value (${node.own}), which has no area. ${drawn}`;\n } else if (node.children.length > 0 && node.own !== null && node.own < node.childSize * (1 - SUM_TOLERANCE)) {\n problem =\n `\"${path}\" is given a value of ${node.own}, below the ${node.childSize} its children add up to. ` +\n 'It is drawn at its children’s total, which has to fit.';\n }\n if (problem === null || warned.has(problem)) continue;\n warned.add(problem);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(`[NGWR] <wr-treemap-chart>: ${problem}`);\n }\n });\n }\n }\n\n /** The data, resolved: top-level nodes with every node below them. */\n private readonly tree = computed(() => resolveNodes(this.data(), [], null, ''));\n\n /** Every node, parents before their children, in the data's order. */\n private readonly nodes = computed(() => flatten(this.tree()));\n\n /** The whole: the area of every top-level node together, which every share is of. */\n private readonly total = computed(() => this.tree().reduce((sum, node) => sum + node.size, 0));\n\n /** The size the layout is cut for: the measured plot, or the fallback width at `height`. */\n private readonly layoutBox = computed(() => this.box() ?? { width: FALLBACK_WIDTH, height: this.height() });\n\n /**\n * Every tile drawn, parents before their children, with its rectangle as percentages\n * of the plot — `start` from the inline-start edge — and its figure as the tile writes it.\n * Its position in this list is what the tooltip and the template know it by.\n */\n protected readonly tiles = computed(() => {\n const { width, height } = this.layoutBox();\n const placed: PlacedTile[] = [];\n placeTiles(\n this.tree(),\n 0,\n { x: 0, y: 0, width, height },\n { labels: this.showLabels(), values: this.showValues() },\n placed\n );\n return placed.map(tile => ({\n key: tile.node.key,\n node: tile.node,\n group: tile.group,\n header: tile.header,\n labelled: tile.labelled,\n valued: tile.valued,\n text: tile.node.value === null ? '' : this.numbers.label(tile.node.value),\n start: percent((tile.rect.x / width) * 100),\n top: percent((tile.rect.y / height) * 100),\n width: percent((tile.rect.width / width) * 100),\n height: percent((tile.rect.height / height) * 100),\n }));\n });\n\n /** The height of a group's name strip, in px, for the stylesheet. */\n protected readonly headerHeight = HEADER;\n\n /**\n * The figures for `dataTable`: the drawing's name as the caption, and a row per node with\n * its value and its share of the whole, written as the tooltip writes them.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.nodes().map(node => ({\n header: node.path.join(SEPARATOR),\n cells: [node.value === null ? '' : this.numbers.value(node.value), this.share(node)],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the tile under the pointer: the node's swatch,\n * its path and its value as the heading, and its share of the whole under it. It points\n * at the tile from above. The pointer over a group's strip or its edge reads the group,\n * with its total.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const tile = this.tiles()[index];\n const el = this.tileEls()[index]?.nativeElement;\n if (!tile || !el) return null;\n const { node } = tile;\n const share = this.share(node);\n return {\n datum: {\n label: node.path.join(SEPARATOR),\n value: node.value === null ? '' : this.numbers.value(node.value),\n color: node.color,\n rows: share ? [{ label: this.shareName(), value: share }] : [],\n },\n anchor: el,\n };\n });\n\n /**\n * The tile under the pointer, heard once on the plot rather than on every tile: the\n * nearest tile up from the element the pointer is over. A MOUSE event, as every chart's\n * is: a tap fires the compatibility `mousemove` and no `pointermove`.\n */\n protected onPointerMove(event: MouseEvent): void {\n const tile = (event.target as Element | null)?.closest<HTMLElement>('.wr-treemap-chart__tile');\n const index = tile ? Number(tile.dataset['index']) : Number.NaN;\n if (Number.isInteger(index) && index >= 0) this.tip.enter(index);\n else this.tip.leave(event);\n }\n\n /** A node's share of the whole, through `percentFormat` or as a percentage in `LOCALE_ID`, or `''` for one with no area. */\n private share(node: ResolvedNode): string {\n const total = this.total();\n if (node.size <= 0 || total <= 0) return '';\n const share = node.size / total;\n const custom = this.percentFormat();\n if (custom) return custom(share);\n return (share < 0.01 ? this.smallShares : this.shares).format(share);\n }\n}\n\nexport type { WrTreemapNode } from './types';\n","@let active = tip.active();\n<!-- The drawing: one named image, every tile inside it positioned by percentages of it.\n The tiles are siblings rather than nested, parents first, so a child is drawn over\n its parent and leaving it for the parent's edge is a `mouseleave` like any other. -->\n<div\n #plot\n class=\"wr-treemap-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n <!-- `inset-inline-start`, not `left`: the layout starts at the inline-start edge, and\n under RTL the whole drawing mirrors with it. `data-index` is what the pointer\n handler reads the tile off. -->\n @for (tile of tiles(); track tile.key) {\n <div\n #tile\n class=\"wr-treemap-chart__tile\"\n [class.wr-treemap-chart__tile--group]=\"tile.group\"\n [class.wr-treemap-chart__tile--leaf]=\"!tile.group\"\n [class.wr-treemap-chart__tile--active]=\"$index === active\"\n [attr.data-index]=\"$index\"\n [style.--wr-treemap-chart-tile-color]=\"tile.node.color\"\n [style.inset-inline-start.%]=\"tile.start\"\n [style.top.%]=\"tile.top\"\n [style.width.%]=\"tile.width\"\n [style.height.%]=\"tile.height\"\n >\n <!-- A name takes its direction from its own text (`dir=\"auto\"`), so a Latin name in an\n RTL tile is cut at its end, not its start, and a Hebrew one in an LTR tile too. A\n value does the same, so `$120K` reads in its own order beside a Hebrew name. -->\n @if (tile.header) {\n <!-- As tall as the strip the layout left above the children, written here so the\n stylesheet and the layout cannot disagree about it. -->\n <span class=\"wr-treemap-chart__header\" [style.height.px]=\"headerHeight\">\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (showValues() && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n </span>\n } @else if (tile.labelled) {\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (tile.valued && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n }\n </div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the drawing's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAS,MAAM,OAAwB,OAAe,KAAa,KAAa,MAAY;CAC1F,IAAI,UAAU;CACd,IAAI,WAAW,OAAO;CACtB,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,KAAK;EAChC,UAAU,KAAK,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI;EACzC,WAAW,KAAK,IAAI,UAAU,MAAM,EAAE,CAAC,IAAI;CAC7C;CACA,MAAM,KAAK,MAAM;CACjB,MAAM,KAAK,OAAO;CAClB,OAAO,KAAK,IAAK,KAAK,UAAW,IAAI,MAAM,KAAK,SAAS;AAC3D;AA+BA,SAAgB,SAAS,QAA2B,KAAkB;CACpE,MAAM,MAAgC,OAAO,UAAU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GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACT,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-treemap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/treemap-chart/internal/squarify.ts","../../../projects/lib/charts/treemap-chart/treemap-chart.ts","../../../projects/lib/charts/treemap-chart/treemap-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\n/**\n * A rectangle in the layout's own units: `x` from the inline-start edge, `y` from the\n * top. The treemap chart lays out in pixels and draws in percentages of its plot.\n *\n * @internal\n */\ninterface WrTreemapRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One value to place, by its position in the caller's list, with its share of the box as an area. */\ninterface Item {\n readonly index: number;\n readonly area: number;\n}\n\n/**\n * The worst aspect ratio in a row of `items[start..end)` laid along a side `side` long,\n * `sum` being their total area: the row is `sum / side` deep, and each item as long as\n * its area over that depth. The ratio is the longer side over the shorter, so a square\n * scores 1 and every other shape more.\n */\nfunction worst(items: readonly Item[], start: number, end: number, sum: number, side: number): number {\n let largest = 0;\n let smallest = Number.POSITIVE_INFINITY;\n for (let k = start; k < end; k++) {\n largest = Math.max(largest, items[k].area);\n smallest = Math.min(smallest, items[k].area);\n }\n const s2 = sum * sum;\n const w2 = side * side;\n return Math.max((w2 * largest) / s2, s2 / (w2 * smallest));\n}\n\n/**\n * Cuts `box` into one rectangle per value, each with an area in proportion to its value,\n * by the squarified algorithm — Bruls, Huizing and van Wijk, \"Squarified Treemaps\"\n * (2000) — which keeps every rectangle as close to a square as it can, so that areas are\n * easy to compare and labels have room.\n *\n * The values are placed IN THE ORDER GIVEN, and the result is in that order too: the\n * algorithm assumes the largest first, so sort them descending for the squarest result.\n * It fills the box in rows. A row runs along the shorter side of the space still free,\n * starting at its inline-start or top edge, and takes values while adding one does not\n * make its worst aspect ratio worse; then it is fixed, and the space beyond it is the\n * next row's. So the first value sits in the inline-start top corner — mirrored with the\n * writing direction when the caller positions by `inset-inline-start`.\n *\n * The last rectangle of every row, and the whole of the last row, take what is left of\n * the space exactly, so floating point leaves no hairline uncovered: the rectangles tile\n * the box with nothing over and nothing under.\n *\n * A value that is not a finite number above zero has no area and gets `null`, as does\n * every value when the box has no area or nothing has a value.\n *\n * @example\n * ```ts\n * squarify([1, 1], { x: 0, y: 0, width: 2, height: 1 });\n * // [{ x: 0, y: 0, width: 1, height: 1 }, { x: 1, y: 0, width: 1, height: 1 }]\n * ```\n *\n * @internal\n */\nexport function squarify(values: readonly number[], box: WrTreemapRect): (WrTreemapRect | null)[] {\n const out: (WrTreemapRect | null)[] = values.map(() => null);\n const positive = values.flatMap((value, index) => (Number.isFinite(value) && value > 0 ? [{ index, value }] : []));\n const total = positive.reduce((sum, item) => sum + item.value, 0);\n if (positive.length === 0 || !(total > 0) || !(box.width > 0) || !(box.height > 0)) return out;\n\n const scale = (box.width * box.height) / total;\n const items: Item[] = positive.map(({ index, value }) => ({ index, area: value * scale }));\n\n let { x, y, width, height } = box;\n let start = 0;\n while (start < items.length) {\n const side = Math.min(width, height);\n // Grow the row while the next value does not make its worst ratio worse.\n let end = start + 1;\n let sum = items[start].area;\n let ratio = worst(items, start, end, sum, side);\n while (end < items.length) {\n const next = worst(items, start, end + 1, sum + items[end].area, side);\n if (next > ratio) break;\n ratio = next;\n sum += items[end].area;\n end++;\n }\n\n const last = end === items.length;\n if (width >= height) {\n // The shorter side is the height: the row is a column at the inline-start edge.\n const depth = last ? width : Math.min(width, sum / height);\n let top = y;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? y + height - top : items[k].area / depth;\n out[items[k].index] = { x, y: top, width: depth, height: length };\n top += length;\n }\n x += depth;\n width = Math.max(0, width - depth);\n } else {\n // The shorter side is the width: the row is a strip along the top.\n const depth = last ? height : Math.min(height, sum / width);\n let left = x;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? x + width - left : items[k].area / depth;\n out[items[k].index] = { x: left, y, width: length, height: depth };\n left += length;\n }\n y += depth;\n height = Math.max(0, height - depth);\n }\n start = end;\n }\n return out;\n}\n\nexport type { WrTreemapRect };\n","/**\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 } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n linkedSignal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartLegend, type WrChartLegendItem, type WrChartLegendPosition } from 'ngwr/charts/chart-legend';\nimport {\n type WrChartSize,\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartSize,\n useChartState,\n wrChartColor,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { type WrTreemapRect, squarify } from './internal/squarify';\nimport type { WrTreemapNode } from './types';\n\n/**\n * The width the layout assumes until the plot has been measured — on the server, and\n * in the first render in a browser. The tiles are drawn in percentages of the plot, so\n * they fill it either way; only their shapes are squarer once the real width is known.\n */\nconst FALLBACK_WIDTH = 640;\n\n/**\n * The height of the strip a group's name is written in, in px: one line of the label's\n * type and a little room. The stylesheet sizes the strip from the same number, written\n * on it inline, so the two cannot disagree; a larger type than the default's is clipped\n * rather than spilling into the tiles under it.\n */\nconst HEADER = 20;\n\n/** The space between a group's edge and the tiles inside it, in px, on the sides and below. */\nconst PAD = 3;\n\n/** The smallest room, in px either way, that a group draws its children in. Smaller, it is drawn as one block. */\nconst MIN_INNER = 12;\n\n/** The smallest tile, in px, that a name is written in, however short the name. */\nconst LABEL_MIN_WIDTH = 36;\nconst LABEL_MIN_HEIGHT = 22;\n\n/**\n * The width, in px, from which a tile writes a name it has to cut: room for about nine\n * letters before the ellipsis, enough of a name to be read as that name. Narrower, a name\n * that does not fit whole is left out, and the tooltip and the data table carry it.\n */\nconst LABEL_CUT_WIDTH = 72;\n\n/** What a letter of the label's type takes on average, in px, and a wide one (CJK, full-width). */\nconst CHAR_WIDTH = 7;\nconst WIDE_CHAR_WIDTH = 12;\n\n/** The label's padding on both sides together, in px. */\nconst LABEL_PADDING = 8;\n\n/**\n * The width a name takes inside a tile, in px, padding included: an estimate from its\n * letters, since nothing is laid out where the layout is cut (a server, the first render).\n * It errs wide, and the stylesheet still ellipsises a name the estimate let through.\n */\nfunction labelWidth(label: string): number {\n let width = LABEL_PADDING;\n for (const char of label) width += (char.codePointAt(0) ?? 0) >= 0x1100 ? WIDE_CHAR_WIDTH : CHAR_WIDTH;\n return width;\n}\n\n/**\n * Whether a tile `width` px wide writes `label`: when the whole name fits, or when the\n * tile is wide enough that the part left before the ellipsis still reads as the name.\n * `Le…` and `Facil…` name nothing, so a tile that small stays blank.\n */\nfunction named(label: string, width: number): boolean {\n return width >= LABEL_MIN_WIDTH && (width >= LABEL_CUT_WIDTH || width >= labelWidth(label));\n}\n\n/** The smallest tile height, in px, that holds the value under the name. */\nconst VALUE_MIN_HEIGHT = 38;\n\n/** Between the names of a path, in the tooltip and the data table. */\nconst SEPARATOR = ' / ';\n\n/**\n * The relative difference below which a group's value and its children's sum are the same\n * number. Decimal data rarely adds up exactly in binary — 0.1 + 0.2 + 0.3 is\n * 0.6000000000000001 — so an exact comparison would call a group of 0.6 smaller than its\n * children and leave a remainder of a few ulps to lay out.\n */\nconst SUM_TOLERANCE = 1e-9;\n\n/** A percentage to three decimals, so a style stays short. */\nconst percent = (value: number): number => wrChartRound(value, 3);\n\n/** A node of the data, resolved: where it sits in the tree, its colour, its figure and its area. */\ninterface ResolvedNode {\n /** Its position in the tree, `0.2.1`: unique, and stable while the data keeps its shape. */\n readonly key: string;\n readonly label: string;\n /** Every name from the top-level node down to this one. */\n readonly path: readonly string[];\n readonly color: string;\n /** The position of the top-level node it sits under: its row in the legend. */\n readonly series: number;\n /** Its own `value`, when that is a finite number. */\n readonly own: number | null;\n /**\n * The figure the tooltip and the data table show: its own value, or for a group with\n * none the sum of its children's areas. `null` for a leaf with no value.\n */\n readonly value: number | null;\n /** The weight its rectangle is drawn with. `0` draws nothing. */\n readonly size: number;\n /** What its children's areas add up to. */\n readonly childSize: number;\n readonly children: readonly ResolvedNode[];\n}\n\n/** A node as drawn: its rectangle in px and what it has room to show. */\ninterface PlacedTile {\n readonly node: ResolvedNode;\n readonly rect: WrTreemapRect;\n /** Its children are drawn inside it. */\n readonly group: boolean;\n /** A strip at its top carries its name and, with `showValues`, its figure. */\n readonly header: boolean;\n /** Its name is written inside it, as on a leaf. */\n readonly labelled: boolean;\n /** Its figure is written under its name. */\n readonly valued: boolean;\n}\n\n/** The fit rules {@link placeTiles} applies. */\ninterface PlaceOptions {\n readonly labels: boolean;\n readonly values: boolean;\n}\n\n/**\n * Every node of `nodes`, resolved: paths and colours handed down, values summed up. A\n * top-level node with no `color` takes the palette colour of its position, and a nested\n * one its parent's.\n */\nfunction resolveNodes(\n nodes: readonly WrTreemapNode[],\n path: readonly string[],\n inherited: string | null,\n key: string,\n top: number | null = null\n): ResolvedNode[] {\n return nodes.map((node, i) => {\n const color = node.color ?? inherited ?? wrChartColor(i);\n const series = top ?? i;\n const own = typeof node.value === 'number' && Number.isFinite(node.value) ? node.value : null;\n const ownSize = own !== null && own > 0 ? own : 0;\n const nodePath = [...path, node.label];\n const children = resolveNodes(node.children ?? [], nodePath, color, `${key}${i}.`, series);\n const childSize = children.reduce((sum, child) => sum + child.size, 0);\n const group = children.length > 0;\n return {\n key: `${key}${i}`,\n label: node.label,\n path: nodePath,\n color,\n series,\n own,\n value: group ? (own ?? childSize) : own,\n // A group is never smaller than its children, whatever it is given: they have to fit.\n size: group ? Math.max(ownSize, childSize) : ownSize,\n childSize,\n children,\n };\n });\n}\n\n/** Every node, parents before their children, in the data's own order: the data table's rows. */\nfunction flatten(nodes: readonly ResolvedNode[]): ResolvedNode[] {\n return nodes.flatMap(node => [node, ...flatten(node.children)]);\n}\n\n/**\n * The tiles for `nodes` inside `box`, parents before their children so a child is drawn\n * over its parent. Siblings are squarified largest first, ties in the data's order, and a\n * group's `remainder` — the part of its value its children do not account for — is laid\n * out last and left empty.\n */\nfunction placeTiles(\n nodes: readonly ResolvedNode[],\n remainder: number,\n box: WrTreemapRect,\n options: PlaceOptions,\n out: PlacedTile[]\n): void {\n const order = nodes\n .map((node, index) => ({ node, index }))\n .filter(({ node }) => node.size > 0)\n .sort((a, b) => b.node.size - a.node.size || a.index - b.index);\n const sizes = order.map(({ node }) => node.size);\n if (remainder > 0) sizes.push(remainder);\n const rects = squarify(sizes, box);\n\n order.forEach(({ node }, k) => {\n const rect = rects[k];\n if (!rect) return;\n const roomForHeader = options.labels && rect.height >= HEADER * 2 && named(node.label, rect.width);\n const top = roomForHeader ? HEADER : PAD;\n const inner: WrTreemapRect = {\n x: rect.x + PAD,\n y: rect.y + top,\n width: rect.width - 2 * PAD,\n height: rect.height - top - PAD,\n };\n const group = node.childSize > 0 && inner.width >= MIN_INNER && inner.height >= MIN_INNER;\n const labelled = !group && options.labels && rect.height >= LABEL_MIN_HEIGHT && named(node.label, rect.width);\n out.push({\n node,\n rect,\n group,\n header: group && roomForHeader,\n labelled,\n valued: labelled && options.values && rect.height >= VALUE_MIN_HEIGHT,\n });\n if (group) {\n const rest = node.size - node.childSize;\n placeTiles(node.children, rest > node.size * SUM_TOLERANCE ? rest : 0, inner, options, out);\n }\n });\n}\n\n/**\n * Treemap chart: a hierarchy as nested rectangles, each with an area in proportion to its\n * value. For the parts of a whole when there are too many for a donut, or when they come\n * in groups — a budget by department and team, a disk by folder. HTML only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-treemap-chart\n * ariaLabel=\"Budget by department\"\n * [data]=\"[\n * { label: 'Engineering', children: [{ label: 'Web', value: 310 }, { label: 'Mobile', value: 260 }] },\n * { label: 'Sales', children: [{ label: 'EMEA', value: 280 }, { label: 'APAC', value: 150 }] },\n * { label: 'Legal', value: 60 }\n * ]\"\n * />\n * ```\n *\n * **The layout** is the squarified algorithm (Bruls, Huizing and van Wijk, 2000): each\n * set of siblings is cut largest first into rectangles as close to square as it allows,\n * so areas can be compared and names have room. It starts in the inline-start top corner,\n * so under RTL the largest node sits at the top right — the tiles are positioned by\n * `inset-inline-start`, and the whole drawing mirrors with the writing direction.\n *\n * **Groups.** A node with children is drawn as a rectangle with its children inside it,\n * a few pixels in from its edge, under a strip carrying its name when it is tall enough.\n * Its value is the sum of its children's unless it is given one, and a value above that\n * sum leaves the rest of its rectangle empty: what the children do not account for. A\n * group too small to hold its children is drawn as one block.\n *\n * **Colour is the top-level node's**, from the chart palette (`--wr-chart-1` to `-8`),\n * and every node inside it takes it unless it has a `color` of its own. A tile is the\n * solid colour, and the line round it is the surface (`--wr-chart-separator`), so two\n * tiles of one colour still read as two. The text on a tile is black or white, whichever\n * reads on that tile's colour. Colour is never the only thing that tells two groups\n * apart: each carries its name where there is room, and its tiles sit inside its own\n * rectangle; the tooltip and the data table name the ones too small to write in, and\n * `showLegend` keys the top-level nodes beside the chart. Under forced colours the line\n * is an outline in the text colour. With more than eight top-level nodes the palette\n * repeats, and the names are what tell neighbours of one colour apart.\n *\n * **Names are written inside the tiles that have room** — a group's in its strip, a\n * leaf's in its corner with its value under it. A name is written whole where it fits,\n * and cut with an ellipsis only on a tile wide enough to keep about nine letters of it:\n * a narrower tile whose name does not fit, or one smaller than about 36 × 22 px, writes\n * nothing rather than `Le…`. The tooltip and the data table name every node in full,\n * with its whole path. A value is never cut: one wider than its tile, or than the room\n * its group's name leaves in the strip, is left out, since `$12…` reads as another\n * number, and the tooltip and the data table carry it whole.\n *\n * **Hover.** The tile under the pointer is ringed, and every tile outside its top-level\n * node falls back; a legend row does the same for its node.\n *\n * **Empty, loading, error.** With nothing to draw the chart keeps its box and says\n * \"No data\"; `loading` and `error` put their own message there in place of the tiles.\n *\n * **What a screen reader gets.** The drawing is one named `role=\"img\"`, and nothing in it\n * is announced. The tooltip is pointer only, so say what the chart shows in `ariaLabel`,\n * or turn on `dataTable`, which lists every node by its path with its value and its share\n * of the whole. No part of the chart is a tab stop.\n *\n * **No drill-down.** Every level is drawn at once and nothing zooms into a group; a\n * deep tree is better split into several charts, or given one level at a time by the host.\n *\n * The tiles are laid out for the plot's measured size, so on the server and in the first\n * render they are cut for an assumed width and squared up once the plot is measured.\n *\n * @see https://ngwr.dev/charts/treemap-chart\n */\n@Component({\n selector: 'wr-treemap-chart',\n templateUrl: './treemap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the plot.\n class: 'wr-treemap-chart wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState, WrChartTable],\n})\nexport class WrTreemapChart {\n /**\n * The nodes, top level first. A node with `children` is a group drawn round them, and\n * one without is a leaf drawn at its `value`. Top-level nodes with no `color` take the\n * palette's colours in order.\n */\n readonly data = input<readonly WrTreemapNode[]>([]);\n\n /**\n * Accessible name of the drawing. The tiles carry no text a screen reader reaches, so\n * this is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `treemapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'treemapChart.label', 'Treemap chart');\n\n /**\n * What the values measure — revenue, size on disk — as the heading of the data table's\n * value column. Falls back to `treemapChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n protected readonly valueName = useI18nText(this.valueLabel, 'treemapChart.value', 'Value');\n\n /** The heading of the share column and the name of the tooltip's share row. */\n protected readonly shareName = wrReadI18nText('treemapChart.share', 'Share');\n\n /** The plot's height in px, at least 80. Its width is the container's. @default 280 */\n readonly height = input(280, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 280);\n return Number.isFinite(value) ? Math.max(80, value) : 280;\n },\n });\n\n /**\n * Write the names inside the tiles that have room for them, a group's in a strip along\n * its top. Off, no tile carries text and no group reserves a strip. @default true\n */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /** Write each value under its name, and each group's beside its name, where there is room. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Key the top-level nodes in a legend: a dot in each one's colour, its name and its\n * value. Off by default, since a tile with room carries its own name. `'auto'` shows\n * it when there are two top-level nodes or more. @default false\n */\n readonly showLegend = input<boolean | 'auto', unknown>(false, {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the chart as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend 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 tiles give way to the loading\n * message, in the box the chart had. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the tiles 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 /** The message shown when there is nothing to draw. Falls back to `chart.empty`, then `'No data'`. */\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 tile under the pointer: its path from the top-level node,\n * its value, and its share of the whole. Pointer only — the data table is where the\n * same figures 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 value the chart shows: inside the tiles, in the tooltip and in the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact inside the tiles\n * (`1.2K`). A value wider than its tile is left out of it rather than cut. Shares are\n * `percentFormat`'s.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every share the chart shows, given as a RATIO — `0.25` for a quarter — the\n * number `Intl.NumberFormat`'s `percent` style takes, so one of those can be passed as\n * it is: in the tooltip and in the data table. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a sliver is not\n * printed as `0%`.\n */\n readonly percentFormat = input<((ratio: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per node, parents before their children in the data's order, headed by its path —\n * `Engineering / Web` — with its value and its share of the whole. A node with no area\n * is listed with an empty share, and a leaf with no value with an empty value too.\n *\n * The drawing is one named `role=\"img\"`, which hides everything inside it, so without\n * the table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * drawing, 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 /** The exact figures and the tiles' compact ones, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** Shares from one percent up, to one decimal: `12.5 %`, `3 %`. */\n private readonly shares = wrChartNumberFormat(inject(LOCALE_ID), { style: 'percent', maximumFractionDigits: 1 });\n\n /** Shares below one percent, to two significant digits, so a sliver does not read `0 %`. */\n private readonly smallShares = wrChartNumberFormat(inject(LOCALE_ID), {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly tileEls = viewChildren<ElementRef<HTMLElement>>('tile');\n\n /**\n * The plot's content box, on the observer every chart shares: one callback a frame for\n * every chart on the page, where each treemap used to make an observer of its own.\n */\n private readonly size = useChartSize(this.plot);\n\n /**\n * The last size the plot measured, in whole px, or `null` before it has one. A hidden\n * chart measures nothing and keeps the layout it had rather than collapse it, and a\n * drag that moves the width by a fraction of a pixel cuts no new layout.\n */\n private readonly box = linkedSignal<WrChartSize, WrChartSize | null>({\n source: this.size,\n computation: ({ width, height }, previous) =>\n width <= 0 || height <= 0 ? (previous?.value ?? null) : { width: Math.round(width), height: Math.round(height) },\n equal: (a, b) => a?.width === b?.width && a?.height === b?.height,\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/treemap-chart');\n\n // One pair of listeners on the host however many tiles there are: the tile under the\n // pointer is the nearest element up from it carrying `data-wr-index`.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n\n // The ring round the tile the tooltip is about, set by hand on that one element. Bound\n // as a class on every tile, it was compared again for every tile on every hover change.\n let ringed: HTMLElement | null = null;\n effect(() => {\n const active = this.tip.active();\n // The tiles are read here too, so a new layout under an open tooltip moves the ring\n // to the tile that now sits at its index.\n const next = active === null ? null : (this.tileEls()[active]?.nativeElement ?? null);\n if (next === ringed) return;\n ringed?.classList.remove('wr-treemap-chart__tile--active');\n next?.classList.add('wr-treemap-chart__tile--active');\n ringed = next;\n });\n\n // Two things in the data the drawing cannot honour, and that look like nothing at all\n // on screen: a missing tile, and a group drawn larger than it was told to be.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n for (const node of this.nodes()) {\n const path = node.path.join(SEPARATOR);\n let problem: string | null = null;\n if (node.own !== null && node.own < 0) {\n // A negative value adds no area of its own, so whatever such a node is drawn at\n // is its children's total — a group is still drawn round them.\n const drawn =\n node.size > 0\n ? `It is drawn at the ${node.childSize} its children add up to, which has to fit.`\n : 'It draws no tile, and the data table still lists it.';\n problem = `\"${path}\" has a negative value (${node.own}), which has no area. ${drawn}`;\n } else if (node.children.length > 0 && node.own !== null && node.own < node.childSize * (1 - SUM_TOLERANCE)) {\n problem =\n `\"${path}\" is given a value of ${node.own}, below the ${node.childSize} its children add up to. ` +\n 'It is drawn at its children’s total, which has to fit.';\n }\n if (problem === null || warned.has(problem)) continue;\n warned.add(problem);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(`[NGWR] <wr-treemap-chart>: ${problem}`);\n }\n });\n }\n }\n\n /** The data, resolved: top-level nodes with every node below them. */\n private readonly tree = computed(() => resolveNodes(this.data(), [], null, ''));\n\n /** Every node, parents before their children, in the data's order. */\n private readonly nodes = computed(() => flatten(this.tree()));\n\n /** The whole: the area of every top-level node together, which every share is of. */\n private readonly total = computed(() => this.tree().reduce((sum, node) => sum + node.size, 0));\n\n /** The size the layout is cut for: the measured plot, or the fallback width at `height`. */\n private readonly layoutBox = computed(() => this.box() ?? { width: FALLBACK_WIDTH, height: this.height() });\n\n /**\n * Every tile drawn, parents before their children, with its rectangle as percentages\n * of the plot — `start` from the inline-start edge — and its figure as the tile writes it.\n * Its position in this list is what the tooltip and the template know it by.\n */\n protected readonly tiles = computed(() => {\n const { width, height } = this.layoutBox();\n const placed: PlacedTile[] = [];\n placeTiles(\n this.tree(),\n 0,\n { x: 0, y: 0, width, height },\n { labels: this.showLabels(), values: this.showValues() },\n placed\n );\n return placed.map(tile => ({\n key: tile.node.key,\n node: tile.node,\n series: tile.node.series,\n group: tile.group,\n header: tile.header,\n labelled: tile.labelled,\n valued: tile.valued,\n text: tile.node.value === null ? '' : this.numbers.label(tile.node.value),\n start: percent((tile.rect.x / width) * 100),\n top: percent((tile.rect.y / height) * 100),\n width: percent((tile.rect.width / width) * 100),\n height: percent((tile.rect.height / height) * 100),\n }));\n });\n\n /** The height of a group's name strip, in px, for the stylesheet. */\n protected readonly headerHeight = HEADER;\n\n /**\n * The figures for `dataTable`: the drawing's name as the caption, and a row per node with\n * its value and its share of the whole, written as the tooltip writes them.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.nodes().map(node => ({\n header: node.path.join(SEPARATOR),\n cells: [node.value === null ? '' : this.numbers.value(node.value), this.share(node)],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the tile under the pointer: the node's swatch,\n * its path and its value as the heading, and its share of the whole under it. It points\n * at the tile from above. The pointer over a group's strip or its edge reads the group,\n * with its total.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const tile = this.tiles()[index];\n const el = this.tileEls()[index]?.nativeElement;\n if (!tile || !el) return null;\n const { node } = tile;\n const share = this.share(node);\n return {\n datum: {\n label: node.path.join(SEPARATOR),\n value: node.value === null ? '' : this.numbers.value(node.value),\n color: node.color,\n rows: share ? [{ label: this.shareName(), value: share }] : [],\n },\n anchor: el,\n };\n });\n\n /** The legend's rows: every top-level node, keyed by a dot in its colour, with its value. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.tree().map(node => ({\n label: node.label,\n color: node.color,\n value: node.value === null ? null : this.numbers.label(node.value),\n }))\n );\n\n /**\n * Whether the chart draws its legend: asked for with `showLegend`, unless\n * `legendPosition` is `none` or there is no node. Under `showLegend=\"auto\"` a single\n * top-level node has nothing to tell apart, and draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.legendItems().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the plot, 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 legend sits beside the plot 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 /** Whether the chart has nothing to draw: no node with an area. */\n private readonly empty = computed(() => this.total() <= 0);\n\n /** What the chart shows in place of its tiles, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: this.empty,\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n /** A node's share of the whole, through `percentFormat` or as a percentage in `LOCALE_ID`, or `''` for one with no area. */\n private share(node: ResolvedNode): string {\n const total = this.total();\n if (node.size <= 0 || total <= 0) return '';\n const share = node.size / total;\n const custom = this.percentFormat();\n if (custom) return custom(share);\n return (share < 0.01 ? this.smallShares : this.shares).format(share);\n }\n}\n\nexport type { WrTreemapNode } from './types';\n","@let shown = state();\n\n<!-- The legend, drawn before the body or after it so it is in the DOM where it is on\n screen. One row per top-level node, in the data's order: a row's position is the\n `data-wr-series` its tiles carry, so hovering a row dims every other node. -->\n<ng-template #legend>\n <ul wr-chart-legend class=\"wr-treemap-chart__legend\" [items]=\"legendItems()\" [position]=\"legendPosition()\"></ul>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div class=\"wr-treemap-chart__body\">\n <!-- The drawing: one named image, every tile inside it positioned by percentages of it.\n The tiles are siblings rather than nested, parents first, so a child is drawn over\n its parent and leaving it for the parent's edge is a `mouseleave` like any other. -->\n <div\n #plot\n class=\"wr-treemap-chart__plot\"\n role=\"img\"\n [class.wr-treemap-chart__plot--idle]=\"!!shown\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n @if (!shown) {\n <!-- `inset-inline-start`, not `left`: the layout starts at the inline-start edge, and\n under RTL the whole drawing mirrors with it. `data-wr-index` is what the hover\n reads the tile off, and `data-wr-series` the top-level node it dims the rest for.\n No binding here follows the pointer: the reading tile's ring is set by hand. -->\n @for (tile of tiles(); track tile.key) {\n <div\n #tile\n class=\"wr-treemap-chart__tile\"\n [class.wr-treemap-chart__tile--group]=\"tile.group\"\n [class.wr-treemap-chart__tile--leaf]=\"!tile.group\"\n [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"tile.series\"\n [style.--wr-treemap-chart-tile-color]=\"tile.node.color\"\n [style.inset-inline-start.%]=\"tile.start\"\n [style.top.%]=\"tile.top\"\n [style.width.%]=\"tile.width\"\n [style.height.%]=\"tile.height\"\n >\n <!-- A name takes its direction from its own text (`dir=\"auto\"`), so a Latin name in an\n RTL tile is cut at its end, not its start, and a Hebrew one in an LTR tile too. A\n value does the same, so `$120K` reads in its own order beside a Hebrew name. -->\n @if (tile.header) {\n <!-- As tall as the strip the layout left above the children, written here so the\n stylesheet and the layout cannot disagree about it. -->\n <span class=\"wr-treemap-chart__header\" [style.height.px]=\"headerHeight\">\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (showValues() && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n </span>\n } @else if (tile.labelled) {\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (tile.valued && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n }\n </div>\n }\n }\n </div>\n @if (shown) {\n <!-- Beside the drawing's `img`, never inside it: `img` makes everything it holds\n presentational, and the message is a live region. Laid over the plot's box. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the drawing's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,SAAS,MAAM,OAAwB,OAAe,KAAa,KAAa,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AA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACT,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -16,11 +16,11 @@ function styleNumber(style, name) {
16
16
  const value = match ? Number.parseFloat(match[1]) : NaN;
17
17
  return Number.isFinite(value) ? value : null;
18
18
  }
19
- async function numberAttribute(element, name, method) {
20
- const raw = await element.getAttribute(name);
21
- const value = raw === null ? NaN : Number.parseFloat(raw);
22
- if (!Number.isFinite(value)) throw new Error(`WrWaterfallChartHarness.${method}(): a step carries ${name}="${raw ?? ""}", which the component writes as a finite number on every step it draws.`);
23
- return value;
19
+ async function runningTotals(element, method) {
20
+ const raw = await element.getAttribute("data-step");
21
+ const [start, end] = (raw ?? "").split(" ").map((part) => Number.parseFloat(part));
22
+ if (!Number.isFinite(start) || !Number.isFinite(end)) throw new Error(`WrWaterfallChartHarness.${method}(): a step carries data-step="${raw ?? ""}", which the component writes as two finite numbers on every step it draws.`);
23
+ return [start, end];
24
24
  }
25
25
  var StepHarness = class StepHarness extends ComponentHarness {
26
26
  static hostSelector = ".wr-waterfall-chart__step";
@@ -32,13 +32,14 @@ var StepHarness = class StepHarness extends ComponentHarness {
32
32
  const bottom = styleNumber(style, "--wr-waterfall-chart-lo");
33
33
  const top = styleNumber(style, "--wr-waterfall-chart-hi");
34
34
  if (bottom === null || top === null) throw new Error(`WrWaterfallChartHarness.getSteps(): the step "${label}" carries no inline bar ends (style: "${style ?? ""}"). The component writes both on every step, a change of zero included, so their absence is the bug — reporting 0 would read as a bar on the frame.`);
35
+ const [start, end] = await runningTotals(host, "getSteps");
35
36
  return {
36
37
  label,
37
38
  kind: await StepHarness.kindOf(host, label),
38
39
  name: await host.getAttribute("aria-label"),
39
40
  value: value ? await value.text() : null,
40
- start: await numberAttribute(host, "data-start", "getSteps"),
41
- end: await numberAttribute(host, "data-end", "getSteps"),
41
+ start,
42
+ end,
42
43
  bottomPercent: bottom,
43
44
  topPercent: top,
44
45
  connected: connector !== null
@@ -93,6 +94,13 @@ var WrWaterfallChartHarness = class WrWaterfallChartHarness extends ComponentHar
93
94
  async hasGrid() {
94
95
  return await this.locatorForOptional(".wr-waterfall-chart__grid-line")() !== null;
95
96
  }
97
+ async hasAxis() {
98
+ return await this.locatorForOptional(".wr-waterfall-chart__y-axis")() !== null;
99
+ }
100
+ async getStateLabel() {
101
+ const state = await this.locatorForOptional(".wr-chart-state")();
102
+ return state ? (await state.text()).trim() : null;
103
+ }
96
104
  async getYTicks() {
97
105
  const ticks = await this.locatorForAll(".wr-waterfall-chart__tick")();
98
106
  return Promise.all(ticks.map((tick) => tick.text()));
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-waterfall-chart-testing.mjs","names":[],"sources":["../../../projects/lib/charts/waterfall-chart/testing/wr-waterfall-chart-harness.ts"],"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 { ComponentHarness, HarnessPredicate, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrWaterfallChartHarnessFilters, WrWaterfallChartHarnessStep, WrWaterfallChartTableRow } from './types';\n\nconst KINDS = ['increase', 'decrease', 'flat', 'total'] as const;\n\n/** One custom property the component wrote into an inline `style`, as a finite number, or `null` when it is absent. */\nfunction styleNumber(style: string | null, name: string): number | null {\n const match = new RegExp(`(?:^|;)\\\\s*${name}\\\\s*:\\\\s*([^;]+)`).exec(style ?? '');\n const value = match ? Number.parseFloat(match[1]) : Number.NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/** A finite number off one attribute, or a sentence saying which one the element lacks. */\nasync function numberAttribute(element: TestElement, name: string, method: string): Promise<number> {\n const raw = await element.getAttribute(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new Error(\n `WrWaterfallChartHarness.${method}(): a step carries ${name}=\"${raw ?? ''}\", which the component writes as a ` +\n 'finite number on every step it draws.'\n );\n }\n return value;\n}\n\n/**\n * One step's column, so its kind, its figure, its bar and its connector are read off the\n * column they sit in rather than matched up by position across the chart: a step prints a\n * figure only with `showValues`, and the last one has no connector.\n */\nclass StepHarness extends ComponentHarness {\n static hostSelector = '.wr-waterfall-chart__step';\n\n async read(label: string): Promise<WrWaterfallChartHarnessStep> {\n const host = await this.host();\n const value = await this.locatorForOptional('.wr-waterfall-chart__value')();\n const connector = await this.locatorForOptional('.wr-waterfall-chart__connector')();\n const style = await host.getAttribute('style');\n const bottom = styleNumber(style, '--wr-waterfall-chart-lo');\n const top = styleNumber(style, '--wr-waterfall-chart-hi');\n if (bottom === null || top === null) {\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the step \"${label}\" carries no inline bar ends (style: \"${style ?? ''}\"). ` +\n 'The component writes both on every step, a change of zero included, so their absence is the bug — ' +\n 'reporting 0 would read as a bar on the frame.'\n );\n }\n return {\n label,\n kind: await StepHarness.kindOf(host, label),\n name: await host.getAttribute('aria-label'),\n value: value ? await value.text() : null,\n start: await numberAttribute(host, 'data-start', 'getSteps'),\n end: await numberAttribute(host, 'data-end', 'getSteps'),\n bottomPercent: bottom,\n topPercent: top,\n connected: connector !== null,\n };\n }\n\n private static async kindOf(host: TestElement, label: string): Promise<WrWaterfallChartHarnessStep['kind']> {\n for (const kind of KINDS) {\n if (await host.hasClass(`wr-waterfall-chart__step--${kind}`)) return kind;\n }\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the step \"${label}\" carries no kind modifier. The component gives every ` +\n 'step one of `--increase`, `--decrease`, `--flat` and `--total`, and the stylesheet paints the figure by it.'\n );\n }\n}\n\n/** One body row of the chart's data table. */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrWaterfallChartTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/**\n * Test harness for `<wr-waterfall-chart>`.\n *\n * **The bars are read as PERCENTAGES of the drawing, not as pixels.** Each step's two\n * ends are written inline as shares of the drawing's height from its bottom, which is the\n * one number that survives a test with no layout, and they are read off the `style`\n * ATTRIBUTE rather than through `getCssValue()`: in a browser that answers laid-out pixels\n * and in jsdom the declaration, with nothing to say which. The running totals before and\n * after each step are read off the `data-*` the component writes beside them, so a spec\n * can hold the arithmetic and the drawing apart — a total at the right figure and the\n * wrong height is exactly the defect worth catching. The hairline a change of zero keeps\n * is the stylesheet's floor, so no method reports it.\n *\n * **Two questions are not one.** A step's printed figure and its accessible name are read\n * separately ({@link WrWaterfallChartHarnessStep.value} and\n * {@link WrWaterfallChartHarnessStep.name}): the column is an `img`, so the name is what a\n * screen reader gets, and asserting only what is drawn would pass on a step that announces\n * nothing.\n *\n * **Whether a printed figure fits is not read.** The stylesheet hides a figure wider than\n * its column by wrapping it out of sight, which takes a layout jsdom does not have;\n * {@link WrWaterfallChartHarnessStep.value} gives the text the component printed, fitting\n * or not.\n *\n * **What tells the kinds apart is read as such.** {@link WrWaterfallChartHarnessStep.kind} comes\n * off the modifier class, not off the colour, and the sign is in the printed figure — so a\n * spec can assert the channels that are not colour, which are the ones a reader without\n * hue relies on. A change of zero is `'flat'`, neither way, so a missing figure the chart\n * counted as nothing never reads as an increase.\n *\n * **No hover method.** The tooltip repeats the step's name, and the chip renders into the\n * overlay container with nothing tying it to this chart, so a query for it would answer\n * with whichever chart's chip is open. The same figures are in the names and in the data\n * table, which {@link getTableRows} reads.\n *\n * @example\n * ```ts\n * const chart = await loader.getHarness(WrWaterfallChartHarness);\n *\n * expect(await chart.getLabels()).toEqual(['Opening', 'Sales', 'Refunds', 'Closing']);\n * const steps = await chart.getSteps();\n * expect(steps[2]).toMatchObject({ kind: 'decrease', value: '−350', end: 5650 });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrWaterfallChartHarness extends ComponentHarness {\n static hostSelector = 'wr-waterfall-chart';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrWaterfallChartHarnessFilters = {}): HarnessPredicate<WrWaterfallChartHarness> {\n return new HarnessPredicate(WrWaterfallChartHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('stepLabel', options.stepLabel, async (harness, label) => {\n for (const step of await harness.getLabels()) {\n if (await HarnessPredicate.stringMatches(step, label)) return true;\n }\n return false;\n });\n }\n\n /** The chart's accessible name, on the `group` that holds the steps. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor('.wr-waterfall-chart__plot')()).getAttribute('aria-label');\n }\n\n /** How many steps the chart drew — one per step given. */\n async getStepCount(): Promise<number> {\n return (await this.locatorForAll('.wr-waterfall-chart__step')()).length;\n }\n\n /** The labels under the bars, in order — the full text, ellipsised on screen or not. */\n async getLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-waterfall-chart__label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /**\n * Every step, in order: its label, its kind, what it prints and announces, the running\n * totals before and after it, and where its bar runs.\n *\n * Throws on a step missing anything the component writes on every one, rather than\n * answering with a `NaN` a spec could compare against.\n */\n async getSteps(): Promise<WrWaterfallChartHarnessStep[]> {\n const steps = await this.locatorForAll(StepHarness)();\n const labels = await this.getLabels();\n if (labels.length !== steps.length) {\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the chart draws ${steps.length} step(s) and ${labels.length} label(s). ` +\n 'It renders one label per step, so the two lists line up or the template is broken.'\n );\n }\n return Promise.all(steps.map((step, i) => step.read(labels[i])));\n }\n\n /** Whether any figure is printed past a bar (`showValues`, and at least one step). */\n async hasValues(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-waterfall-chart__value')()) !== null;\n }\n\n /** How many connectors are drawn: one per step that the next one starts from, with `showConnectors`. */\n async getConnectorCount(): Promise<number> {\n return (await this.locatorForAll('.wr-waterfall-chart__connector')()).length;\n }\n\n /** Whether the gridlines are drawn (`showGrid`). */\n async hasGrid(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-waterfall-chart__grid-line')()) !== null;\n }\n\n /** The value axis' tick labels, top to bottom; `[]` with `showGrid` off. */\n async getYTicks(): Promise<string[]> {\n const ticks = await this.locatorForAll('.wr-waterfall-chart__tick')();\n return Promise.all(ticks.map(tick => tick.text()));\n }\n\n /**\n * Where zero is — the line every total stands on — as the percentage of the drawing's\n * height from its bottom that the component wrote: `0` when nothing goes below zero.\n */\n async getZeroPercent(): Promise<number> {\n const style = await (await this.locatorFor('.wr-waterfall-chart__track')()).getAttribute('style');\n const zero = styleNumber(style, '--wr-waterfall-chart-zero');\n if (zero === null) {\n throw new Error(\n `WrWaterfallChartHarness.getZeroPercent(): no inline zero on .wr-waterfall-chart__track (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero line on the frame.'\n );\n }\n return zero;\n }\n\n /** Whether the hidden data table is rendered (`dataTable`). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the change and the running total, in that order.\n *\n * Throws when the chart renders no table (`dataTable` off) rather than answering with\n * no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n // The first cell is the corner over the row headers — what one row is — not a column\n // of figures.\n const cells = await this.locatorForAll('.wr-chart-table thead tr > *')();\n return Promise.all(cells.slice(1).map(cell => cell.text()));\n }\n\n /**\n * The data table's rows, one per step: its label, its change (`''` on a total) and the\n * running total after it, as a screen reader walks them.\n *\n * Throws when the chart renders no table (`dataTable` off), for the reason\n * {@link getTableColumns} gives.\n */\n async getTableRows(): Promise<WrWaterfallChartTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n /**\n * The plot's height in pixels, read off the `style` ATTRIBUTE the component wrote, not\n * through `getCssValue()`, which answers from the laid-out box and so differs between\n * jsdom and a browser.\n */\n async getPlotHeight(): Promise<number> {\n const style = await (await this.locatorFor('.wr-waterfall-chart__plot')()).getAttribute('style');\n const match = /height:\\s*([\\d.]+)px/.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrWaterfallChartHarness.getPlotHeight(): no inline height on .wr-waterfall-chart__plot (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrWaterfallChartHarness.${method}(): the chart renders no data table — \\`dataTable\\` is off. Ask hasDataTable() first.`\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ;CAAC;CAAY;CAAY;CAAQ;AAAO;AAGtD,SAAS,YAAY,OAAsB,MAAY;CACrD,MAAM,QAAQ,IAAI,OAAO,cAAc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K,gBAAgB,cAAc;EACzC,MAAM,OAAO,MAAM,KAAK,cAAc,eAAe,CAAC,CAAA;EACtD,OAAO,QAAQ,IAAI,KAAK,KAAI,QAAO,IAAI,KAAI,CAAE,CAAC;CAChD;CAOA,MAAM,gBAAa;EACjB,MAAM,QAAQ,OAAO,MAAM,KAAK,WAAW,2BAA2B,CAAC,CAAA,EAAA,CAAI,aAAa,OAAO;EAC/F,MAAM,QAAQ,uBAAuB,KAAK,SAAS,EAAE;EACrD,IAAI,CAAC,OACH,MAAM,IAAI,MACR,mGAAmG,SAAS,GAAE,4FACnB;EAG/F,OAAO,OAAO,WAAW,MAAM,EAAE;CACnC;CAEQ,MAAM,gBAAgB,QAAc;EAC1C,IAAI,CAAE,MAAM,KAAK,aAAY,GAC3B,MAAM,IAAI,MACR,2BAA2B,OAAM,sFAAuF;CAG9H"}
1
+ {"version":3,"file":"ngwr-charts-waterfall-chart-testing.mjs","names":[],"sources":["../../../projects/lib/charts/waterfall-chart/testing/wr-waterfall-chart-harness.ts"],"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 { ComponentHarness, HarnessPredicate, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrWaterfallChartHarnessFilters, WrWaterfallChartHarnessStep, WrWaterfallChartTableRow } from './types';\n\nconst KINDS = ['increase', 'decrease', 'flat', 'total'] as const;\n\n/** One custom property the component wrote into an inline `style`, as a finite number, or `null` when it is absent. */\nfunction styleNumber(style: string | null, name: string): number | null {\n const match = new RegExp(`(?:^|;)\\\\s*${name}\\\\s*:\\\\s*([^;]+)`).exec(style ?? '');\n const value = match ? Number.parseFloat(match[1]) : Number.NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * The running totals before and after a step, off the one `data-step=\"start end\"` the\n * component writes, or a sentence saying what the step carries instead.\n */\nasync function runningTotals(element: TestElement, method: string): Promise<[start: number, end: number]> {\n const raw = await element.getAttribute('data-step');\n const [start, end] = (raw ?? '').split(' ').map(part => Number.parseFloat(part));\n if (!Number.isFinite(start) || !Number.isFinite(end)) {\n throw new Error(\n `WrWaterfallChartHarness.${method}(): a step carries data-step=\"${raw ?? ''}\", which the component writes as ` +\n 'two finite numbers on every step it draws.'\n );\n }\n return [start, end];\n}\n\n/**\n * One step's column, so its kind, its figure, its bar and its connector are read off the\n * column they sit in rather than matched up by position across the chart: a step prints a\n * figure only with `showValues`, and the last one has no connector.\n */\nclass StepHarness extends ComponentHarness {\n static hostSelector = '.wr-waterfall-chart__step';\n\n async read(label: string): Promise<WrWaterfallChartHarnessStep> {\n const host = await this.host();\n const value = await this.locatorForOptional('.wr-waterfall-chart__value')();\n const connector = await this.locatorForOptional('.wr-waterfall-chart__connector')();\n const style = await host.getAttribute('style');\n const bottom = styleNumber(style, '--wr-waterfall-chart-lo');\n const top = styleNumber(style, '--wr-waterfall-chart-hi');\n if (bottom === null || top === null) {\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the step \"${label}\" carries no inline bar ends (style: \"${style ?? ''}\"). ` +\n 'The component writes both on every step, a change of zero included, so their absence is the bug — ' +\n 'reporting 0 would read as a bar on the frame.'\n );\n }\n const [start, end] = await runningTotals(host, 'getSteps');\n return {\n label,\n kind: await StepHarness.kindOf(host, label),\n name: await host.getAttribute('aria-label'),\n value: value ? await value.text() : null,\n start,\n end,\n bottomPercent: bottom,\n topPercent: top,\n connected: connector !== null,\n };\n }\n\n private static async kindOf(host: TestElement, label: string): Promise<WrWaterfallChartHarnessStep['kind']> {\n for (const kind of KINDS) {\n if (await host.hasClass(`wr-waterfall-chart__step--${kind}`)) return kind;\n }\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the step \"${label}\" carries no kind modifier. The component gives every ` +\n 'step one of `--increase`, `--decrease`, `--flat` and `--total`, and the stylesheet paints the figure by it.'\n );\n }\n}\n\n/** One body row of the chart's data table. */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrWaterfallChartTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/**\n * Test harness for `<wr-waterfall-chart>`.\n *\n * **The bars are read as PERCENTAGES of the drawing, not as pixels.** Each step's two\n * ends are written inline as shares of the drawing's height from its bottom, which is the\n * one number that survives a test with no layout, and they are read off the `style`\n * ATTRIBUTE rather than through `getCssValue()`: in a browser that answers laid-out pixels\n * and in jsdom the declaration, with nothing to say which. The running totals before and\n * after each step are read off the `data-*` the component writes beside them, so a spec\n * can hold the arithmetic and the drawing apart — a total at the right figure and the\n * wrong height is exactly the defect worth catching. The hairline a change of zero keeps\n * is the stylesheet's floor, so no method reports it.\n *\n * **Two questions are not one.** A step's printed figure and its accessible name are read\n * separately ({@link WrWaterfallChartHarnessStep.value} and\n * {@link WrWaterfallChartHarnessStep.name}): the column is an `img`, so the name is what a\n * screen reader gets, and asserting only what is drawn would pass on a step that announces\n * nothing.\n *\n * **Whether a printed figure fits is not read.** The stylesheet hides a figure wider than\n * its column by wrapping it out of sight, which takes a layout jsdom does not have;\n * {@link WrWaterfallChartHarnessStep.value} gives the text the component printed, fitting\n * or not.\n *\n * **What tells the kinds apart is read as such.** {@link WrWaterfallChartHarnessStep.kind} comes\n * off the modifier class, not off the colour, and the sign is in the printed figure — so a\n * spec can assert the channels that are not colour, which are the ones a reader without\n * hue relies on. A change of zero is `'flat'`, neither way, so a missing figure the chart\n * counted as nothing never reads as an increase.\n *\n * **No hover method.** The tooltip repeats the step's name, and the chip renders into the\n * overlay container with nothing tying it to this chart, so a query for it would answer\n * with whichever chart's chip is open. The same figures are in the names and in the data\n * table, which {@link getTableRows} reads.\n *\n * @example\n * ```ts\n * const chart = await loader.getHarness(WrWaterfallChartHarness);\n *\n * expect(await chart.getLabels()).toEqual(['Opening', 'Sales', 'Refunds', 'Closing']);\n * const steps = await chart.getSteps();\n * expect(steps[2]).toMatchObject({ kind: 'decrease', value: '−350', end: 5650 });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrWaterfallChartHarness extends ComponentHarness {\n static hostSelector = 'wr-waterfall-chart';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrWaterfallChartHarnessFilters = {}): HarnessPredicate<WrWaterfallChartHarness> {\n return new HarnessPredicate(WrWaterfallChartHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('stepLabel', options.stepLabel, async (harness, label) => {\n for (const step of await harness.getLabels()) {\n if (await HarnessPredicate.stringMatches(step, label)) return true;\n }\n return false;\n });\n }\n\n /** The chart's accessible name, on the `group` that holds the steps. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor('.wr-waterfall-chart__plot')()).getAttribute('aria-label');\n }\n\n /** How many steps the chart drew — one per step given. */\n async getStepCount(): Promise<number> {\n return (await this.locatorForAll('.wr-waterfall-chart__step')()).length;\n }\n\n /** The labels under the bars, in order — the full text, ellipsised on screen or not. */\n async getLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-waterfall-chart__label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /**\n * Every step, in order: its label, its kind, what it prints and announces, the running\n * totals before and after it, and where its bar runs.\n *\n * Throws on a step missing anything the component writes on every one, rather than\n * answering with a `NaN` a spec could compare against.\n */\n async getSteps(): Promise<WrWaterfallChartHarnessStep[]> {\n const steps = await this.locatorForAll(StepHarness)();\n const labels = await this.getLabels();\n if (labels.length !== steps.length) {\n throw new Error(\n `WrWaterfallChartHarness.getSteps(): the chart draws ${steps.length} step(s) and ${labels.length} label(s). ` +\n 'It renders one label per step, so the two lists line up or the template is broken.'\n );\n }\n return Promise.all(steps.map((step, i) => step.read(labels[i])));\n }\n\n /** Whether any figure is printed past a bar (`showValues`, and at least one step). */\n async hasValues(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-waterfall-chart__value')()) !== null;\n }\n\n /** How many connectors are drawn: one per step that the next one starts from, with `showConnectors`. */\n async getConnectorCount(): Promise<number> {\n return (await this.locatorForAll('.wr-waterfall-chart__connector')()).length;\n }\n\n /** Whether the gridlines are drawn (`showGrid`). */\n async hasGrid(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-waterfall-chart__grid-line')()) !== null;\n }\n\n /** Whether the value axis' scale is printed beside the plot (`showAxis`). */\n async hasAxis(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-waterfall-chart__y-axis')()) !== null;\n }\n\n /**\n * The message the chart shows in place of its bars: \"No data\" with no step, or the\n * loading or error message. `null` while it draws its bars.\n */\n async getStateLabel(): Promise<string | null> {\n const state = await this.locatorForOptional('.wr-chart-state')();\n return state ? (await state.text()).trim() : null;\n }\n\n /** The value axis' tick labels, top to bottom; `[]` with `showAxis` off. */\n async getYTicks(): Promise<string[]> {\n const ticks = await this.locatorForAll('.wr-waterfall-chart__tick')();\n return Promise.all(ticks.map(tick => tick.text()));\n }\n\n /**\n * Where zero is — the line every total stands on — as the percentage of the drawing's\n * height from its bottom that the component wrote: `0` when nothing goes below zero.\n */\n async getZeroPercent(): Promise<number> {\n const style = await (await this.locatorFor('.wr-waterfall-chart__track')()).getAttribute('style');\n const zero = styleNumber(style, '--wr-waterfall-chart-zero');\n if (zero === null) {\n throw new Error(\n `WrWaterfallChartHarness.getZeroPercent(): no inline zero on .wr-waterfall-chart__track (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero line on the frame.'\n );\n }\n return zero;\n }\n\n /** Whether the hidden data table is rendered (`dataTable`). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the change and the running total, in that order.\n *\n * Throws when the chart renders no table (`dataTable` off) rather than answering with\n * no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n // The first cell is the corner over the row headers — what one row is — not a column\n // of figures.\n const cells = await this.locatorForAll('.wr-chart-table thead tr > *')();\n return Promise.all(cells.slice(1).map(cell => cell.text()));\n }\n\n /**\n * The data table's rows, one per step: its label, its change (`''` on a total) and the\n * running total after it, as a screen reader walks them.\n *\n * Throws when the chart renders no table (`dataTable` off), for the reason\n * {@link getTableColumns} gives.\n */\n async getTableRows(): Promise<WrWaterfallChartTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n /**\n * The plot's height in pixels, read off the `style` ATTRIBUTE the component wrote, not\n * through `getCssValue()`, which answers from the laid-out box and so differs between\n * jsdom and a browser.\n */\n async getPlotHeight(): Promise<number> {\n const style = await (await this.locatorFor('.wr-waterfall-chart__plot')()).getAttribute('style');\n const match = /height:\\s*([\\d.]+)px/.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrWaterfallChartHarness.getPlotHeight(): no inline height on .wr-waterfall-chart__plot (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrWaterfallChartHarness.${method}(): the chart renders no data table — \\`dataTable\\` is off. Ask hasDataTable() first.`\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ;CAAC;CAAY;CAAY;CAAQ;AAAO;AAGtD,SAAS,YAAY,OAAsB,MAAY;CACrD,MAAM,QAAQ,IAAI,OAAO,cAAc,KAAI,iBAAkB,CAAC,CAAC,KAAK,SAAS,EAAE;CAC/E,MAAM,QAAQ,QAAQ,OAAO,WAAW,MAAM,EAAE,IAAI;CACpD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAMA,eAAe,cAAc,SAAsB,QAAc;CAC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