ngwr 16.4.0 → 16.6.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 (427) hide show
  1. package/back-top/styles/_index.scss +6 -0
  2. package/breadcrumbs/styles/_rules.scss +34 -0
  3. package/cascader/styles/_rules.scss +7 -0
  4. package/charts/bar-chart/styles/_index.scss +494 -305
  5. package/charts/boxplot-chart/styles/_index.scss +114 -48
  6. package/charts/bullet-chart/styles/_index.scss +113 -42
  7. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  8. package/charts/candlestick-chart/styles/_index.scss +61 -26
  9. package/charts/chart-legend/styles/_index.scss +120 -10
  10. package/charts/core/styles/_index.scss +201 -5
  11. package/charts/donut-chart/styles/_index.scss +76 -21
  12. package/charts/funnel-chart/styles/_index.scss +66 -38
  13. package/charts/gauge/styles/_index.scss +12 -1
  14. package/charts/heatmap-chart/styles/_index.scss +90 -53
  15. package/charts/line-chart/styles/_index.scss +143 -139
  16. package/charts/meter-group/styles/_index.scss +87 -25
  17. package/charts/radar-chart/styles/_index.scss +82 -40
  18. package/charts/scatter-chart/styles/_index.scss +117 -44
  19. package/charts/sparkline/styles/_index.scss +7 -1
  20. package/charts/treemap-chart/styles/_index.scss +94 -42
  21. package/charts/waterfall-chart/styles/_index.scss +150 -87
  22. package/color-picker/styles/_index.scss +7 -3
  23. package/copy-value/styles/_index.scss +21 -2
  24. package/counter/styles/_index.scss +1 -8
  25. package/date-picker/styles/_index.scss +15 -9
  26. package/date-stamp/styles/_index.scss +2 -1
  27. package/dialog/styles/_index.scss +43 -0
  28. package/drawer/styles/_index.scss +5 -1
  29. package/editor/styles/_index.scss +1 -8
  30. package/event-calendar/styles/_index.scss +2 -6
  31. package/fesm2022/ngwr-affix.mjs +1 -1
  32. package/fesm2022/ngwr-affix.mjs.map +1 -1
  33. package/fesm2022/ngwr-anchor.mjs +9 -2
  34. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  36. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  38. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  40. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  42. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  44. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  46. package/fesm2022/ngwr-animations-glow-border.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-gradient-flow.mjs.map +1 -1
  48. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  50. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  52. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  54. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  56. package/fesm2022/ngwr-animations-tilt.mjs +20 -13
  57. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  58. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  59. package/fesm2022/ngwr-breadcrumbs.mjs +40 -7
  60. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  61. package/fesm2022/ngwr-button.mjs +12 -3
  62. package/fesm2022/ngwr-button.mjs.map +1 -1
  63. package/fesm2022/ngwr-carousel-testing.mjs +4 -1
  64. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  65. package/fesm2022/ngwr-carousel.mjs +27 -2
  66. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  67. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  68. package/fesm2022/ngwr-cascader.mjs +72 -8
  69. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  71. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  73. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  75. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  77. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  79. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  81. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  83. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  85. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  87. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-core.mjs +311 -23
  89. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  90. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  91. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  92. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  93. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  94. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  95. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  96. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  97. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  98. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  99. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  100. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  101. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  102. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  103. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  104. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  105. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  106. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  107. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  108. package/fesm2022/ngwr-charts-meter-group.mjs +225 -31
  109. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  110. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  111. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  112. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  113. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  114. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  115. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  116. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  117. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  118. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  119. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  120. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  121. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  122. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  123. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  124. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  125. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  126. package/fesm2022/ngwr-checkbox.mjs +3 -2
  127. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  128. package/fesm2022/ngwr-color-picker.mjs +65 -5
  129. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  130. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  131. package/fesm2022/ngwr-context-menu.mjs +51 -24
  132. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  133. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  134. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  135. package/fesm2022/ngwr-copy-value.mjs +38 -2
  136. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  137. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  138. package/fesm2022/ngwr-date-picker.mjs +105 -9
  139. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  140. package/fesm2022/ngwr-dialog.mjs +29 -11
  141. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  142. package/fesm2022/ngwr-directives.mjs +9 -6
  143. package/fesm2022/ngwr-directives.mjs.map +1 -1
  144. package/fesm2022/ngwr-drawer.mjs +19 -3
  145. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  146. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  147. package/fesm2022/ngwr-dropdown.mjs +35 -6
  148. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  149. package/fesm2022/ngwr-editor.mjs +1 -0
  150. package/fesm2022/ngwr-editor.mjs.map +1 -1
  151. package/fesm2022/ngwr-event-calendar.mjs +20 -9
  152. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  153. package/fesm2022/ngwr-form.mjs +170 -3
  154. package/fesm2022/ngwr-form.mjs.map +1 -1
  155. package/fesm2022/ngwr-graph.mjs +81 -13
  156. package/fesm2022/ngwr-graph.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-ar.mjs +20 -0
  158. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-cs.mjs +20 -0
  160. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-de.mjs +20 -0
  162. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-en.mjs +20 -0
  164. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-es.mjs +20 -0
  166. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-fr.mjs +20 -0
  168. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-he.mjs +20 -0
  170. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-hi.mjs +20 -0
  172. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-id.mjs +20 -0
  174. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-it.mjs +20 -0
  176. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-ja.mjs +20 -0
  178. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-ko.mjs +20 -0
  180. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-nl.mjs +20 -0
  182. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n-pl.mjs +20 -0
  184. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  185. package/fesm2022/ngwr-i18n-pt.mjs +20 -0
  186. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  187. package/fesm2022/ngwr-i18n-ru.mjs +20 -0
  188. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  189. package/fesm2022/ngwr-i18n-sv.mjs +20 -0
  190. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  191. package/fesm2022/ngwr-i18n-tr.mjs +20 -0
  192. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  193. package/fesm2022/ngwr-i18n-uk.mjs +20 -0
  194. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  195. package/fesm2022/ngwr-i18n-vi.mjs +20 -0
  196. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  197. package/fesm2022/ngwr-i18n-zh-tw.mjs +20 -0
  198. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  199. package/fesm2022/ngwr-i18n-zh.mjs +20 -0
  200. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  201. package/fesm2022/ngwr-i18n.mjs +82 -11
  202. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  203. package/fesm2022/ngwr-input-number.mjs +24 -1
  204. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  205. package/fesm2022/ngwr-input-otp.mjs +2 -2
  206. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  207. package/fesm2022/ngwr-input.mjs +10 -2
  208. package/fesm2022/ngwr-input.mjs.map +1 -1
  209. package/fesm2022/ngwr-layout.mjs.map +1 -1
  210. package/fesm2022/ngwr-lightbox.mjs +20 -3
  211. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  212. package/fesm2022/ngwr-list.mjs +1 -1
  213. package/fesm2022/ngwr-list.mjs.map +1 -1
  214. package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -1
  215. package/fesm2022/ngwr-loading-bar.mjs +2 -2
  216. package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
  217. package/fesm2022/ngwr-mention.mjs +8 -0
  218. package/fesm2022/ngwr-mention.mjs.map +1 -1
  219. package/fesm2022/ngwr-meta.mjs +9 -6
  220. package/fesm2022/ngwr-meta.mjs.map +1 -1
  221. package/fesm2022/ngwr-overlay.mjs +21 -2
  222. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  223. package/fesm2022/ngwr-page-header.mjs +21 -0
  224. package/fesm2022/ngwr-page-header.mjs.map +1 -1
  225. package/fesm2022/ngwr-pagination.mjs +2 -0
  226. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  227. package/fesm2022/ngwr-pipes.mjs +8 -1
  228. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  229. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  230. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  231. package/fesm2022/ngwr-popconfirm.mjs +43 -6
  232. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  233. package/fesm2022/ngwr-popover.mjs +114 -15
  234. package/fesm2022/ngwr-popover.mjs.map +1 -1
  235. package/fesm2022/ngwr-qr.mjs +6 -2
  236. package/fesm2022/ngwr-qr.mjs.map +1 -1
  237. package/fesm2022/ngwr-radio.mjs +71 -5
  238. package/fesm2022/ngwr-radio.mjs.map +1 -1
  239. package/fesm2022/ngwr-schema-form.mjs +12 -1
  240. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  241. package/fesm2022/ngwr-scroll.mjs +1 -3
  242. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  243. package/fesm2022/ngwr-segmented.mjs +20 -0
  244. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  245. package/fesm2022/ngwr-select.mjs +80 -9
  246. package/fesm2022/ngwr-select.mjs.map +1 -1
  247. package/fesm2022/ngwr-sortable-list.mjs +16 -4
  248. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  249. package/fesm2022/ngwr-storage.mjs +1 -1
  250. package/fesm2022/ngwr-storage.mjs.map +1 -1
  251. package/fesm2022/ngwr-switch.mjs +2 -2
  252. package/fesm2022/ngwr-switch.mjs.map +1 -1
  253. package/fesm2022/ngwr-table.mjs +43 -7
  254. package/fesm2022/ngwr-table.mjs.map +1 -1
  255. package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
  256. package/fesm2022/ngwr-textarea.mjs +2 -2
  257. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  258. package/fesm2022/ngwr-toast.mjs +28 -0
  259. package/fesm2022/ngwr-toast.mjs.map +1 -1
  260. package/fesm2022/ngwr-tour.mjs +16 -11
  261. package/fesm2022/ngwr-tour.mjs.map +1 -1
  262. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  263. package/fesm2022/ngwr-tree.mjs +49 -16
  264. package/fesm2022/ngwr-tree.mjs.map +1 -1
  265. package/fesm2022/ngwr-typography.mjs +20 -0
  266. package/fesm2022/ngwr-typography.mjs.map +1 -1
  267. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  268. package/fesm2022/ngwr-utils.mjs +46 -4
  269. package/fesm2022/ngwr-utils.mjs.map +1 -1
  270. package/fesm2022/ngwr-validators.mjs +33 -1
  271. package/fesm2022/ngwr-validators.mjs.map +1 -1
  272. package/fesm2022/ngwr-version.mjs +1 -1
  273. package/fesm2022/ngwr-version.mjs.map +1 -1
  274. package/fesm2022/ngwr-window.mjs +16 -9
  275. package/fesm2022/ngwr-window.mjs.map +1 -1
  276. package/form/styles/_index.scss +37 -0
  277. package/graph/styles/_index.scss +1 -9
  278. package/i18n/ar.json +20 -0
  279. package/i18n/cs.json +20 -0
  280. package/i18n/de.json +20 -0
  281. package/i18n/en.json +20 -0
  282. package/i18n/es.json +20 -0
  283. package/i18n/fr.json +20 -0
  284. package/i18n/he.json +20 -0
  285. package/i18n/hi.json +20 -0
  286. package/i18n/id.json +20 -0
  287. package/i18n/it.json +20 -0
  288. package/i18n/ja.json +20 -0
  289. package/i18n/ko.json +20 -0
  290. package/i18n/nl.json +20 -0
  291. package/i18n/pl.json +20 -0
  292. package/i18n/pt.json +20 -0
  293. package/i18n/ru.json +20 -0
  294. package/i18n/sv.json +20 -0
  295. package/i18n/tr.json +20 -0
  296. package/i18n/uk.json +20 -0
  297. package/i18n/vi.json +20 -0
  298. package/i18n/zh-TW.json +20 -0
  299. package/i18n/zh.json +20 -0
  300. package/image-cropper/styles/_index.scss +1 -9
  301. package/input-number/styles/_index.scss +7 -0
  302. package/layout/styles/_index.scss +13 -1
  303. package/llms-full.txt +17 -17
  304. package/llms.txt +7 -3
  305. package/loading-bar/styles/_rules.scss +6 -0
  306. package/package.json +2 -2
  307. package/page-header/styles/_index.scss +18 -0
  308. package/popconfirm/styles/_index.scss +6 -0
  309. package/popover/styles/_index.scss +31 -13
  310. package/schematics/use/symbol-map.json +3 -0
  311. package/segmented/styles/_index.scss +7 -0
  312. package/select/styles/_index.scss +7 -0
  313. package/sidebar/styles/_index.scss +6 -0
  314. package/skills/ngwr/references/catalog.md +2 -2
  315. package/sortable-list/styles/_rules.scss +1 -9
  316. package/speed-dial/styles/_index.scss +6 -0
  317. package/stepper/styles/_index.scss +1 -9
  318. package/table/styles/_index.scss +49 -0
  319. package/theme/_index.scss +12 -1
  320. package/theme/styles/_colors.scss +11 -0
  321. package/theme/styles/_contrast.scss +6 -0
  322. package/theme/styles/_index.scss +1 -0
  323. package/theme/styles/_mixins.scss +45 -0
  324. package/theme/styles/_print.scss +17 -0
  325. package/toast/styles/_index.scss +7 -0
  326. package/tour/styles/_index.scss +14 -0
  327. package/tree/styles/_index.scss +1 -9
  328. package/types/ngwr-anchor.d.ts +3 -0
  329. package/types/ngwr-animations-aurora.d.ts +6 -0
  330. package/types/ngwr-animations-blur-reveal.d.ts +6 -0
  331. package/types/ngwr-animations-click-sparks.d.ts +6 -0
  332. package/types/ngwr-animations-confetti.d.ts +6 -0
  333. package/types/ngwr-animations-decode.d.ts +6 -0
  334. package/types/ngwr-animations-destruct.d.ts +6 -0
  335. package/types/ngwr-animations-dot-grid.d.ts +6 -0
  336. package/types/ngwr-animations-falling-letters.d.ts +6 -0
  337. package/types/ngwr-animations-flow-lines.d.ts +6 -0
  338. package/types/ngwr-animations-fluid-cursor.d.ts +6 -0
  339. package/types/ngwr-animations-glitch.d.ts +6 -0
  340. package/types/ngwr-animations-glow-border.d.ts +6 -0
  341. package/types/ngwr-animations-gradient-flow.d.ts +6 -0
  342. package/types/ngwr-animations-marquee.d.ts +6 -0
  343. package/types/ngwr-animations-orbit.d.ts +6 -0
  344. package/types/ngwr-animations-reveal.d.ts +6 -0
  345. package/types/ngwr-animations-ripple-grid.d.ts +6 -0
  346. package/types/ngwr-animations-rotate-reveal.d.ts +6 -0
  347. package/types/ngwr-animations-shimmer.d.ts +6 -0
  348. package/types/ngwr-animations-spotlight.d.ts +6 -0
  349. package/types/ngwr-animations-thread-lines.d.ts +6 -0
  350. package/types/ngwr-animations-tilt.d.ts +10 -0
  351. package/types/ngwr-animations-typewriter.d.ts +6 -0
  352. package/types/ngwr-breadcrumbs.d.ts +25 -0
  353. package/types/ngwr-button.d.ts +23 -3
  354. package/types/ngwr-carousel-testing.d.ts +6 -4
  355. package/types/ngwr-carousel.d.ts +16 -3
  356. package/types/ngwr-cascader-testing.d.ts +4 -3
  357. package/types/ngwr-cascader.d.ts +34 -3
  358. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  359. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  360. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  361. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  362. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  363. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  364. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  365. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  366. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  367. package/types/ngwr-charts-core.d.ts +275 -21
  368. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  369. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  370. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  371. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  372. package/types/ngwr-charts-gauge.d.ts +72 -10
  373. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  374. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  375. package/types/ngwr-charts-line-chart.d.ts +215 -86
  376. package/types/ngwr-charts-meter-group.d.ts +98 -7
  377. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  378. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  379. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  380. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  381. package/types/ngwr-charts-sparkline.d.ts +26 -4
  382. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  383. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  384. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  385. package/types/ngwr-checkbox.d.ts +1 -0
  386. package/types/ngwr-color-picker.d.ts +28 -0
  387. package/types/ngwr-context-menu-testing.d.ts +10 -9
  388. package/types/ngwr-context-menu.d.ts +18 -1
  389. package/types/ngwr-copy-value.d.ts +8 -0
  390. package/types/ngwr-date-picker.d.ts +53 -2
  391. package/types/ngwr-dialog.d.ts +64 -13
  392. package/types/ngwr-directives.d.ts +12 -4
  393. package/types/ngwr-drawer.d.ts +33 -2
  394. package/types/ngwr-dropdown-testing.d.ts +8 -5
  395. package/types/ngwr-dropdown.d.ts +29 -6
  396. package/types/ngwr-event-calendar.d.ts +4 -0
  397. package/types/ngwr-form.d.ts +85 -1
  398. package/types/ngwr-graph.d.ts +22 -6
  399. package/types/ngwr-i18n.d.ts +65 -5
  400. package/types/ngwr-input-number.d.ts +8 -0
  401. package/types/ngwr-input.d.ts +7 -0
  402. package/types/ngwr-layout.d.ts +1 -1
  403. package/types/ngwr-lightbox.d.ts +15 -0
  404. package/types/ngwr-loading-bar-router.d.ts +6 -0
  405. package/types/ngwr-overlay.d.ts +16 -1
  406. package/types/ngwr-page-header.d.ts +23 -1
  407. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  408. package/types/ngwr-popconfirm.d.ts +29 -2
  409. package/types/ngwr-popover.d.ts +87 -13
  410. package/types/ngwr-radio.d.ts +47 -5
  411. package/types/ngwr-segmented.d.ts +7 -0
  412. package/types/ngwr-select.d.ts +57 -13
  413. package/types/ngwr-sortable-list.d.ts +20 -7
  414. package/types/ngwr-table.d.ts +59 -6
  415. package/types/ngwr-tabs-router.d.ts +6 -0
  416. package/types/ngwr-toast.d.ts +11 -0
  417. package/types/ngwr-tour.d.ts +21 -3
  418. package/types/ngwr-tree-testing.d.ts +1 -2
  419. package/types/ngwr-tree.d.ts +33 -2
  420. package/types/ngwr-typography.d.ts +7 -0
  421. package/types/ngwr-utils-router.d.ts +6 -0
  422. package/types/ngwr-utils.d.ts +56 -2
  423. package/types/ngwr-validators.d.ts +49 -1
  424. package/types/ngwr-version.d.ts +1 -1
  425. package/types/ngwr-window.d.ts +14 -11
  426. package/typography/styles/_index.scss +4 -0
  427. package/window/styles/_index.scss +6 -19
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-funnel-chart-testing.mjs","names":[],"sources":["../../../projects/lib/charts/funnel-chart/testing/wr-funnel-chart-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrFunnelChartHarnessFilters, WrFunnelChartHarnessStage, WrFunnelChartTableRow } from './types';\n\n/** The `width: <n>%` the component writes onto a bar, out of its inline `style`. */\nconst BAR_WIDTH = /(?:^|;)\\s*width\\s*:\\s*([\\d.]+)%/;\n\n/**\n * One stage row, so its label, its figures and its bar are read off the row they sit in\n * rather than matched up by position across the chart — a missing stage has no bar and a\n * stage with no figure no value, so lists of each would not line up.\n */\nclass StageHarness extends ComponentHarness {\n static hostSelector = '.wr-funnel-chart__stage';\n\n async read(): Promise<WrFunnelChartHarnessStage> {\n const host = await this.host();\n const label = await this.locatorFor('.wr-funnel-chart__label')();\n const value = await this.locatorForOptional('.wr-funnel-chart__value')();\n const overall = await this.locatorForOptional('.wr-funnel-chart__overall')();\n const bar = await this.locatorForOptional('.wr-funnel-chart__bar')();\n return {\n label: await label.text(),\n value: value ? await value.text() : null,\n fromFirst: overall ? await overall.text() : null,\n name: await host.getAttribute('aria-label'),\n widthPercent: bar ? StageHarness.widthOf(await bar.getAttribute('style')) : null,\n };\n }\n\n /** Parse a bar's declared width. See the class note on {@link WrFunnelChartHarness} for why this is not `getCssValue()`. */\n private static widthOf(style: string | null): number {\n const match = BAR_WIDTH.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrFunnelChartHarness.getStages(): a bar carries no inline width percentage (style: \"${style ?? ''}\"). ` +\n 'The component writes one for every bar it draws, a stage of zero included, so its absence is the bug — ' +\n 'reporting 0 would read as a stage of zero.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n}\n\n/** The gap between two stages: the band and the share of the stage above. */\nclass GapHarness extends ComponentHarness {\n static hostSelector = '.wr-funnel-chart__gap';\n\n async label(): Promise<string | null> {\n const label = await this.locatorForOptional('.wr-funnel-chart__gap-label')();\n return label ? label.text() : null;\n }\n}\n\n/** One body row of the chart's data table. */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrFunnelChartTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/**\n * Test harness for `<wr-funnel-chart>`.\n *\n * **The bars are read as PERCENTAGES of the track, not as pixels.** Each bar's width is\n * written inline as a share of the full width — the largest stage, or `max` — which is\n * the one number that survives a test with no layout, and the component's whole job. It is\n * read off the `style` ATTRIBUTE rather than through `getCssValue()`, which is\n * `getComputedStyle()`: in a browser that answers the laid-out pixels and in jsdom the\n * declaration, with nothing to say which, and with no inline width at all it would fall\n * back to the stylesheet's and read as a stage of zero. The hairline a stage of zero keeps\n * is the stylesheet's floor, so no method reports it.\n *\n * **Two questions are not one.** A stage's printed text and its accessible name are read\n * separately ({@link WrFunnelChartHarnessStage.value} and {@link WrFunnelChartHarnessStage.name}): the\n * row is an `img`, so the name is what a screen reader gets, and asserting only what is\n * drawn would pass on a stage that announces nothing. The shares printed between the bars\n * are `aria-hidden` for the same reason — {@link getGapLabels} reads what is drawn, the\n * names carry the same figures.\n *\n * **The bands' shapes are not read.** Each is a `clip-path` polygon from one bar's width\n * to the next, and asserting its corners would restate the bar widths this harness already\n * reads; {@link getBandCount} counts them, since where one is missing is the decision\n * worth catching — there is none next to a missing stage.\n *\n * **No hover method.** The tooltip repeats the stage's name, and the chip renders into\n * the overlay container with nothing tying it to this chart, so a query for it would\n * answer with whichever chart's chip is open. The same figures are in the names and in the\n * data table, which {@link getTableRows} reads.\n *\n * @example\n * ```ts\n * const chart = await loader.getHarness(WrFunnelChartHarness);\n *\n * expect(await chart.getLabels()).toEqual(['Visited', 'Signed up', 'Paid']);\n * expect((await chart.getStages())[1].widthPercent).toBe(40);\n * expect(await chart.getGapLabels()).toEqual(['40%', '15%']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrFunnelChartHarness extends ComponentHarness {\n static hostSelector = 'wr-funnel-chart';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrFunnelChartHarnessFilters = {}): HarnessPredicate<WrFunnelChartHarness> {\n return new HarnessPredicate(WrFunnelChartHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('stageLabel', options.stageLabel, async (harness, label) => {\n for (const stage of await harness.getLabels()) {\n if (await HarnessPredicate.stringMatches(stage, label)) return true;\n }\n return false;\n });\n }\n\n /** The chart's accessible name, on the `group` that holds the stages. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor('.wr-funnel-chart__plot')()).getAttribute('aria-label');\n }\n\n /** Every stage, from the top of the funnel down: what it prints, what it announces and how wide its bar is. */\n async getStages(): Promise<WrFunnelChartHarnessStage[]> {\n const stages = await this.locatorForAll(StageHarness)();\n return Promise.all(stages.map(stage => stage.read()));\n }\n\n /** How many stages the chart drew — one per stage given, a missing one included. */\n async getStageCount(): Promise<number> {\n return (await this.locatorForAll('.wr-funnel-chart__stage')()).length;\n }\n\n /** The labels beside the bars, in order — the full text, ellipsised on screen or not. */\n async getLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-funnel-chart__label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /**\n * The share of the stage above printed in each gap between two bars, from the top down —\n * one entry per gap, so one fewer than there are stages. `null` where none is printed:\n * a stage with no such share, or a `conversion` that leaves it off the drawing.\n */\n async getGapLabels(): Promise<(string | null)[]> {\n const gaps = await this.locatorForAll(GapHarness)();\n return Promise.all(gaps.map(gap => gap.label()));\n }\n\n /**\n * How many bands join two bars: one per gap whose two stages both have a value. A missing\n * stage breaks the funnel on either side of it, since a band across it would draw a drop\n * the data never gave.\n */\n async getBandCount(): Promise<number> {\n return (await this.locatorForAll('.wr-funnel-chart__band')()).length;\n }\n\n /** Whether any value is printed beside a bar (`showValues`). */\n async hasValues(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-funnel-chart__value')()) !== null;\n }\n\n /** Whether the hidden data table is rendered (`dataTable`). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the value, the share of the previous stage and the\n * share of the first, in that order.\n *\n * Throws when the chart renders no table (`dataTable` off) rather than answering with\n * no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n // The first cell is the corner over the row headers — what one row is, a `<th>` or an\n // empty `<td>` — not a column of figures.\n const cells = await this.locatorForAll('.wr-chart-table thead tr > *')();\n return Promise.all(cells.slice(1).map(cell => cell.text()));\n }\n\n /**\n * The data table's rows, one per stage: its label and its three figures, as a screen\n * reader walks them. A stage above a fixed `max` is drawn full width and tabulated as\n * itself, and a figure the stage does not have is `''`.\n *\n * Throws when the chart renders no table (`dataTable` off), for the reason\n * {@link getTableColumns} gives.\n */\n async getTableRows(): Promise<WrFunnelChartTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrFunnelChartHarness.${method}(): the chart renders no data table — \\`dataTable\\` is off. Ask hasDataTable() first.`\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,YAAY;AAOlB,IAAM,eAAN,MAAM,qBAAqB,iBAAgB;CACzC,OAAO,eAAe;CAEtB,MAAM,OAAI;EACR,MAAM,OAAO,MAAM,KAAK,KAAI;EAC5B,MAAM,QAAQ,MAAM,KAAK,WAAW,yBAAyB,CAAC,CAAA;EAC9D,MAAM,QAAQ,MAAM,KAAK,mBAAmB,yBAAyB,CAAC,CAAA;EACtE,MAAM,UAAU,MAAM,KAAK,mBAAmB,2BAA2B,CAAC,CAAA;EAC1E,MAAM,MAAM,MAAM,KAAK,mBAAmB,uBAAuB,CAAC,CAAA;EAClE,OAAO;GACL,OAAO,MAAM,MAAM,KAAI;GACvB,OAAO,QAAQ,MAAM,MAAM,KAAI,IAAK;GACpC,WAAW,UAAU,MAAM,QAAQ,KAAI,IAAK;GAC5C,MAAM,MAAM,KAAK,aAAa,YAAY;GAC1C,cAAc,MAAM,aAAa,QAAQ,MAAM,IAAI,aAAa,OAAO,CAAC,IAAI;EAC7E;CACH;CAGQ,OAAO,QAAQ,OAAoB;EACzC,MAAM,QAAQ,UAAU,KAAK,SAAS,EAAE;EACxC,IAAI,CAAC,OACH,MAAM,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funnel-chart/testing/wr-funnel-chart-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrFunnelChartHarnessFilters, WrFunnelChartHarnessStage, WrFunnelChartTableRow } from './types';\n\n/** The share of the track the component writes onto a bar, 0 to 1, out of its inline `style`. */\nconst BAR_SCALE = /(?:^|;)\\s*--wr-funnel-chart-bar-scale\\s*:\\s*([\\d.]+)/;\n\n/**\n * One stage row, so its label, its figures and its bar are read off the row they sit in\n * rather than matched up by position across the chart — a missing stage has no bar and a\n * stage with no figure no value, so lists of each would not line up.\n */\nclass StageHarness extends ComponentHarness {\n static hostSelector = '.wr-funnel-chart__stage';\n\n async read(): Promise<WrFunnelChartHarnessStage> {\n const host = await this.host();\n const label = await this.locatorFor('.wr-funnel-chart__label')();\n const value = await this.locatorForOptional('.wr-funnel-chart__value')();\n const overall = await this.locatorForOptional('.wr-funnel-chart__overall')();\n const bar = await this.locatorForOptional('.wr-funnel-chart__bar')();\n return {\n label: await label.text(),\n value: value ? await value.text() : null,\n fromFirst: overall ? await overall.text() : null,\n name: await host.getAttribute('aria-label'),\n widthPercent: bar ? StageHarness.widthOf(await bar.getAttribute('style')) : null,\n };\n }\n\n /** Parse a bar's declared width. See the class note on {@link WrFunnelChartHarness} for why this is not `getCssValue()`. */\n private static widthOf(style: string | null): number {\n const match = BAR_SCALE.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrFunnelChartHarness.getStages(): a bar carries no inline share of the track (style: \"${style ?? ''}\"). ` +\n 'The component writes one for every bar it draws, a stage of zero included, so its absence is the bug — ' +\n 'reporting 0 would read as a stage of zero.'\n );\n }\n return Math.round(Number.parseFloat(match[1]) * 1e5) / 1e3;\n }\n}\n\n/** The gap between two stages: the band and the share of the stage above. */\nclass GapHarness extends ComponentHarness {\n static hostSelector = '.wr-funnel-chart__gap';\n\n async label(): Promise<string | null> {\n const label = await this.locatorForOptional('.wr-funnel-chart__gap-label')();\n return label ? label.text() : null;\n }\n}\n\n/** One body row of the chart's data table. */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrFunnelChartTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/**\n * Test harness for `<wr-funnel-chart>`.\n *\n * **The bars are read as PERCENTAGES of the track, not as pixels.** Each bar's width is\n * written inline as a share of the full width — the largest stage, or `max` — which is\n * the one number that survives a test with no layout, and the component's whole job. It is\n * read off the `style` ATTRIBUTE rather than through `getCssValue()`, which is\n * `getComputedStyle()`: in a browser that answers the laid-out pixels and in jsdom the\n * declaration, with nothing to say which, and with no inline width at all it would fall\n * back to the stylesheet's and read as a stage of zero. The hairline a stage of zero keeps\n * is the stylesheet's floor, so no method reports it.\n *\n * **Two questions are not one.** A stage's printed text and its accessible name are read\n * separately ({@link WrFunnelChartHarnessStage.value} and {@link WrFunnelChartHarnessStage.name}): the\n * row is an `img`, so the name is what a screen reader gets, and asserting only what is\n * drawn would pass on a stage that announces nothing. The shares printed between the bars\n * are `aria-hidden` for the same reason — {@link getGapLabels} reads what is drawn, the\n * names carry the same figures.\n *\n * **The bands' shapes are not read.** Each is a `clip-path` polygon from one bar's width\n * to the next, and asserting its corners would restate the bar widths this harness already\n * reads; {@link getBandCount} counts them, since where one is missing is the decision\n * worth catching — there is none next to a missing stage.\n *\n * **No hover method.** The tooltip repeats the stage's name, and the chip renders into\n * the overlay container with nothing tying it to this chart, so a query for it would\n * answer with whichever chart's chip is open. The same figures are in the names and in the\n * data table, which {@link getTableRows} reads.\n *\n * @example\n * ```ts\n * const chart = await loader.getHarness(WrFunnelChartHarness);\n *\n * expect(await chart.getLabels()).toEqual(['Visited', 'Signed up', 'Paid']);\n * expect((await chart.getStages())[1].widthPercent).toBe(40);\n * expect(await chart.getGapLabels()).toEqual(['40%', '15%']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrFunnelChartHarness extends ComponentHarness {\n static hostSelector = 'wr-funnel-chart';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrFunnelChartHarnessFilters = {}): HarnessPredicate<WrFunnelChartHarness> {\n return new HarnessPredicate(WrFunnelChartHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('stageLabel', options.stageLabel, async (harness, label) => {\n for (const stage of await harness.getLabels()) {\n if (await HarnessPredicate.stringMatches(stage, label)) return true;\n }\n return false;\n });\n }\n\n /** The chart's accessible name, on the `group` that holds the stages. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor('.wr-funnel-chart__plot')()).getAttribute('aria-label');\n }\n\n /** Every stage, from the top of the funnel down: what it prints, what it announces and how wide its bar is. */\n async getStages(): Promise<WrFunnelChartHarnessStage[]> {\n const stages = await this.locatorForAll(StageHarness)();\n return Promise.all(stages.map(stage => stage.read()));\n }\n\n /** How many stages the chart drew — one per stage given, a missing one included. */\n async getStageCount(): Promise<number> {\n return (await this.locatorForAll('.wr-funnel-chart__stage')()).length;\n }\n\n /** The labels beside the bars, in order — the full text, ellipsised on screen or not. */\n async getLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-funnel-chart__label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /**\n * The share of the stage above printed in each gap between two bars, from the top down —\n * one entry per gap, so one fewer than there are stages. `null` where none is printed:\n * a stage with no such share, or a `conversion` that leaves it off the drawing.\n */\n async getGapLabels(): Promise<(string | null)[]> {\n const gaps = await this.locatorForAll(GapHarness)();\n return Promise.all(gaps.map(gap => gap.label()));\n }\n\n /**\n * How many bands join two bars: one per gap whose two stages both have a value. A missing\n * stage breaks the funnel on either side of it, since a band across it would draw a drop\n * the data never gave.\n */\n async getBandCount(): Promise<number> {\n return (await this.locatorForAll('.wr-funnel-chart__band')()).length;\n }\n\n /** Whether any value is printed beside a bar (`showValues`). */\n async hasValues(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-funnel-chart__value')()) !== null;\n }\n\n /** Whether the hidden data table is rendered (`dataTable`). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the value, the share of the previous stage and the\n * share of the first, in that order.\n *\n * Throws when the chart renders no table (`dataTable` off) rather than answering with\n * no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n // The first cell is the corner over the row headers — what one row is, a `<th>` or an\n // empty `<td>` — not a column of figures.\n const cells = await this.locatorForAll('.wr-chart-table thead tr > *')();\n return Promise.all(cells.slice(1).map(cell => cell.text()));\n }\n\n /**\n * The data table's rows, one per stage: its label and its three figures, as a screen\n * reader walks them. A stage above a fixed `max` is drawn full width and tabulated as\n * itself, and a figure the stage does not have is `''`.\n *\n * Throws when the chart renders no table (`dataTable` off), for the reason\n * {@link getTableColumns} gives.\n */\n async getTableRows(): Promise<WrFunnelChartTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrFunnelChartHarness.${method}(): the chart renders no data table — \\`dataTable\\` is off. Ask hasDataTable() first.`\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,YAAY;AAOlB,IAAM,eAAN,MAAM,qBAAqB,iBAAgB;CACzC,OAAO,eAAe;CAEtB,MAAM,OAAI;EACR,MAAM,OAAO,MAAM,KAAK,KAAI;EAC5B,MAAM,QAAQ,MAAM,KAAK,WAAW,yBAAyB,CAAC,CAAA;EAC9D,MAAM,QAAQ,MAA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AiB;EAG5C,MAAM,QAAQ,MAAM,KAAK,cAAc,8BAA8B,CAAC,CAAA;EACtE,OAAO,QAAQ,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,KAAI,SAAQ,KAAK,KAAI,CAAE,CAAC;CAC5D;CAUA,MAAM,eAAY;EAChB,MAAM,KAAK,gBAAgB,cAAc;EACzC,MAAM,OAAO,MAAM,KAAK,cAAc,eAAe,CAAC,CAAA;EACtD,OAAO,QAAQ,IAAI,KAAK,KAAI,QAAO,IAAI,KAAI,CAAE,CAAC;CAChD;CAEQ,MAAM,gBAAgB,QAAc;EAC1C,IAAI,CAAE,MAAM,KAAK,aAAY,GAC3B,MAAM,IAAI,MACR,wBAAwB,OAAM,sFAAuF;CAG3H"}
@@ -3,15 +3,15 @@ import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input, viewC
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { wrCheckStyles, wrClamp } from "ngwr/utils";
5
5
  import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
6
- import { WrChartTable, useChartNumbers } from "ngwr/charts/core";
7
- import { useChartTooltip } from "ngwr/popover";
6
+ import { WrChartState, WrChartTable, useChartHover, useChartNumbers, useChartState, wrChartNumberFormat, wrChartRound } from "ngwr/charts/core";
7
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
8
8
  /**
9
9
  * @license
10
10
  *
11
11
  * Use of this source code is governed by an MIT-style license that can be
12
12
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
13
13
  */
14
- const short = (value) => Math.round(value * 1e3) / 1e3 || 0;
14
+ const short = (value) => wrChartRound(value, 3);
15
15
  function share(value, reference) {
16
16
  if (value === null || reference === null || reference <= 0 || value < 0) return null;
17
17
  return value / reference;
@@ -19,11 +19,15 @@ function share(value, reference) {
19
19
  var WrFunnelChart = class WrFunnelChart {
20
20
  constructor() {
21
21
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("charts/funnel-chart");
22
+ useChartHover({
23
+ enter: (index) => this.tip.enter(index),
24
+ leave: (event) => this.tip.leave(event)
25
+ });
22
26
  }
23
27
  stages = input([], ...ngDevMode ? [{ debugName: "stages" }] : /* istanbul ignore next */ []);
24
28
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
25
29
  resolvedAriaLabel = useI18nText(this.ariaLabel, "funnelChart.label", "Funnel chart");
26
- color = input("var(--wr-color-primary)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
30
+ color = input("var(--wr-chart-1)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
27
31
  max = input(0, {
28
32
  ...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
29
33
  transform: (v) => {
@@ -39,8 +43,19 @@ var WrFunnelChart = class WrFunnelChart {
39
43
  valueLabel = input(null, ...ngDevMode ? [{ debugName: "valueLabel" }] : /* istanbul ignore next */ []);
40
44
  tooltip = input(true, {
41
45
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
46
+ transform: wrCoerceChartTooltip
47
+ });
48
+ loading = input(false, {
49
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
50
+ transform: coerceBooleanProperty
51
+ });
52
+ error = input(false, {
53
+ ...ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {},
42
54
  transform: coerceBooleanProperty
43
55
  });
56
+ emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
57
+ loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
58
+ errorLabel = input(null, ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
44
59
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
45
60
  percentFormat = input(null, ...ngDevMode ? [{ debugName: "percentFormat" }] : /* istanbul ignore next */ []);
46
61
  dataTable = input(false, {
@@ -49,11 +64,11 @@ var WrFunnelChart = class WrFunnelChart {
49
64
  });
50
65
  numbers = useChartNumbers(this.valueFormat);
51
66
  locale = inject(LOCALE_ID);
52
- percents = new Intl.NumberFormat(this.locale, {
67
+ percents = wrChartNumberFormat(this.locale, {
53
68
  style: "percent",
54
69
  maximumFractionDigits: 1
55
70
  });
56
- smallPercents = new Intl.NumberFormat(this.locale, {
71
+ smallPercents = wrChartNumberFormat(this.locale, {
57
72
  style: "percent",
58
73
  maximumSignificantDigits: 2
59
74
  });
@@ -113,7 +128,7 @@ var WrFunnelChart = class WrFunnelChart {
113
128
  label: stage.label,
114
129
  value: stage.value,
115
130
  color: stage.color,
116
- width: `${short(stage.width * 100)}%`,
131
+ scale: wrChartRound(stage.width, 5),
117
132
  valueText,
118
133
  previousText,
119
134
  firstText,
@@ -124,6 +139,14 @@ var WrFunnelChart = class WrFunnelChart {
124
139
  };
125
140
  });
126
141
  }, ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
142
+ state = useChartState({
143
+ loading: this.loading,
144
+ error: this.error,
145
+ empty: computed(() => this.stages().length === 0),
146
+ emptyLabel: this.emptyLabel,
147
+ loadingLabel: this.loadingLabel,
148
+ errorLabel: this.errorLabel
149
+ });
127
150
  tableData = computed(() => ({
128
151
  caption: this.resolvedAriaLabel(),
129
152
  corner: this.stageName(),
@@ -263,6 +286,41 @@ var WrFunnelChart = class WrFunnelChart {
263
286
  isRequired: false,
264
287
  transformFunction: null
265
288
  },
289
+ loading: {
290
+ classPropertyName: "loading",
291
+ publicName: "loading",
292
+ isSignal: true,
293
+ isRequired: false,
294
+ transformFunction: null
295
+ },
296
+ error: {
297
+ classPropertyName: "error",
298
+ publicName: "error",
299
+ isSignal: true,
300
+ isRequired: false,
301
+ transformFunction: null
302
+ },
303
+ emptyLabel: {
304
+ classPropertyName: "emptyLabel",
305
+ publicName: "emptyLabel",
306
+ isSignal: true,
307
+ isRequired: false,
308
+ transformFunction: null
309
+ },
310
+ loadingLabel: {
311
+ classPropertyName: "loadingLabel",
312
+ publicName: "loadingLabel",
313
+ isSignal: true,
314
+ isRequired: false,
315
+ transformFunction: null
316
+ },
317
+ errorLabel: {
318
+ classPropertyName: "errorLabel",
319
+ publicName: "errorLabel",
320
+ isSignal: true,
321
+ isRequired: false,
322
+ transformFunction: null
323
+ },
266
324
  valueFormat: {
267
325
  classPropertyName: "valueFormat",
268
326
  publicName: "valueFormat",
@@ -293,8 +351,13 @@ var WrFunnelChart = class WrFunnelChart {
293
351
  isSignal: true
294
352
  }],
295
353
  ngImport: i0,
296
- template: "@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",
354
+ template: "@let previous = showPrevious();\n@let first = showFirst();\n@let values = showValues();\n@let active = activeStage();\n@let shown = state();\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\n class=\"wr-funnel-chart__plot\"\n role=\"group\"\n [class.wr-funnel-chart__plot--idle]=\"!!shown\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n>\n @if (shown) {\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n @for (row of shown ? [] : 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. `data-wr-index` is what the\n chart's one hover listener reads the stage off, and `data-wr-series` what dims the\n other stages while the pointer is on this one. -->\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 [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"`s${$index}`\"\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. The bar is\n as wide as the track and scaled to its share, so its length is a transform. -->\n @if (row.value !== null) {\n <span\n class=\"wr-funnel-chart__bar\"\n [class.wr-funnel-chart__bar--hairline]=\"row.scale === 0\"\n [style.--wr-funnel-chart-bar-scale]=\"row.scale\"\n [style.background]=\"row.color\"\n ></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",
297
355
  dependencies: [{
356
+ kind: "component",
357
+ type: WrChartState,
358
+ selector: "wr-chart-state",
359
+ inputs: ["kind", "label"]
360
+ }, {
298
361
  kind: "component",
299
362
  type: WrChartTable,
300
363
  selector: "wr-chart-table",
@@ -314,8 +377,8 @@ i0.ɵɵngDeclareClassMetadata({
314
377
  selector: "wr-funnel-chart",
315
378
  encapsulation: ViewEncapsulation.None,
316
379
  host: { class: "wr-funnel-chart" },
317
- imports: [WrChartTable],
318
- template: "@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"
380
+ imports: [WrChartState, WrChartTable],
381
+ template: "@let previous = showPrevious();\n@let first = showFirst();\n@let values = showValues();\n@let active = activeStage();\n@let shown = state();\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\n class=\"wr-funnel-chart__plot\"\n role=\"group\"\n [class.wr-funnel-chart__plot--idle]=\"!!shown\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n>\n @if (shown) {\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n @for (row of shown ? [] : 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. `data-wr-index` is what the\n chart's one hover listener reads the stage off, and `data-wr-series` what dims the\n other stages while the pointer is on this one. -->\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 [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"`s${$index}`\"\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. The bar is\n as wide as the track and scaled to its share, so its length is a transform. -->\n @if (row.value !== null) {\n <span\n class=\"wr-funnel-chart__bar\"\n [class.wr-funnel-chart__bar--hairline]=\"row.scale === 0\"\n [style.--wr-funnel-chart-bar-scale]=\"row.scale\"\n [style.background]=\"row.color\"\n ></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"
319
382
  }]
320
383
  }],
321
384
  ctorParameters: () => [],
@@ -384,6 +447,46 @@ i0.ɵɵngDeclareClassMetadata({
384
447
  required: false
385
448
  }]
386
449
  }],
450
+ loading: [{
451
+ type: i0.Input,
452
+ args: [{
453
+ isSignal: true,
454
+ alias: "loading",
455
+ required: false
456
+ }]
457
+ }],
458
+ error: [{
459
+ type: i0.Input,
460
+ args: [{
461
+ isSignal: true,
462
+ alias: "error",
463
+ required: false
464
+ }]
465
+ }],
466
+ emptyLabel: [{
467
+ type: i0.Input,
468
+ args: [{
469
+ isSignal: true,
470
+ alias: "emptyLabel",
471
+ required: false
472
+ }]
473
+ }],
474
+ loadingLabel: [{
475
+ type: i0.Input,
476
+ args: [{
477
+ isSignal: true,
478
+ alias: "loadingLabel",
479
+ required: false
480
+ }]
481
+ }],
482
+ errorLabel: [{
483
+ type: i0.Input,
484
+ args: [{
485
+ isSignal: true,
486
+ alias: "errorLabel",
487
+ required: false
488
+ }]
489
+ }],
387
490
  valueFormat: [{
388
491
  type: i0.Input,
389
492
  args: [{
@@ -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 { 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,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI;EACvD;CAAC,CAAA;CASM,aAAa,MAA0B,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAG9C,aAAa,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,aAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAM3D,aAAa,MAAqB,MAAK,GAAA,YAAA,CAA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AA;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
+ {"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 {\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip, wrCoerceChartTooltip } 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 => wrChartRound(value, 3);\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 * **On the chart theme.** The bars are the first colour of the chart palette, the band\n * between two of them the theme's track, and the corners the theme's radius. Hovering a\n * stage dims the others. With no stage the chart keeps a box and says \"No data\";\n * `loading` and `error` put their own message there in place of the stages.\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: [WrChartState, WrChartTable],\n})\nexport class WrFunnelChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/funnel-chart');\n // One pair of listeners on the host, not two on every stage: the stage under the\n // pointer is the nearest element up from it carrying `data-wr-index`.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\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. The first colour of\n * the chart palette, which is the brand colour unless the theme says otherwise.\n * @default 'var(--wr-chart-1)'\n */\n readonly color = input<string>('var(--wr-chart-1)');\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.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * A request for the chart's data is in flight: the stages give way to the loading\n * message. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the stages give way to the error message. `loading`\n * wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is no stage. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /**\n * 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 = wrChartNumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Below 1%, by significant digits, which keep 0.0004 from printing as `0%`. */\n private readonly smallPercents = wrChartNumberFormat(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 /**\n * The bar's length as a share of the track, 0 to 1: the bar is as wide as the\n * track and scaled to this, so a new value moves a transform and lays nothing out.\n */\n scale: wrChartRound(stage.width, 5),\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 /** What the chart shows in place of its stages, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.stages().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\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@let shown = state();\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\n class=\"wr-funnel-chart__plot\"\n role=\"group\"\n [class.wr-funnel-chart__plot--idle]=\"!!shown\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n>\n @if (shown) {\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n @for (row of shown ? [] : 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. `data-wr-index` is what the\n chart's one hover listener reads the stage off, and `data-wr-series` what dims the\n other stages while the pointer is on this one. -->\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 [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"`s${$index}`\"\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. The bar is\n as wide as the track and scaled to its share, so its length is a transform. -->\n @if (row.value !== null) {\n <span\n class=\"wr-funnel-chart__bar\"\n [class.wr-funnel-chart__bar--hairline]=\"row.scale === 0\"\n [style.--wr-funnel-chart-bar-scale]=\"row.scale\"\n [style.background]=\"row.color\"\n ></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":";;;;;;;;;;;;;AAoCA,MAAM,SAAS,UAA0B,aAAa,OAAO,CAAC;AAQ9D,SAAS,MAAM,OAAsB,WAAwB;CAC3D,IAAI,UAAU,QAAQ,cAAc,QAAQ,aAAa,KAAK,QAAQ,GAAG,OAAO;CAChF,OAAO,QAAQ;AACjB;AAkFA,IAAa,gBAAb,MAAa,cAAa;CACxB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,qBAAqB;EAGtF,cAAc;GAAE,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;GAAG,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;EAAC,CAAE;CAChG;CAMS,SAAS,MAAgC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA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AA;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 +1 @@
1
- {"version":3,"file":"ngwr-charts-gauge-testing.mjs","names":[],"sources":["../../../projects/lib/charts/gauge/testing/wr-gauge-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrGaugeHarnessFilters } from './types';\n\n/**\n * Test harness for `<wr-gauge>`.\n *\n * **The dial is `aria-hidden` and the printed number is optional, so the ARIA is the\n * whole readable surface.** The component carries `role=\"meter\"` with the value\n * trio and an `aria-valuetext` that includes the suffix — which is what makes a\n * gauge with `showValue` off readable at all. {@link getValue} is what it announces;\n * {@link getDisplayValue} is what is drawn, and it is `null` when nothing is.\n *\n * The arc is an SVG path, and its `d` is a rendering detail rather than an\n * assertion — it moves with the size, the stroke width and the sweep.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGaugeHarness extends ComponentHarness {\n static hostSelector = 'wr-gauge';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrGaugeHarnessFilters = {}): HarnessPredicate<WrGaugeHarness> {\n return new HarnessPredicate(WrGaugeHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('value', options.value, async (harness, value) => (await harness.getValue()) === value);\n }\n\n private readonly surface = this.locatorFor('.wr-gauge__surface');\n\n /** The role the dial announces — `meter`, which is what a gauge is. */\n async getRole(): Promise<string | null> {\n return (await this.surface()).getAttribute('role');\n }\n\n /** The dial's accessible name. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.surface()).getAttribute('aria-label');\n }\n\n /** The value it announces, from `aria-valuenow`. */\n async getValue(): Promise<number> {\n return this.numberAttribute('aria-valuenow', 'getValue');\n }\n\n /** The bottom of the range, from `aria-valuemin`. */\n async getMin(): Promise<number> {\n return this.numberAttribute('aria-valuemin', 'getMin');\n }\n\n /** The top of the range, from `aria-valuemax`. */\n async getMax(): Promise<number> {\n return this.numberAttribute('aria-valuemax', 'getMax');\n }\n\n /**\n * A finite number off one of the meter's attributes, or a sentence saying which one\n * it lacks. `Number(null)` is `0`, so a lost binding read as a range starting at zero.\n */\n private async numberAttribute(name: string, method: string): Promise<number> {\n const raw = await (await this.surface()).getAttribute(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new Error(\n `WrGaugeHarness.${method}(): the meter carries ${name}=\"${raw ?? ''}\", which the component writes as a ` +\n 'finite number on every gauge.'\n );\n }\n return value;\n }\n\n /**\n * The spoken form of the value — the number with its suffix.\n *\n * The reason a gauge with no printed value is still readable, and worth asserting\n * separately from {@link getValue}: a percentage announced as a bare `72` says\n * something different from `72%`.\n */\n async getValueText(): Promise<string | null> {\n return (await this.surface()).getAttribute('aria-valuetext');\n }\n\n /** The number printed in the middle, suffix included, or `null` when `showValue` is off. */\n async getDisplayValue(): Promise<string | null> {\n const text = await this.locatorForOptional('.wr-gauge__text')();\n return text ? text.text() : null;\n }\n\n /** The suffix alone, or `null` when there is none — or nothing is printed. */\n async getSuffix(): Promise<string | null> {\n const suffix = await this.locatorForOptional('.wr-gauge__suffix')();\n if (!suffix) return null;\n const text = await suffix.text();\n return text === '' ? null : text;\n }\n\n /**\n * The dial's width in pixels, read off the `style` ATTRIBUTE.\n *\n * NOT `getCssValue()`, which is `getComputedStyle()`: a computed read answers\n * from the LAID-OUT box, so it agrees with the inline value in jsdom — which\n * lays nothing out and echoes the declaration — and disagrees in a browser,\n * where sub-pixel rounding turns a declared 240 into 239.5. A harness that\n * answers differently in the two places it runs is worse than one that refuses.\n */\n async getSize(): Promise<number> {\n const style = await (await this.surface()).getAttribute('style');\n const match = /width:\\s*([\\d.]+)px/.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrGaugeHarness.getSize(): the dial carries no inline width (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,iBAAb,MAAa,uBAAuB,iBAAgB;CAClD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAiC,CAAA,GAAE;EAC7C,OAAO,IAAI,iBAAiB,gBAAgB,OAAO,CAAC,CACjD,UAAU,aAAa,QAAQ,YAAY,SAAS,UACnD,iBAAiB,cAAc,QAAQ,kBAAiB,GAAI,KAAK,CAAC,CACnE,CACA,UAAU,SAAS,QAAQ,OAAO,OAAO,SAAS,UAAW,MAAM,QAAQ,SAAQ,MAAQ,KAAK;CACrG;CAEiB,UAAU,KAAK,WAAW,oBAAoB;CAG/D,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,aAAa,MAAM;CACnD;CAGA,MAAM,oBAAiB;EACrB,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,aAAa,YAAY;CACzD;CAGA,MAAM,WAAQ;EACZ,OAAO,KAAK,gBAAgB,iBAAiB,UAAU;CACzD;CAGA,MAAM,SAAM;EACV,OAAO,KAAK,gBAAgB,iBAAiB,QAAQ;CACvD;CAGA,MAAM,SAAM;EACV,OAAO,KAAK,gBAAgB,iBAAiB,QAAQ;CACvD;CAMQ,MAAM,gBAAgB,MAAc,QAAc;EACxD,MAAM,MAAM,OAAO,MAAM,KAAK,QAAO,EAAA,CAAI,aAAa,IAAI;EAC1D,MAAM,QAAQ,QAAQ,OAAO,MAAa,OAAO,WAAW,GAAG;EAC/D,IAAI,CAAC,OAAO,SAAS,KAAK,GACxB,MAAM,IAAI,MACR,kBAAkB,OAAM,wBAAyB,KAAI,IAAK,OAAO,GAAE,iEAClC;EAGrC,OAAO;CACT;CASA,MAAM,eAAY;EAChB,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,aAAa,gBAAgB;CAC7D;CAGA,MAAM,kBAAe;EACnB,MAAM,OAAO,MAAM,KAAK,mBAAmB,iBAAiB,CAAC,CAAA;EAC7D,OAAO,OAAO,KAAK,KAAI,IAAK;CAC9B;CAGA,MAAM,YAAS;EACb,MAAM,SAAS,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA;EACjE,IAAI,CAAC,QAAQ,OAAO;EACpB,MAAM,OAAO,MAAM,OAAO,KAAI;EAC9B,OAAO,SAAS,KAAK,OAAO;CAC9B;CAWA,MAAM,UAAO;EACX,MAAM,QAAQ,OAAO,MAAM,KAAK,QAAO,EAAA,CAAI,aAAa,OAAO;EAC/D,MAAM,QAAQ,sBAAsB,KAAK,SAAS,EAAE;EACpD,IAAI,CAAC,OACH,MAAM,IAAI,MACR,uEAAuE,SAAS,GAAE,4FACS;EAG/F,OAAO,OAAO,WAAW,MAAM,EAAE;CACnC"}
1
+ {"version":3,"file":"ngwr-charts-gauge-testing.mjs","names":[],"sources":["../../../projects/lib/charts/gauge/testing/wr-gauge-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrGaugeHarnessFilters } from './types';\n\n/**\n * Test harness for `<wr-gauge>`.\n *\n * **The dial is `aria-hidden` and the printed number is optional, so the ARIA is the\n * whole readable surface.** The component carries `role=\"meter\"` with the value\n * trio and an `aria-valuetext` that includes the suffix — which is what makes a\n * gauge with `showValue` off readable at all. {@link getValue} is what it announces;\n * {@link getDisplayValue} is what is drawn, and it is `null` when nothing is.\n *\n * The arc is an SVG path, and its `d` is a rendering detail rather than an\n * assertion — it moves with the size, the stroke width and the sweep.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGaugeHarness extends ComponentHarness {\n static hostSelector = 'wr-gauge';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrGaugeHarnessFilters = {}): HarnessPredicate<WrGaugeHarness> {\n return new HarnessPredicate(WrGaugeHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('value', options.value, async (harness, value) => (await harness.getValue()) === value);\n }\n\n private readonly surface = this.locatorFor('.wr-gauge__surface');\n\n /**\n * The role the dial announces — `meter`, which is what a gauge is. Under `loading` or\n * `error` it is a `group`: there is no reading to announce, so the value attributes are\n * gone and the methods that read them say so.\n */\n async getRole(): Promise<string | null> {\n return (await this.surface()).getAttribute('role');\n }\n\n /** The dial's accessible name. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.surface()).getAttribute('aria-label');\n }\n\n /** The value it announces, from `aria-valuenow`. */\n async getValue(): Promise<number> {\n return this.numberAttribute('aria-valuenow', 'getValue');\n }\n\n /** The bottom of the range, from `aria-valuemin`. */\n async getMin(): Promise<number> {\n return this.numberAttribute('aria-valuemin', 'getMin');\n }\n\n /** The top of the range, from `aria-valuemax`. */\n async getMax(): Promise<number> {\n return this.numberAttribute('aria-valuemax', 'getMax');\n }\n\n /**\n * A finite number off one of the meter's attributes, or a sentence saying which one\n * it lacks. `Number(null)` is `0`, so a lost binding read as a range starting at zero.\n */\n private async numberAttribute(name: string, method: string): Promise<number> {\n const raw = await (await this.surface()).getAttribute(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new Error(\n `WrGaugeHarness.${method}(): the meter carries ${name}=\"${raw ?? ''}\", which the component writes as a ` +\n 'finite number on every gauge.'\n );\n }\n return value;\n }\n\n /**\n * The spoken form of the value — the number with its suffix.\n *\n * The reason a gauge with no printed value is still readable, and worth asserting\n * separately from {@link getValue}: a percentage announced as a bare `72` says\n * something different from `72%`.\n */\n async getValueText(): Promise<string | null> {\n return (await this.surface()).getAttribute('aria-valuetext');\n }\n\n /** The number printed in the middle, suffix included, or `null` when `showValue` is off. */\n async getDisplayValue(): Promise<string | null> {\n const text = await this.locatorForOptional('.wr-gauge__text')();\n return text ? text.text() : null;\n }\n\n /** The suffix alone, or `null` when there is none — or nothing is printed. */\n async getSuffix(): Promise<string | null> {\n const suffix = await this.locatorForOptional('.wr-gauge__suffix')();\n if (!suffix) return null;\n const text = await suffix.text();\n return text === '' ? null : text;\n }\n\n /**\n * The dial's width in pixels, read off the `style` ATTRIBUTE.\n *\n * NOT `getCssValue()`, which is `getComputedStyle()`: a computed read answers\n * from the LAID-OUT box, so it agrees with the inline value in jsdom — which\n * lays nothing out and echoes the declaration — and disagrees in a browser,\n * where sub-pixel rounding turns a declared 240 into 239.5. A harness that\n * answers differently in the two places it runs is worse than one that refuses.\n */\n async getSize(): Promise<number> {\n const style = await (await this.surface()).getAttribute('style');\n const match = /width:\\s*([\\d.]+)px/.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrGaugeHarness.getSize(): the dial carries no inline width (style: \"${style ?? ''}\"). ` +\n 'The component writes one unconditionally, so its absence is the bug rather than a zero.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,iBAAb,MAAa,uBAAuB,iBAAgB;CAClD,OAAO,eAAe;CAGtB,OAAO,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