ngwr 15.9.0 → 16.1.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 (455) hide show
  1. package/animations/aurora/styles/_index.scss +1 -1
  2. package/animations/blur-reveal/styles/_index.scss +1 -1
  3. package/animations/decode/styles/_index.scss +1 -1
  4. package/animations/dot-grid/styles/_index.scss +1 -1
  5. package/animations/flow-lines/styles/_index.scss +1 -1
  6. package/animations/fluid-cursor/styles/_index.scss +1 -1
  7. package/animations/{core → internal}/styles/_mixins.scss +1 -1
  8. package/animations/reveal/styles/_index.scss +1 -1
  9. package/animations/ripple-grid/styles/_index.scss +1 -1
  10. package/animations/rotate-reveal/styles/_index.scss +1 -1
  11. package/animations/thread-lines/styles/_index.scss +1 -1
  12. package/animations/typewriter/styles/_index.scss +1 -1
  13. package/badge/styles/_tag.scss +8 -4
  14. package/button/styles/_index.scss +13 -7
  15. package/cascader/styles/_rules.scss +4 -2
  16. package/checkbox/styles/_index.scss +4 -2
  17. package/copy-value/styles/_index.scss +104 -0
  18. package/date-picker/styles/_index.scss +121 -0
  19. package/date-stamp/styles/_index.scss +38 -0
  20. package/dialog/styles/_index.scss +38 -0
  21. package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
  22. package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
  23. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  24. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  25. package/fesm2022/ngwr-alert.mjs +13 -9
  26. package/fesm2022/ngwr-alert.mjs.map +1 -1
  27. package/fesm2022/ngwr-animations-aurora.mjs +21 -21
  28. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  29. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  30. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  31. package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
  32. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  33. package/fesm2022/ngwr-animations-confetti.mjs +5 -5
  34. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-decode.mjs +4 -4
  36. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-destruct.mjs +5 -5
  38. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
  40. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  42. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
  44. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
  46. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-glitch.mjs +2 -2
  48. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-marquee.mjs +2 -2
  50. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-orbit.mjs +7 -7
  52. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-reveal.mjs +4 -4
  54. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
  56. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  57. package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
  58. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  59. package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
  60. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  61. package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
  62. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  63. package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
  64. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  65. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  66. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  67. package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
  68. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  69. package/fesm2022/ngwr-avatar.mjs +14 -10
  70. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  71. package/fesm2022/ngwr-back-top.mjs +10 -6
  72. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  73. package/fesm2022/ngwr-badge.mjs +18 -6
  74. package/fesm2022/ngwr-badge.mjs.map +1 -1
  75. package/fesm2022/ngwr-burger.mjs +9 -6
  76. package/fesm2022/ngwr-burger.mjs.map +1 -1
  77. package/fesm2022/ngwr-button.mjs +8 -4
  78. package/fesm2022/ngwr-button.mjs.map +1 -1
  79. package/fesm2022/ngwr-calendar.mjs +19 -8
  80. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  81. package/fesm2022/ngwr-card.mjs +9 -5
  82. package/fesm2022/ngwr-card.mjs.map +1 -1
  83. package/fesm2022/ngwr-cascader.mjs +54 -25
  84. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  85. package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
  86. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  87. package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
  88. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  89. package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
  90. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  91. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  92. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  93. package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
  94. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  95. package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
  96. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  97. package/fesm2022/ngwr-charts-core.mjs +20 -20
  98. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  99. package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
  100. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  101. package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
  102. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  103. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  104. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  105. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  106. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  107. package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
  108. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  109. package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
  110. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  111. package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
  112. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  113. package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
  114. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  115. package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
  116. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  117. package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
  118. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  119. package/fesm2022/ngwr-checkbox.mjs +12 -8
  120. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  121. package/fesm2022/ngwr-clipboard.mjs +2 -1
  122. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  123. package/fesm2022/ngwr-collapse.mjs +11 -7
  124. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  125. package/fesm2022/ngwr-color-picker.mjs +56 -54
  126. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  127. package/fesm2022/ngwr-command-palette.mjs +4 -4
  128. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  129. package/fesm2022/ngwr-comment.mjs +15 -9
  130. package/fesm2022/ngwr-comment.mjs.map +1 -1
  131. package/fesm2022/ngwr-compare.mjs +15 -9
  132. package/fesm2022/ngwr-compare.mjs.map +1 -1
  133. package/fesm2022/ngwr-context-menu.mjs +8 -6
  134. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  135. package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
  136. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
  137. package/fesm2022/ngwr-copy-value.mjs +201 -0
  138. package/fesm2022/ngwr-copy-value.mjs.map +1 -0
  139. package/fesm2022/ngwr-counter.mjs +3 -3
  140. package/fesm2022/ngwr-counter.mjs.map +1 -1
  141. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  142. package/fesm2022/ngwr-date-picker.mjs +303 -70
  143. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  144. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  145. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  146. package/fesm2022/ngwr-date-stamp.mjs +149 -0
  147. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  148. package/fesm2022/ngwr-date.mjs +304 -53
  149. package/fesm2022/ngwr-date.mjs.map +1 -1
  150. package/fesm2022/ngwr-descriptions.mjs +9 -5
  151. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  152. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  153. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  154. package/fesm2022/ngwr-dialog.mjs +77 -19
  155. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  156. package/fesm2022/ngwr-directives.mjs +218 -12
  157. package/fesm2022/ngwr-directives.mjs.map +1 -1
  158. package/fesm2022/ngwr-divider.mjs +4 -2
  159. package/fesm2022/ngwr-divider.mjs.map +1 -1
  160. package/fesm2022/ngwr-drawer.mjs +32 -6
  161. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  162. package/fesm2022/ngwr-dropdown.mjs +17 -14
  163. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  164. package/fesm2022/ngwr-editor.mjs +33 -30
  165. package/fesm2022/ngwr-editor.mjs.map +1 -1
  166. package/fesm2022/ngwr-event-calendar.mjs +9 -7
  167. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  168. package/fesm2022/ngwr-file-upload.mjs +17 -11
  169. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  170. package/fesm2022/ngwr-form.mjs +18 -6
  171. package/fesm2022/ngwr-form.mjs.map +1 -1
  172. package/fesm2022/ngwr-graph.mjs +3 -3
  173. package/fesm2022/ngwr-graph.mjs.map +1 -1
  174. package/fesm2022/ngwr-hotkey.mjs +22 -22
  175. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  176. package/fesm2022/ngwr-i18n-ar.mjs +7 -0
  177. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  178. package/fesm2022/ngwr-i18n-cs.mjs +7 -0
  179. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  180. package/fesm2022/ngwr-i18n-de.mjs +7 -0
  181. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  182. package/fesm2022/ngwr-i18n-en.mjs +7 -0
  183. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  184. package/fesm2022/ngwr-i18n-es.mjs +7 -0
  185. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  186. package/fesm2022/ngwr-i18n-fr.mjs +7 -0
  187. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  188. package/fesm2022/ngwr-i18n-he.mjs +7 -0
  189. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  190. package/fesm2022/ngwr-i18n-hi.mjs +7 -0
  191. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  192. package/fesm2022/ngwr-i18n-id.mjs +7 -0
  193. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  194. package/fesm2022/ngwr-i18n-it.mjs +7 -0
  195. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  196. package/fesm2022/ngwr-i18n-ja.mjs +7 -0
  197. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  198. package/fesm2022/ngwr-i18n-ko.mjs +7 -0
  199. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  200. package/fesm2022/ngwr-i18n-nl.mjs +7 -0
  201. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  202. package/fesm2022/ngwr-i18n-pl.mjs +7 -0
  203. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  204. package/fesm2022/ngwr-i18n-pt.mjs +7 -0
  205. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  206. package/fesm2022/ngwr-i18n-ru.mjs +7 -0
  207. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  208. package/fesm2022/ngwr-i18n-sv.mjs +7 -0
  209. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  210. package/fesm2022/ngwr-i18n-tr.mjs +7 -0
  211. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  212. package/fesm2022/ngwr-i18n-uk.mjs +7 -0
  213. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  214. package/fesm2022/ngwr-i18n-vi.mjs +7 -0
  215. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  216. package/fesm2022/ngwr-i18n-zh-tw.mjs +7 -0
  217. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  218. package/fesm2022/ngwr-i18n-zh.mjs +7 -0
  219. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  220. package/fesm2022/ngwr-i18n.mjs +36 -10
  221. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  222. package/fesm2022/ngwr-icon.mjs +5 -5
  223. package/fesm2022/ngwr-icon.mjs.map +1 -1
  224. package/fesm2022/ngwr-image-cropper.mjs +11 -11
  225. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  226. package/fesm2022/ngwr-input-number.mjs +13 -7
  227. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  228. package/fesm2022/ngwr-input-otp.mjs +6 -4
  229. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  230. package/fesm2022/ngwr-input.mjs +35 -25
  231. package/fesm2022/ngwr-input.mjs.map +1 -1
  232. package/fesm2022/ngwr-keyboard.mjs +37 -31
  233. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  234. package/fesm2022/ngwr-knob.mjs +13 -7
  235. package/fesm2022/ngwr-knob.mjs.map +1 -1
  236. package/fesm2022/ngwr-layout.mjs +13 -5
  237. package/fesm2022/ngwr-layout.mjs.map +1 -1
  238. package/fesm2022/ngwr-lightbox.mjs +11 -7
  239. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  240. package/fesm2022/ngwr-list.mjs +13 -5
  241. package/fesm2022/ngwr-list.mjs.map +1 -1
  242. package/fesm2022/ngwr-load-state.mjs +11 -7
  243. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  244. package/fesm2022/ngwr-mention.mjs +6 -6
  245. package/fesm2022/ngwr-mention.mjs.map +1 -1
  246. package/fesm2022/ngwr-meta.mjs +19 -3
  247. package/fesm2022/ngwr-meta.mjs.map +1 -1
  248. package/fesm2022/ngwr-overlay.mjs +87 -4
  249. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  250. package/fesm2022/ngwr-pagination.mjs +10 -7
  251. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  252. package/fesm2022/ngwr-pipes.mjs +22 -8
  253. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  254. package/fesm2022/ngwr-platform.mjs +4 -1
  255. package/fesm2022/ngwr-platform.mjs.map +1 -1
  256. package/fesm2022/ngwr-popconfirm.mjs +6 -5
  257. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  258. package/fesm2022/ngwr-popover.mjs +124 -34
  259. package/fesm2022/ngwr-popover.mjs.map +1 -1
  260. package/fesm2022/ngwr-progress.mjs +4 -2
  261. package/fesm2022/ngwr-progress.mjs.map +1 -1
  262. package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
  263. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
  264. package/fesm2022/ngwr-qr.mjs +6 -6
  265. package/fesm2022/ngwr-qr.mjs.map +1 -1
  266. package/fesm2022/ngwr-radio.mjs +12 -8
  267. package/fesm2022/ngwr-radio.mjs.map +1 -1
  268. package/fesm2022/ngwr-rating.mjs +19 -13
  269. package/fesm2022/ngwr-rating.mjs.map +1 -1
  270. package/fesm2022/ngwr-resizable.mjs +503 -0
  271. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  272. package/fesm2022/ngwr-result.mjs +9 -5
  273. package/fesm2022/ngwr-result.mjs.map +1 -1
  274. package/fesm2022/ngwr-schema-form.mjs +15 -5
  275. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  276. package/fesm2022/ngwr-segmented.mjs +4 -2
  277. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  278. package/fesm2022/ngwr-select.mjs +70 -39
  279. package/fesm2022/ngwr-select.mjs.map +1 -1
  280. package/fesm2022/ngwr-sidebar.mjs +3 -3
  281. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  282. package/fesm2022/ngwr-skeleton.mjs +6 -4
  283. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  284. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  285. package/fesm2022/ngwr-slider.mjs +17 -15
  286. package/fesm2022/ngwr-slider.mjs.map +1 -1
  287. package/fesm2022/ngwr-sortable-list.mjs +3 -3
  288. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  289. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  290. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  291. package/fesm2022/ngwr-spinner.mjs +4 -2
  292. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  293. package/fesm2022/ngwr-splitter.mjs +21 -25
  294. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  295. package/fesm2022/ngwr-statistic.mjs +5 -3
  296. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  297. package/fesm2022/ngwr-stepper.mjs +9 -3
  298. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  299. package/fesm2022/ngwr-storage.mjs +6 -4
  300. package/fesm2022/ngwr-storage.mjs.map +1 -1
  301. package/fesm2022/ngwr-switch.mjs +11 -7
  302. package/fesm2022/ngwr-switch.mjs.map +1 -1
  303. package/fesm2022/ngwr-table-testing.mjs +5 -1
  304. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  305. package/fesm2022/ngwr-table.mjs +396 -35
  306. package/fesm2022/ngwr-table.mjs.map +1 -1
  307. package/fesm2022/ngwr-tabs.mjs +2 -2
  308. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  309. package/fesm2022/ngwr-textarea.mjs +9 -3
  310. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  311. package/fesm2022/ngwr-timeline.mjs +18 -8
  312. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  313. package/fesm2022/ngwr-toast-testing.mjs +14 -2
  314. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  315. package/fesm2022/ngwr-toast.mjs +588 -120
  316. package/fesm2022/ngwr-toast.mjs.map +1 -1
  317. package/fesm2022/ngwr-tour.mjs +7 -7
  318. package/fesm2022/ngwr-tour.mjs.map +1 -1
  319. package/fesm2022/ngwr-transfer.mjs +24 -11
  320. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  321. package/fesm2022/ngwr-tree.mjs +68 -26
  322. package/fesm2022/ngwr-tree.mjs.map +1 -1
  323. package/fesm2022/ngwr-typography.mjs +9 -3
  324. package/fesm2022/ngwr-typography.mjs.map +1 -1
  325. package/fesm2022/ngwr-utils-router.mjs +18 -2
  326. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  327. package/fesm2022/ngwr-utils.mjs +106 -56
  328. package/fesm2022/ngwr-utils.mjs.map +1 -1
  329. package/fesm2022/ngwr-validators.mjs +2 -2
  330. package/fesm2022/ngwr-validators.mjs.map +1 -1
  331. package/fesm2022/ngwr-version.mjs +1 -1
  332. package/fesm2022/ngwr-version.mjs.map +1 -1
  333. package/fesm2022/ngwr-window.mjs +33 -30
  334. package/fesm2022/ngwr-window.mjs.map +1 -1
  335. package/fesm2022/ngwr.mjs.map +1 -1
  336. package/i18n/ar.json +11 -0
  337. package/i18n/cs.json +11 -0
  338. package/i18n/de.json +11 -0
  339. package/i18n/en.json +11 -0
  340. package/i18n/es.json +11 -0
  341. package/i18n/fr.json +11 -0
  342. package/i18n/he.json +11 -0
  343. package/i18n/hi.json +11 -0
  344. package/i18n/id.json +11 -0
  345. package/i18n/it.json +11 -0
  346. package/i18n/ja.json +11 -0
  347. package/i18n/ko.json +11 -0
  348. package/i18n/nl.json +11 -0
  349. package/i18n/pl.json +11 -0
  350. package/i18n/pt.json +11 -0
  351. package/i18n/ru.json +11 -0
  352. package/i18n/sv.json +11 -0
  353. package/i18n/tr.json +11 -0
  354. package/i18n/uk.json +11 -0
  355. package/i18n/vi.json +11 -0
  356. package/i18n/zh-TW.json +11 -0
  357. package/i18n/zh.json +11 -0
  358. package/input/styles/_index.scss +10 -5
  359. package/input-number/styles/_index.scss +12 -3
  360. package/input-otp/styles/_index.scss +4 -2
  361. package/llms-full.txt +54 -23
  362. package/llms.txt +45 -23
  363. package/mcp/providers.js +1 -1
  364. package/package.json +29 -10
  365. package/radio/styles/_index.scss +4 -2
  366. package/resizable/styles/_index.scss +154 -0
  367. package/schematics/icon-set/index.js +3 -3
  368. package/schematics/migrations/v16/index.js +742 -0
  369. package/schematics/migrations.json +5 -0
  370. package/schematics/ng-add/index.js +4 -4
  371. package/schematics/provider/index.js +4 -4
  372. package/schematics/use/rule.js +1 -0
  373. package/schematics/use/symbol-map.json +6 -0
  374. package/select/styles/_index.scss +7 -4
  375. package/skills/ngwr/SKILL.md +6 -4
  376. package/skills/ngwr/references/catalog.md +8 -3
  377. package/skills/ngwr/references/setup.md +13 -9
  378. package/switch/styles/_index.scss +4 -2
  379. package/table/styles/_index.scss +138 -29
  380. package/textarea/styles/_index.scss +4 -2
  381. package/theme/styles/_motion.scss +6 -0
  382. package/toast/styles/_index.scss +49 -0
  383. package/tree/styles/_index.scss +17 -0
  384. package/types/index-CXbgza47.d.ts +13 -0
  385. package/types/ngwr-animations-aurora.d.ts +1 -1
  386. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  387. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  388. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  389. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  390. package/types/ngwr-animations-reveal.d.ts +4 -8
  391. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  392. package/types/ngwr-animations-spotlight.d.ts +1 -1
  393. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  394. package/types/ngwr-animations-tilt.d.ts +1 -1
  395. package/types/ngwr-avatar.d.ts +2 -2
  396. package/types/ngwr-badge.d.ts +1 -1
  397. package/types/ngwr-burger.d.ts +0 -1
  398. package/types/ngwr-calendar.d.ts +7 -0
  399. package/types/ngwr-cascader.d.ts +12 -1
  400. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  401. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  402. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  403. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  404. package/types/ngwr-charts-core.d.ts +12 -12
  405. package/types/ngwr-charts-line-chart.d.ts +2 -2
  406. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  407. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  408. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  409. package/types/ngwr-clipboard.d.ts +7 -0
  410. package/types/ngwr-color-picker.d.ts +12 -12
  411. package/types/ngwr-copy-value-testing.d.ts +87 -0
  412. package/types/ngwr-copy-value.d.ts +95 -0
  413. package/types/ngwr-date-picker-testing.d.ts +3 -3
  414. package/types/ngwr-date-picker.d.ts +106 -3
  415. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  416. package/types/ngwr-date-stamp.d.ts +81 -0
  417. package/types/ngwr-date.d.ts +179 -27
  418. package/types/ngwr-dialog-testing.d.ts +10 -0
  419. package/types/ngwr-dialog.d.ts +120 -5
  420. package/types/ngwr-directives.d.ts +76 -1
  421. package/types/ngwr-drawer.d.ts +22 -1
  422. package/types/ngwr-dropdown.d.ts +3 -2
  423. package/types/ngwr-hotkey.d.ts +5 -5
  424. package/types/ngwr-i18n.d.ts +47 -17
  425. package/types/ngwr-icon.d.ts +26 -26
  426. package/types/ngwr-input-number.d.ts +2 -2
  427. package/types/ngwr-input.d.ts +8 -8
  428. package/types/ngwr-load-state.d.ts +6 -6
  429. package/types/ngwr-meta.d.ts +18 -0
  430. package/types/ngwr-overlay.d.ts +36 -0
  431. package/types/ngwr-pipes.d.ts +21 -4
  432. package/types/ngwr-platform.d.ts +2 -1
  433. package/types/ngwr-popconfirm.d.ts +3 -2
  434. package/types/ngwr-popover.d.ts +43 -4
  435. package/types/ngwr-resizable.d.ts +228 -0
  436. package/types/ngwr-select.d.ts +33 -18
  437. package/types/ngwr-slider-testing.d.ts +2 -2
  438. package/types/ngwr-slider.d.ts +3 -3
  439. package/types/ngwr-statistic.d.ts +5 -1
  440. package/types/ngwr-storage.d.ts +1 -1
  441. package/types/ngwr-table-testing.d.ts +5 -2
  442. package/types/ngwr-table.d.ts +255 -14
  443. package/types/ngwr-tabs.d.ts +10 -2
  444. package/types/ngwr-toast-testing.d.ts +18 -3
  445. package/types/ngwr-toast.d.ts +248 -23
  446. package/types/ngwr-transfer.d.ts +5 -0
  447. package/types/ngwr-tree.d.ts +22 -2
  448. package/types/ngwr-utils-router.d.ts +22 -0
  449. package/types/ngwr-utils.d.ts +165 -83
  450. package/types/ngwr-validators.d.ts +4 -2
  451. package/types/ngwr-version.d.ts +1 -1
  452. package/types/ngwr.d.ts +2 -0
  453. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  454. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  455. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-candlestick-chart.mjs","names":[],"sources":["../../../projects/lib/charts/candlestick-chart/candlestick-chart.ts","../../../projects/lib/charts/candlestick-chart/candlestick-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, chartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCandlestickDatum } from './types';\n\n/**\n * The drawing's width, in px, before a browser has measured it: what the server and the\n * first paint decide the body width and the x labels against. A phone's plot is about\n * 300px and a desktop column's about 700px.\n */\nconst ASSUMED_WIDTH = 560;\n\n/** How much of its slot a body takes: the stylesheet's own share, which this mirrors. */\nconst BODY_SHARE = 0.7;\n\n/** The widest a body is drawn, in px: `--wr-candlestick-chart-body-max-width`'s default, which this mirrors. */\nconst BODY_MAX = 24;\n\n/**\n * Below this width, in px, a hollow body has no inside to show: two 1px edges and at\n * most a pixel between them read as one bar. The chart is drawn `--dense` then.\n */\nconst DENSE_BELOW = 4;\n\n/** A label's width per character, in px, before a browser has measured the widest one. */\nconst CHAR_WIDTH = 7;\n\n/** The least room, in px, between two neighbouring x labels. */\nconst LABEL_GAP = 12;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/**\n * The most fraction digits a price is written with by default: past it a decimal is\n * float noise — 0.1 + 0.2 is 0.30000000000000004 — rather than precision, and every\n * instrument quotes fewer. Crypto's eight places fit.\n */\nconst MAX_PRICE_DIGITS = 10;\n\n/**\n * How many fraction digits the shortest decimal that reads back as `value` has: 5 for\n * 1.08345, 0 for 120, 8 for 1.2e-7. `toString()` is that shortest form, written with an\n * exponent past 1e21 and below 1e-6, which this reads too.\n */\nfunction fractionDigits(value: number): number {\n const [mantissa, exponent = '0'] = Math.abs(value).toString().split('e');\n return Math.max(0, (mantissa.split('.')[1]?.length ?? 0) - Number(exponent));\n}\n\n/** What a browser measured: the drawing's width, the widest x label's and one body's, in px. */\ninterface Measured {\n readonly width: number;\n readonly label: number;\n readonly body: number;\n}\n\n/** One candle as the chart draws it: its prices and where it sits. */\ninterface DrawnCandle {\n /** Its position in `data`, which is its slot on the x axis and what it is tracked by. */\n readonly index: number;\n readonly label: string;\n readonly open: number;\n readonly high: number;\n readonly low: number;\n readonly close: number;\n /** Whether it closed at or above its open: drawn hollow in the increase colour, else filled in the decrease one. */\n readonly increase: boolean;\n /** Its centre, as a percentage of the drawing's width from the left. */\n readonly left: number;\n /** Its top — the higher of the high and the body — as a percentage of the drawing's height from the top. */\n readonly top: number;\n /** How far it reaches down from `top`, as a percentage of the drawing's height. */\n readonly height: number;\n /** How much of its own height the upper wick takes, from its top to the body, in percent. */\n readonly upper: number;\n /** How much of its own height the lower wick takes, from the body to its bottom, in percent. */\n readonly lower: number;\n}\n\n/**\n * Prices over time as candles: one per period, its wick from the low to the high and its\n * body from the open to the close. No external dependency, and no SVG: every candle is a\n * box placed by percentage, so its width can be a share of its slot held between 1px and\n * a ceiling.\n *\n * @example\n * ```html\n * <wr-candlestick-chart\n * ariaLabel=\"ACME, daily\"\n * [data]=\"[\n * { label: 'Mon', open: 102, high: 108, low: 99, close: 106 },\n * { label: 'Tue', open: 106, high: 107, low: 98, close: 100 }\n * ]\"\n * />\n * ```\n *\n * **A rise and a fall are told apart twice.** A rising candle, one that closed at or\n * above its open, is drawn HOLLOW in the increase colour, success by default; a falling\n * one FILLED in the decrease colour, danger by default — the words, the modifiers and\n * the hooks the waterfall chart uses for a change up and a change down. The two intents\n * sit within 1.004:1 of each other in luminance, so the fill is what a reader without\n * red-green vision reads, and what survives greyscale and print. `increaseColor` and\n * `decreaseColor` swap the colours — for a market that draws rises in red — and leave\n * the fill alone. So the fill always has room\n * to show, every body is drawn at least tall enough to hold it: its two edges and a 2px\n * inside (4px at the default edge), or two dashes and the gap between them while dense\n * (5px). It grows into its own wicks, so the high and the low stay put. A candle that\n * barely moved is drawn a few pixels taller than its prices, in both directions alike,\n * rather than as a line whose direction only its colour would tell.\n *\n * **Many candles thin out rather than pile up.** A body takes 70% of its slot, between\n * 1px and `--wr-candlestick-chart-body-max-width`, so the gaps close as the candles\n * crowd. Once a body is under 4px wide it has no inside to leave hollow, and the chart\n * is drawn `--dense`: a rising body is dotted rather than outlined, so the second\n * channel holds. The x labels are thinned to every n-th, the smallest n that keeps the\n * widest label clear of its neighbours. Both are decided on the drawing's measured\n * width, after render, so the server and the first paint assume a 560px drawing. Past a\n * candle per pixel the candles overlap; aggregate the periods first.\n *\n * The y axis is fitted to the lows and highs shown with no zero forced in, since a price\n * has no baseline, and snapped outward to a readable step, so no wick ends on the frame.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip, the period\n * with its open, high, low and close, is pointer only. `dataTable` renders every price\n * as a table only assistive technology reaches.\n *\n * @see https://ngwr.dev/charts/candlestick-chart\n */\n@Component({\n selector: 'wr-candlestick-chart',\n templateUrl: './candlestick-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-candlestick-chart',\n // A body too narrow to leave hollow is dotted instead; see `dense`.\n '[class.wr-candlestick-chart--dense]': 'dense()',\n // Variables of their own rather than the hooks, which an author sets from outside: a\n // `null` binding wipes a value of its own name from the host's `style` attribute.\n '[style.--wr-candlestick-chart-input-increase-color]': 'increaseColor()',\n '[style.--wr-candlestick-chart-input-decrease-color]': 'decreaseColor()',\n },\n imports: [WrChartTable],\n})\nexport class WrCandlestickChart {\n /**\n * The periods, oldest first: one evenly spaced slot each. A period whose four prices\n * are not all finite keeps its slot and its label, and draws no candle.\n */\n readonly data = input<readonly WrCandlestickDatum[]>([]);\n\n /**\n * Accessible name of the chart. The prices are nowhere in text unless `dataTable`\n * puts them there, so say what the chart shows: the instrument and the period.\n * Falls back to `candlestickChart.label` (\"Candlestick chart\"). It is also the data\n * table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'candlestickChart.label', 'Candlestick chart');\n\n /**\n * The colour of a rising candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-increase-color`, which is `var(--wr-color-success)`. A rising\n * candle is hollow whatever its colour. @default null\n */\n readonly increaseColor = input<string | null>(null);\n\n /**\n * The colour of a falling candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-decrease-color`, which is `var(--wr-color-danger)`. A falling\n * candle is filled whatever its colour. @default null\n */\n readonly decreaseColor = input<string | null>(null);\n\n /**\n * Writes every price the chart shows: the y-axis ticks, the tooltip and the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact ticks (`1.2K`) unless\n * the full numbers are shorter, and in the tooltip and the table every price at the\n * data's own precision — as many fraction digits as the most precise price given, up\n * to ten, and never fewer than the axis step needs — so a forex quote of 1.08345 is\n * not written `1.083`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The axis' compact ticks and the prices at the data's own precision, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /**\n * Show the gridlines and the y-axis ticks. The period labels under the candles are the\n * time axis, so they stay either way, as the line chart's `xLabels` do. @default true\n */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /** Show a tooltip with the period's open, high, low and close under the pointer. Pointer only. @default true */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render every period's prices as a table only assistive technology reaches, beside\n * the drawing: a row per period, headed by its label, and a column each for the open,\n * the high, the low and the close. A price that is not a finite number is an empty\n * cell. The drawing is one named image, so without it the prices are nowhere a screen\n * reader can walk. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The words for the four prices, from the catalog: in the tooltip and as the data table's columns. */\n private readonly openText = readI18nText('candlestickChart.open', 'Open');\n private readonly highText = readI18nText('candlestickChart.high', 'High');\n private readonly lowText = readI18nText('candlestickChart.low', 'Low');\n private readonly closeText = readI18nText('candlestickChart.close', 'Close');\n\n private readonly plot = viewChild<ElementRef<HTMLElement>>('plot');\n\n private readonly drawing = viewChild<ElementRef<HTMLElement>>('drawing');\n\n private readonly probe = viewChild<ElementRef<HTMLElement>>('probe');\n\n private readonly candleEls = viewChildren<ElementRef<HTMLElement>>('candleEl');\n\n /**\n * What a browser measured, once it has: `null` on the server and until the first\n * render, which decide against {@link ASSUMED_WIDTH} instead.\n */\n private readonly measured = signal<Measured | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/candlestick-chart');\n // Measured after render, in a browser: again when the candles or the labels change,\n // and when the drawing changes width. Never on the server — said here as well as by\n // the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const destroyRef = inject(DestroyRef);\n\n afterRenderEffect(() => {\n this.candles();\n this.probeText();\n untracked(() => this.measure());\n });\n\n afterNextRender(() => {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => this.measure());\n observer.observe(drawing);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /** How many slots the x axis has: one per period, drawn or not. */\n protected readonly slots = computed(() => this.data().length);\n\n /** One slot's share of the drawing's width, in percent: what the stylesheet sizes a body against. */\n protected readonly slot = computed(() => (this.slots() === 0 ? 100 : percent(100 / this.slots())));\n\n /**\n * The y axis, from `chartAxis` over every candle drawn: fitted from the lowest of the\n * lows to the highest of the highs with no zero forced in, since a price has no\n * baseline, snapped outward at both ends and lifted a step at either end a wick would\n * end on (`symmetric`). A single price is centred with a step either side. With\n * nothing to draw, the 0 to 1 frame.\n *\n * A high below the body or a low above it counts as the body's edge, so nothing is\n * drawn outside the frame.\n */\n protected readonly axis = computed(() => {\n let lo = Number.POSITIVE_INFINITY;\n let hi = Number.NEGATIVE_INFINITY;\n for (const d of this.data()) {\n if (!WrCandlestickChart.drawable(d)) continue;\n lo = Math.min(lo, d.low, d.open, d.close);\n hi = Math.max(hi, d.high, d.open, d.close);\n }\n return chartAxis(lo, hi, { symmetric: true });\n });\n\n /**\n * The candles as drawn: every period whose four prices are finite, placed on its slot\n * and on the axis, with its wicks as shares of its own height so the stylesheet can\n * draw both and the body between them.\n */\n protected readonly candles = computed<readonly DrawnCandle[]>(() => {\n const { min, max } = this.axis();\n const slots = this.slots();\n const y = (value: number): number => ((max - value) / (max - min)) * 100;\n return this.data().flatMap((d, index) => {\n if (!WrCandlestickChart.drawable(d)) return [];\n const top = Math.max(d.high, d.open, d.close);\n const bottom = Math.min(d.low, d.open, d.close);\n const span = top - bottom;\n const share = (value: number): number => (span > 0 ? percent((value / span) * 100) : 0);\n return [\n {\n index,\n label: d.label,\n open: d.open,\n high: d.high,\n low: d.low,\n close: d.close,\n increase: d.close >= d.open,\n left: percent(((index + 0.5) / slots) * 100),\n top: percent(y(top)),\n height: percent(y(bottom) - y(top)),\n upper: share(top - Math.max(d.open, d.close)),\n lower: share(Math.min(d.open, d.close) - bottom),\n },\n ];\n });\n });\n\n /** Each drawn candle's position in {@link candles}, by its slot: how the tooltip finds a candle's element. */\n private readonly positions = computed(\n () => new Map(this.candles().map((candle, position) => [candle.index, position]))\n );\n\n /** One slot's width in px: measured, or against the assumed drawing. */\n private readonly slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()));\n\n /**\n * Whether a body is too narrow to leave hollow — under 4px wide, measured off the\n * first candle, or worked out from the assumed drawing before a browser has measured\n * it. A dense chart dots its rising bodies instead (see the stylesheet). A chart with\n * no candle is never dense.\n */\n protected readonly dense = computed(() => {\n if (this.candles().length === 0) return false;\n const measured = this.measured()?.body ?? 0;\n const body = measured > 0 ? measured : clamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX);\n return body < DENSE_BELOW;\n });\n\n /** The longest period label, by its characters: what the room for the x labels is estimated from before a browser has measured. */\n private readonly longestLabel = computed(() =>\n this.data().reduce((longest, d) => (d.label.length > longest.length ? d.label : longest), '')\n );\n\n /**\n * Every period label once, a line each: the hidden copy the x labels' room is measured\n * against. Laid out as wide as its widest line, so it measures the widest label rather\n * than the one with the most characters — `WWWWWWW` is wider than `iiiiiiii`. A line\n * break inside a label is a space here, as the printed label shows it.\n */\n protected readonly probeText = computed(() =>\n [...new Set(this.data().map(d => d.label.replace(/\\r\\n?|\\n/g, ' ')))].join('\\n')\n );\n\n /**\n * How wide a period label is taken to be, in px: the widest one as a browser measured\n * it, or seven pixels a character of the longest before it has. Every label is spaced as\n * if it were that wide.\n */\n private readonly labelPx = computed(() => {\n const measured = this.measured()?.label ?? 0;\n return measured > 0 ? measured : this.longestLabel().length * CHAR_WIDTH;\n });\n\n /**\n * Every how many slots a period label is printed: 1 while the widest label and a gap\n * fit one slot, else the smallest n whose n slots hold them.\n */\n protected readonly labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.slotPx())));\n\n /**\n * The period labels printed, left to right: every `labelEvery`-th, gaps included. Each\n * is laid out as wide as the widest, centred under its candle and moved inwards where\n * that would cross the frame, as the stylesheet draws it; the last is left out if\n * moving it brings it within the gap of the one before.\n *\n * They start from the first period, unless moving its label inwards would bring it\n * within the gap of the next printed one. Then they start from the first period whose\n * label fits between the frame and its candle unmoved, a slot or two in: dropping the\n * second label instead would open a gap of two steps at the start of the axis, and\n * keeping both would let them touch. With one candle and a label wider than the\n * drawing, that label is printed alone, ellipsised.\n */\n protected readonly xLabels = computed(() => {\n const every = this.labelEvery();\n const slots = this.slots();\n const slotPx = this.slotPx();\n const width = slotPx * slots;\n const label = Math.min(this.labelPx(), width);\n const data = this.data();\n /** Where a label's laid-out box starts, in px from the drawing's left. */\n const at = (index: number): number => clamp((index + 0.5) * slotPx - label / 2, 0, width - label);\n // A hair of slack on every comparison, so the regular spacing never fails on a rounding.\n const crowds = (start: number, previousEnd: number): boolean => start + 1e-6 < previousEnd + LABEL_GAP;\n const start =\n slots > every && crowds(at(every), at(0) + label) ? Math.max(0, Math.ceil(label / 2 / slotPx - 0.5 - 1e-6)) : 0;\n\n const labels: { readonly index: number; readonly label: string; readonly left: number }[] = [];\n let end = Number.NEGATIVE_INFINITY;\n for (let index = start; index < slots; index += every) {\n const left = at(index);\n if (crowds(left, end)) break;\n labels.push({ index, label: data[index].label, left: percent(((index + 0.5) / slots) * 100) });\n end = left + label;\n }\n return labels;\n });\n\n /** The room each printed label has, as a percentage of the drawing's width: `labelEvery` slots, at most all of it. */\n protected readonly xSlot = computed(() => Math.min(100, percent(this.slot() * this.labelEvery())));\n\n /** The y ticks, top to bottom: each value's label and its gridline's distance from the top, in percent. */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.axis();\n const labels = this.numbers.ticks(ticks, step);\n return ticks.map((value, i) => ({ label: labels[i], top: percent(((max - value) / (max - min)) * 100) }));\n });\n\n /**\n * How many fraction digits an exact price is written with, at most: as many as the\n * most precise finite price in `data` has, and at least as many as the axis step,\n * held to {@link MAX_PRICE_DIGITS}. A ceiling rather than a count, so `120` stays `120`\n * beside `120.25`. The shared `value` writer stops at three, which wrote the four\n * prices of a forex candle — 1.08345, 1.08391, 1.08301, 1.08362 — as two numbers,\n * coarser than the axis beside them.\n */\n private readonly priceDigits = computed(() => {\n let digits = fractionDigits(this.axis().step);\n for (const d of this.data()) {\n for (const price of [d.open, d.high, d.low, d.close]) {\n if (Number.isFinite(price)) digits = Math.max(digits, fractionDigits(price));\n }\n }\n return Math.min(digits, MAX_PRICE_DIGITS);\n });\n\n /** A price as the tooltip and the data table write it: through `valueFormat`, else at the data's precision. */\n private price(value: number): string {\n return this.numbers.exact(value, this.priceDigits());\n }\n\n /**\n * One tooltip for the candle under the pointer: the period as its heading, then a row\n * each for the open, the high, the low and the close, every price written in full. It\n * points at the candle itself, from above its high, and follows it if the data moves\n * it. No swatch: the colour is the candle's direction, and the four prices say it.\n *\n * The candle is found by POSITION — the slot under the pointer, anywhere over the\n * drawing — so a thin candle needs no aim, and a candle under the open chip can still\n * be reached by moving onto it.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const position = this.positions().get(index);\n if (position === undefined) return null;\n const candle = this.candles()[position];\n const anchor = this.candleEls()[position]?.nativeElement;\n if (!candle || !anchor) return null;\n return {\n datum: {\n label: candle.label,\n value: '',\n rows: [\n { label: this.openText(), value: this.price(candle.open) },\n { label: this.highText(), value: this.price(candle.high) },\n { label: this.lowText(), value: this.price(candle.low) },\n { label: this.closeText(), value: this.price(candle.close) },\n ],\n },\n anchor,\n };\n },\n (x, y) => this.slotAt(x, y)\n );\n\n /** The slot the tooltip is reading, marked by a band behind its candle. */\n protected readonly activeSlot = computed(() => {\n const index = this.tip.active();\n return index === null ? null : { left: percent((index / Math.max(1, this.slots())) * 100) };\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per period headed\n * by its label, and the open, high, low and close written as the tooltip writes them.\n * A period with no candle keeps its row, with an empty cell for each price that is not\n * a finite number.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const cell = (value: number): string => (Number.isFinite(value) ? this.price(value) : '');\n return {\n caption: this.resolvedAriaLabel(),\n columns: [this.openText(), this.highText(), this.lowText(), this.closeText()],\n groups: [\n {\n rows: this.data().map(d => ({\n header: d.label,\n cells: [cell(d.open), cell(d.high), cell(d.low), cell(d.close)],\n })),\n },\n ],\n };\n });\n\n /**\n * The candle under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Over a slot with no candle, the open\n * tooltip starts its grace period.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const index = this.slotAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The slot under a viewport position, if a candle is drawn there: across the drawing's\n * width, and anywhere down the plot, its padding included. A drawing with no box\n * (nothing laid out yet) answers nothing.\n */\n private slotAt(clientX: number, clientY: number): number | null {\n const drawing = this.drawing()?.nativeElement;\n const plot = this.plot()?.nativeElement;\n const slots = this.slots();\n if (!drawing || !plot || slots === 0) return null;\n const box = drawing.getBoundingClientRect();\n const frame = plot.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;\n const index = clamp(Math.floor(((clientX - box.left) / box.width) * slots), 0, slots - 1);\n return this.positions().has(index) ? index : null;\n }\n\n /**\n * Read the drawing's width, the widest label's and one body's off the layout. A\n * hidden chart measures 0 and keeps its last reading rather than thin to nothing; a\n * label or a body with nothing to measure — no period, no candle — reads 0 and leaves\n * the estimate in charge of what it decides.\n */\n private measure(): void {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing) return;\n const width = drawing.getBoundingClientRect().width;\n if (width <= 0) return;\n const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;\n const body = this.candleEls()[0]?.nativeElement.getBoundingClientRect().width ?? 0;\n const last = this.measured();\n if (last?.width === width && last.label === label && last.body === body) return;\n this.measured.set({ width, label, body });\n }\n\n /** Whether a period can be drawn: all four prices finite. */\n private static drawable(d: WrCandlestickDatum): boolean {\n return Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close);\n }\n}\n\nexport type { WrCandlestickDatum } from './types';\n","@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAGnB,MAAM,WAAW;AAMjB,MAAM,cAAc;AAGpB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candlestick-chart.mjs","names":[],"sources":["../../../projects/lib/charts/candlestick-chart/candlestick-chart.ts","../../../projects/lib/charts/candlestick-chart/candlestick-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, wrChartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCandlestickDatum } from './types';\n\n/**\n * The drawing's width, in px, before a browser has measured it: what the server and the\n * first paint decide the body width and the x labels against. A phone's plot is about\n * 300px and a desktop column's about 700px.\n */\nconst ASSUMED_WIDTH = 560;\n\n/** How much of its slot a body takes: the stylesheet's own share, which this mirrors. */\nconst BODY_SHARE = 0.7;\n\n/** The widest a body is drawn, in px: `--wr-candlestick-chart-body-max-width`'s default, which this mirrors. */\nconst BODY_MAX = 24;\n\n/**\n * Below this width, in px, a hollow body has no inside to show: two 1px edges and at\n * most a pixel between them read as one bar. The chart is drawn `--dense` then.\n */\nconst DENSE_BELOW = 4;\n\n/** A label's width per character, in px, before a browser has measured the widest one. */\nconst CHAR_WIDTH = 7;\n\n/** The least room, in px, between two neighbouring x labels. */\nconst LABEL_GAP = 12;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/**\n * The most fraction digits a price is written with by default: past it a decimal is\n * float noise — 0.1 + 0.2 is 0.30000000000000004 — rather than precision, and every\n * instrument quotes fewer. Crypto's eight places fit.\n */\nconst MAX_PRICE_DIGITS = 10;\n\n/**\n * How many fraction digits the shortest decimal that reads back as `value` has: 5 for\n * 1.08345, 0 for 120, 8 for 1.2e-7. `toString()` is that shortest form, written with an\n * exponent past 1e21 and below 1e-6, which this reads too.\n */\nfunction fractionDigits(value: number): number {\n const [mantissa, exponent = '0'] = Math.abs(value).toString().split('e');\n return Math.max(0, (mantissa.split('.')[1]?.length ?? 0) - Number(exponent));\n}\n\n/** What a browser measured: the drawing's width, the widest x label's and one body's, in px. */\ninterface Measured {\n readonly width: number;\n readonly label: number;\n readonly body: number;\n}\n\n/** One candle as the chart draws it: its prices and where it sits. */\ninterface DrawnCandle {\n /** Its position in `data`, which is its slot on the x axis and what it is tracked by. */\n readonly index: number;\n readonly label: string;\n readonly open: number;\n readonly high: number;\n readonly low: number;\n readonly close: number;\n /** Whether it closed at or above its open: drawn hollow in the increase colour, else filled in the decrease one. */\n readonly increase: boolean;\n /** Its centre, as a percentage of the drawing's width from the left. */\n readonly left: number;\n /** Its top — the higher of the high and the body — as a percentage of the drawing's height from the top. */\n readonly top: number;\n /** How far it reaches down from `top`, as a percentage of the drawing's height. */\n readonly height: number;\n /** How much of its own height the upper wick takes, from its top to the body, in percent. */\n readonly upper: number;\n /** How much of its own height the lower wick takes, from the body to its bottom, in percent. */\n readonly lower: number;\n}\n\n/**\n * Prices over time as candles: one per period, its wick from the low to the high and its\n * body from the open to the close. No external dependency, and no SVG: every candle is a\n * box placed by percentage, so its width can be a share of its slot held between 1px and\n * a ceiling.\n *\n * @example\n * ```html\n * <wr-candlestick-chart\n * ariaLabel=\"ACME, daily\"\n * [data]=\"[\n * { label: 'Mon', open: 102, high: 108, low: 99, close: 106 },\n * { label: 'Tue', open: 106, high: 107, low: 98, close: 100 }\n * ]\"\n * />\n * ```\n *\n * **A rise and a fall are told apart twice.** A rising candle, one that closed at or\n * above its open, is drawn HOLLOW in the increase colour, success by default; a falling\n * one FILLED in the decrease colour, danger by default — the words, the modifiers and\n * the hooks the waterfall chart uses for a change up and a change down. The two intents\n * sit within 1.004:1 of each other in luminance, so the fill is what a reader without\n * red-green vision reads, and what survives greyscale and print. `increaseColor` and\n * `decreaseColor` swap the colours — for a market that draws rises in red — and leave\n * the fill alone. So the fill always has room\n * to show, every body is drawn at least tall enough to hold it: its two edges and a 2px\n * inside (4px at the default edge), or two dashes and the gap between them while dense\n * (5px). It grows into its own wicks, so the high and the low stay put. A candle that\n * barely moved is drawn a few pixels taller than its prices, in both directions alike,\n * rather than as a line whose direction only its colour would tell.\n *\n * **Many candles thin out rather than pile up.** A body takes 70% of its slot, between\n * 1px and `--wr-candlestick-chart-body-max-width`, so the gaps close as the candles\n * crowd. Once a body is under 4px wide it has no inside to leave hollow, and the chart\n * is drawn `--dense`: a rising body is dotted rather than outlined, so the second\n * channel holds. The x labels are thinned to every n-th, the smallest n that keeps the\n * widest label clear of its neighbours. Both are decided on the drawing's measured\n * width, after render, so the server and the first paint assume a 560px drawing. Past a\n * candle per pixel the candles overlap; aggregate the periods first.\n *\n * The y axis is fitted to the lows and highs shown with no zero forced in, since a price\n * has no baseline, and snapped outward to a readable step, so no wick ends on the frame.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip, the period\n * with its open, high, low and close, is pointer only. `dataTable` renders every price\n * as a table only assistive technology reaches.\n *\n * @see https://ngwr.dev/charts/candlestick-chart\n */\n@Component({\n selector: 'wr-candlestick-chart',\n templateUrl: './candlestick-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-candlestick-chart',\n // A body too narrow to leave hollow is dotted instead; see `dense`.\n '[class.wr-candlestick-chart--dense]': 'dense()',\n // Variables of their own rather than the hooks, which an author sets from outside: a\n // `null` binding wipes a value of its own name from the host's `style` attribute.\n '[style.--wr-candlestick-chart-input-increase-color]': 'increaseColor()',\n '[style.--wr-candlestick-chart-input-decrease-color]': 'decreaseColor()',\n },\n imports: [WrChartTable],\n})\nexport class WrCandlestickChart {\n /**\n * The periods, oldest first: one evenly spaced slot each. A period whose four prices\n * are not all finite keeps its slot and its label, and draws no candle.\n */\n readonly data = input<readonly WrCandlestickDatum[]>([]);\n\n /**\n * Accessible name of the chart. The prices are nowhere in text unless `dataTable`\n * puts them there, so say what the chart shows: the instrument and the period.\n * Falls back to `candlestickChart.label` (\"Candlestick chart\"). It is also the data\n * table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'candlestickChart.label', 'Candlestick chart');\n\n /**\n * The colour of a rising candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-increase-color`, which is `var(--wr-color-success)`. A rising\n * candle is hollow whatever its colour. @default null\n */\n readonly increaseColor = input<string | null>(null);\n\n /**\n * The colour of a falling candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-decrease-color`, which is `var(--wr-color-danger)`. A falling\n * candle is filled whatever its colour. @default null\n */\n readonly decreaseColor = input<string | null>(null);\n\n /**\n * Writes every price the chart shows: the y-axis ticks, the tooltip and the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact ticks (`1.2K`) unless\n * the full numbers are shorter, and in the tooltip and the table every price at the\n * data's own precision — as many fraction digits as the most precise price given, up\n * to ten, and never fewer than the axis step needs — so a forex quote of 1.08345 is\n * not written `1.083`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The axis' compact ticks and the prices at the data's own precision, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /**\n * Show the gridlines and the y-axis ticks. The period labels under the candles are the\n * time axis, so they stay either way, as the line chart's `xLabels` do. @default true\n */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /** Show a tooltip with the period's open, high, low and close under the pointer. Pointer only. @default true */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render every period's prices as a table only assistive technology reaches, beside\n * the drawing: a row per period, headed by its label, and a column each for the open,\n * the high, the low and the close. A price that is not a finite number is an empty\n * cell. The drawing is one named image, so without it the prices are nowhere a screen\n * reader can walk. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The words for the four prices, from the catalog: in the tooltip and as the data table's columns. */\n private readonly openText = wrReadI18nText('candlestickChart.open', 'Open');\n private readonly highText = wrReadI18nText('candlestickChart.high', 'High');\n private readonly lowText = wrReadI18nText('candlestickChart.low', 'Low');\n private readonly closeText = wrReadI18nText('candlestickChart.close', 'Close');\n\n private readonly plot = viewChild<ElementRef<HTMLElement>>('plot');\n\n private readonly drawing = viewChild<ElementRef<HTMLElement>>('drawing');\n\n private readonly probe = viewChild<ElementRef<HTMLElement>>('probe');\n\n private readonly candleEls = viewChildren<ElementRef<HTMLElement>>('candleEl');\n\n /**\n * What a browser measured, once it has: `null` on the server and until the first\n * render, which decide against {@link ASSUMED_WIDTH} instead.\n */\n private readonly measured = signal<Measured | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/candlestick-chart');\n // Measured after render, in a browser: again when the candles or the labels change,\n // and when the drawing changes width. Never on the server — said here as well as by\n // the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const destroyRef = inject(DestroyRef);\n\n afterRenderEffect(() => {\n this.candles();\n this.probeText();\n untracked(() => this.measure());\n });\n\n afterNextRender(() => {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => this.measure());\n observer.observe(drawing);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /** How many slots the x axis has: one per period, drawn or not. */\n protected readonly slots = computed(() => this.data().length);\n\n /** One slot's share of the drawing's width, in percent: what the stylesheet sizes a body against. */\n protected readonly slot = computed(() => (this.slots() === 0 ? 100 : percent(100 / this.slots())));\n\n /**\n * The y axis, from `wrChartAxis` over every candle drawn: fitted from the lowest of the\n * lows to the highest of the highs with no zero forced in, since a price has no\n * baseline, snapped outward at both ends and lifted a step at either end a wick would\n * end on (`symmetric`). A single price is centred with a step either side. With\n * nothing to draw, the 0 to 1 frame.\n *\n * A high below the body or a low above it counts as the body's edge, so nothing is\n * drawn outside the frame.\n */\n protected readonly axis = computed(() => {\n let lo = Number.POSITIVE_INFINITY;\n let hi = Number.NEGATIVE_INFINITY;\n for (const d of this.data()) {\n if (!WrCandlestickChart.drawable(d)) continue;\n lo = Math.min(lo, d.low, d.open, d.close);\n hi = Math.max(hi, d.high, d.open, d.close);\n }\n return wrChartAxis(lo, hi, { symmetric: true });\n });\n\n /**\n * The candles as drawn: every period whose four prices are finite, placed on its slot\n * and on the axis, with its wicks as shares of its own height so the stylesheet can\n * draw both and the body between them.\n */\n protected readonly candles = computed<readonly DrawnCandle[]>(() => {\n const { min, max } = this.axis();\n const slots = this.slots();\n const y = (value: number): number => ((max - value) / (max - min)) * 100;\n return this.data().flatMap((d, index) => {\n if (!WrCandlestickChart.drawable(d)) return [];\n const top = Math.max(d.high, d.open, d.close);\n const bottom = Math.min(d.low, d.open, d.close);\n const span = top - bottom;\n const share = (value: number): number => (span > 0 ? percent((value / span) * 100) : 0);\n return [\n {\n index,\n label: d.label,\n open: d.open,\n high: d.high,\n low: d.low,\n close: d.close,\n increase: d.close >= d.open,\n left: percent(((index + 0.5) / slots) * 100),\n top: percent(y(top)),\n height: percent(y(bottom) - y(top)),\n upper: share(top - Math.max(d.open, d.close)),\n lower: share(Math.min(d.open, d.close) - bottom),\n },\n ];\n });\n });\n\n /** Each drawn candle's position in {@link candles}, by its slot: how the tooltip finds a candle's element. */\n private readonly positions = computed(\n () => new Map(this.candles().map((candle, position) => [candle.index, position]))\n );\n\n /** One slot's width in px: measured, or against the assumed drawing. */\n private readonly slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()));\n\n /**\n * Whether a body is too narrow to leave hollow — under 4px wide, measured off the\n * first candle, or worked out from the assumed drawing before a browser has measured\n * it. A dense chart dots its rising bodies instead (see the stylesheet). A chart with\n * no candle is never dense.\n */\n protected readonly dense = computed(() => {\n if (this.candles().length === 0) return false;\n const measured = this.measured()?.body ?? 0;\n const body = measured > 0 ? measured : wrClamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX);\n return body < DENSE_BELOW;\n });\n\n /** The longest period label, by its characters: what the room for the x labels is estimated from before a browser has measured. */\n private readonly longestLabel = computed(() =>\n this.data().reduce((longest, d) => (d.label.length > longest.length ? d.label : longest), '')\n );\n\n /**\n * Every period label once, a line each: the hidden copy the x labels' room is measured\n * against. Laid out as wide as its widest line, so it measures the widest label rather\n * than the one with the most characters — `WWWWWWW` is wider than `iiiiiiii`. A line\n * break inside a label is a space here, as the printed label shows it.\n */\n protected readonly probeText = computed(() =>\n [...new Set(this.data().map(d => d.label.replace(/\\r\\n?|\\n/g, ' ')))].join('\\n')\n );\n\n /**\n * How wide a period label is taken to be, in px: the widest one as a browser measured\n * it, or seven pixels a character of the longest before it has. Every label is spaced as\n * if it were that wide.\n */\n private readonly labelPx = computed(() => {\n const measured = this.measured()?.label ?? 0;\n return measured > 0 ? measured : this.longestLabel().length * CHAR_WIDTH;\n });\n\n /**\n * Every how many slots a period label is printed: 1 while the widest label and a gap\n * fit one slot, else the smallest n whose n slots hold them.\n */\n protected readonly labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.slotPx())));\n\n /**\n * The period labels printed, left to right: every `labelEvery`-th, gaps included. Each\n * is laid out as wide as the widest, centred under its candle and moved inwards where\n * that would cross the frame, as the stylesheet draws it; the last is left out if\n * moving it brings it within the gap of the one before.\n *\n * They start from the first period, unless moving its label inwards would bring it\n * within the gap of the next printed one. Then they start from the first period whose\n * label fits between the frame and its candle unmoved, a slot or two in: dropping the\n * second label instead would open a gap of two steps at the start of the axis, and\n * keeping both would let them touch. With one candle and a label wider than the\n * drawing, that label is printed alone, ellipsised.\n */\n protected readonly xLabels = computed(() => {\n const every = this.labelEvery();\n const slots = this.slots();\n const slotPx = this.slotPx();\n const width = slotPx * slots;\n const label = Math.min(this.labelPx(), width);\n const data = this.data();\n /** Where a label's laid-out box starts, in px from the drawing's left. */\n const at = (index: number): number => wrClamp((index + 0.5) * slotPx - label / 2, 0, width - label);\n // A hair of slack on every comparison, so the regular spacing never fails on a rounding.\n const crowds = (start: number, previousEnd: number): boolean => start + 1e-6 < previousEnd + LABEL_GAP;\n const start =\n slots > every && crowds(at(every), at(0) + label) ? Math.max(0, Math.ceil(label / 2 / slotPx - 0.5 - 1e-6)) : 0;\n\n const labels: { readonly index: number; readonly label: string; readonly left: number }[] = [];\n let end = Number.NEGATIVE_INFINITY;\n for (let index = start; index < slots; index += every) {\n const left = at(index);\n if (crowds(left, end)) break;\n labels.push({ index, label: data[index].label, left: percent(((index + 0.5) / slots) * 100) });\n end = left + label;\n }\n return labels;\n });\n\n /** The room each printed label has, as a percentage of the drawing's width: `labelEvery` slots, at most all of it. */\n protected readonly xSlot = computed(() => Math.min(100, percent(this.slot() * this.labelEvery())));\n\n /** The y ticks, top to bottom: each value's label and its gridline's distance from the top, in percent. */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.axis();\n const labels = this.numbers.ticks(ticks, step);\n return ticks.map((value, i) => ({ label: labels[i], top: percent(((max - value) / (max - min)) * 100) }));\n });\n\n /**\n * How many fraction digits an exact price is written with, at most: as many as the\n * most precise finite price in `data` has, and at least as many as the axis step,\n * held to {@link MAX_PRICE_DIGITS}. A ceiling rather than a count, so `120` stays `120`\n * beside `120.25`. The shared `value` writer stops at three, which wrote the four\n * prices of a forex candle — 1.08345, 1.08391, 1.08301, 1.08362 — as two numbers,\n * coarser than the axis beside them.\n */\n private readonly priceDigits = computed(() => {\n let digits = fractionDigits(this.axis().step);\n for (const d of this.data()) {\n for (const price of [d.open, d.high, d.low, d.close]) {\n if (Number.isFinite(price)) digits = Math.max(digits, fractionDigits(price));\n }\n }\n return Math.min(digits, MAX_PRICE_DIGITS);\n });\n\n /** A price as the tooltip and the data table write it: through `valueFormat`, else at the data's precision. */\n private price(value: number): string {\n return this.numbers.exact(value, this.priceDigits());\n }\n\n /**\n * One tooltip for the candle under the pointer: the period as its heading, then a row\n * each for the open, the high, the low and the close, every price written in full. It\n * points at the candle itself, from above its high, and follows it if the data moves\n * it. No swatch: the colour is the candle's direction, and the four prices say it.\n *\n * The candle is found by POSITION — the slot under the pointer, anywhere over the\n * drawing — so a thin candle needs no aim, and a candle under the open chip can still\n * be reached by moving onto it.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const position = this.positions().get(index);\n if (position === undefined) return null;\n const candle = this.candles()[position];\n const anchor = this.candleEls()[position]?.nativeElement;\n if (!candle || !anchor) return null;\n return {\n datum: {\n label: candle.label,\n value: '',\n rows: [\n { label: this.openText(), value: this.price(candle.open) },\n { label: this.highText(), value: this.price(candle.high) },\n { label: this.lowText(), value: this.price(candle.low) },\n { label: this.closeText(), value: this.price(candle.close) },\n ],\n },\n anchor,\n };\n },\n (x, y) => this.slotAt(x, y)\n );\n\n /** The slot the tooltip is reading, marked by a band behind its candle. */\n protected readonly activeSlot = computed(() => {\n const index = this.tip.active();\n return index === null ? null : { left: percent((index / Math.max(1, this.slots())) * 100) };\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per period headed\n * by its label, and the open, high, low and close written as the tooltip writes them.\n * A period with no candle keeps its row, with an empty cell for each price that is not\n * a finite number.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const cell = (value: number): string => (Number.isFinite(value) ? this.price(value) : '');\n return {\n caption: this.resolvedAriaLabel(),\n columns: [this.openText(), this.highText(), this.lowText(), this.closeText()],\n groups: [\n {\n rows: this.data().map(d => ({\n header: d.label,\n cells: [cell(d.open), cell(d.high), cell(d.low), cell(d.close)],\n })),\n },\n ],\n };\n });\n\n /**\n * The candle under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Over a slot with no candle, the open\n * tooltip starts its grace period.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const index = this.slotAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The slot under a viewport position, if a candle is drawn there: across the drawing's\n * width, and anywhere down the plot, its padding included. A drawing with no box\n * (nothing laid out yet) answers nothing.\n */\n private slotAt(clientX: number, clientY: number): number | null {\n const drawing = this.drawing()?.nativeElement;\n const plot = this.plot()?.nativeElement;\n const slots = this.slots();\n if (!drawing || !plot || slots === 0) return null;\n const box = drawing.getBoundingClientRect();\n const frame = plot.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;\n const index = wrClamp(Math.floor(((clientX - box.left) / box.width) * slots), 0, slots - 1);\n return this.positions().has(index) ? index : null;\n }\n\n /**\n * Read the drawing's width, the widest label's and one body's off the layout. A\n * hidden chart measures 0 and keeps its last reading rather than thin to nothing; a\n * label or a body with nothing to measure — no period, no candle — reads 0 and leaves\n * the estimate in charge of what it decides.\n */\n private measure(): void {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing) return;\n const width = drawing.getBoundingClientRect().width;\n if (width <= 0) return;\n const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;\n const body = this.candleEls()[0]?.nativeElement.getBoundingClientRect().width ?? 0;\n const last = this.measured();\n if (last?.width === width && last.label === label && last.body === body) return;\n this.measured.set({ width, label, body });\n }\n\n /** Whether a period can be drawn: all four prices finite. */\n private static drawable(d: WrCandlestickDatum): boolean {\n return Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close);\n }\n}\n\nexport type { WrCandlestickDatum } from './types';\n","@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAGnB,MAAM,WAAW;AAMjB,MAAM,cAAc;AAGpB,MAAM,aAAa;AAGnB,MAAM,YAAY;AAGlB,MAAM,WAAW,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI;AAOtE,MAAM,mBAAmB;AAOzB,SAAS,eAAe,OAAa;CACnC,MAAM,CAAC,UAAU,WAAW,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,SAAQ,CAAE,CAAC,MAAM,GAAG;CACvE,OAAO,KAAK,IAAI,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,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;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEH,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEX,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -4,7 +4,7 @@ import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
4
  import { NgTemplateOutlet } from "@angular/common";
5
5
  import { wrCheckStyles } from "ngwr/utils";
6
6
  import { useI18nText } from "ngwr/i18n";
7
- import { chartMarkerPath } from "ngwr/charts/core";
7
+ import { wrChartMarkerPath } from "ngwr/charts/core";
8
8
  /**
9
9
  * @license
10
10
  *
@@ -104,7 +104,7 @@ var WrChartLegend = class WrChartLegend {
104
104
  return this.block ? `${this.block}__${name}` : "";
105
105
  }
106
106
  markerPath(shape, r) {
107
- return chartMarkerPath(shape, r);
107
+ return wrChartMarkerPath(shape, r);
108
108
  }
109
109
  toggle(index) {
110
110
  const current = this.hiddenSeries();
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-chart-legend.mjs","names":[],"sources":["../../../projects/lib/charts/chart-legend/internal/chart-legend-part.ts","../../../projects/lib/charts/chart-legend/tokens/chart-legend-block.token.ts","../../../projects/lib/charts/chart-legend/chart-legend.ts","../../../projects/lib/charts/chart-legend/chart-legend.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 { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Adds the host chart's own class to one part of a legend row, beside the part's\n * static `wr-chart-legend__*` classes.\n *\n * A host `[class]` binding merges with the element's static `class`, where a\n * template's `class` plus `[class]` pair is one the template lint refuses — and the\n * static half has to stay static: `charts/stylesheets.spec.ts` reads the first class\n * of every inline-painted mark off the template to hold it to `forced-color-adjust`.\n *\n * @internal\n */\n@Directive({\n selector: '[wrChartLegendPart]',\n host: { '[class]': 'wrChartLegendPart()' },\n})\nexport class WrChartLegendPart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** The class to add; `''` adds none. */\n readonly wrChartLegendPart = input('');\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * The BEM block of the chart a legend is drawn inside, provided by that chart:\n * `'wr-donut-chart'` makes every row also carry `.wr-donut-chart__legend-item`,\n * its key `.wr-donut-chart__swatch`, its name `.wr-donut-chart__legend-label` and\n * its value `.wr-donut-chart__legend-value` — the classes the chart drew before it\n * drew its legend through `WrChartLegend`, which are public API and stay on the\n * same elements.\n *\n * A chart provides it in `viewProviders`, and the legend reads it with `host: true`:\n * that lookup stops at the host element of the view the legend is declared in, where\n * it sees that component's `viewProviders` and not its `providers`. So only a legend\n * in the chart's OWN template takes the block, never one further down the tree.\n *\n * @internal\n */\nexport const WR_CHART_LEGEND_BLOCK = new InjectionToken<string>('WR_CHART_LEGEND_BLOCK');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, ViewEncapsulation, computed, inject, input, model, output, signal } from '@angular/core';\n\nimport { chartMarkerPath } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrChartLegendPart } from './internal/chart-legend-part';\nimport { WR_CHART_LEGEND_BLOCK } from './tokens';\nimport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * A chart's key: one row per series, each a swatch, a name and an optional value.\n * It stands on its own for a key that several charts share — one legend above a row\n * of sparklines — and the bar, line, donut, meter group, scatter and radar charts\n * draw their own legends with it.\n *\n * It sits on a `<ul>` the way `button[wr-btn]` sits on a `<button>`, and renders the\n * `<li>`s, so the list is the consumer's element: its class, its placement, its\n * name. The swatch follows what tells the series apart in the chart: a dot, a line\n * in the series' `dash`, or the series' `marker`. A dot is a span painted with an\n * inline background, a line or a marker is an SVG, and every key is `aria-hidden`:\n * the row's text is its name.\n *\n * **Toggling is opt-in.** With `toggleable`, every row is a\n * `<button type=\"button\" aria-pressed>` that shows and hides its series: pressed\n * means shown, and `hiddenSeries` holds the positions of the hidden ones. The rows\n * stay in the tab order, one stop each, rather than becoming one toolbar stop with\n * arrow keys: the toolbar pattern needs `role=\"toolbar\"`, which would take the\n * `<ul>`'s list role and with it the \"list, 5 items\" a reader hears, while each row\n * is an independent toggle — the Button pattern, Tab plus Space or Enter — and a\n * chart's series rarely outnumber the five colours it cycles through. A legend\n * draws nothing hidden by itself: the chart reads `hiddenSeries`.\n *\n * **A hidden row says so in both modes.** On a toggle it is `aria-pressed=\"false\"`;\n * on a legend that does not toggle, where a host has hidden the series from\n * elsewhere, the row carries a visually hidden word after its name\n * (`chartLegend.hidden`, \"hidden\"), since the strike-through and the faded key reach\n * no one who cannot see them.\n *\n * @example\n * ```html\n * <ul\n * wr-chart-legend\n * [items]=\"[\n * { label: 'Visits', color: 'var(--wr-color-primary)', value: '1,204' },\n * { label: 'Signups', color: 'var(--wr-color-success)', value: '86' }\n * ]\"\n * ></ul>\n *\n * <ul wr-chart-legend toggleable [items]=\"series\" [(hiddenSeries)]=\"hidden\"></ul>\n * ```\n *\n * @see https://ngwr.dev/charts/chart-legend\n */\n@Component({\n selector: 'ul[wr-chart-legend]',\n templateUrl: './chart-legend.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-legend',\n // Written out because `list-style: none` (styles/_index.scss) drops the implicit\n // list semantics in Safari, and with them the list's `aria-label`.\n role: 'list',\n '[class.wr-chart-legend--toggleable]': 'toggleable()',\n '[attr.aria-label]': 'label()',\n },\n imports: [NgTemplateOutlet, WrChartLegendPart],\n})\nexport class WrChartLegend {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** One row per series, in the chart's order. */\n readonly items = input<readonly WrChartLegendItem[]>([]);\n\n /**\n * Make each row a toggle button that shows and hides its series, through\n * `hiddenSeries` and `toggled`. @default false\n */\n readonly toggleable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `items` of the series that are hidden, ascending. Positions\n * rather than labels: two series may share a label, and a label translated into\n * another language would no longer match the one it hid. A position past the end\n * of `items` is kept and ignored, so a series coming back finds its state.\n *\n * Written by a click on a `toggleable` row; read in either mode, so a legend that\n * does not toggle still shows a series hidden from elsewhere as hidden.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /**\n * Accessible name of the list. A `toggleable` legend falls back to\n * `chartLegend.toggleLabel` (\"Toggle series visibility\"), which tells a reader\n * what its buttons do; one that does not toggle has no name unless given one.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emits when a reader shows or hides a series from a `toggleable` legend, after `hiddenSeries` moves. */\n readonly toggled = output<WrChartLegendToggle>();\n\n private readonly toggleLabel = useI18nText(this.ariaLabel, 'chartLegend.toggleLabel', 'Toggle series visibility');\n\n /**\n * The word a hidden row of a legend that does not toggle carries after its name,\n * visually hidden: the strike-through and the faded key are the eye's half of the\n * state, and a toggle row's `aria-pressed` is the other half there. Catalog-only\n * rather than an input, as `stepper.completed` is: one word shared by every row,\n * which an app rewords once in its catalog.\n */\n protected readonly hiddenText = useI18nText(NO_OVERRIDE, 'chartLegend.hidden', 'hidden');\n\n protected readonly label = computed(() => (this.ariaLabel() || this.toggleable() ? this.toggleLabel() : null));\n\n private readonly block = inject(WR_CHART_LEGEND_BLOCK, { optional: true, host: true });\n\n private readonly hidden = computed(() => new Set(this.hiddenSeries()));\n\n /** Whether the series at `index` is hidden. */\n protected isHidden(index: number): boolean {\n return this.hidden().has(index);\n }\n\n /** The host chart's own class for one part of a row, or nothing outside a chart. */\n protected part(name: 'legend-item' | 'swatch' | 'legend-label' | 'legend-value'): string {\n return this.block ? `${this.block}__${name}` : '';\n }\n\n /** A marker's path, as large as a circle of radius `r` in the swatch's own units. */\n protected markerPath(shape: WrChartMarker, r: number): string {\n return chartMarkerPath(shape, r);\n }\n\n /** Shows or hides the series at `index`, then says so. */\n protected toggle(index: number): void {\n const current = this.hiddenSeries();\n const hide = !current.includes(index);\n this.hiddenSeries.set(hide ? [...current, index].sort((a, b) => a - b) : current.filter(i => i !== index));\n this.toggled.emit({ index, label: this.items()[index]?.label ?? '', hidden: hide });\n }\n}\n\nexport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n","@for (item of items(); track $index) {\n <li\n class=\"wr-chart-legend__item\"\n [class.wr-chart-legend__item--hidden]=\"isHidden($index)\"\n [wrChartLegendPart]=\"part('legend-item')\"\n >\n @if (toggleable()) {\n <!-- Pressed means SHOWN: the button's name is the series, and pressing it turns\n that series on. The name never changes with the state, as the toggle-button\n pattern requires; the state is `aria-pressed` and the struck-through label. -->\n <button\n type=\"button\"\n class=\"wr-chart-legend__toggle\"\n [attr.aria-pressed]=\"!isHidden($index)\"\n (click)=\"toggle($index)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n </button>\n } @else {\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n }\n </li>\n}\n\n<ng-template #row let-index>\n @let item = items()[index];\n @if (item.dash !== undefined) {\n <!-- The key draws the series' own dash, not a solid block. A legend that pairs a\n coloured square with a name leaves the reader to match the square to the LINE,\n and matching by colour is the step the patterns exist to remove. -->\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--line\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"0 0 16 2\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker ?? null\"\n >\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"16\"\n y2=\"1\"\n [attr.stroke]=\"item.color\"\n [attr.stroke-dasharray]=\"item.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n @if (item.marker) {\n <path [attr.d]=\"markerPath(item.marker, 3.5)\" transform=\"translate(8 1)\" [attr.fill]=\"item.color\" />\n }\n </svg>\n } @else if (item.marker) {\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--marker\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"-6 -6 12 12\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker\"\n >\n <path [attr.d]=\"markerPath(item.marker, 5)\" [attr.fill]=\"item.color\" />\n </svg>\n } @else {\n <span\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--dot\"\n [wrChartLegendPart]=\"part('swatch')\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\"\n ></span>\n }\n <span class=\"wr-chart-legend__label\" [wrChartLegendPart]=\"part('legend-label')\">{{ item.label }}</span>\n @if (!toggleable() && isHidden(index)) {\n <!-- A toggle says hidden through aria-pressed. A row that is not one has nothing but\n the strike-through and the faded key, which reach no one who cannot see them. -->\n <span class=\"wr-chart-legend__sr-only\"> {{ hiddenText() }} </span>\n }\n @if (item.value !== undefined && item.value !== null) {\n <span class=\"wr-chart-legend__value\" [wrChartLegendPart]=\"part('legend-value')\">{{ item.value }}</span>\n }\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,qBAAqB;CACxF;CAGS,oBAAoB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,oBAAA,CAAA,+BAAA,CAAA,CAAA;CAN3B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,mBAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,sBAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAjB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAJ7B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,WAAW,sB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AA,MAAA;GAAA,MAAE;GAAiB,UAAA;GAAA,QAAA,CAAA,mBAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAElC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAdzB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAqB,eAEhB,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IAGP,MAAM;IACN,uCAAuC;IACvC,qBAAqB;GACtB;GAAA,SACQ,CAAC,kBAAkB,iBAAiB;GAAC,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-chart-legend.mjs","names":[],"sources":["../../../projects/lib/charts/chart-legend/internal/chart-legend-part.ts","../../../projects/lib/charts/chart-legend/tokens/chart-legend-block.token.ts","../../../projects/lib/charts/chart-legend/chart-legend.ts","../../../projects/lib/charts/chart-legend/chart-legend.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 { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Adds the host chart's own class to one part of a legend row, beside the part's\n * static `wr-chart-legend__*` classes.\n *\n * A host `[class]` binding merges with the element's static `class`, where a\n * template's `class` plus `[class]` pair is one the template lint refuses — and the\n * static half has to stay static: `charts/stylesheets.spec.ts` reads the first class\n * of every inline-painted mark off the template to hold it to `forced-color-adjust`.\n *\n * @internal\n */\n@Directive({\n selector: '[wrChartLegendPart]',\n host: { '[class]': 'wrChartLegendPart()' },\n})\nexport class WrChartLegendPart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** The class to add; `''` adds none. */\n readonly wrChartLegendPart = input('');\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * The BEM block of the chart a legend is drawn inside, provided by that chart:\n * `'wr-donut-chart'` makes every row also carry `.wr-donut-chart__legend-item`,\n * its key `.wr-donut-chart__swatch`, its name `.wr-donut-chart__legend-label` and\n * its value `.wr-donut-chart__legend-value` — the classes the chart drew before it\n * drew its legend through `WrChartLegend`, which are public API and stay on the\n * same elements.\n *\n * A chart provides it in `viewProviders`, and the legend reads it with `host: true`:\n * that lookup stops at the host element of the view the legend is declared in, where\n * it sees that component's `viewProviders` and not its `providers`. So only a legend\n * in the chart's OWN template takes the block, never one further down the tree.\n *\n * @internal\n */\nexport const WR_CHART_LEGEND_BLOCK = new InjectionToken<string>('WR_CHART_LEGEND_BLOCK');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, ViewEncapsulation, computed, inject, input, model, output, signal } from '@angular/core';\n\nimport { wrChartMarkerPath } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrChartLegendPart } from './internal/chart-legend-part';\nimport { WR_CHART_LEGEND_BLOCK } from './tokens';\nimport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * A chart's key: one row per series, each a swatch, a name and an optional value.\n * It stands on its own for a key that several charts share — one legend above a row\n * of sparklines — and the bar, line, donut, meter group, scatter and radar charts\n * draw their own legends with it.\n *\n * It sits on a `<ul>` the way `button[wr-btn]` sits on a `<button>`, and renders the\n * `<li>`s, so the list is the consumer's element: its class, its placement, its\n * name. The swatch follows what tells the series apart in the chart: a dot, a line\n * in the series' `dash`, or the series' `marker`. A dot is a span painted with an\n * inline background, a line or a marker is an SVG, and every key is `aria-hidden`:\n * the row's text is its name.\n *\n * **Toggling is opt-in.** With `toggleable`, every row is a\n * `<button type=\"button\" aria-pressed>` that shows and hides its series: pressed\n * means shown, and `hiddenSeries` holds the positions of the hidden ones. The rows\n * stay in the tab order, one stop each, rather than becoming one toolbar stop with\n * arrow keys: the toolbar pattern needs `role=\"toolbar\"`, which would take the\n * `<ul>`'s list role and with it the \"list, 5 items\" a reader hears, while each row\n * is an independent toggle — the Button pattern, Tab plus Space or Enter — and a\n * chart's series rarely outnumber the five colours it cycles through. A legend\n * draws nothing hidden by itself: the chart reads `hiddenSeries`.\n *\n * **A hidden row says so in both modes.** On a toggle it is `aria-pressed=\"false\"`;\n * on a legend that does not toggle, where a host has hidden the series from\n * elsewhere, the row carries a visually hidden word after its name\n * (`chartLegend.hidden`, \"hidden\"), since the strike-through and the faded key reach\n * no one who cannot see them.\n *\n * @example\n * ```html\n * <ul\n * wr-chart-legend\n * [items]=\"[\n * { label: 'Visits', color: 'var(--wr-color-primary)', value: '1,204' },\n * { label: 'Signups', color: 'var(--wr-color-success)', value: '86' }\n * ]\"\n * ></ul>\n *\n * <ul wr-chart-legend toggleable [items]=\"series\" [(hiddenSeries)]=\"hidden\"></ul>\n * ```\n *\n * @see https://ngwr.dev/charts/chart-legend\n */\n@Component({\n selector: 'ul[wr-chart-legend]',\n templateUrl: './chart-legend.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-legend',\n // Written out because `list-style: none` (styles/_index.scss) drops the implicit\n // list semantics in Safari, and with them the list's `aria-label`.\n role: 'list',\n '[class.wr-chart-legend--toggleable]': 'toggleable()',\n '[attr.aria-label]': 'label()',\n },\n imports: [NgTemplateOutlet, WrChartLegendPart],\n})\nexport class WrChartLegend {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** One row per series, in the chart's order. */\n readonly items = input<readonly WrChartLegendItem[]>([]);\n\n /**\n * Make each row a toggle button that shows and hides its series, through\n * `hiddenSeries` and `toggled`. @default false\n */\n readonly toggleable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `items` of the series that are hidden, ascending. Positions\n * rather than labels: two series may share a label, and a label translated into\n * another language would no longer match the one it hid. A position past the end\n * of `items` is kept and ignored, so a series coming back finds its state.\n *\n * Written by a click on a `toggleable` row; read in either mode, so a legend that\n * does not toggle still shows a series hidden from elsewhere as hidden.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /**\n * Accessible name of the list. A `toggleable` legend falls back to\n * `chartLegend.toggleLabel` (\"Toggle series visibility\"), which tells a reader\n * what its buttons do; one that does not toggle has no name unless given one.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emits when a reader shows or hides a series from a `toggleable` legend, after `hiddenSeries` moves. */\n readonly toggled = output<WrChartLegendToggle>();\n\n private readonly toggleLabel = useI18nText(this.ariaLabel, 'chartLegend.toggleLabel', 'Toggle series visibility');\n\n /**\n * The word a hidden row of a legend that does not toggle carries after its name,\n * visually hidden: the strike-through and the faded key are the eye's half of the\n * state, and a toggle row's `aria-pressed` is the other half there. Catalog-only\n * rather than an input, as `stepper.completed` is: one word shared by every row,\n * which an app rewords once in its catalog.\n */\n protected readonly hiddenText = useI18nText(NO_OVERRIDE, 'chartLegend.hidden', 'hidden');\n\n protected readonly label = computed(() => (this.ariaLabel() || this.toggleable() ? this.toggleLabel() : null));\n\n private readonly block = inject(WR_CHART_LEGEND_BLOCK, { optional: true, host: true });\n\n private readonly hidden = computed(() => new Set(this.hiddenSeries()));\n\n /** Whether the series at `index` is hidden. */\n protected isHidden(index: number): boolean {\n return this.hidden().has(index);\n }\n\n /** The host chart's own class for one part of a row, or nothing outside a chart. */\n protected part(name: 'legend-item' | 'swatch' | 'legend-label' | 'legend-value'): string {\n return this.block ? `${this.block}__${name}` : '';\n }\n\n /** A marker's path, as large as a circle of radius `r` in the swatch's own units. */\n protected markerPath(shape: WrChartMarker, r: number): string {\n return wrChartMarkerPath(shape, r);\n }\n\n /** Shows or hides the series at `index`, then says so. */\n protected toggle(index: number): void {\n const current = this.hiddenSeries();\n const hide = !current.includes(index);\n this.hiddenSeries.set(hide ? [...current, index].sort((a, b) => a - b) : current.filter(i => i !== index));\n this.toggled.emit({ index, label: this.items()[index]?.label ?? '', hidden: hide });\n }\n}\n\nexport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n","@for (item of items(); track $index) {\n <li\n class=\"wr-chart-legend__item\"\n [class.wr-chart-legend__item--hidden]=\"isHidden($index)\"\n [wrChartLegendPart]=\"part('legend-item')\"\n >\n @if (toggleable()) {\n <!-- Pressed means SHOWN: the button's name is the series, and pressing it turns\n that series on. The name never changes with the state, as the toggle-button\n pattern requires; the state is `aria-pressed` and the struck-through label. -->\n <button\n type=\"button\"\n class=\"wr-chart-legend__toggle\"\n [attr.aria-pressed]=\"!isHidden($index)\"\n (click)=\"toggle($index)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n </button>\n } @else {\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n }\n </li>\n}\n\n<ng-template #row let-index>\n @let item = items()[index];\n @if (item.dash !== undefined) {\n <!-- The key draws the series' own dash, not a solid block. A legend that pairs a\n coloured square with a name leaves the reader to match the square to the LINE,\n and matching by colour is the step the patterns exist to remove. -->\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--line\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"0 0 16 2\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker ?? null\"\n >\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"16\"\n y2=\"1\"\n [attr.stroke]=\"item.color\"\n [attr.stroke-dasharray]=\"item.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n @if (item.marker) {\n <path [attr.d]=\"markerPath(item.marker, 3.5)\" transform=\"translate(8 1)\" [attr.fill]=\"item.color\" />\n }\n </svg>\n } @else if (item.marker) {\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--marker\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"-6 -6 12 12\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker\"\n >\n <path [attr.d]=\"markerPath(item.marker, 5)\" [attr.fill]=\"item.color\" />\n </svg>\n } @else {\n <span\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--dot\"\n [wrChartLegendPart]=\"part('swatch')\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\"\n ></span>\n }\n <span class=\"wr-chart-legend__label\" [wrChartLegendPart]=\"part('legend-label')\">{{ item.label }}</span>\n @if (!toggleable() && isHidden(index)) {\n <!-- A toggle says hidden through aria-pressed. A row that is not one has nothing but\n the strike-through and the faded key, which reach no one who cannot see them. -->\n <span class=\"wr-chart-legend__sr-only\"> {{ hiddenText() }} </span>\n }\n @if (item.value !== undefined && item.value !== null) {\n <span class=\"wr-chart-legend__value\" [wrChartLegendPart]=\"part('legend-value')\">{{ item.value }}</span>\n }\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,qBAAqB;CACxF;CAGS,oBAAoB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,oBAAA,CAAA,+BAAA,CAAA,CAAA;CAN3B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,mBAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,U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AA;GAAA,cAAA;GAAA,SAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,OAAA;GAAA,YAAA;IAAA,qCAAA;IAAA,mBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC/E1B;EA+EA,cAAA,CAAA;GAAA,MAAA;GAAA,MDFY;GAAgB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;GAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAiB,UAAA;GAAA,QAAA,CAAA,mBAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAElC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAdzB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAqB,eAEhB,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IAGP,MAAM;IACN,uCAAuC;IACvC,qBAAqB;GACtB;GAAA,SACQ,CAAC,kBAAkB,iBAAiB;GAAC,UAAA;EAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input } from "@angular/core";
3
- import { clamp, round } from "ngwr/utils";
3
+ import { wrClamp, wrRound } from "ngwr/utils";
4
4
  /**
5
5
  * @license
6
6
  *
@@ -50,9 +50,9 @@ function centredAxis(value) {
50
50
  max: value + step,
51
51
  step,
52
52
  ticks: [
53
- round(value + step, digits),
53
+ wrRound(value + step, digits),
54
54
  value,
55
- round(value - step, digits)
55
+ wrRound(value - step, digits)
56
56
  ]
57
57
  };
58
58
  }
@@ -62,7 +62,7 @@ function niceStep(raw) {
62
62
  const normalised = raw / magnitude;
63
63
  return (normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10) * magnitude;
64
64
  }
65
- function chartAxis(min, max, options = {}) {
65
+ function wrChartAxis(min, max, options = {}) {
66
66
  if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;
67
67
  const dataLo = Math.min(min, max);
68
68
  const dataHi = Math.max(min, max);
@@ -78,7 +78,7 @@ function chartAxis(min, max, options = {}) {
78
78
  const gaps = Math.round((top - bottom) / step);
79
79
  const digits = tickDigits(step);
80
80
  const ticks = [];
81
- for (let i = 0; i <= gaps; i++) ticks.push(round(top - i * step, digits));
81
+ for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));
82
82
  return {
83
83
  min: bottom,
84
84
  max: top,
@@ -151,17 +151,17 @@ i0.ɵɵngDeclareClassMetadata({
151
151
  * Use of this source code is governed by an MIT-style license that can be
152
152
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
153
153
  */
154
- const CHART_PALETTE = [
154
+ const WR_CHART_PALETTE = [
155
155
  "var(--wr-color-primary)",
156
156
  "var(--wr-color-success)",
157
157
  "var(--wr-color-warning)",
158
158
  "var(--wr-color-danger)",
159
159
  "var(--wr-color-on-surface-muted)"
160
160
  ];
161
- function chartColor(index) {
162
- return CHART_PALETTE[wrap(index, CHART_PALETTE.length)];
161
+ function wrChartColor(index) {
162
+ return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];
163
163
  }
164
- const CHART_DASHES = [
164
+ const WR_CHART_DASHES = [
165
165
  "",
166
166
  "7 4",
167
167
  "2 3",
@@ -169,8 +169,8 @@ const CHART_DASHES = [
169
169
  "1 4",
170
170
  "6 3 2 3"
171
171
  ];
172
- function chartDash(index) {
173
- return CHART_DASHES[wrap(index, CHART_DASHES.length)];
172
+ function wrChartDash(index) {
173
+ return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];
174
174
  }
175
175
  function wrap(index, length) {
176
176
  return ((Number.isFinite(index) ? Math.trunc(index) : 0) % length + length) % length;
@@ -227,7 +227,7 @@ const EXTENTS = {
227
227
  };
228
228
  const n = (value) => String(Math.round(value * 1e3) / 1e3 || 0);
229
229
  const polygon = (points) => `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(" L ")} Z`;
230
- const CHART_MARKERS = [
230
+ const WR_CHART_MARKERS = [
231
231
  "circle",
232
232
  "square",
233
233
  "triangle",
@@ -235,10 +235,10 @@ const CHART_MARKERS = [
235
235
  "cross",
236
236
  "triangle-down"
237
237
  ];
238
- function chartMarker(index) {
239
- return CHART_MARKERS[wrap(index, CHART_MARKERS.length)];
238
+ function wrChartMarker(index) {
239
+ return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];
240
240
  }
241
- function chartMarkerPath(shape, r) {
241
+ function wrChartMarkerPath(shape, r) {
242
242
  if (!Number.isFinite(r) || r <= 0) return "";
243
243
  switch (shape) {
244
244
  case "square": {
@@ -291,7 +291,7 @@ function chartMarkerPath(shape, r) {
291
291
  default: return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;
292
292
  }
293
293
  }
294
- function chartMarkerExtent(shape, r) {
294
+ function wrChartMarkerExtent(shape, r) {
295
295
  const size = Number.isFinite(r) && r > 0 ? r : 0;
296
296
  const unit = EXTENTS[shape] ?? EXTENTS.circle;
297
297
  return {
@@ -343,12 +343,12 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
343
343
  if (custom) return values.map((v) => custom(v, ...args));
344
344
  if (values.length === 0) return [];
345
345
  const last = lastDigit(step);
346
- const digits = last <= -21 ? fractionDigits(step) : clamp(-last, 0, 20);
346
+ const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);
347
347
  const full = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });
348
348
  const plain = values.map((v) => full.format(v));
349
349
  const compact = values.map((v) => v === 0 ? full.format(0) : new Intl.NumberFormat(locale, {
350
350
  notation: "compact",
351
- maximumSignificantDigits: clamp(magnitude(v) - last + 1, 1, 21)
351
+ maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21)
352
352
  }).format(v));
353
353
  const longest = (labels) => Math.max(...labels.map((text) => text.length));
354
354
  return longest(compact) <= longest(plain) ? compact : plain;
@@ -357,7 +357,7 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
357
357
  const exact = (v, fractionDigits, ...args) => {
358
358
  const custom = valueFormat();
359
359
  if (custom) return custom(v, ...args);
360
- const digits = Number.isFinite(fractionDigits) ? clamp(Math.round(fractionDigits), 0, 20) : 3;
360
+ const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;
361
361
  let writer = exactNumbers.get(digits);
362
362
  if (!writer) {
363
363
  writer = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });
@@ -378,6 +378,6 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
378
378
  * Use of this source code is governed by an MIT-style license that can be
379
379
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
380
380
  */
381
- export { CHART_DASHES, CHART_MARKERS, CHART_PALETTE, WrChartTable, chartAxis, chartColor, chartDash, chartMarker, chartMarkerExtent, chartMarkerPath, useChartNumbers };
381
+ export { WR_CHART_DASHES, WR_CHART_MARKERS, WR_CHART_PALETTE, WrChartTable, useChartNumbers, wrChartAxis, wrChartColor, wrChartDash, wrChartMarker, wrChartMarkerExtent, wrChartMarkerPath };
382
382
 
383
383
  //# sourceMappingURL=ngwr-charts-core.mjs.map