ngwr 15.9.0 → 16.0.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 (375) hide show
  1. package/animations/aurora/styles/_index.scss +1 -1
  2. package/animations/blur-reveal/styles/_index.scss +1 -1
  3. package/animations/decode/styles/_index.scss +1 -1
  4. package/animations/dot-grid/styles/_index.scss +1 -1
  5. package/animations/flow-lines/styles/_index.scss +1 -1
  6. package/animations/fluid-cursor/styles/_index.scss +1 -1
  7. package/animations/{core → internal}/styles/_mixins.scss +1 -1
  8. package/animations/reveal/styles/_index.scss +1 -1
  9. package/animations/ripple-grid/styles/_index.scss +1 -1
  10. package/animations/rotate-reveal/styles/_index.scss +1 -1
  11. package/animations/thread-lines/styles/_index.scss +1 -1
  12. package/animations/typewriter/styles/_index.scss +1 -1
  13. package/copy-value/styles/_index.scss +104 -0
  14. package/date-picker/styles/_index.scss +117 -0
  15. package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
  16. package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
  17. package/fesm2022/ngwr-alert.mjs +2 -2
  18. package/fesm2022/ngwr-alert.mjs.map +1 -1
  19. package/fesm2022/ngwr-animations-aurora.mjs +21 -21
  20. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  21. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  22. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  23. package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
  24. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  25. package/fesm2022/ngwr-animations-confetti.mjs +5 -5
  26. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  27. package/fesm2022/ngwr-animations-decode.mjs +4 -4
  28. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  29. package/fesm2022/ngwr-animations-destruct.mjs +5 -5
  30. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  31. package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
  32. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  33. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  34. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
  36. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
  38. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-glitch.mjs +2 -2
  40. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-marquee.mjs +2 -2
  42. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-orbit.mjs +7 -7
  44. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-reveal.mjs +4 -4
  46. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
  48. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
  50. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
  52. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
  54. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
  56. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  57. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  58. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  59. package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
  60. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  61. package/fesm2022/ngwr-avatar.mjs +3 -3
  62. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  63. package/fesm2022/ngwr-badge.mjs.map +1 -1
  64. package/fesm2022/ngwr-cascader.mjs +43 -20
  65. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
  67. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
  69. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
  71. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
  73. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
  75. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-core.mjs +20 -20
  77. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
  79. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
  81. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  83. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  85. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
  87. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
  89. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  90. package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
  91. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  92. package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
  93. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  94. package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
  95. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  96. package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
  97. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  98. package/fesm2022/ngwr-checkbox.mjs +2 -2
  99. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  100. package/fesm2022/ngwr-collapse.mjs +2 -2
  101. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  102. package/fesm2022/ngwr-color-picker.mjs +52 -52
  103. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  104. package/fesm2022/ngwr-command-palette.mjs +4 -4
  105. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  106. package/fesm2022/ngwr-comment.mjs +2 -2
  107. package/fesm2022/ngwr-comment.mjs.map +1 -1
  108. package/fesm2022/ngwr-compare.mjs +6 -6
  109. package/fesm2022/ngwr-compare.mjs.map +1 -1
  110. package/fesm2022/ngwr-context-menu.mjs +4 -4
  111. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  112. package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
  113. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
  114. package/fesm2022/ngwr-copy-value.mjs +196 -0
  115. package/fesm2022/ngwr-copy-value.mjs.map +1 -0
  116. package/fesm2022/ngwr-counter.mjs +3 -3
  117. package/fesm2022/ngwr-counter.mjs.map +1 -1
  118. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  119. package/fesm2022/ngwr-date-picker.mjs +217 -40
  120. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  121. package/fesm2022/ngwr-date.mjs +27 -5
  122. package/fesm2022/ngwr-date.mjs.map +1 -1
  123. package/fesm2022/ngwr-dialog.mjs +32 -3
  124. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  125. package/fesm2022/ngwr-directives.mjs +116 -1
  126. package/fesm2022/ngwr-directives.mjs.map +1 -1
  127. package/fesm2022/ngwr-drawer.mjs +3 -3
  128. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  129. package/fesm2022/ngwr-dropdown.mjs +13 -12
  130. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  131. package/fesm2022/ngwr-editor.mjs +28 -28
  132. package/fesm2022/ngwr-editor.mjs.map +1 -1
  133. package/fesm2022/ngwr-event-calendar.mjs +5 -5
  134. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  135. package/fesm2022/ngwr-file-upload.mjs +8 -8
  136. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  137. package/fesm2022/ngwr-graph.mjs +3 -3
  138. package/fesm2022/ngwr-graph.mjs.map +1 -1
  139. package/fesm2022/ngwr-hotkey.mjs +22 -22
  140. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  153. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  154. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  155. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  156. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  158. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  160. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  162. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  164. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  166. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  168. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  170. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  172. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  174. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  176. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  178. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  180. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  182. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  184. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  185. package/fesm2022/ngwr-i18n.mjs +2 -2
  186. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  187. package/fesm2022/ngwr-icon.mjs +5 -5
  188. package/fesm2022/ngwr-icon.mjs.map +1 -1
  189. package/fesm2022/ngwr-image-cropper.mjs +11 -11
  190. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  191. package/fesm2022/ngwr-input-number.mjs +4 -4
  192. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  193. package/fesm2022/ngwr-input-otp.mjs +2 -2
  194. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  195. package/fesm2022/ngwr-input.mjs +15 -15
  196. package/fesm2022/ngwr-input.mjs.map +1 -1
  197. package/fesm2022/ngwr-keyboard.mjs +28 -28
  198. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  199. package/fesm2022/ngwr-knob.mjs +4 -4
  200. package/fesm2022/ngwr-knob.mjs.map +1 -1
  201. package/fesm2022/ngwr-lightbox.mjs +2 -2
  202. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  203. package/fesm2022/ngwr-load-state.mjs +2 -2
  204. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  205. package/fesm2022/ngwr-mention.mjs +6 -6
  206. package/fesm2022/ngwr-mention.mjs.map +1 -1
  207. package/fesm2022/ngwr-meta.mjs +19 -3
  208. package/fesm2022/ngwr-meta.mjs.map +1 -1
  209. package/fesm2022/ngwr-overlay.mjs +3 -3
  210. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  211. package/fesm2022/ngwr-pagination.mjs +7 -5
  212. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  213. package/fesm2022/ngwr-pipes.mjs +3 -5
  214. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  215. package/fesm2022/ngwr-platform.mjs +4 -1
  216. package/fesm2022/ngwr-platform.mjs.map +1 -1
  217. package/fesm2022/ngwr-popconfirm.mjs +6 -5
  218. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  219. package/fesm2022/ngwr-popover.mjs +31 -30
  220. package/fesm2022/ngwr-popover.mjs.map +1 -1
  221. package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
  222. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
  223. package/fesm2022/ngwr-qr.mjs +6 -6
  224. package/fesm2022/ngwr-qr.mjs.map +1 -1
  225. package/fesm2022/ngwr-radio.mjs +3 -3
  226. package/fesm2022/ngwr-radio.mjs.map +1 -1
  227. package/fesm2022/ngwr-rating.mjs +10 -10
  228. package/fesm2022/ngwr-rating.mjs.map +1 -1
  229. package/fesm2022/ngwr-schema-form.mjs +15 -5
  230. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  231. package/fesm2022/ngwr-select.mjs +57 -34
  232. package/fesm2022/ngwr-select.mjs.map +1 -1
  233. package/fesm2022/ngwr-sidebar.mjs +3 -3
  234. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  235. package/fesm2022/ngwr-skeleton.mjs +2 -2
  236. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  237. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  238. package/fesm2022/ngwr-slider.mjs +13 -13
  239. package/fesm2022/ngwr-slider.mjs.map +1 -1
  240. package/fesm2022/ngwr-sortable-list.mjs +3 -3
  241. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  242. package/fesm2022/ngwr-splitter.mjs +5 -5
  243. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  244. package/fesm2022/ngwr-statistic.mjs +5 -3
  245. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  246. package/fesm2022/ngwr-storage.mjs +6 -4
  247. package/fesm2022/ngwr-storage.mjs.map +1 -1
  248. package/fesm2022/ngwr-switch.mjs +2 -2
  249. package/fesm2022/ngwr-switch.mjs.map +1 -1
  250. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  251. package/fesm2022/ngwr-table.mjs +231 -27
  252. package/fesm2022/ngwr-table.mjs.map +1 -1
  253. package/fesm2022/ngwr-tabs.mjs +2 -2
  254. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  255. package/fesm2022/ngwr-toast-testing.mjs +8 -1
  256. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  257. package/fesm2022/ngwr-toast.mjs +63 -20
  258. package/fesm2022/ngwr-toast.mjs.map +1 -1
  259. package/fesm2022/ngwr-tour.mjs +7 -7
  260. package/fesm2022/ngwr-tour.mjs.map +1 -1
  261. package/fesm2022/ngwr-transfer.mjs +20 -9
  262. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  263. package/fesm2022/ngwr-tree.mjs +64 -24
  264. package/fesm2022/ngwr-tree.mjs.map +1 -1
  265. package/fesm2022/ngwr-utils.mjs +98 -55
  266. package/fesm2022/ngwr-utils.mjs.map +1 -1
  267. package/fesm2022/ngwr-validators.mjs +2 -2
  268. package/fesm2022/ngwr-validators.mjs.map +1 -1
  269. package/fesm2022/ngwr-version.mjs +1 -1
  270. package/fesm2022/ngwr-version.mjs.map +1 -1
  271. package/fesm2022/ngwr-window.mjs +26 -26
  272. package/fesm2022/ngwr-window.mjs.map +1 -1
  273. package/fesm2022/ngwr.mjs.map +1 -1
  274. package/i18n/ar.json +5 -0
  275. package/i18n/cs.json +5 -0
  276. package/i18n/de.json +5 -0
  277. package/i18n/en.json +5 -0
  278. package/i18n/es.json +5 -0
  279. package/i18n/fr.json +5 -0
  280. package/i18n/he.json +5 -0
  281. package/i18n/hi.json +5 -0
  282. package/i18n/id.json +5 -0
  283. package/i18n/it.json +5 -0
  284. package/i18n/ja.json +5 -0
  285. package/i18n/ko.json +5 -0
  286. package/i18n/nl.json +5 -0
  287. package/i18n/pl.json +5 -0
  288. package/i18n/pt.json +5 -0
  289. package/i18n/ru.json +5 -0
  290. package/i18n/sv.json +5 -0
  291. package/i18n/tr.json +5 -0
  292. package/i18n/uk.json +5 -0
  293. package/i18n/vi.json +5 -0
  294. package/i18n/zh-TW.json +5 -0
  295. package/i18n/zh.json +5 -0
  296. package/input-number/styles/_index.scss +6 -0
  297. package/llms-full.txt +31 -19
  298. package/llms.txt +37 -19
  299. package/mcp/providers.js +1 -1
  300. package/package.json +15 -10
  301. package/schematics/icon-set/index.js +3 -3
  302. package/schematics/migrations/v16/index.js +742 -0
  303. package/schematics/migrations.json +5 -0
  304. package/schematics/ng-add/index.js +4 -4
  305. package/schematics/provider/index.js +4 -4
  306. package/schematics/use/symbol-map.json +2 -0
  307. package/select/styles/_index.scss +1 -1
  308. package/skills/ngwr/SKILL.md +6 -4
  309. package/skills/ngwr/references/catalog.md +4 -2
  310. package/skills/ngwr/references/setup.md +10 -9
  311. package/table/styles/_index.scss +85 -29
  312. package/toast/styles/_index.scss +30 -0
  313. package/tree/styles/_index.scss +17 -0
  314. package/types/index-CXbgza47.d.ts +13 -0
  315. package/types/ngwr-animations-aurora.d.ts +1 -1
  316. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  317. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  318. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  319. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  320. package/types/ngwr-animations-reveal.d.ts +4 -8
  321. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  322. package/types/ngwr-animations-spotlight.d.ts +1 -1
  323. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  324. package/types/ngwr-animations-tilt.d.ts +1 -1
  325. package/types/ngwr-avatar.d.ts +2 -2
  326. package/types/ngwr-badge.d.ts +1 -1
  327. package/types/ngwr-cascader.d.ts +12 -1
  328. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  329. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  330. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  331. package/types/ngwr-charts-core.d.ts +12 -12
  332. package/types/ngwr-charts-line-chart.d.ts +2 -2
  333. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  334. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  335. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  336. package/types/ngwr-color-picker.d.ts +12 -12
  337. package/types/ngwr-copy-value-testing.d.ts +87 -0
  338. package/types/ngwr-copy-value.d.ts +95 -0
  339. package/types/ngwr-date-picker-testing.d.ts +3 -3
  340. package/types/ngwr-date-picker.d.ts +97 -1
  341. package/types/ngwr-date.d.ts +44 -3
  342. package/types/ngwr-dialog.d.ts +50 -3
  343. package/types/ngwr-directives.d.ts +40 -0
  344. package/types/ngwr-drawer.d.ts +1 -1
  345. package/types/ngwr-dropdown.d.ts +3 -2
  346. package/types/ngwr-hotkey.d.ts +5 -5
  347. package/types/ngwr-i18n.d.ts +3 -3
  348. package/types/ngwr-icon.d.ts +26 -26
  349. package/types/ngwr-input-number.d.ts +2 -2
  350. package/types/ngwr-input.d.ts +8 -8
  351. package/types/ngwr-load-state.d.ts +6 -6
  352. package/types/ngwr-meta.d.ts +18 -0
  353. package/types/ngwr-pipes.d.ts +6 -4
  354. package/types/ngwr-platform.d.ts +2 -1
  355. package/types/ngwr-popconfirm.d.ts +3 -2
  356. package/types/ngwr-popover.d.ts +4 -3
  357. package/types/ngwr-select.d.ts +33 -18
  358. package/types/ngwr-slider-testing.d.ts +2 -2
  359. package/types/ngwr-slider.d.ts +3 -3
  360. package/types/ngwr-statistic.d.ts +5 -1
  361. package/types/ngwr-storage.d.ts +1 -1
  362. package/types/ngwr-table-testing.d.ts +2 -1
  363. package/types/ngwr-table.d.ts +136 -11
  364. package/types/ngwr-tabs.d.ts +10 -2
  365. package/types/ngwr-toast-testing.d.ts +6 -2
  366. package/types/ngwr-toast.d.ts +33 -5
  367. package/types/ngwr-transfer.d.ts +5 -0
  368. package/types/ngwr-tree.d.ts +22 -2
  369. package/types/ngwr-utils.d.ts +157 -82
  370. package/types/ngwr-validators.d.ts +4 -2
  371. package/types/ngwr-version.d.ts +1 -1
  372. package/types/ngwr.d.ts +1 -0
  373. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  374. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  375. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-funnel-chart.mjs","names":[],"sources":["../../../projects/lib/charts/funnel-chart/funnel-chart.ts","../../../projects/lib/charts/funnel-chart/funnel-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip } from 'ngwr/popover';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrFunnelConversion, WrFunnelStage } from './types';\n\n/** A number for an inline style, to three decimals with `-0` folded to `0`, so the style stays short. */\nconst short = (value: number): number => Math.round(value * 1000) / 1000 || 0;\n\n/**\n * `value` as a share of `reference`, or `null` where no share means anything: either\n * side missing, a reference of zero or below (there is nothing to be a share of), or a\n * negative value (a share of a count below zero). A value above its reference is a share\n * above one — a stage that grew — and is returned as it is.\n */\nfunction share(value: number | null, reference: number | null): number | null {\n if (value === null || reference === null || reference <= 0 || value < 0) return null;\n return value / reference;\n}\n\n/** One stage, resolved: its value with `null` where it is missing, its paint, its width and its conversions. */\ninterface Stage {\n readonly label: string;\n /** `null` when the stage's value is not a finite number. */\n readonly value: number | null;\n readonly color: string;\n /** The bar's width as a share of the track, from 0 to 1. */\n readonly width: number;\n /** Its share of the stage before it, or `null` (see `share`). Always `null` for the first stage. */\n readonly fromPrevious: number | null;\n /** Its share of the first stage, or `null`. Always `null` for the first stage, which is the reference. */\n readonly fromFirst: number | null;\n}\n\n/**\n * Funnel chart: how many reached each stage of a sequence — visited, signed up, paid —\n * and how many of them went on to the next. SVG-free and dependency-free: every part is\n * HTML laid out by the stylesheet.\n *\n * @example\n * ```html\n * <wr-funnel-chart\n * [stages]=\"[\n * { label: 'Visited', value: 12000 },\n * { label: 'Signed up', value: 4800 },\n * { label: 'Activated', value: 2900 },\n * { label: 'Paid', value: 720 }\n * ]\"\n * />\n * ```\n *\n * **The bars are honest about the values.** Each stage is a bar centred on the funnel's\n * axis, its width proportional to its value — the largest stage, or `max`, is the full\n * width. The funnel shape between two bars is a band from one bar's width to the next,\n * so it narrows by exactly the drop and carries no value of its own. That is why this is\n * bars and not a trapezoid per stage: a trapezoid's area depends on its neighbour, so a\n * stage would look larger or smaller for what follows it.\n *\n * **What the data does not promise, the drawing does not assume.** A stage larger than\n * the one before it is drawn WIDER and its conversion is above 100%, rather than clamped\n * into a shape a funnel is expected to have. Zero and a negative value draw a hairline,\n * never a negative width; a negative value is printed as given and gets no conversion. A\n * value that is not a finite number is missing: no bar, no figure, no band to or from it,\n * and no conversion that would need it.\n *\n * **The conversions.** Each stage after the first has two: its share of the stage before\n * it, printed between the two bars, and its share of the first stage, printed under its\n * value (`conversion` chooses which are printed). Both are percentages in `LOCALE_ID`,\n * with one fraction digit and two significant digits below 1%, so a real conversion of\n * 0.04% is not printed as `0%`; `percentFormat` replaces that.\n *\n * **What a screen reader gets.** The chart is a named `role=\"group\"` of one `role=\"img\"`\n * per stage, as the bar chart's columns are, each named with its label, its value and both\n * conversions — \"Signed up: 4,800, 40% of previous, 40% of first\". The whole sentence is a\n * catalog template, one per shape — `funnelChart.stageName` with no conversion,\n * `stageNameOne` with one and `stageNameBoth` with both — so a locale sets its own\n * punctuation and order round the figures. The bands and the percentages between the bars\n * are `aria-hidden`, since every figure they show is in a name already. `dataTable` adds\n * the same figures as a table a reader can walk cell by cell. No part of the chart is a\n * tab stop.\n *\n * Under RTL the labels and the figures swap sides; the bars and the bands are centred,\n * so they read the same in both directions. A label takes its direction from its own\n * text, so a Latin one is ellipsised at its end on an RTL page, and a figure from its\n * own, so a sign stays in front of its digits.\n *\n * @see https://ngwr.dev/charts/funnel-chart\n */\n@Component({\n selector: 'wr-funnel-chart',\n templateUrl: './funnel-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-funnel-chart' },\n imports: [WrChartTable],\n})\nexport class WrFunnelChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/funnel-chart');\n }\n\n /**\n * The stages, from the top of the funnel down. Nothing is sorted: a stage is drawn where\n * it is given, so a stage larger than the one before it shows as one.\n */\n readonly stages = input<readonly WrFunnelStage[]>([]);\n\n /**\n * Accessible name of the chart, and the data table's caption. Each stage names itself,\n * so this says what the funnel is about. Falls back to `funnelChart.label`, then\n * `'Funnel chart'`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'funnelChart.label', 'Funnel chart');\n\n /**\n * The colour of a stage with no `color` of its own. One colour by default, because the\n * stages are one quantity measured along a sequence, not categories: every stage is\n * named in text beside its bar, so colour tells nothing apart here.\n * @default 'var(--wr-color-primary)'\n */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * The value of a full-width bar. `0` makes it the largest stage shown; a value above\n * `0` fixes it, so two funnels side by side share one scale. A stage above a fixed\n * `max` is drawn full width, and its figure, the tooltip and the data table still give\n * its own value. @default 0\n */\n readonly max = input(0, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 0);\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n },\n });\n\n /**\n * Which conversions are printed on the drawing: each stage's share of the stage before\n * it, between the two bars (`previous`), its share of the first stage, under its value\n * (`first`), `both` or `none`. The tooltip, every stage's accessible name and the data\n * table carry both whatever this says. @default 'both'\n */\n readonly conversion = input<WrFunnelConversion>('both');\n\n /** Print each stage's value beside its bar. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * What the values count — visitors, orders — as the heading of the data table's value\n * column. Falls back to `funnelChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n /**\n * Show a tooltip with the stage's label, value and both conversions on hover. Pointer\n * only — each stage's accessible name already carries the same figures. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value the chart shows: beside the bars, in the tooltip, in the accessible\n * names and in the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every conversion the chart shows, given as a RATIO — `0.25` for a quarter, `1.2`\n * for a stage that grew by a fifth — the number `Intl.NumberFormat`'s `percent` style\n * takes, so one of those can be passed as it is. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a small real\n * conversion is not 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 stage, headed by its label, with its value and both conversions, each written as\n * the tooltip writes it. A figure the stage does not have is an empty cell.\n *\n * Each stage's accessible name already carries its figures; the table is for a reader\n * who wants to move through them cell by cell, with the column headings read out. It is\n * rendered beside the stages, clipped to nothing: it takes no room, draws nothing and\n * holds no tab stop. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The figures in full, never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly locale = inject(LOCALE_ID);\n private readonly percents = new Intl.NumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Below 1%, by significant digits, which keep 0.0004 from printing as `0%`. */\n private readonly smallPercents = new Intl.NumberFormat(this.locale, {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly stageName = readI18nText('funnelChart.stage', 'Stage');\n private readonly valueName = useI18nText(this.valueLabel, 'funnelChart.value', 'Value');\n private readonly fromPreviousName = readI18nText('funnelChart.fromPrevious', 'From previous');\n private readonly fromFirstName = readI18nText('funnelChart.fromFirst', 'From first');\n private readonly ofPrevious = useI18nFormatter('funnelChart.ofPrevious', '{{percent}} of previous');\n private readonly ofFirst = useI18nFormatter('funnelChart.ofFirst', '{{percent}} of first');\n /**\n * A stage's accessible name, one sentence per shape, so a locale places the colon, the\n * commas and the order itself: with no conversion (the first stage, or none that means\n * anything), with one, and with both. Each conversion arrives already worded — \"40% of\n * previous\" — from the two templates above.\n */\n private readonly stageNameText = useI18nFormatter('funnelChart.stageName', '{{label}}: {{value}}');\n private readonly stageNameOneText = useI18nFormatter(\n 'funnelChart.stageNameOne',\n '{{label}}: {{value}}, {{conversion}}'\n );\n private readonly stageNameBothText = useI18nFormatter(\n 'funnelChart.stageNameBoth',\n '{{label}}: {{value}}, {{previous}}, {{first}}'\n );\n\n private readonly stageEls = viewChildren<ElementRef<HTMLElement>>('stageEl');\n\n /** Whether the shares of the previous stage are printed between the bars. */\n protected readonly showPrevious = computed(() => {\n const conversion = this.conversion();\n return conversion === 'both' || conversion === 'previous';\n });\n\n /** Whether the shares of the first stage are printed under the values. */\n protected readonly showFirst = computed(() => {\n const conversion = this.conversion();\n return conversion === 'both' || conversion === 'first';\n });\n\n /**\n * Every stage, resolved. The full width is a fixed `max`, else the largest value given,\n * else 1 — so a funnel of zeros draws hairlines rather than dividing by nothing.\n */\n private readonly resolved = computed<readonly Stage[]>(() => {\n const stages = this.stages();\n const values = stages.map(stage => (Number.isFinite(stage.value) ? stage.value : null));\n const explicit = this.max();\n const largest = Math.max(0, ...values.filter((v): v is number => v !== null));\n const full = explicit > 0 ? explicit : largest > 0 ? largest : 1;\n const first = values[0] ?? null;\n return stages.map((stage, i) => {\n const value = values[i];\n return {\n label: stage.label,\n value,\n color: stage.color ?? this.color(),\n width: value === null ? 0 : clamp(value / full, 0, 1),\n fromPrevious: i === 0 ? null : share(value, values[i - 1]),\n fromFirst: i === 0 ? null : share(value, first),\n };\n });\n });\n\n /**\n * The stages as drawn and announced: every figure written once, here, so the drawing,\n * the names, the tooltip and the table cannot disagree.\n *\n * `band` is the shape between a stage and the one above it: a `clip-path` polygon on\n * the track's width, from the upper bar's width at its top edge to this bar's at its\n * bottom, both centred. There is none next to a missing stage, since joining across one\n * would draw a drop the data never gave.\n */\n protected readonly rows = computed(() => {\n const stages = this.resolved();\n return stages.map((stage, i) => {\n const valueText = stage.value === null ? '' : this.numbers.value(stage.value);\n const previousText = stage.fromPrevious === null ? '' : this.percent(stage.fromPrevious);\n const firstText = stage.fromFirst === null ? '' : this.percent(stage.fromFirst);\n const ofPreviousText = previousText ? this.ofPrevious({ percent: previousText }) : '';\n const ofFirstText = firstText ? this.ofFirst({ percent: firstText }) : '';\n\n const above = stages[Math.max(0, i - 1)];\n let band: string | null = null;\n if (i > 0 && above.value !== null && stage.value !== null) {\n const top = above.width * 50;\n const bottom = stage.width * 50;\n band =\n `polygon(${short(50 - top)}% 0%, ${short(50 + top)}% 0%, ` +\n `${short(50 + bottom)}% 100%, ${short(50 - bottom)}% 100%)`;\n }\n\n return {\n label: stage.label,\n value: stage.value,\n color: stage.color,\n /** The bar's inline width, a percentage of the track. */\n width: `${short(stage.width * 100)}%`,\n valueText,\n previousText,\n firstText,\n /** The share of the first stage as it is printed under the value: \"40% of first\". */\n ofFirstText,\n /** What the stage announces: its label, its value and both conversions. */\n name: stage.value === null ? stage.label : this.nameOf(stage.label, valueText, ofPreviousText, ofFirstText),\n band,\n /** The paint of the stage above, where the band starts. */\n bandFrom: above.color,\n };\n });\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per stage, and its\n * value and both conversions as the columns, each cell written as the tooltip writes it.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n corner: this.stageName(),\n columns: [this.valueName(), this.fromPreviousName(), this.fromFirstName()],\n groups: [\n {\n rows: this.rows().map(row => ({\n header: row.label,\n cells: [row.valueText, row.previousText, row.firstText],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the stage under the pointer: its label and value\n * as the heading, and a row for each conversion it has. It points at the top edge of the\n * BAR, so the chip sits over the band and the percentage it repeats; a stage of zero\n * keeps its hairline to point at. A missing stage opens none — it has no figure to show.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const row = this.rows().at(index);\n if (!row) return null;\n const anchor = this.stageEls()[index]?.nativeElement.querySelector('.wr-funnel-chart__bar');\n if (row.value === null || !anchor) return null;\n const rows: WrChartTooltipRow[] = [];\n if (row.previousText) rows.push({ label: this.fromPreviousName(), value: row.previousText });\n if (row.firstText) rows.push({ label: this.fromFirstName(), value: row.firstText });\n return { datum: { label: row.label, value: row.valueText, color: row.color, rows }, anchor };\n });\n\n /**\n * The stage the open tooltip is about, which the active row's wash marks: the hovered\n * stage, unless it is missing. A missing stage opens no tooltip, and `tip.active()` is\n * the hovered index whatever the resolver returned, so without this the wash would mark\n * a row with nothing to show.\n */\n protected readonly activeStage = computed(() => {\n const index = this.tip.active();\n const row = index === null ? undefined : this.rows().at(index);\n return row && row.value !== null ? index : null;\n });\n\n /**\n * The accessible name of a stage with a value: the sentence for the conversions it has,\n * each already worded. A missing stage is named by its label alone.\n */\n private nameOf(label: string, value: string, ofPrevious: string, ofFirst: string): string {\n if (ofPrevious && ofFirst) return this.stageNameBothText({ label, value, previous: ofPrevious, first: ofFirst });\n if (ofPrevious || ofFirst) return this.stageNameOneText({ label, value, conversion: ofPrevious || ofFirst });\n return this.stageNameText({ label, value });\n }\n\n /** A conversion as the chart prints it: through `percentFormat`, or as a percentage in `LOCALE_ID`. */\n private percent(ratio: number): string {\n const custom = this.percentFormat();\n if (custom) return custom(ratio);\n return (ratio !== 0 && Math.abs(ratio) < 0.01 ? this.smallPercents : this.percents).format(ratio);\n }\n}\n\nexport type { WrFunnelConversion, WrFunnelStage } from './types';\n","@let previous = showPrevious();\n@let first = showFirst();\n@let values = showValues();\n@let active = activeStage();\n<!-- A named `group` of one named `img` per stage, as the bar chart's columns are. Not one\n `img` round the whole funnel: `img` makes everything inside it presentational, and\n WebKit drops such a subtree, so every stage's own name would go with it. -->\n<div class=\"wr-funnel-chart__plot\" role=\"group\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @for (row of rows(); track $index) {\n @if (!$first) {\n <!-- The band between two bars and the share of the stage above, both repeated in the\n stage's own name, so hidden here. -->\n <div class=\"wr-funnel-chart__gap\" aria-hidden=\"true\">\n @if (row.band) {\n <span\n class=\"wr-funnel-chart__band\"\n [style.clip-path]=\"row.band\"\n [style.--wr-funnel-chart-band-from]=\"row.bandFrom\"\n [style.--wr-funnel-chart-band-to]=\"row.color\"\n ></span>\n }\n @if (previous && row.previousText) {\n <span class=\"wr-funnel-chart__gap-label\">{{ row.previousText }}</span>\n }\n </div>\n }\n <!-- Its label, its value and both conversions in its name: the text inside is drawn for\n the eye, and the `img` role makes it presentational. -->\n <div\n #stageEl\n class=\"wr-funnel-chart__stage\"\n [class.wr-funnel-chart__stage--active]=\"active === $index\"\n role=\"img\"\n [attr.aria-label]=\"row.name\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- The host's own text, in whatever language it is, so it takes its direction from\n that text and is ellipsised at its own end, not at the page's. -->\n <span class=\"wr-funnel-chart__label\" dir=\"auto\">{{ row.label }}</span>\n <span class=\"wr-funnel-chart__track\">\n <!-- A missing stage draws no bar at all; zero and below keep a hairline. -->\n @if (row.value !== null) {\n <span class=\"wr-funnel-chart__bar\" [style.width]=\"row.width\" [style.background]=\"row.color\"></span>\n }\n </span>\n <span class=\"wr-funnel-chart__figures\">\n @if (values && row.valueText) {\n <span class=\"wr-funnel-chart__value\">{{ row.valueText }}</span>\n }\n @if (first && row.ofFirstText) {\n <span class=\"wr-funnel-chart__overall\">{{ row.ofFirstText }}</span>\n }\n </span>\n </div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the stages rather than inside an `img`, which\n would make them presentational. Clipped to nothing by its own stylesheet, so it takes\n no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;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,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,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-funnel-chart.mjs","names":[],"sources":["../../../projects/lib/charts/funnel-chart/funnel-chart.ts","../../../projects/lib/charts/funnel-chart/funnel-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrFunnelConversion, WrFunnelStage } from './types';\n\n/** A number for an inline style, to three decimals with `-0` folded to `0`, so the style stays short. */\nconst short = (value: number): number => Math.round(value * 1000) / 1000 || 0;\n\n/**\n * `value` as a share of `reference`, or `null` where no share means anything: either\n * side missing, a reference of zero or below (there is nothing to be a share of), or a\n * negative value (a share of a count below zero). A value above its reference is a share\n * above one — a stage that grew — and is returned as it is.\n */\nfunction share(value: number | null, reference: number | null): number | null {\n if (value === null || reference === null || reference <= 0 || value < 0) return null;\n return value / reference;\n}\n\n/** One stage, resolved: its value with `null` where it is missing, its paint, its width and its conversions. */\ninterface Stage {\n readonly label: string;\n /** `null` when the stage's value is not a finite number. */\n readonly value: number | null;\n readonly color: string;\n /** The bar's width as a share of the track, from 0 to 1. */\n readonly width: number;\n /** Its share of the stage before it, or `null` (see `share`). Always `null` for the first stage. */\n readonly fromPrevious: number | null;\n /** Its share of the first stage, or `null`. Always `null` for the first stage, which is the reference. */\n readonly fromFirst: number | null;\n}\n\n/**\n * Funnel chart: how many reached each stage of a sequence — visited, signed up, paid —\n * and how many of them went on to the next. SVG-free and dependency-free: every part is\n * HTML laid out by the stylesheet.\n *\n * @example\n * ```html\n * <wr-funnel-chart\n * [stages]=\"[\n * { label: 'Visited', value: 12000 },\n * { label: 'Signed up', value: 4800 },\n * { label: 'Activated', value: 2900 },\n * { label: 'Paid', value: 720 }\n * ]\"\n * />\n * ```\n *\n * **The bars are honest about the values.** Each stage is a bar centred on the funnel's\n * axis, its width proportional to its value — the largest stage, or `max`, is the full\n * width. The funnel shape between two bars is a band from one bar's width to the next,\n * so it narrows by exactly the drop and carries no value of its own. That is why this is\n * bars and not a trapezoid per stage: a trapezoid's area depends on its neighbour, so a\n * stage would look larger or smaller for what follows it.\n *\n * **What the data does not promise, the drawing does not assume.** A stage larger than\n * the one before it is drawn WIDER and its conversion is above 100%, rather than clamped\n * into a shape a funnel is expected to have. Zero and a negative value draw a hairline,\n * never a negative width; a negative value is printed as given and gets no conversion. A\n * value that is not a finite number is missing: no bar, no figure, no band to or from it,\n * and no conversion that would need it.\n *\n * **The conversions.** Each stage after the first has two: its share of the stage before\n * it, printed between the two bars, and its share of the first stage, printed under its\n * value (`conversion` chooses which are printed). Both are percentages in `LOCALE_ID`,\n * with one fraction digit and two significant digits below 1%, so a real conversion of\n * 0.04% is not printed as `0%`; `percentFormat` replaces that.\n *\n * **What a screen reader gets.** The chart is a named `role=\"group\"` of one `role=\"img\"`\n * per stage, as the bar chart's columns are, each named with its label, its value and both\n * conversions — \"Signed up: 4,800, 40% of previous, 40% of first\". The whole sentence is a\n * catalog template, one per shape — `funnelChart.stageName` with no conversion,\n * `stageNameOne` with one and `stageNameBoth` with both — so a locale sets its own\n * punctuation and order round the figures. The bands and the percentages between the bars\n * are `aria-hidden`, since every figure they show is in a name already. `dataTable` adds\n * the same figures as a table a reader can walk cell by cell. No part of the chart is a\n * tab stop.\n *\n * Under RTL the labels and the figures swap sides; the bars and the bands are centred,\n * so they read the same in both directions. A label takes its direction from its own\n * text, so a Latin one is ellipsised at its end on an RTL page, and a figure from its\n * own, so a sign stays in front of its digits.\n *\n * @see https://ngwr.dev/charts/funnel-chart\n */\n@Component({\n selector: 'wr-funnel-chart',\n templateUrl: './funnel-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-funnel-chart' },\n imports: [WrChartTable],\n})\nexport class WrFunnelChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/funnel-chart');\n }\n\n /**\n * The stages, from the top of the funnel down. Nothing is sorted: a stage is drawn where\n * it is given, so a stage larger than the one before it shows as one.\n */\n readonly stages = input<readonly WrFunnelStage[]>([]);\n\n /**\n * Accessible name of the chart, and the data table's caption. Each stage names itself,\n * so this says what the funnel is about. Falls back to `funnelChart.label`, then\n * `'Funnel chart'`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'funnelChart.label', 'Funnel chart');\n\n /**\n * The colour of a stage with no `color` of its own. One colour by default, because the\n * stages are one quantity measured along a sequence, not categories: every stage is\n * named in text beside its bar, so colour tells nothing apart here.\n * @default 'var(--wr-color-primary)'\n */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * The value of a full-width bar. `0` makes it the largest stage shown; a value above\n * `0` fixes it, so two funnels side by side share one scale. A stage above a fixed\n * `max` is drawn full width, and its figure, the tooltip and the data table still give\n * its own value. @default 0\n */\n readonly max = input(0, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 0);\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n },\n });\n\n /**\n * Which conversions are printed on the drawing: each stage's share of the stage before\n * it, between the two bars (`previous`), its share of the first stage, under its value\n * (`first`), `both` or `none`. The tooltip, every stage's accessible name and the data\n * table carry both whatever this says. @default 'both'\n */\n readonly conversion = input<WrFunnelConversion>('both');\n\n /** Print each stage's value beside its bar. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * What the values count — visitors, orders — as the heading of the data table's value\n * column. Falls back to `funnelChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n /**\n * Show a tooltip with the stage's label, value and both conversions on hover. Pointer\n * only — each stage's accessible name already carries the same figures. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value the chart shows: beside the bars, in the tooltip, in the accessible\n * names and in the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every conversion the chart shows, given as a RATIO — `0.25` for a quarter, `1.2`\n * for a stage that grew by a fifth — the number `Intl.NumberFormat`'s `percent` style\n * takes, so one of those can be passed as it is. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a small real\n * conversion is not 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 stage, headed by its label, with its value and both conversions, each written as\n * the tooltip writes it. A figure the stage does not have is an empty cell.\n *\n * Each stage's accessible name already carries its figures; the table is for a reader\n * who wants to move through them cell by cell, with the column headings read out. It is\n * rendered beside the stages, clipped to nothing: it takes no room, draws nothing and\n * holds no tab stop. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The figures in full, never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly locale = inject(LOCALE_ID);\n private readonly percents = new Intl.NumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Below 1%, by significant digits, which keep 0.0004 from printing as `0%`. */\n private readonly smallPercents = new Intl.NumberFormat(this.locale, {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly stageName = wrReadI18nText('funnelChart.stage', 'Stage');\n private readonly valueName = useI18nText(this.valueLabel, 'funnelChart.value', 'Value');\n private readonly fromPreviousName = wrReadI18nText('funnelChart.fromPrevious', 'From previous');\n private readonly fromFirstName = wrReadI18nText('funnelChart.fromFirst', 'From first');\n private readonly ofPrevious = useI18nFormatter('funnelChart.ofPrevious', '{{percent}} of previous');\n private readonly ofFirst = useI18nFormatter('funnelChart.ofFirst', '{{percent}} of first');\n /**\n * A stage's accessible name, one sentence per shape, so a locale places the colon, the\n * commas and the order itself: with no conversion (the first stage, or none that means\n * anything), with one, and with both. Each conversion arrives already worded — \"40% of\n * previous\" — from the two templates above.\n */\n private readonly stageNameText = useI18nFormatter('funnelChart.stageName', '{{label}}: {{value}}');\n private readonly stageNameOneText = useI18nFormatter(\n 'funnelChart.stageNameOne',\n '{{label}}: {{value}}, {{conversion}}'\n );\n private readonly stageNameBothText = useI18nFormatter(\n 'funnelChart.stageNameBoth',\n '{{label}}: {{value}}, {{previous}}, {{first}}'\n );\n\n private readonly stageEls = viewChildren<ElementRef<HTMLElement>>('stageEl');\n\n /** Whether the shares of the previous stage are printed between the bars. */\n protected readonly showPrevious = computed(() => {\n const conversion = this.conversion();\n return conversion === 'both' || conversion === 'previous';\n });\n\n /** Whether the shares of the first stage are printed under the values. */\n protected readonly showFirst = computed(() => {\n const conversion = this.conversion();\n return conversion === 'both' || conversion === 'first';\n });\n\n /**\n * Every stage, resolved. The full width is a fixed `max`, else the largest value given,\n * else 1 — so a funnel of zeros draws hairlines rather than dividing by nothing.\n */\n private readonly resolved = computed<readonly Stage[]>(() => {\n const stages = this.stages();\n const values = stages.map(stage => (Number.isFinite(stage.value) ? stage.value : null));\n const explicit = this.max();\n const largest = Math.max(0, ...values.filter((v): v is number => v !== null));\n const full = explicit > 0 ? explicit : largest > 0 ? largest : 1;\n const first = values[0] ?? null;\n return stages.map((stage, i) => {\n const value = values[i];\n return {\n label: stage.label,\n value,\n color: stage.color ?? this.color(),\n width: value === null ? 0 : wrClamp(value / full, 0, 1),\n fromPrevious: i === 0 ? null : share(value, values[i - 1]),\n fromFirst: i === 0 ? null : share(value, first),\n };\n });\n });\n\n /**\n * The stages as drawn and announced: every figure written once, here, so the drawing,\n * the names, the tooltip and the table cannot disagree.\n *\n * `band` is the shape between a stage and the one above it: a `clip-path` polygon on\n * the track's width, from the upper bar's width at its top edge to this bar's at its\n * bottom, both centred. There is none next to a missing stage, since joining across one\n * would draw a drop the data never gave.\n */\n protected readonly rows = computed(() => {\n const stages = this.resolved();\n return stages.map((stage, i) => {\n const valueText = stage.value === null ? '' : this.numbers.value(stage.value);\n const previousText = stage.fromPrevious === null ? '' : this.percent(stage.fromPrevious);\n const firstText = stage.fromFirst === null ? '' : this.percent(stage.fromFirst);\n const ofPreviousText = previousText ? this.ofPrevious({ percent: previousText }) : '';\n const ofFirstText = firstText ? this.ofFirst({ percent: firstText }) : '';\n\n const above = stages[Math.max(0, i - 1)];\n let band: string | null = null;\n if (i > 0 && above.value !== null && stage.value !== null) {\n const top = above.width * 50;\n const bottom = stage.width * 50;\n band =\n `polygon(${short(50 - top)}% 0%, ${short(50 + top)}% 0%, ` +\n `${short(50 + bottom)}% 100%, ${short(50 - bottom)}% 100%)`;\n }\n\n return {\n label: stage.label,\n value: stage.value,\n color: stage.color,\n /** The bar's inline width, a percentage of the track. */\n width: `${short(stage.width * 100)}%`,\n valueText,\n previousText,\n firstText,\n /** The share of the first stage as it is printed under the value: \"40% of first\". */\n ofFirstText,\n /** What the stage announces: its label, its value and both conversions. */\n name: stage.value === null ? stage.label : this.nameOf(stage.label, valueText, ofPreviousText, ofFirstText),\n band,\n /** The paint of the stage above, where the band starts. */\n bandFrom: above.color,\n };\n });\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per stage, and its\n * value and both conversions as the columns, each cell written as the tooltip writes it.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n corner: this.stageName(),\n columns: [this.valueName(), this.fromPreviousName(), this.fromFirstName()],\n groups: [\n {\n rows: this.rows().map(row => ({\n header: row.label,\n cells: [row.valueText, row.previousText, row.firstText],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the stage under the pointer: its label and value\n * as the heading, and a row for each conversion it has. It points at the top edge of the\n * BAR, so the chip sits over the band and the percentage it repeats; a stage of zero\n * keeps its hairline to point at. A missing stage opens none — it has no figure to show.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const row = this.rows().at(index);\n if (!row) return null;\n const anchor = this.stageEls()[index]?.nativeElement.querySelector('.wr-funnel-chart__bar');\n if (row.value === null || !anchor) return null;\n const rows: WrChartTooltipRow[] = [];\n if (row.previousText) rows.push({ label: this.fromPreviousName(), value: row.previousText });\n if (row.firstText) rows.push({ label: this.fromFirstName(), value: row.firstText });\n return { datum: { label: row.label, value: row.valueText, color: row.color, rows }, anchor };\n });\n\n /**\n * The stage the open tooltip is about, which the active row's wash marks: the hovered\n * stage, unless it is missing. A missing stage opens no tooltip, and `tip.active()` is\n * the hovered index whatever the resolver returned, so without this the wash would mark\n * a row with nothing to show.\n */\n protected readonly activeStage = computed(() => {\n const index = this.tip.active();\n const row = index === null ? undefined : this.rows().at(index);\n return row && row.value !== null ? index : null;\n });\n\n /**\n * The accessible name of a stage with a value: the sentence for the conversions it has,\n * each already worded. A missing stage is named by its label alone.\n */\n private nameOf(label: string, value: string, ofPrevious: string, ofFirst: string): string {\n if (ofPrevious && ofFirst) return this.stageNameBothText({ label, value, previous: ofPrevious, first: ofFirst });\n if (ofPrevious || ofFirst) return this.stageNameOneText({ label, value, conversion: ofPrevious || ofFirst });\n return this.stageNameText({ label, value });\n }\n\n /** A conversion as the chart prints it: through `percentFormat`, or as a percentage in `LOCALE_ID`. */\n private percent(ratio: number): string {\n const custom = this.percentFormat();\n if (custom) return custom(ratio);\n return (ratio !== 0 && Math.abs(ratio) < 0.01 ? this.smallPercents : this.percents).format(ratio);\n }\n}\n\nexport type { WrFunnelConversion, WrFunnelStage } from './types';\n","@let previous = showPrevious();\n@let first = showFirst();\n@let values = showValues();\n@let active = activeStage();\n<!-- A named `group` of one named `img` per stage, as the bar chart's columns are. Not one\n `img` round the whole funnel: `img` makes everything inside it presentational, and\n WebKit drops such a subtree, so every stage's own name would go with it. -->\n<div class=\"wr-funnel-chart__plot\" role=\"group\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @for (row of rows(); track $index) {\n @if (!$first) {\n <!-- The band between two bars and the share of the stage above, both repeated in the\n stage's own name, so hidden here. -->\n <div class=\"wr-funnel-chart__gap\" aria-hidden=\"true\">\n @if (row.band) {\n <span\n class=\"wr-funnel-chart__band\"\n [style.clip-path]=\"row.band\"\n [style.--wr-funnel-chart-band-from]=\"row.bandFrom\"\n [style.--wr-funnel-chart-band-to]=\"row.color\"\n ></span>\n }\n @if (previous && row.previousText) {\n <span class=\"wr-funnel-chart__gap-label\">{{ row.previousText }}</span>\n }\n </div>\n }\n <!-- Its label, its value and both conversions in its name: the text inside is drawn for\n the eye, and the `img` role makes it presentational. -->\n <div\n #stageEl\n class=\"wr-funnel-chart__stage\"\n [class.wr-funnel-chart__stage--active]=\"active === $index\"\n role=\"img\"\n [attr.aria-label]=\"row.name\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- The host's own text, in whatever language it is, so it takes its direction from\n that text and is ellipsised at its own end, not at the page's. -->\n <span class=\"wr-funnel-chart__label\" dir=\"auto\">{{ row.label }}</span>\n <span class=\"wr-funnel-chart__track\">\n <!-- A missing stage draws no bar at all; zero and below keep a hairline. -->\n @if (row.value !== null) {\n <span class=\"wr-funnel-chart__bar\" [style.width]=\"row.width\" [style.background]=\"row.color\"></span>\n }\n </span>\n <span class=\"wr-funnel-chart__figures\">\n @if (values && row.valueText) {\n <span class=\"wr-funnel-chart__value\">{{ row.valueText }}</span>\n }\n @if (first && row.ofFirstText) {\n <span class=\"wr-funnel-chart__overall\">{{ row.ofFirstText }}</span>\n }\n </span>\n </div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the stages rather than inside an `img`, which\n would make them presentational. Clipped to nothing by its own stylesheet, so it takes\n no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAM,SAAS,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI,OAAQ;AAQ5E,SAAS,MAAM,OAAsB,WAAwB;CAC3D,IAAI,UAAU,QAAQ,cAAc,QAAQ,aAAa,KAAK,QAAQ,GAAG,OAAO;CAChF,OAAO,QAAQ;AACjB;AA6EA,IAAa,gBAAb,MAAa,cAAa;CACxB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,qBAAqB;CACxF;CAMS,SAAS,MAAgC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAO5C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,qBAAqB,cAAc;CAQ7F,QAAQ,MAAc,2BAA0B,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAQhD,MAAM,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EACpB,YAAY,MAAsB;GAChC,MAAM,QAAQ,qBAAqB,GAAG,CAAC;GACvC,OAAO,OAAO,SAAS,KAAK,IAA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AAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,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,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, ViewEncapsulation, computed, input, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
- import { clamp, wrCheckStyles } from "ngwr/utils";
4
+ import { wrCheckStyles, wrClamp } from "ngwr/utils";
5
5
  import { useI18nText } from "ngwr/i18n";
6
6
  import { useChartNumbers } from "ngwr/charts/core";
7
7
  import { useChartTooltip } from "ngwr/popover";
@@ -54,12 +54,12 @@ var WrGauge = class WrGauge {
54
54
  cx = 50;
55
55
  cy = 50;
56
56
  radius = computed(() => Math.max(1, 50 - this.strokeWidth() / 2 - .5), ...ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []);
57
- displayValue = computed(() => clamp(this.value(), this.min(), this.max()), ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
57
+ displayValue = computed(() => wrClamp(this.value(), this.min(), this.max()), ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
58
58
  displayText = computed(() => this.numbers.value(this.displayValue()), ...ngDevMode ? [{ debugName: "displayText" }] : /* istanbul ignore next */ []);
59
59
  ratio = computed(() => {
60
60
  const range = this.max() - this.min();
61
61
  if (range <= 0) return 0;
62
- return clamp((this.value() - this.min()) / range, 0, 1);
62
+ return wrClamp((this.value() - this.min()) / range, 0, 1);
63
63
  }, ...ngDevMode ? [{ debugName: "ratio" }] : /* istanbul ignore next */ []);
64
64
  trackPath = computed(() => {
65
65
  const r = this.radius();
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-gauge.mjs","names":[],"sources":["../../../projects/lib/charts/gauge/gauge.ts","../../../projects/lib/charts/gauge/gauge.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, type ElementRef, ViewEncapsulation, computed, input, viewChild } from '@angular/core';\n\nimport { useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Semicircle progress gauge. Display-only — for interactive use see the\n * {@link WrKnob} from `ngwr/knob`.\n *\n * @example\n * ```html\n * <wr-gauge [value]=\"72\" />\n * <wr-gauge [value]=\"9.5\" [min]=\"0\" [max]=\"10\" suffix=\"/10\" valueColor=\"var(--wr-color-warning)\" />\n * ```\n *\n * @see https://ngwr.dev/charts/gauge\n */\n@Component({\n selector: 'wr-gauge',\n templateUrl: './gauge.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-gauge' },\n})\nexport class WrGauge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/gauge');\n }\n\n /** Accessible name — the role needs one. Falls back to `gauge.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'gauge.label', 'Gauge');\n\n /**\n * The reading. Coerced like every other numeric input here — it was the only one\n * without it, so a NaN reached the arc's `d` as the literal text `NaN`, which is\n * invalid path geometry and drops the arc.\n */\n readonly value = input.required<number, unknown>({\n transform: (v: unknown): number => coerceNumberProperty(v, 0),\n });\n /**\n * Low end of the scale — where the arc starts. Values below it clamp here.\n * @default 0\n */\n readonly min = input(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n /**\n * High end of the scale — where the arc completes. Values above it clamp here.\n * @default 100\n */\n readonly max = input(100, { transform: (v: unknown): number => coerceNumberProperty(v, 100) });\n\n /** Diameter in CSS pixels. @default 160 */\n readonly size = input(160, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 160)) });\n\n /** Arc stroke thickness in viewBox units (out of 100). @default 10 */\n readonly strokeWidth = input(10, {\n transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 10)),\n });\n\n /**\n * Colour of the unfilled arc behind the value. Any CSS colour; the default is\n * `--wr-border-base` at 60%, which reads as a hairline in both themes.\n * @default color-mix(in srgb, var(--wr-border-base) 60%, transparent)\n */\n readonly trackColor = input<string>('color-mix(in srgb, var(--wr-border-base) 60%, transparent)');\n /**\n * Colour of the filled arc. Any CSS colour — pass an intent token to tie it to\n * a threshold, e.g. `var(--wr-color-danger)` once the value crosses one.\n * @default 'var(--wr-color-primary)'\n */\n readonly valueColor = input<string>('var(--wr-color-primary)');\n\n /** Show the value text in the center. @default true */\n readonly showValue = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Unit printed immediately after the number — `%`, `/10`, ` GB`. It goes into\n * the accessible text too, so the gauge is announced the way it reads.\n */\n readonly suffix = input<string>('');\n\n /**\n * Show a tooltip with the reading on hover, named by `ariaLabel` when one is\n * given. Pointer only — the meter announces the same reading. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes the reading in the centre, the tooltip and `aria-valuetext`, before\n * `suffix`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`. `aria-valuenow` stays a\n * number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The reading as the centre, the tooltip and `aria-valuetext` write it: never compact. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly surface = viewChild<ElementRef<HTMLElement>>('surface');\n\n // Geometry — semicircle in a 100×56 viewBox (centre at 50, 50).\n protected readonly cx = 50;\n protected readonly cy = 50;\n // A negative radius is invalid in the SVG path grammar, so the browser drops the arc\n // and the dial vanishes — which a fat stroke reaches at 99. `wr-knob` floors it too.\n protected readonly radius = computed(() => Math.max(1, 50 - this.strokeWidth() / 2 - 0.5));\n\n /**\n * The reading as it can actually be shown. Only `ratio` used to be clamped, so an\n * over-range value drew a full bar while `aria-valuenow` announced the raw number\n * against `aria-valuemax` — an invalid state for `role=\"meter\"` — and the printed\n * text disagreed with the bar as well.\n */\n protected readonly displayValue = computed(() => clamp(this.value(), this.min(), this.max()));\n\n /** The reading as the centre prints it, without the suffix. */\n protected readonly displayText = computed(() => this.numbers.value(this.displayValue()));\n\n protected readonly ratio = computed(() => {\n const range = this.max() - this.min();\n if (range <= 0) return 0;\n return clamp((this.value() - this.min()) / range, 0, 1);\n });\n\n protected readonly trackPath = computed(() => {\n const r = this.radius();\n return `M ${this.cx - r} ${this.cy} A ${r} ${r} 0 0 1 ${this.cx + r} ${this.cy}`;\n });\n\n protected readonly valuePath = computed(() => {\n // Nothing to draw at zero. A zero-length arc is not nothing: its round cap paints a\n // dot a stroke wide at the start of the track, so 0 read as a small reading.\n if (this.ratio() === 0) return null;\n const r = this.radius();\n const angle = Math.PI * (1 - this.ratio());\n const ex = this.cx + r * Math.cos(angle);\n const ey = this.cy - r * Math.sin(angle);\n // The arc always spans `π × ratio` radians (≤ 180°), so largeArc stays 0.\n // Previously this was set to 1 when ratio > 0.5, which made the swept arc\n // take the long way round and visually flipped the bar.\n return `M ${this.cx - r} ${this.cy} A ${r} ${r} 0 0 1 ${ex.toFixed(2)} ${ey.toFixed(2)}`;\n });\n\n protected readonly viewBox = '0 0 100 56';\n\n /**\n * The reading as the meter announces it — `aria-valuetext`, the number plus the\n * suffix — so the tooltip, the printed value and a screen reader all say one\n * thing.\n */\n protected readonly valueText = computed(() => `${this.displayText()}${this.suffix()}`);\n\n /**\n * One tooltip, pointing at the top of the dial. The whole gauge is one section.\n * The label is the `ariaLabel` input and not the catalog fallback, which names\n * the kind of widget rather than the reading.\n */\n protected readonly tip = useChartTooltip(this.tooltip, () => {\n const el = this.surface()?.nativeElement;\n if (!el) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.valueText(), color: this.valueColor() },\n anchor: el,\n };\n });\n}\n","<!--\n The dial is drawn in an aria-hidden <svg> and the printed value is optional, so\n with `showValue` off the component had no accessible representation at all.\n `role=\"meter\"` plus the value attributes make it readable either way.\n-->\n<div\n #surface\n class=\"wr-gauge__surface\"\n [style.width.px]=\"size()\"\n role=\"meter\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"displayValue()\"\n [attr.aria-valuetext]=\"valueText()\"\n (mouseenter)=\"tip.enter(0)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n <svg [attr.viewBox]=\"viewBox\" aria-hidden=\"true\">\n <path\n class=\"wr-gauge__track\"\n [attr.d]=\"trackPath()\"\n fill=\"none\"\n [attr.stroke]=\"trackColor()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n />\n <path\n class=\"wr-gauge__value\"\n [attr.d]=\"valuePath()\"\n fill=\"none\"\n [attr.stroke]=\"valueColor()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n />\n </svg>\n @if (showValue()) {\n <!--\n `dir=\"auto\"`, as on `wr-knob`'s value: a number and its unit read as one phrase,\n and the browser is the only thing that knows which way that phrase runs. In an\n RTL page the flex row ran right to left, so `72%` was drawn `% 72` and `9.5/10`\n as `10/ 9.5`. `dir=\"auto\"` takes the direction from the first strong character,\n so a Latin or symbol `suffix` keeps the number first, and an Arabic one still\n reads right to left. `unicode-bidi: isolate` does nothing here, since the flip\n happens inside the element; a hard `dir=\"ltr\"` would be wrong for that Arabic\n suffix.\n -->\n <div class=\"wr-gauge__text\" dir=\"auto\">\n {{ displayText() }}<span class=\"wr-gauge__suffix\">{{ suffix() }}</span>\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;;;;AAiCA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,cAAc;CACjF;CAGS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,eAAe,OAAO;CAOhF,QAAQ,MAAM,SAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAC7B,YAAY,MAAuB,qBAAqB,GAAG,CAAC;CAAC,CAAA;CAMtD,MAAM,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,qBAAqB,GAAG,CAAC;CAAC,CAAA;CAK9E,MAAM,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,qBAAqB,GAAG,GAAG;CAAC,CAAA;CAGlF,OAA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AAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,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,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,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,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-gauge.mjs","names":[],"sources":["../../../projects/lib/charts/gauge/gauge.ts","../../../projects/lib/charts/gauge/gauge.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, type ElementRef, ViewEncapsulation, computed, input, viewChild } from '@angular/core';\n\nimport { useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Semicircle progress gauge. Display-only — for interactive use see the\n * {@link WrKnob} from `ngwr/knob`.\n *\n * @example\n * ```html\n * <wr-gauge [value]=\"72\" />\n * <wr-gauge [value]=\"9.5\" [min]=\"0\" [max]=\"10\" suffix=\"/10\" valueColor=\"var(--wr-color-warning)\" />\n * ```\n *\n * @see https://ngwr.dev/charts/gauge\n */\n@Component({\n selector: 'wr-gauge',\n templateUrl: './gauge.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-gauge' },\n})\nexport class WrGauge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/gauge');\n }\n\n /** Accessible name — the role needs one. Falls back to `gauge.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'gauge.label', 'Gauge');\n\n /**\n * The reading. Coerced like every other numeric input here — it was the only one\n * without it, so a NaN reached the arc's `d` as the literal text `NaN`, which is\n * invalid path geometry and drops the arc.\n */\n readonly value = input.required<number, unknown>({\n transform: (v: unknown): number => coerceNumberProperty(v, 0),\n });\n /**\n * Low end of the scale — where the arc starts. Values below it clamp here.\n * @default 0\n */\n readonly min = input(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n /**\n * High end of the scale — where the arc completes. Values above it clamp here.\n * @default 100\n */\n readonly max = input(100, { transform: (v: unknown): number => coerceNumberProperty(v, 100) });\n\n /** Diameter in CSS pixels. @default 160 */\n readonly size = input(160, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 160)) });\n\n /** Arc stroke thickness in viewBox units (out of 100). @default 10 */\n readonly strokeWidth = input(10, {\n transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 10)),\n });\n\n /**\n * Colour of the unfilled arc behind the value. Any CSS colour; the default is\n * `--wr-border-base` at 60%, which reads as a hairline in both themes.\n * @default color-mix(in srgb, var(--wr-border-base) 60%, transparent)\n */\n readonly trackColor = input<string>('color-mix(in srgb, var(--wr-border-base) 60%, transparent)');\n /**\n * Colour of the filled arc. Any CSS colour — pass an intent token to tie it to\n * a threshold, e.g. `var(--wr-color-danger)` once the value crosses one.\n * @default 'var(--wr-color-primary)'\n */\n readonly valueColor = input<string>('var(--wr-color-primary)');\n\n /** Show the value text in the center. @default true */\n readonly showValue = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Unit printed immediately after the number — `%`, `/10`, ` GB`. It goes into\n * the accessible text too, so the gauge is announced the way it reads.\n */\n readonly suffix = input<string>('');\n\n /**\n * Show a tooltip with the reading on hover, named by `ariaLabel` when one is\n * given. Pointer only — the meter announces the same reading. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes the reading in the centre, the tooltip and `aria-valuetext`, before\n * `suffix`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`. `aria-valuenow` stays a\n * number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The reading as the centre, the tooltip and `aria-valuetext` write it: never compact. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly surface = viewChild<ElementRef<HTMLElement>>('surface');\n\n // Geometry — semicircle in a 100×56 viewBox (centre at 50, 50).\n protected readonly cx = 50;\n protected readonly cy = 50;\n // A negative radius is invalid in the SVG path grammar, so the browser drops the arc\n // and the dial vanishes — which a fat stroke reaches at 99. `wr-knob` floors it too.\n protected readonly radius = computed(() => Math.max(1, 50 - this.strokeWidth() / 2 - 0.5));\n\n /**\n * The reading as it can actually be shown. Only `ratio` used to be clamped, so an\n * over-range value drew a full bar while `aria-valuenow` announced the raw number\n * against `aria-valuemax` — an invalid state for `role=\"meter\"` — and the printed\n * text disagreed with the bar as well.\n */\n protected readonly displayValue = computed(() => wrClamp(this.value(), this.min(), this.max()));\n\n /** The reading as the centre prints it, without the suffix. */\n protected readonly displayText = computed(() => this.numbers.value(this.displayValue()));\n\n protected readonly ratio = computed(() => {\n const range = this.max() - this.min();\n if (range <= 0) return 0;\n return wrClamp((this.value() - this.min()) / range, 0, 1);\n });\n\n protected readonly trackPath = computed(() => {\n const r = this.radius();\n return `M ${this.cx - r} ${this.cy} A ${r} ${r} 0 0 1 ${this.cx + r} ${this.cy}`;\n });\n\n protected readonly valuePath = computed(() => {\n // Nothing to draw at zero. A zero-length arc is not nothing: its round cap paints a\n // dot a stroke wide at the start of the track, so 0 read as a small reading.\n if (this.ratio() === 0) return null;\n const r = this.radius();\n const angle = Math.PI * (1 - this.ratio());\n const ex = this.cx + r * Math.cos(angle);\n const ey = this.cy - r * Math.sin(angle);\n // The arc always spans `π × ratio` radians (≤ 180°), so largeArc stays 0.\n // Previously this was set to 1 when ratio > 0.5, which made the swept arc\n // take the long way round and visually flipped the bar.\n return `M ${this.cx - r} ${this.cy} A ${r} ${r} 0 0 1 ${ex.toFixed(2)} ${ey.toFixed(2)}`;\n });\n\n protected readonly viewBox = '0 0 100 56';\n\n /**\n * The reading as the meter announces it — `aria-valuetext`, the number plus the\n * suffix — so the tooltip, the printed value and a screen reader all say one\n * thing.\n */\n protected readonly valueText = computed(() => `${this.displayText()}${this.suffix()}`);\n\n /**\n * One tooltip, pointing at the top of the dial. The whole gauge is one section.\n * The label is the `ariaLabel` input and not the catalog fallback, which names\n * the kind of widget rather than the reading.\n */\n protected readonly tip = useChartTooltip(this.tooltip, () => {\n const el = this.surface()?.nativeElement;\n if (!el) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.valueText(), color: this.valueColor() },\n anchor: el,\n };\n });\n}\n","<!--\n The dial is drawn in an aria-hidden <svg> and the printed value is optional, so\n with `showValue` off the component had no accessible representation at all.\n `role=\"meter\"` plus the value attributes make it readable either way.\n-->\n<div\n #surface\n class=\"wr-gauge__surface\"\n [style.width.px]=\"size()\"\n role=\"meter\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"displayValue()\"\n [attr.aria-valuetext]=\"valueText()\"\n (mouseenter)=\"tip.enter(0)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n <svg [attr.viewBox]=\"viewBox\" aria-hidden=\"true\">\n <path\n class=\"wr-gauge__track\"\n [attr.d]=\"trackPath()\"\n fill=\"none\"\n [attr.stroke]=\"trackColor()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n />\n <path\n class=\"wr-gauge__value\"\n [attr.d]=\"valuePath()\"\n fill=\"none\"\n [attr.stroke]=\"valueColor()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n />\n </svg>\n @if (showValue()) {\n <!--\n `dir=\"auto\"`, as on `wr-knob`'s value: a number and its unit read as one phrase,\n and the browser is the only thing that knows which way that phrase runs. In an\n RTL page the flex row ran right to left, so `72%` was drawn `% 72` and `9.5/10`\n as `10/ 9.5`. `dir=\"auto\"` takes the direction from the first strong character,\n so a Latin or symbol `suffix` keeps the number first, and an Arabic one still\n reads right to left. `unicode-bidi: isolate` does nothing here, since the flip\n happens inside the element; a hard `dir=\"ltr\"` would be wrong for that Arabic\n suffix.\n -->\n <div class=\"wr-gauge__text\" dir=\"auto\">\n {{ displayText() }}<span class=\"wr-gauge__suffix\">{{ suffix() }}</span>\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;;;;AAiCA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,cAAc;CACjF;CAGS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,eAAe,OAAO;CAOhF,QAAQ,MAAM,SAAQ;EAAA,GAAA,YAAA,EAAA,W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EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
2
2
  import { Component, DestroyRef, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, inject, input, signal, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { isPlatformBrowser } from "@angular/common";
5
- import { clamp, wrCheckStyles } from "ngwr/utils";
5
+ import { wrCheckStyles, wrClamp } from "ngwr/utils";
6
6
  import { useI18nText } from "ngwr/i18n";
7
7
  import { WrChartTable, useChartNumbers } from "ngwr/charts/core";
8
8
  import { useChartTooltip } from "ngwr/popover";
@@ -40,7 +40,7 @@ var WrHeatmapChart = class WrHeatmapChart {
40
40
  ...ngDevMode ? { debugName: "levels" } : /* istanbul ignore next */ {},
41
41
  transform: (v) => {
42
42
  const value = Math.round(coerceNumberProperty(v, 5));
43
- return Number.isFinite(value) ? clamp(value, 2, 10) : 5;
43
+ return Number.isFinite(value) ? wrClamp(value, 2, 10) : 5;
44
44
  }
45
45
  });
46
46
  showValues = input(false, {
@@ -133,7 +133,7 @@ var WrHeatmapChart = class WrHeatmapChart {
133
133
  text: ""
134
134
  };
135
135
  const span = scale.max - scale.min;
136
- const band = span === 0 ? 0 : Math.floor(clamp((value - scale.min) / span, 0, 1) * levels + 1e-9);
136
+ const band = span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9);
137
137
  return {
138
138
  row: r,
139
139
  column: c,
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-heatmap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/heatmap-chart/heatmap-chart.ts","../../../projects/lib/charts/heatmap-chart/heatmap-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapMatrix } from './types';\n\n/** The scale's bounds: the lowest and the highest value a level is drawn for. */\ninterface Scale {\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * Which column names are drawn: every `every`-th, from the first, up to `last`. The rest\n * are in the markup still, drawn nowhere.\n */\ninterface Thinning {\n readonly every: number;\n readonly last: number;\n}\n\n/** Every name drawn: what the chart starts with, and keeps on the server and in jsdom. */\nconst ALL_NAMES: Thinning = { every: 1, last: Number.POSITIVE_INFINITY };\n\n/** One cell as the chart draws it. */\ninterface Cell {\n readonly row: number;\n readonly column: number;\n /** Its value, or `null` for an empty cell: no data, which is not zero. */\n readonly value: number | null;\n /**\n * Its level as a place on the scale, from 0 (the lowest level) to 1 (the colour itself),\n * rounded so the inline style stays short. `null` for an empty cell.\n */\n readonly level: number | null;\n /** The number printed in the cell with `showValues`, compact from a thousand; `''` when it prints none. */\n readonly text: string;\n}\n\n/** A value as the scale reads it: a finite number, or `null` for an empty cell. */\nconst valueOf = (raw: unknown): number | null => (typeof raw === 'number' && Number.isFinite(raw) ? raw : null);\n\n/** A bound input: a finite number, or `null` for \"from the data\". */\nconst boundOf = (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A level to four decimals, with `-0` folded to `0`, so the inline style stays short. */\nconst short = (value: number): number => Math.round(value * 1e4) / 1e4 || 0;\n\n/**\n * Heatmap chart: a matrix of values, a row per category on one side and a column per\n * category on the other, each cell painted a level of one colour by its value. For where\n * two categories meet — weekday by hour, region by month, feature by release. For a year\n * of days, `<wr-calendar-heatmap>` lays them out as a calendar. HTML and CSS only — no\n * external dependency.\n *\n * @example\n * ```html\n * <wr-heatmap-chart\n * [rows]=\"['Mon', 'Tue', 'Wed']\"\n * [columns]=\"['Morning', 'Afternoon', 'Evening']\"\n * [data]=\"[\n * [12, 30, 8],\n * [18, null, 11],\n * [9, 41, 15]\n * ]\"\n * showValues\n * />\n * ```\n *\n * **The scale.** It runs from `min` to `max`, each the data's own unless given, and is cut\n * into `levels` equal bands. A cell takes its band's level: the lowest is a faint tint of\n * `color` and the highest is `color` itself, every level between mixed from the two in\n * OKLab, whose lightness moves evenly, so the levels look evenly spaced in either colour\n * scheme. A value outside a given `min` or `max` takes the end level; the tooltip and the\n * data table still give its own figure. A legend under the matrix keys the levels from the\n * scale's minimum to its maximum. A scale with no span — every value the same, an\n * all-zero matrix included — has one level, the lowest, and the legend keys that one.\n *\n * **An empty cell is no data, never zero.** A `null`, a value that is not a finite number,\n * or one a shorter row does not reach is drawn hatched and outlined, not as the lowest\n * level, and the legend keys it while any cell is empty (`noDataLabel`).\n *\n * **Colour is the only thing that encodes a value here, by nature** — a heatmap is a\n * picture of where the values are high and low, and its levels are told apart by\n * lightness alone. So the value has a second channel in TEXT: `showValues` prints each\n * number in its cell, where it fits, and `dataTable` renders the whole matrix as a table a\n * screen reader walks. With neither, say what the chart shows in `ariaLabel`. A printed\n * value is black or white, whichever reads better on its own cell, the pick the theme's\n * `-contrast` tokens make.\n *\n * **What a screen reader gets.** The cells are one named `role=\"img\"`; the row and column\n * names are real text beside it, and the legend is hidden, as an axis' ticks are on every\n * chart here. The numbers are in text only in the tooltip, which is pointer only, and in\n * the table `dataTable` renders. No part of the chart is a tab stop.\n *\n * **Names that do not fit.** Where the column names are wider than their columns — an hour\n * per column, on a phone — the chart draws every second, third or later name, the first\n * included, each starting at its own column, and leaves the rest out of sight: measured in\n * the browser after render and again whenever the chart is resized. The names left out\n * are still read by a screen reader, and the tooltip and the data table name every column.\n * A row name is cut with an ellipsis at `--wr-heatmap-chart-row-label-max-width`.\n *\n * The matrix follows `direction`, the way a table does: under RTL the row names are on\n * the right and the first column is the rightmost.\n *\n * @see https://ngwr.dev/charts/heatmap-chart\n */\n@Component({\n selector: 'wr-heatmap-chart',\n templateUrl: './heatmap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-heatmap-chart',\n // The highest level's colour, which every lower level is mixed from: read by the cells\n // and the legend's swatches.\n '[style.--wr-heatmap-chart-scale-color]': 'color()',\n },\n imports: [WrChartTable],\n})\nexport class WrHeatmapChart {\n /**\n * The values, rows × columns: one array per row, in the order of `rows`, each with one\n * value per column, in the order of `columns`. A `null`, a value that is not a finite\n * number, or one past the end of a shorter row is an EMPTY cell — no data, drawn hatched\n * and outlined rather than as the lowest level.\n */\n readonly data = input<WrHeatmapMatrix>([]);\n\n /**\n * The rows' names, top to bottom, beside the matrix at inline start. The matrix is as\n * tall as the longer of this list and `data`; a row with no name here is named by its\n * position, from 1. A name wider than `--wr-heatmap-chart-row-label-max-width` (10rem)\n * is cut with an ellipsis, and the tooltip and the data table carry it whole.\n */\n readonly rows = input<readonly string[]>([]);\n\n /**\n * The columns' names, from inline start, above the matrix. The matrix is as wide as the\n * longer of this list and the longest row of `data`; a column with no name here is named\n * by its position, from 1. Where the names are wider than their columns, the chart draws\n * every second, third or later one and leaves the rest out of sight, still read by a\n * screen reader; the tooltip and the data table name every column. A single column too\n * narrow for its name cuts it with an ellipsis.\n */\n readonly columns = input<readonly string[]>([]);\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. Every lower\n * level is mixed from it toward the surface, the lowest a faint tint.\n * @default 'var(--wr-color-primary)'\n */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * The value of the lowest level. `null` takes the lowest value in `data`; a value given\n * holds the scale there, and a cell below it takes the lowest level. @default null\n */\n readonly min = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * The value of the highest level. `null` takes the highest value in `data`; a value given\n * holds the scale there, and a cell above it takes the highest level. Bounds given in the\n * wrong order are swapped. A scale with no span — every value the same, or `min` equal\n * to `max` — has one level, the lowest: every value is drawn on it, an all-zero matrix\n * as a faint tint rather than as the peak, and the legend keys that one level.\n * @default null\n */\n readonly max = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * How many levels the scale is cut into, each an equal share of it from `min` to `max`:\n * whole numbers from 2 to 10. Fewer levels are easier to tell apart; the value text and\n * the data table carry what the levels round. @default 5\n */\n readonly levels = input(5, {\n transform: (v: unknown): number => {\n const value = Math.round(coerceNumberProperty(v, 5));\n return Number.isFinite(value) ? clamp(value, 2, 10) : 5;\n },\n });\n\n /**\n * Print each value in its cell, compact from a thousand (`1.2K`). A value is printed\n * whole or not at all: one wider than its cell is left out rather than cut, and the\n * tooltip and the data table still carry it. Black or white, whichever reads better on\n * the cell — picked with CSS relative colour syntax; a browser without it (Firefox\n * before 128) prints the value on a small chip of the surface in the chart's text\n * colour instead, which reads on every level. An empty cell prints nothing.\n * @default false\n */\n readonly showValues = input(false, { transform: coerceBooleanProperty });\n\n /** Show the colour-scale legend under the matrix, from `min` to `max`, with a key for an empty cell while there is one. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the cell under the pointer: its row's name, its column's name and\n * its value, or `noDataLabel` for an empty cell. Pointer only — the data table is where\n * the same numbers are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every number the chart shows: the values in the cells, the legend, the tooltip\n * and the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact in the\n * cells from a thousand up.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per row, headed by its name, and a column per column, every value written the way the\n * tooltip writes it, and an empty cell as `noDataLabel`.\n *\n * The cells are one named `role=\"img\"`, which hides everything inside it, so without the\n * table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * matrix, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the matrix. Its cells carry no text a screen reader reaches, so this\n * is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `heatmapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * What an empty cell is called, in the tooltip, the legend's key and the data table —\n * \"Closed\", \"Not measured\". Falls back to `heatmapChart.noData`.\n */\n readonly noDataLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'heatmapChart.label', 'Heatmap chart');\n\n protected readonly resolvedNoDataLabel = useI18nText(this.noDataLabel, 'heatmapChart.noData', 'No data');\n\n /** The cells' compact text and the full figures, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** A row or column with no name is named by its position, written in `LOCALE_ID`. */\n private readonly positions = new Intl.NumberFormat(inject(LOCALE_ID));\n\n private readonly grid = viewChild<ElementRef<HTMLElement>>('grid');\n\n private readonly columnStrip = viewChild<ElementRef<HTMLElement>>('columnStrip');\n\n /** The column names' strip's width, as last observed: what measures the names again on a resize. */\n private readonly stripWidth = signal(0);\n\n /**\n * Which column names are drawn. Every one until the browser has measured them, so the\n * server and the first paint carry every name, cut where it does not fit.\n */\n protected readonly thinning = signal<Thinning>(ALL_NAMES, {\n equal: (a, b) => a.every === b.every && a.last === b.last,\n });\n\n /** How many rows and columns the matrix has: the longer of the names and the data, each way. */\n protected readonly shape = computed(() => {\n const data = this.data();\n let columnCount = this.columns().length;\n for (const row of data) columnCount = Math.max(columnCount, row?.length ?? 0);\n return { rowCount: Math.max(this.rows().length, data.length), columnCount };\n });\n\n /** Every row's name, its position for a row the names do not reach. */\n protected readonly rowLabels = computed(() => {\n const names = this.rows();\n return Array.from({ length: this.shape().rowCount }, (_, r) => names[r] ?? this.positions.format(r + 1));\n });\n\n /** Every column's name, its position for a column the names do not reach. */\n protected readonly columnLabels = computed(() => {\n const names = this.columns();\n return Array.from({ length: this.shape().columnCount }, (_, c) => names[c] ?? this.positions.format(c + 1));\n });\n\n /** Every cell's value, row by row, `null` where it is empty. */\n private readonly values = computed(() => {\n const data = this.data();\n const { rowCount, columnCount } = this.shape();\n return Array.from({ length: rowCount }, (_, r) =>\n Array.from({ length: columnCount }, (__, c) => valueOf(data[r]?.[c]))\n );\n });\n\n /**\n * The scale: `min` and `max` where given, the data's own lowest and highest value where\n * not, in order. `null` while there is nothing to scale — no value, and a bound missing.\n */\n protected readonly scale = computed<Scale | null>(() => {\n let lo = this.min();\n let hi = this.max();\n if (lo === null || hi === null) {\n // A loop rather than `Math.min(...values)`: a spread passes every cell as an\n // argument, and a large enough matrix overflows the call stack.\n let low = Infinity;\n let high = -Infinity;\n for (const row of this.values()) {\n for (const v of row) {\n if (v === null) continue;\n if (v < low) low = v;\n if (v > high) high = v;\n }\n }\n if (low !== Infinity) {\n lo ??= low;\n hi ??= high;\n }\n }\n if (lo === null || hi === null) return null;\n return lo <= hi ? { min: lo, max: hi } : { min: hi, max: lo };\n });\n\n /**\n * Every cell, row by row: its value, its level, and the text it prints. The level is the\n * value's band — the scale cut into `levels` equal shares — as a place from 0 to 1; a\n * scale with no span has one level, the lowest, and puts every value on it.\n */\n protected readonly cells = computed<readonly Cell[]>(() => {\n const scale = this.scale();\n const levels = this.levels();\n const print = this.showValues();\n return this.values().flatMap((row, r) =>\n row.map((value, c): Cell => {\n if (value === null || scale === null) return { row: r, column: c, value, level: null, text: '' };\n const span = scale.max - scale.min;\n // The epsilon keeps a value ON a band's edge in the band above it: 0.3 × 10 is\n // 2.9999999999999996 in floating point.\n const band = span === 0 ? 0 : Math.floor(clamp((value - scale.min) / span, 0, 1) * levels + 1e-9);\n return {\n row: r,\n column: c,\n value,\n level: short(Math.min(band, levels - 1) / (levels - 1)),\n text: print ? this.numbers.label(value) : '',\n };\n })\n );\n });\n\n /** Whether any cell is empty, which is when the legend keys the hatching. */\n protected readonly hasEmpty = computed(() => this.cells().some(cell => cell.value === null));\n\n /**\n * The legend's scale: its two ends, compact from a thousand as the cells print a value,\n * and one swatch per level, each at its place on the scale. A scale with no span has one\n * level, so one swatch and one label, and `max` is `null`. `null` with nothing to scale,\n * when the legend keys an empty cell alone.\n */\n protected readonly legend = computed(() => {\n const scale = this.scale();\n if (scale === null) return null;\n if (scale.min === scale.max) return { min: this.numbers.label(scale.min), max: null, levels: [0] };\n const levels = this.levels();\n return {\n min: this.numbers.label(scale.min),\n max: this.numbers.label(scale.max),\n levels: Array.from({ length: levels }, (_, k) => short(k / (levels - 1))),\n };\n });\n\n /**\n * The figures for `dataTable`: the matrix's name as the caption, a column per column and\n * a row per row, every value written as the tooltip writes it and an empty cell as\n * `noDataLabel`.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const empty = this.resolvedNoDataLabel();\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.columnLabels(),\n groups: [\n {\n rows: this.values().map((row, r) => ({\n header: this.rowLabels()[r],\n cells: row.map(value => (value === null ? empty : this.numbers.value(value))),\n })),\n },\n ],\n };\n });\n\n /**\n * One tooltip for the whole matrix, pointing at the cell under the pointer: the row's\n * name as its heading, and a line with the column's name and the value — the order a\n * table is read in. A listener on the matrix rather than one per cell.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The cells are the container's only children, drawn in `cells()` order.\n const anchor = cell ? this.grid()?.nativeElement.children.item(index) : null;\n if (!cell || !anchor) return null;\n return {\n datum: {\n label: this.rowLabels()[cell.row],\n value: '',\n rows: [\n {\n label: this.columnLabels()[cell.column],\n value: cell.value === null ? this.resolvedNoDataLabel() : this.numbers.value(cell.value),\n },\n ],\n },\n anchor,\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/heatmap-chart');\n const destroyRef = inject(DestroyRef);\n // The names are measured after render, in a browser: again when they change, and when\n // the observer below reports a new width. Never on the server, which keeps every name\n // — said here as well as by the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterRenderEffect(() => {\n this.stripWidth();\n this.columnLabels();\n this.thinning.set(this.measureColumnNames());\n });\n\n // The strip's width is what decides how many names fit. A hidden chart reports 0 and\n // draws every name, and showing it again is a change of width, so it is measured afresh\n // even where its width is the one it was hidden at.\n afterNextRender(() => {\n const strip = this.columnStrip()?.nativeElement;\n if (!strip || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => this.stripWidth.set(entry.contentRect.width));\n observer.observe(strip);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Which column names fit: every name while each fits its own column, else every n-th,\n * the smallest n whose room holds the widest name and half an em beside it.\n *\n * A name is shrunk to its text by the stylesheet, so its `scrollWidth` is the whole text,\n * cut or not. The columns' pitch is read off the first two cells, which the grid sizes\n * whatever the names say. The last name drawn has only the columns left to the end,\n * which can be fewer than n: one that does not fit them is left out rather than spill\n * past the chart or be cut. Anything unmeasurable — one column, no cells, no layout —\n * draws every name.\n */\n private measureColumnNames(): Thinning {\n const strip = this.columnStrip()?.nativeElement;\n const cells = this.grid()?.nativeElement.children;\n const count = this.shape().columnCount;\n if (!strip || !cells || count < 2 || cells.length < 2) return ALL_NAMES;\n const first = cells[0].getBoundingClientRect();\n const pitch = Math.abs(cells[1].getBoundingClientRect().left - first.left);\n if (!(pitch > 0)) return ALL_NAMES;\n const gap = Math.max(0, pitch - first.width);\n const widths = Array.from(strip.children, name => name.scrollWidth);\n const space = Math.max(gap, (Number.parseFloat(getComputedStyle(strip).fontSize) || 0) / 2);\n const every = Math.max(1, Math.ceil((Math.max(0, ...widths) + space) / pitch));\n if (every === 1) return ALL_NAMES;\n let last = Math.floor((count - 1) / every) * every;\n if ((widths[last] ?? 0) > (count - last) * pitch - gap) last -= every;\n return { every, last };\n }\n\n /**\n * The cell under the pointer, heard on the matrix. A MOUSE event, as every chart's is: a\n * tap fires the compatibility `mousemove` and no `pointermove`. Over the gap between two\n * cells it is on none, and the tooltip starts to leave.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const cell = (event.target as Element | null)?.closest?.<HTMLElement>('.wr-heatmap-chart__cell');\n const row = Number(cell?.dataset['row']);\n const column = Number(cell?.dataset['column']);\n if (!cell || !Number.isInteger(row) || !Number.isInteger(column)) this.tip.leave(event);\n else this.tip.enter(row * this.shape().columnCount + column);\n }\n}\n\nexport type { WrHeatmapMatrix } from './types';\n","@let active = tip.active();\n@let key = legend();\n@let thin = thinning();\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <div\n #grid\n class=\"wr-heatmap-chart__cells\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @for (cell of cells(); track $index) {\n <!-- A level's paint is the stylesheet's, from the level written here; an empty cell has\n no level and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [class.wr-heatmap-chart__cell--active]=\"active === $index\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n</div>\n\n@if (showLegend() && (key || hasEmpty())) {\n <!-- Hidden, as an axis' ticks are on every chart: the matrix's name is what is announced,\n and the figures are in the data table. -->\n <div class=\"wr-heatmap-chart__legend\" aria-hidden=\"true\">\n @if (key) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.min }}</span>\n <span class=\"wr-heatmap-chart__scale\">\n @for (level of key.levels; track $index) {\n <span class=\"wr-heatmap-chart__swatch\" [style.--wr-heatmap-chart-level]=\"level\"></span>\n }\n </span>\n <!-- A scale with no span is one level, keyed by one figure. -->\n @if (key.max !== null) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.max }}</span>\n }\n }\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </div>\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\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,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,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,WAAA,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,aAAA,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,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEC,eAAa,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-heatmap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/heatmap-chart/heatmap-chart.ts","../../../projects/lib/charts/heatmap-chart/heatmap-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapMatrix } from './types';\n\n/** The scale's bounds: the lowest and the highest value a level is drawn for. */\ninterface Scale {\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * Which column names are drawn: every `every`-th, from the first, up to `last`. The rest\n * are in the markup still, drawn nowhere.\n */\ninterface Thinning {\n readonly every: number;\n readonly last: number;\n}\n\n/** Every name drawn: what the chart starts with, and keeps on the server and in jsdom. */\nconst ALL_NAMES: Thinning = { every: 1, last: Number.POSITIVE_INFINITY };\n\n/** One cell as the chart draws it. */\ninterface Cell {\n readonly row: number;\n readonly column: number;\n /** Its value, or `null` for an empty cell: no data, which is not zero. */\n readonly value: number | null;\n /**\n * Its level as a place on the scale, from 0 (the lowest level) to 1 (the colour itself),\n * rounded so the inline style stays short. `null` for an empty cell.\n */\n readonly level: number | null;\n /** The number printed in the cell with `showValues`, compact from a thousand; `''` when it prints none. */\n readonly text: string;\n}\n\n/** A value as the scale reads it: a finite number, or `null` for an empty cell. */\nconst valueOf = (raw: unknown): number | null => (typeof raw === 'number' && Number.isFinite(raw) ? raw : null);\n\n/** A bound input: a finite number, or `null` for \"from the data\". */\nconst boundOf = (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A level to four decimals, with `-0` folded to `0`, so the inline style stays short. */\nconst short = (value: number): number => Math.round(value * 1e4) / 1e4 || 0;\n\n/**\n * Heatmap chart: a matrix of values, a row per category on one side and a column per\n * category on the other, each cell painted a level of one colour by its value. For where\n * two categories meet — weekday by hour, region by month, feature by release. For a year\n * of days, `<wr-calendar-heatmap>` lays them out as a calendar. HTML and CSS only — no\n * external dependency.\n *\n * @example\n * ```html\n * <wr-heatmap-chart\n * [rows]=\"['Mon', 'Tue', 'Wed']\"\n * [columns]=\"['Morning', 'Afternoon', 'Evening']\"\n * [data]=\"[\n * [12, 30, 8],\n * [18, null, 11],\n * [9, 41, 15]\n * ]\"\n * showValues\n * />\n * ```\n *\n * **The scale.** It runs from `min` to `max`, each the data's own unless given, and is cut\n * into `levels` equal bands. A cell takes its band's level: the lowest is a faint tint of\n * `color` and the highest is `color` itself, every level between mixed from the two in\n * OKLab, whose lightness moves evenly, so the levels look evenly spaced in either colour\n * scheme. A value outside a given `min` or `max` takes the end level; the tooltip and the\n * data table still give its own figure. A legend under the matrix keys the levels from the\n * scale's minimum to its maximum. A scale with no span — every value the same, an\n * all-zero matrix included — has one level, the lowest, and the legend keys that one.\n *\n * **An empty cell is no data, never zero.** A `null`, a value that is not a finite number,\n * or one a shorter row does not reach is drawn hatched and outlined, not as the lowest\n * level, and the legend keys it while any cell is empty (`noDataLabel`).\n *\n * **Colour is the only thing that encodes a value here, by nature** — a heatmap is a\n * picture of where the values are high and low, and its levels are told apart by\n * lightness alone. So the value has a second channel in TEXT: `showValues` prints each\n * number in its cell, where it fits, and `dataTable` renders the whole matrix as a table a\n * screen reader walks. With neither, say what the chart shows in `ariaLabel`. A printed\n * value is black or white, whichever reads better on its own cell, the pick the theme's\n * `-contrast` tokens make.\n *\n * **What a screen reader gets.** The cells are one named `role=\"img\"`; the row and column\n * names are real text beside it, and the legend is hidden, as an axis' ticks are on every\n * chart here. The numbers are in text only in the tooltip, which is pointer only, and in\n * the table `dataTable` renders. No part of the chart is a tab stop.\n *\n * **Names that do not fit.** Where the column names are wider than their columns — an hour\n * per column, on a phone — the chart draws every second, third or later name, the first\n * included, each starting at its own column, and leaves the rest out of sight: measured in\n * the browser after render and again whenever the chart is resized. The names left out\n * are still read by a screen reader, and the tooltip and the data table name every column.\n * A row name is cut with an ellipsis at `--wr-heatmap-chart-row-label-max-width`.\n *\n * The matrix follows `direction`, the way a table does: under RTL the row names are on\n * the right and the first column is the rightmost.\n *\n * @see https://ngwr.dev/charts/heatmap-chart\n */\n@Component({\n selector: 'wr-heatmap-chart',\n templateUrl: './heatmap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-heatmap-chart',\n // The highest level's colour, which every lower level is mixed from: read by the cells\n // and the legend's swatches.\n '[style.--wr-heatmap-chart-scale-color]': 'color()',\n },\n imports: [WrChartTable],\n})\nexport class WrHeatmapChart {\n /**\n * The values, rows × columns: one array per row, in the order of `rows`, each with one\n * value per column, in the order of `columns`. A `null`, a value that is not a finite\n * number, or one past the end of a shorter row is an EMPTY cell — no data, drawn hatched\n * and outlined rather than as the lowest level.\n */\n readonly data = input<WrHeatmapMatrix>([]);\n\n /**\n * The rows' names, top to bottom, beside the matrix at inline start. The matrix is as\n * tall as the longer of this list and `data`; a row with no name here is named by its\n * position, from 1. A name wider than `--wr-heatmap-chart-row-label-max-width` (10rem)\n * is cut with an ellipsis, and the tooltip and the data table carry it whole.\n */\n readonly rows = input<readonly string[]>([]);\n\n /**\n * The columns' names, from inline start, above the matrix. The matrix is as wide as the\n * longer of this list and the longest row of `data`; a column with no name here is named\n * by its position, from 1. Where the names are wider than their columns, the chart draws\n * every second, third or later one and leaves the rest out of sight, still read by a\n * screen reader; the tooltip and the data table name every column. A single column too\n * narrow for its name cuts it with an ellipsis.\n */\n readonly columns = input<readonly string[]>([]);\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. Every lower\n * level is mixed from it toward the surface, the lowest a faint tint.\n * @default 'var(--wr-color-primary)'\n */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * The value of the lowest level. `null` takes the lowest value in `data`; a value given\n * holds the scale there, and a cell below it takes the lowest level. @default null\n */\n readonly min = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * The value of the highest level. `null` takes the highest value in `data`; a value given\n * holds the scale there, and a cell above it takes the highest level. Bounds given in the\n * wrong order are swapped. A scale with no span — every value the same, or `min` equal\n * to `max` — has one level, the lowest: every value is drawn on it, an all-zero matrix\n * as a faint tint rather than as the peak, and the legend keys that one level.\n * @default null\n */\n readonly max = input<number | null, unknown>(null, { transform: boundOf });\n\n /**\n * How many levels the scale is cut into, each an equal share of it from `min` to `max`:\n * whole numbers from 2 to 10. Fewer levels are easier to tell apart; the value text and\n * the data table carry what the levels round. @default 5\n */\n readonly levels = input(5, {\n transform: (v: unknown): number => {\n const value = Math.round(coerceNumberProperty(v, 5));\n return Number.isFinite(value) ? wrClamp(value, 2, 10) : 5;\n },\n });\n\n /**\n * Print each value in its cell, compact from a thousand (`1.2K`). A value is printed\n * whole or not at all: one wider than its cell is left out rather than cut, and the\n * tooltip and the data table still carry it. Black or white, whichever reads better on\n * the cell — picked with CSS relative colour syntax; a browser without it (Firefox\n * before 128) prints the value on a small chip of the surface in the chart's text\n * colour instead, which reads on every level. An empty cell prints nothing.\n * @default false\n */\n readonly showValues = input(false, { transform: coerceBooleanProperty });\n\n /** Show the colour-scale legend under the matrix, from `min` to `max`, with a key for an empty cell while there is one. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the cell under the pointer: its row's name, its column's name and\n * its value, or `noDataLabel` for an empty cell. Pointer only — the data table is where\n * the same numbers are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every number the chart shows: the values in the cells, the legend, the tooltip\n * and the data table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact in the\n * cells from a thousand up.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per row, headed by its name, and a column per column, every value written the way the\n * tooltip writes it, and an empty cell as `noDataLabel`.\n *\n * The cells are one named `role=\"img\"`, which hides everything inside it, so without the\n * table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * matrix, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the matrix. Its cells carry no text a screen reader reaches, so this\n * is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `heatmapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * What an empty cell is called, in the tooltip, the legend's key and the data table —\n * \"Closed\", \"Not measured\". Falls back to `heatmapChart.noData`.\n */\n readonly noDataLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'heatmapChart.label', 'Heatmap chart');\n\n protected readonly resolvedNoDataLabel = useI18nText(this.noDataLabel, 'heatmapChart.noData', 'No data');\n\n /** The cells' compact text and the full figures, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** A row or column with no name is named by its position, written in `LOCALE_ID`. */\n private readonly positions = new Intl.NumberFormat(inject(LOCALE_ID));\n\n private readonly grid = viewChild<ElementRef<HTMLElement>>('grid');\n\n private readonly columnStrip = viewChild<ElementRef<HTMLElement>>('columnStrip');\n\n /** The column names' strip's width, as last observed: what measures the names again on a resize. */\n private readonly stripWidth = signal(0);\n\n /**\n * Which column names are drawn. Every one until the browser has measured them, so the\n * server and the first paint carry every name, cut where it does not fit.\n */\n protected readonly thinning = signal<Thinning>(ALL_NAMES, {\n equal: (a, b) => a.every === b.every && a.last === b.last,\n });\n\n /** How many rows and columns the matrix has: the longer of the names and the data, each way. */\n protected readonly shape = computed(() => {\n const data = this.data();\n let columnCount = this.columns().length;\n for (const row of data) columnCount = Math.max(columnCount, row?.length ?? 0);\n return { rowCount: Math.max(this.rows().length, data.length), columnCount };\n });\n\n /** Every row's name, its position for a row the names do not reach. */\n protected readonly rowLabels = computed(() => {\n const names = this.rows();\n return Array.from({ length: this.shape().rowCount }, (_, r) => names[r] ?? this.positions.format(r + 1));\n });\n\n /** Every column's name, its position for a column the names do not reach. */\n protected readonly columnLabels = computed(() => {\n const names = this.columns();\n return Array.from({ length: this.shape().columnCount }, (_, c) => names[c] ?? this.positions.format(c + 1));\n });\n\n /** Every cell's value, row by row, `null` where it is empty. */\n private readonly values = computed(() => {\n const data = this.data();\n const { rowCount, columnCount } = this.shape();\n return Array.from({ length: rowCount }, (_, r) =>\n Array.from({ length: columnCount }, (__, c) => valueOf(data[r]?.[c]))\n );\n });\n\n /**\n * The scale: `min` and `max` where given, the data's own lowest and highest value where\n * not, in order. `null` while there is nothing to scale — no value, and a bound missing.\n */\n protected readonly scale = computed<Scale | null>(() => {\n let lo = this.min();\n let hi = this.max();\n if (lo === null || hi === null) {\n // A loop rather than `Math.min(...values)`: a spread passes every cell as an\n // argument, and a large enough matrix overflows the call stack.\n let low = Infinity;\n let high = -Infinity;\n for (const row of this.values()) {\n for (const v of row) {\n if (v === null) continue;\n if (v < low) low = v;\n if (v > high) high = v;\n }\n }\n if (low !== Infinity) {\n lo ??= low;\n hi ??= high;\n }\n }\n if (lo === null || hi === null) return null;\n return lo <= hi ? { min: lo, max: hi } : { min: hi, max: lo };\n });\n\n /**\n * Every cell, row by row: its value, its level, and the text it prints. The level is the\n * value's band — the scale cut into `levels` equal shares — as a place from 0 to 1; a\n * scale with no span has one level, the lowest, and puts every value on it.\n */\n protected readonly cells = computed<readonly Cell[]>(() => {\n const scale = this.scale();\n const levels = this.levels();\n const print = this.showValues();\n return this.values().flatMap((row, r) =>\n row.map((value, c): Cell => {\n if (value === null || scale === null) return { row: r, column: c, value, level: null, text: '' };\n const span = scale.max - scale.min;\n // The epsilon keeps a value ON a band's edge in the band above it: 0.3 × 10 is\n // 2.9999999999999996 in floating point.\n const band = span === 0 ? 0 : Math.floor(wrClamp((value - scale.min) / span, 0, 1) * levels + 1e-9);\n return {\n row: r,\n column: c,\n value,\n level: short(Math.min(band, levels - 1) / (levels - 1)),\n text: print ? this.numbers.label(value) : '',\n };\n })\n );\n });\n\n /** Whether any cell is empty, which is when the legend keys the hatching. */\n protected readonly hasEmpty = computed(() => this.cells().some(cell => cell.value === null));\n\n /**\n * The legend's scale: its two ends, compact from a thousand as the cells print a value,\n * and one swatch per level, each at its place on the scale. A scale with no span has one\n * level, so one swatch and one label, and `max` is `null`. `null` with nothing to scale,\n * when the legend keys an empty cell alone.\n */\n protected readonly legend = computed(() => {\n const scale = this.scale();\n if (scale === null) return null;\n if (scale.min === scale.max) return { min: this.numbers.label(scale.min), max: null, levels: [0] };\n const levels = this.levels();\n return {\n min: this.numbers.label(scale.min),\n max: this.numbers.label(scale.max),\n levels: Array.from({ length: levels }, (_, k) => short(k / (levels - 1))),\n };\n });\n\n /**\n * The figures for `dataTable`: the matrix's name as the caption, a column per column and\n * a row per row, every value written as the tooltip writes it and an empty cell as\n * `noDataLabel`.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const empty = this.resolvedNoDataLabel();\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.columnLabels(),\n groups: [\n {\n rows: this.values().map((row, r) => ({\n header: this.rowLabels()[r],\n cells: row.map(value => (value === null ? empty : this.numbers.value(value))),\n })),\n },\n ],\n };\n });\n\n /**\n * One tooltip for the whole matrix, pointing at the cell under the pointer: the row's\n * name as its heading, and a line with the column's name and the value — the order a\n * table is read in. A listener on the matrix rather than one per cell.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The cells are the container's only children, drawn in `cells()` order.\n const anchor = cell ? this.grid()?.nativeElement.children.item(index) : null;\n if (!cell || !anchor) return null;\n return {\n datum: {\n label: this.rowLabels()[cell.row],\n value: '',\n rows: [\n {\n label: this.columnLabels()[cell.column],\n value: cell.value === null ? this.resolvedNoDataLabel() : this.numbers.value(cell.value),\n },\n ],\n },\n anchor,\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/heatmap-chart');\n const destroyRef = inject(DestroyRef);\n // The names are measured after render, in a browser: again when they change, and when\n // the observer below reports a new width. Never on the server, which keeps every name\n // — said here as well as by the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterRenderEffect(() => {\n this.stripWidth();\n this.columnLabels();\n this.thinning.set(this.measureColumnNames());\n });\n\n // The strip's width is what decides how many names fit. A hidden chart reports 0 and\n // draws every name, and showing it again is a change of width, so it is measured afresh\n // even where its width is the one it was hidden at.\n afterNextRender(() => {\n const strip = this.columnStrip()?.nativeElement;\n if (!strip || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => this.stripWidth.set(entry.contentRect.width));\n observer.observe(strip);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Which column names fit: every name while each fits its own column, else every n-th,\n * the smallest n whose room holds the widest name and half an em beside it.\n *\n * A name is shrunk to its text by the stylesheet, so its `scrollWidth` is the whole text,\n * cut or not. The columns' pitch is read off the first two cells, which the grid sizes\n * whatever the names say. The last name drawn has only the columns left to the end,\n * which can be fewer than n: one that does not fit them is left out rather than spill\n * past the chart or be cut. Anything unmeasurable — one column, no cells, no layout —\n * draws every name.\n */\n private measureColumnNames(): Thinning {\n const strip = this.columnStrip()?.nativeElement;\n const cells = this.grid()?.nativeElement.children;\n const count = this.shape().columnCount;\n if (!strip || !cells || count < 2 || cells.length < 2) return ALL_NAMES;\n const first = cells[0].getBoundingClientRect();\n const pitch = Math.abs(cells[1].getBoundingClientRect().left - first.left);\n if (!(pitch > 0)) return ALL_NAMES;\n const gap = Math.max(0, pitch - first.width);\n const widths = Array.from(strip.children, name => name.scrollWidth);\n const space = Math.max(gap, (Number.parseFloat(getComputedStyle(strip).fontSize) || 0) / 2);\n const every = Math.max(1, Math.ceil((Math.max(0, ...widths) + space) / pitch));\n if (every === 1) return ALL_NAMES;\n let last = Math.floor((count - 1) / every) * every;\n if ((widths[last] ?? 0) > (count - last) * pitch - gap) last -= every;\n return { every, last };\n }\n\n /**\n * The cell under the pointer, heard on the matrix. A MOUSE event, as every chart's is: a\n * tap fires the compatibility `mousemove` and no `pointermove`. Over the gap between two\n * cells it is on none, and the tooltip starts to leave.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const cell = (event.target as Element | null)?.closest?.<HTMLElement>('.wr-heatmap-chart__cell');\n const row = Number(cell?.dataset['row']);\n const column = Number(cell?.dataset['column']);\n if (!cell || !Number.isInteger(row) || !Number.isInteger(column)) this.tip.leave(event);\n else this.tip.enter(row * this.shape().columnCount + column);\n }\n}\n\nexport type { WrHeatmapMatrix } from './types';\n","@let active = tip.active();\n@let key = legend();\n@let thin = thinning();\n<!-- One grid: the row names in a column at inline start, the column names in a row above,\n and the cells beside and below them. The names and the cells share its tracks through\n `subgrid`, so a name lines up with its cells at any width. -->\n<div\n class=\"wr-heatmap-chart__matrix\"\n [style.--wr-heatmap-chart-rows]=\"shape().rowCount || 1\"\n [style.--wr-heatmap-chart-columns]=\"shape().columnCount || 1\"\n>\n <!-- Real text beside the cells, as the line chart's x labels are: the cells are an `img`,\n which hides everything inside it, so the names are kept out of it. Where they do not\n fit, every n-th is drawn across the columns up to the next, and the rest are left in\n the markup, out of sight, so a screen reader still reads every name. -->\n <div\n #columnStrip\n class=\"wr-heatmap-chart__column-labels\"\n [class.wr-heatmap-chart__column-labels--thinned]=\"thin.every > 1\"\n [style.--wr-heatmap-chart-label-every]=\"thin.every > 1 ? thin.every : null\"\n >\n @for (label of columnLabels(); track $index) {\n <span\n class=\"wr-heatmap-chart__column-label\"\n [class.wr-heatmap-chart__column-label--hidden]=\"$index % thin.every !== 0 || $index > thin.last\"\n >\n {{ label }}\n </span>\n }\n </div>\n <div class=\"wr-heatmap-chart__row-labels\">\n @for (label of rowLabels(); track $index) {\n <span class=\"wr-heatmap-chart__row-label\">{{ label }}</span>\n }\n </div>\n\n <div\n #grid\n class=\"wr-heatmap-chart__cells\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @for (cell of cells(); track $index) {\n <!-- A level's paint is the stylesheet's, from the level written here; an empty cell has\n no level and is hatched instead. -->\n <span\n class=\"wr-heatmap-chart__cell\"\n [class.wr-heatmap-chart__cell--empty]=\"cell.value === null\"\n [class.wr-heatmap-chart__cell--active]=\"active === $index\"\n [style.--wr-heatmap-chart-level]=\"cell.level\"\n [attr.data-row]=\"cell.row\"\n [attr.data-column]=\"cell.column\"\n [attr.data-value]=\"cell.value\"\n >\n @if (cell.text) {\n <span class=\"wr-heatmap-chart__value\">{{ cell.text }}</span>\n }\n </span>\n }\n </div>\n</div>\n\n@if (showLegend() && (key || hasEmpty())) {\n <!-- Hidden, as an axis' ticks are on every chart: the matrix's name is what is announced,\n and the figures are in the data table. -->\n <div class=\"wr-heatmap-chart__legend\" aria-hidden=\"true\">\n @if (key) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.min }}</span>\n <span class=\"wr-heatmap-chart__scale\">\n @for (level of key.levels; track $index) {\n <span class=\"wr-heatmap-chart__swatch\" [style.--wr-heatmap-chart-level]=\"level\"></span>\n }\n </span>\n <!-- A scale with no span is one level, keyed by one figure. -->\n @if (key.max !== null) {\n <span class=\"wr-heatmap-chart__legend-label\">{{ key.max }}</span>\n }\n }\n @if (hasEmpty()) {\n <span class=\"wr-heatmap-chart__legend-empty\">\n <span class=\"wr-heatmap-chart__swatch wr-heatmap-chart__swatch--empty\"></span>\n <span class=\"wr-heatmap-chart__legend-label\">{{ resolvedNoDataLabel() }}</span>\n </span>\n }\n </div>\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the cells' `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAgDA,MAAM,YAAsB;CAAE,OAAO;CAAG,MAAM,OAAO;AAAiB;AAkBtE,MAAM,WAAW,QAAiC,OAAO,QAAQ,YAAY,OAAO,SAAS,GAAG,IAAI,MAAM;AAG1G,MAAM,WAAW,MAA6B;CAC5C,IAAI,MAAM,QAAQ,MAAM,UAAa,MAAM,IAAI,OAAO;CACtD,MAAM,QAAQ,qBAAqB,GAAG,GAAU;CAChD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAGA,MAAM,SAAS,UAA0B,KAAK,MAAM,QAAQ,GAAG,IAAI,OAAO;AAyE1E,IAAa,iBAAb,MAAa,eAAc;CAOhB,OAAO,MAAuB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQjC,OAAO,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAUnC,UAAU,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,QAAQ,MAAc,2BAA0B,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAMhD,MAAM,MAA8B,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,WAAW;CAAO,CAAA;CAU9D,MAAM,MAA8B,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,WAAW;CAAO,CAAA;CAO9D,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EACvB,YAAY,MAAsB;GAChC,MAAM,QAAQ,KAAK,MAAM,qBAAqB,GAA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, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, effect, inject, input, model, signal, untracked, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
5
- import { clamp, wrCheckStyles } from "ngwr/utils";
5
+ import { wrCheckStyles, wrClamp } from "ngwr/utils";
6
6
  import { useI18nText } from "ngwr/i18n";
7
7
  import { WR_CHART_LEGEND_BLOCK, WrChartLegend } from "ngwr/charts/chart-legend";
8
- import { WrChartTable, chartAxis, chartColor, chartDash, useChartNumbers } from "ngwr/charts/core";
8
+ import { WrChartTable, useChartNumbers, wrChartAxis, wrChartColor, wrChartDash } from "ngwr/charts/core";
9
9
  /**
10
10
  * @license
11
11
  *
@@ -111,9 +111,9 @@ var WrLineChart = class WrLineChart {
111
111
  resolvedSeries = computed(() => this.series().map((s, i) => ({
112
112
  index: i,
113
113
  label: s.label,
114
- dash: chartDash(i),
114
+ dash: wrChartDash(i),
115
115
  data: s.data.map((v) => typeof v === "number" && Number.isFinite(v) ? v : null),
116
- color: s.color ?? chartColor(i)
116
+ color: s.color ?? wrChartColor(i)
117
117
  })), ...ngDevMode ? [{ debugName: "resolvedSeries" }] : /* istanbul ignore next */ []);
118
118
  legendItems = computed(() => this.resolvedSeries().map(({ label, color, dash }) => ({
119
119
  label,
@@ -163,9 +163,9 @@ var WrLineChart = class WrLineChart {
163
163
  if (v < min) min = v;
164
164
  if (v > max) max = v;
165
165
  }
166
- if (min > max) return chartAxis(NaN, NaN);
167
- if (this.showArea() || this.stacked()) return chartAxis(min, max, { includeZero: true });
168
- return chartAxis(Math.min(0, min), max);
166
+ if (min > max) return wrChartAxis(NaN, NaN);
167
+ if (this.showArea() || this.stacked()) return wrChartAxis(min, max, { includeZero: true });
168
+ return wrChartAxis(Math.min(0, min), max);
169
169
  }, ...ngDevMode ? [{ debugName: "bounds" }] : /* istanbul ignore next */ []);
170
170
  pointCount = computed(() => {
171
171
  const maxLen = this.resolvedSeries().reduce((acc, s) => Math.max(acc, s.data.length), 0);
@@ -267,7 +267,7 @@ var WrLineChart = class WrLineChart {
267
267
  const longest = labels.reduce((most, label) => Math.max(most, label.length), 0);
268
268
  const label = Math.min(measured && measured.label > 0 ? measured.label : longest * CHAR_WIDTH, strip);
269
269
  const step = count <= 1 ? strip : width / (count - 1);
270
- const start = (index) => clamp(inset + this.pointX(index) * (width / this.vbW) - label / 2, 0, strip - label);
270
+ const start = (index) => wrClamp(inset + this.pointX(index) * (width / this.vbW) - label / 2, 0, strip - label);
271
271
  const crowds = (from, previousEnd) => from + 1e-6 < previousEnd + LABEL_GAP;
272
272
  let every = count <= 1 ? 1 : Math.max(1, Math.ceil((label + LABEL_GAP - 1e-6) / step));
273
273
  while (every < labels.length - 1 && crowds(start(every), start(0) + label)) every++;
@@ -318,7 +318,7 @@ var WrLineChart = class WrLineChart {
318
318
  const box = this.svg().nativeElement.getBoundingClientRect();
319
319
  if (count === 0 || box.width <= 0) return;
320
320
  const ratio = (event.clientX - box.left) / box.width;
321
- const i = count === 1 ? 0 : clamp(Math.round(ratio * (count - 1)), 0, count - 1);
321
+ const i = count === 1 ? 0 : wrClamp(Math.round(ratio * (count - 1)), 0, count - 1);
322
322
  if (i === this.dismissed) return;
323
323
  this.dismissed = null;
324
324
  this.hoveredIndex.set(i);
@@ -353,7 +353,7 @@ var WrLineChart = class WrLineChart {
353
353
  const { width, height } = rect;
354
354
  const x = box.left + points[0].x / this.vbW * box.width;
355
355
  const ys = points.map((p) => box.top + p.y / this.vbH * box.height);
356
- const across = (left) => clamp(left, plot.left, plot.right - width);
356
+ const across = (left) => wrClamp(left, plot.left, plot.right - width);
357
357
  const top = box.top + inset;
358
358
  const candidates = [
359
359
  {