ngwr 16.7.1 → 16.9.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 (236) hide show
  1. package/charts/donut-chart/styles/_index.scss +9 -3
  2. package/charts/meter-group/styles/_index.scss +8 -1
  3. package/charts/sparkline/styles/_index.scss +6 -3
  4. package/command-palette/styles/_index.scss +10 -0
  5. package/descriptions/styles/_index.scss +91 -0
  6. package/fesm2022/ngwr-anchor.mjs +48 -10
  7. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  8. package/fesm2022/ngwr-carousel.mjs +3 -2
  9. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  10. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
  11. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  12. package/fesm2022/ngwr-charts-core.mjs +17 -0
  13. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  14. package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
  15. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  16. package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
  17. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  18. package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
  19. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  20. package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
  21. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  22. package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
  23. package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
  24. package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
  25. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  26. package/fesm2022/ngwr-checkbox.mjs +38 -3
  27. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  28. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-color-picker.mjs +4 -3
  30. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  31. package/fesm2022/ngwr-command-palette.mjs +39 -19
  32. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  33. package/fesm2022/ngwr-compare.mjs +4 -0
  34. package/fesm2022/ngwr-compare.mjs.map +1 -1
  35. package/fesm2022/ngwr-context-menu.mjs +7 -2
  36. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  37. package/fesm2022/ngwr-cookie.mjs +6 -3
  38. package/fesm2022/ngwr-cookie.mjs.map +1 -1
  39. package/fesm2022/ngwr-date-stamp-testing.mjs +3 -0
  40. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
  41. package/fesm2022/ngwr-date-stamp.mjs +81 -4
  42. package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
  43. package/fesm2022/ngwr-date.mjs +16 -2
  44. package/fesm2022/ngwr-date.mjs.map +1 -1
  45. package/fesm2022/ngwr-density.mjs +4 -3
  46. package/fesm2022/ngwr-density.mjs.map +1 -1
  47. package/fesm2022/ngwr-descriptions.mjs +77 -20
  48. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  49. package/fesm2022/ngwr-dialog.mjs +10 -7
  50. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  51. package/fesm2022/ngwr-directives.mjs +12 -0
  52. package/fesm2022/ngwr-directives.mjs.map +1 -1
  53. package/fesm2022/ngwr-drawer.mjs +14 -8
  54. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  55. package/fesm2022/ngwr-editor.mjs +1 -0
  56. package/fesm2022/ngwr-editor.mjs.map +1 -1
  57. package/fesm2022/ngwr-file-upload.mjs +4 -5
  58. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  59. package/fesm2022/ngwr-form.mjs.map +1 -1
  60. package/fesm2022/ngwr-hotkey.mjs +10 -5
  61. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-ar.mjs +18 -5
  63. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  64. package/fesm2022/ngwr-i18n-cs.mjs +18 -5
  65. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  66. package/fesm2022/ngwr-i18n-de.mjs +18 -5
  67. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  68. package/fesm2022/ngwr-i18n-en.mjs +18 -5
  69. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  70. package/fesm2022/ngwr-i18n-es.mjs +18 -5
  71. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  72. package/fesm2022/ngwr-i18n-fr.mjs +18 -5
  73. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  74. package/fesm2022/ngwr-i18n-he.mjs +18 -5
  75. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-hi.mjs +18 -5
  77. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-id.mjs +18 -5
  79. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  80. package/fesm2022/ngwr-i18n-it.mjs +18 -5
  81. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  82. package/fesm2022/ngwr-i18n-ja.mjs +18 -5
  83. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  84. package/fesm2022/ngwr-i18n-kk.mjs +18 -5
  85. package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
  86. package/fesm2022/ngwr-i18n-ko.mjs +18 -5
  87. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  88. package/fesm2022/ngwr-i18n-nl.mjs +18 -5
  89. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  90. package/fesm2022/ngwr-i18n-pl.mjs +18 -5
  91. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  92. package/fesm2022/ngwr-i18n-pt.mjs +18 -5
  93. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  94. package/fesm2022/ngwr-i18n-ru.mjs +18 -5
  95. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  96. package/fesm2022/ngwr-i18n-sv.mjs +18 -5
  97. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  98. package/fesm2022/ngwr-i18n-tr.mjs +18 -5
  99. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  100. package/fesm2022/ngwr-i18n-uk.mjs +18 -5
  101. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  102. package/fesm2022/ngwr-i18n-vi.mjs +18 -5
  103. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  104. package/fesm2022/ngwr-i18n-zh-tw.mjs +18 -5
  105. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  106. package/fesm2022/ngwr-i18n-zh.mjs +18 -5
  107. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  108. package/fesm2022/ngwr-i18n.mjs +7 -6
  109. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  110. package/fesm2022/ngwr-image-cropper-testing.mjs +33 -0
  111. package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -1
  112. package/fesm2022/ngwr-image-cropper.mjs +536 -30
  113. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  114. package/fesm2022/ngwr-input-number.mjs +33 -10
  115. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  116. package/fesm2022/ngwr-input-otp.mjs +24 -10
  117. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  118. package/fesm2022/ngwr-input.mjs +2 -2
  119. package/fesm2022/ngwr-input.mjs.map +1 -1
  120. package/fesm2022/ngwr-knob.mjs +5 -0
  121. package/fesm2022/ngwr-knob.mjs.map +1 -1
  122. package/fesm2022/ngwr-lightbox.mjs +5 -3
  123. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  124. package/fesm2022/ngwr-mention.mjs +2 -0
  125. package/fesm2022/ngwr-mention.mjs.map +1 -1
  126. package/fesm2022/ngwr-meta.mjs +43 -8
  127. package/fesm2022/ngwr-meta.mjs.map +1 -1
  128. package/fesm2022/ngwr-overlay.mjs +51 -2
  129. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  130. package/fesm2022/ngwr-pagination.mjs +1 -1
  131. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  132. package/fesm2022/ngwr-pipes.mjs +160 -8
  133. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  134. package/fesm2022/ngwr-popconfirm.mjs +2 -2
  135. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  136. package/fesm2022/ngwr-qr.mjs +65 -7
  137. package/fesm2022/ngwr-qr.mjs.map +1 -1
  138. package/fesm2022/ngwr-schema-form.mjs +2 -2
  139. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  140. package/fesm2022/ngwr-scroll.mjs +1 -2
  141. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  142. package/fesm2022/ngwr-slider.mjs +22 -17
  143. package/fesm2022/ngwr-slider.mjs.map +1 -1
  144. package/fesm2022/ngwr-speed-dial.mjs +30 -1
  145. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  146. package/fesm2022/ngwr-statistic.mjs +1 -1
  147. package/fesm2022/ngwr-stepper-testing.mjs +7 -1
  148. package/fesm2022/ngwr-stepper-testing.mjs.map +1 -1
  149. package/fesm2022/ngwr-stepper.mjs +55 -4
  150. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  151. package/fesm2022/ngwr-switch.mjs +33 -3
  152. package/fesm2022/ngwr-switch.mjs.map +1 -1
  153. package/fesm2022/ngwr-timeline.mjs +4 -0
  154. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  155. package/fesm2022/ngwr-toolbar.mjs +171 -16
  156. package/fesm2022/ngwr-toolbar.mjs.map +1 -1
  157. package/fesm2022/ngwr-tour.mjs +8 -3
  158. package/fesm2022/ngwr-tour.mjs.map +1 -1
  159. package/fesm2022/ngwr-transfer.mjs +3 -2
  160. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  161. package/fesm2022/ngwr-tree.mjs +1 -1
  162. package/fesm2022/ngwr-utils.mjs +46 -8
  163. package/fesm2022/ngwr-utils.mjs.map +1 -1
  164. package/fesm2022/ngwr-version.mjs +1 -1
  165. package/fesm2022/ngwr-version.mjs.map +1 -1
  166. package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
  167. package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
  168. package/i18n/ar.json +18 -5
  169. package/i18n/cs.json +18 -5
  170. package/i18n/de.json +18 -5
  171. package/i18n/en.json +18 -5
  172. package/i18n/es.json +18 -5
  173. package/i18n/fr.json +18 -5
  174. package/i18n/he.json +18 -5
  175. package/i18n/hi.json +18 -5
  176. package/i18n/id.json +18 -5
  177. package/i18n/it.json +18 -5
  178. package/i18n/ja.json +18 -5
  179. package/i18n/kk.json +18 -5
  180. package/i18n/ko.json +18 -5
  181. package/i18n/nl.json +18 -5
  182. package/i18n/pl.json +18 -5
  183. package/i18n/pt.json +18 -5
  184. package/i18n/ru.json +18 -5
  185. package/i18n/sv.json +18 -5
  186. package/i18n/tr.json +18 -5
  187. package/i18n/uk.json +18 -5
  188. package/i18n/vi.json +18 -5
  189. package/i18n/zh-TW.json +18 -5
  190. package/i18n/zh.json +18 -5
  191. package/image-cropper/styles/_index.scss +30 -1
  192. package/llms-full.txt +9 -9
  193. package/package.json +1 -1
  194. package/schematics/use/rule.js +1 -0
  195. package/schematics/use/symbol-map.json +2 -0
  196. package/skills/ngwr/SKILL.md +2 -2
  197. package/stepper/styles/_index.scss +33 -0
  198. package/tour/styles/_index.scss +11 -7
  199. package/types/ngwr-anchor.d.ts +14 -1
  200. package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
  201. package/types/ngwr-charts-donut-chart.d.ts +45 -6
  202. package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
  203. package/types/ngwr-charts-meter-group.d.ts +43 -4
  204. package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
  205. package/types/ngwr-charts-sparkline.d.ts +42 -3
  206. package/types/ngwr-checkbox.d.ts +14 -0
  207. package/types/ngwr-color-picker-testing.d.ts +1 -1
  208. package/types/ngwr-command-palette.d.ts +2 -1
  209. package/types/ngwr-date-stamp-testing.d.ts +2 -0
  210. package/types/ngwr-date-stamp.d.ts +41 -2
  211. package/types/ngwr-date.d.ts +3 -1
  212. package/types/ngwr-descriptions.d.ts +33 -5
  213. package/types/ngwr-dialog.d.ts +11 -6
  214. package/types/ngwr-directives.d.ts +1 -0
  215. package/types/ngwr-drawer.d.ts +12 -4
  216. package/types/ngwr-file-upload.d.ts +1 -1
  217. package/types/ngwr-form.d.ts +4 -0
  218. package/types/ngwr-hotkey.d.ts +2 -0
  219. package/types/ngwr-image-cropper-testing.d.ts +33 -1
  220. package/types/ngwr-image-cropper.d.ts +214 -6
  221. package/types/ngwr-input-number.d.ts +14 -2
  222. package/types/ngwr-input-otp.d.ts +2 -0
  223. package/types/ngwr-lightbox.d.ts +1 -0
  224. package/types/ngwr-meta.d.ts +13 -1
  225. package/types/ngwr-overlay.d.ts +20 -1
  226. package/types/ngwr-pipes.d.ts +125 -1
  227. package/types/ngwr-qr.d.ts +17 -0
  228. package/types/ngwr-slider.d.ts +3 -1
  229. package/types/ngwr-speed-dial.d.ts +10 -0
  230. package/types/ngwr-stepper-testing.d.ts +10 -0
  231. package/types/ngwr-stepper.d.ts +47 -1
  232. package/types/ngwr-switch.d.ts +13 -0
  233. package/types/ngwr-toolbar.d.ts +27 -0
  234. package/types/ngwr-transfer.d.ts +2 -0
  235. package/types/ngwr-utils.d.ts +61 -2
  236. package/types/ngwr-version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-calendar-heatmap.mjs","names":[],"sources":["../../../projects/lib/charts/calendar-heatmap/calendar-heatmap.ts","../../../projects/lib/charts/calendar-heatmap/calendar-heatmap.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartScale, type WrChartLegendPosition } from 'ngwr/charts/chart-legend';\nimport { WrChartState, WrChartTable, type WrChartTableData, useChartNumbers, useChartState } from 'ngwr/charts/core';\nimport { wrDateLocale } from 'ngwr/date';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapDatum } from './types';\n\ninterface Cell {\n readonly iso: string;\n /** The day as the reader's locale writes it — see `cellTitle`. */\n readonly date: Date;\n readonly value: number;\n readonly intensity: number;\n /** Its step on the scale: 0 for a day of nothing, 1 to 5 for a day of something. */\n readonly level: number;\n /** The paint of its level, written on the square. */\n readonly paint: string;\n readonly week: number;\n readonly day: number;\n}\n\n/**\n * The steps of the sequential scale a day of something is painted with, lowest first: the\n * chart's own hooks, which the stylesheet points at `--wr-chart-seq-1` to `-5`. Written\n * out, so each hook is read by name.\n */\nconst STEPS = [\n 'var(--wr-calendar-heatmap-step-1)',\n 'var(--wr-calendar-heatmap-step-2)',\n 'var(--wr-calendar-heatmap-step-3)',\n 'var(--wr-calendar-heatmap-step-4)',\n 'var(--wr-calendar-heatmap-step-5)',\n] as const;\n\n/** A day in the form the data usually gives it, which sorts as a date does: `2026-03-09`. */\nconst ISO_DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/** Every `Intl.DateTimeFormat` the calendars have asked for, by locale and options. */\nconst DATE_FORMATS = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * The `Intl.DateTimeFormat` for `locale` and `options`, built once for the page: every\n * calendar built four of its own, 0.4 ms an instance, and a formatter holds no state.\n */\nfunction dateFormat(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `${locale}|${JSON.stringify(options)}`;\n let format = DATE_FORMATS.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(locale, options);\n DATE_FORMATS.set(key, format);\n }\n return format;\n}\n\nfunction toIso(d: Date): string {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${y}-${m}-${day}`;\n}\n\nfunction parseInput(value: string | Date): Date {\n return value instanceof Date ? new Date(value) : new Date(`${value}T00:00:00`);\n}\n\n/** Which rows carry a weekday label: three of seven, or they do not fit. */\nconst LABELLED_ROWS = new Set([1, 3, 5]);\n\n/**\n * A day's contribution, with anything non-finite read as `0`.\n *\n * One `NaN` used to flatten the entire rendered window rather than its own day:\n * `Math.max(a, NaN)` is `NaN`, so the data set's maximum became `NaN`, `max > 0`\n * was false, and every cell fell to intensity 0 — a map that reads as a stretch\n * with no activity at all. The bad day also printed the literal text `NaN` in its\n * `title`.\n */\nfunction amount(raw: number): number {\n return Number.isFinite(raw) ? raw : 0;\n}\n\n/**\n * GitHub-style year-grid heatmap. One column per ISO week, one row per\n * weekday — cells coloured by `value` relative to the largest day drawn.\n *\n * **The scale.** A day of something takes one of five levels by its share of the largest\n * day, painted with the chart theme's sequential scale: `--wr-chart-seq-1`, a tint of the\n * first palette colour, up to `--wr-chart-seq-5`, the colour itself. `color` steps the same\n * five from a colour of the chart's own. A day of nothing is the theme's track, and every\n * square carries a faint edge, so the lowest level still reads on a dark surface. A scale\n * key under the grid shows the levels from 0 to the largest day (`showLegend`,\n * `legendPosition`).\n *\n * **Empty, loading, error.** With no data the grid keeps its squares and says \"No data\"\n * under them; `loading` and `error` put their own message there.\n *\n * **A year does not reflow.** Its 53 columns are a fixed cell size, so in a container\n * narrower than the grid the host scrolls sideways. While it does, it is a tab stop with\n * the shared focus ring, so the keyboard can scroll it too — WebKit makes no scroller\n * focusable by itself — and it opens on the inline END, the newest weeks, rather than on\n * the oldest. The stop carries no name of its own: focus lands on the grid's picture,\n * named by `ariaLabel`.\n *\n * **What a screen reader gets.** The grid is one named `role=\"img\"` and every square is\n * hidden, so the days' values are not in text anywhere unless `dataTable` renders them;\n * without it, say what the year shows in `ariaLabel`.\n *\n * @example\n * ```html\n * <wr-calendar-heatmap [data]=\"contributions\" />\n * <wr-calendar-heatmap [data]=\"data\" [endDate]=\"today\" [weeks]=\"26\" color=\"#10b981\" />\n * ```\n *\n * @see https://ngwr.dev/charts/calendar-heatmap\n */\n@Component({\n selector: 'wr-calendar-heatmap',\n templateUrl: './calendar-heatmap.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the scale key's room from the grid.\n class: 'wr-calendar-heatmap wr-chart--legend',\n // A colour of the chart's own for the highest level, which the stylesheet then steps\n // the lower ones from. Without one the levels are the chart theme's sequential scale.\n '[class.wr-calendar-heatmap--tinted]': 'color() !== null',\n '[style.--wr-calendar-heatmap-scale-color]': 'color()',\n // A tab stop only while the year is wider than its container: see `scrollable`.\n '[attr.tabindex]': 'scrollable() ? 0 : null',\n },\n imports: [WrChartScale, WrChartState, WrChartTable],\n})\nexport class WrCalendarHeatmap {\n /**\n * One entry per day — `{ date, value }`. Days you pass nothing for render as\n * empty cells, so a sparse array is the normal shape rather than a gap. Rows outside\n * the weeks drawn are skipped, and do not move the scale.\n */\n readonly data = input<readonly WrHeatmapDatum[]>([]);\n\n /**\n * Accessible name of the whole grid. Its cells are bare spans whose `title` a screen\n * reader on a role-less element does not read, so the map used to be several hundred\n * anonymous nodes with no name. Falls back to `calendarHeatmap.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'calendarHeatmap.label', 'Calendar heatmap');\n\n private readonly cellText = useI18nFormatter('calendarHeatmap.cell', '{{date}}: {{count}}');\n\n /**\n * A cell's tooltip, with both halves formatted and the sentence in the catalog.\n *\n * It used to be `` `${cell.iso}: ${cell.value}` `` — a raw ISO date beside an\n * unformatted number, joined by a hard-coded `': '`. Three things were wrong\n * at once and none of them are visible from the template: `2026-09-10` is not\n * how most of the world writes a date, `1234` is not how every locale groups\n * digits (`ar-SA` does not even use these ones), and the separator and order\n * were frozen into a shape a translator could not reach.\n *\n * Both halves go through `Intl`: the date in `WR_DATE_LOCALE`, which the weekday\n * and month labels use too and which follows Angular's `LOCALE_ID` unless\n * `withDates()` pins it, and the count in `LOCALE_ID` itself — or through\n * `valueFormat` — as every chart writes its numbers. The key ships as\n * `{{date}}: {{count}}` everywhere, so nothing reorders today and every locale can.\n */\n protected cellTitle(cell: { readonly date: Date; readonly value: number }): string {\n return this.cellText({ date: this.dateFormat().format(cell.date), count: this.numbers.value(cell.value) });\n }\n\n /**\n * The formatters, built once. They were built per call, and with `tooltip` off\n * the template asks for every square's title on every pass — so each `mousemove`\n * over the grid, which still marks the view for check, built 740 of them: 44,400\n * for 60 moves, measured in dev mode at 907–931ms against 348–358ms with the\n * tooltip on.\n */\n private readonly dateFormat = computed(() => dateFormat(this.locale, { dateStyle: 'medium' }));\n\n /**\n * Every square's `title`, and only while the tooltip is off — the tooltip carries the\n * same sentence, and the browser would open a second copy a moment later. Worked out\n * when the days or the catalog change, not on every pass of the template.\n */\n protected readonly titles = computed(() => (this.tooltip() ? null : this.cells().map(cell => this.cellTitle(cell))));\n\n /** Last day to render. @default today */\n readonly endDate = input<string | Date | null>(null);\n\n /** Number of weeks (columns) to render. @default 53 */\n readonly weeks = input(53, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 53)) });\n\n /**\n * Cell side in CSS pixels. Twelve with a gap of three reads as a grid of days; the\n * eleven and two it was before 16.5 ran the squares together. @default 12\n */\n readonly cellSize = input(12, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 12)) });\n\n /** Pixel gap between cells. @default 3 */\n readonly cellGap = input(3, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 3)) });\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. The four\n * levels under it are stepped from it toward the surface, as the chart theme steps its\n * own scale. `null` paints the levels with the theme's sequential scale,\n * `--wr-chart-seq-1` to `-5`, which an app retints for every chart at once.\n * @default null\n */\n readonly color = input<string | null>(null);\n\n /**\n * Background colour for zero-value days. `null` takes `--wr-calendar-heatmap-empty`,\n * the chart theme's track. @default null\n */\n readonly emptyColor = input<string | null>(null);\n\n /** Show the scale key: the levels from 0 to the largest day. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Where the scale key sits: under the grid, over it, or `none` for no key at all. It\n * keeps to the inline end, where the newest weeks are, so it stays in sight while the\n * year scrolls. @default 'bottom'\n */\n readonly legendPosition = input<Exclude<WrChartLegendPosition, 'start' | 'end'>>('bottom');\n\n /**\n * A request for the days is in flight: the grid keeps its squares, all empty, and the\n * loading message sits under them. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The days failed to load: the grid keeps its squares, all empty, with the error\n * message under them. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown with no data. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** Show the weekday + month labels around the grid. @default true */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the day and its count on hover. It is the sentence the square's\n * `title` carried, so the `title` is written only while this is off — or the browser\n * would open a second copy a moment later.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes each day's count in the tooltip, the `title` and the data table. `null` uses\n * `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the days' values as a table that only assistive technology reaches: a row per\n * week, headed by its dates, and a column per weekday, each day's count written the way\n * the tooltip writes it. A day after the last one drawn is an empty cell.\n *\n * The grid is one named `role=\"img\"`, which hides everything inside it, so without the\n * table the values are nowhere a screen reader can walk. It is rendered beside the grid,\n * clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** A day's count as the tooltip, the `title` and the data table write it, in `LOCALE_ID`: never compact. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly daysEl = viewChild<ElementRef<HTMLElement>>('days');\n\n private readonly gridEl = viewChild<ElementRef<HTMLElement>>('grid');\n\n /**\n * Whether the year is wider than the host, which then scrolls it — and is a tab stop\n * while it does. `axe`'s `scrollable-region-focusable` named the scroller with no stop\n * at all, and in WebKit, which makes no scroller focusable by itself, a keyboard could\n * not reach the newest weeks. Measured in the browser after render and on every resize;\n * `false` on the server and in jsdom, which lay nothing out.\n */\n protected readonly scrollable = signal(false);\n\n private readonly dateLocale = wrDateLocale();\n\n private get locale(): string {\n return this.dateLocale();\n }\n\n /**\n * Weekday names from the locale rather than a hard-coded English list — the row order is\n * Sunday-first, matching the grid's own alignment, so 7 Jan 2024 (a Sunday) is the\n * reference. Rows without a label stay blank on purpose: seven labels do not fit.\n */\n protected readonly weekdayLabels = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { weekday: 'short' });\n const sunday = new Date(2024, 0, 7);\n return Array.from({ length: 7 }, (_, row) => {\n if (!LABELLED_ROWS.has(row)) return '';\n const day = new Date(sunday);\n day.setDate(sunday.getDate() + row);\n return formatter.format(day);\n });\n });\n\n private readonly monthNames = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { month: 'short' });\n return Array.from({ length: 12 }, (_, month) => formatter.format(new Date(2024, month, 15)));\n });\n\n protected readonly cells = computed<readonly Cell[]>(() => {\n const end = this.endDate() ? parseInput(this.endDate()!) : new Date();\n end.setHours(0, 0, 0, 0);\n const weeks = this.weeks();\n // A state shows the grid as its frame: every square empty.\n const data = this.state() && this.state()?.kind !== 'empty' ? [] : this.data();\n\n // Walk backwards from end day; arrange into columns by week, rows by weekday.\n const out: Cell[] = [];\n // Exactly `weeks` columns, the last of them the week `end` falls in, every\n // column starting on a Sunday (matches GitHub).\n //\n // Counted in WEEKS rather than in days. It used to allocate `weeks * 7`\n // days and then align the start back to a Sunday, which adds up to six\n // more — so any alignment at all produced one column more than asked for:\n // 54 for the default 53, with `--wr-calendar-heatmap-columns` reporting 54 and a\n // container sized from `weeks * (cellSize + cellGap)` one column short.\n const start = new Date(end);\n start.setDate(end.getDate() - end.getDay() - (weeks - 1) * 7);\n\n // Build value lookup, from the rows inside the window only. Ten years of days handed\n // to a year's calendar parsed every one of them, 19 ms for ten thousand rows, to keep\n // 371. A day written `2026-03-09` sorts as a date does, so one outside the window is\n // told by a string compare and never parsed; a week of margin at the start keeps a\n // day the calendar rolls over (`2026-02-31` is 3 March) where it was. A `Date` is\n // told by its time. The largest day is taken over the rows kept.\n const from = new Date(start);\n from.setDate(start.getDate() - 7);\n const firstIso = toIso(from);\n const lastIso = toIso(end);\n const firstTime = start.getTime();\n const lastTime = end.getTime() + 86_400_000;\n const map = new Map<string, number>();\n let max = 0;\n for (const d of data) {\n const { date } = d;\n if (typeof date === 'string') {\n if (ISO_DAY.test(date) && (date < firstIso || date > lastIso)) continue;\n } else {\n const time = date.getTime();\n if (time < firstTime || time >= lastTime) continue;\n }\n const iso = toIso(parseInput(date));\n const sum = (map.get(iso) ?? 0) + amount(d.value);\n map.set(iso, sum);\n }\n const startIso = toIso(start);\n for (const [iso, sum] of map) if (iso >= startIso && iso <= lastIso && sum > max) max = sum;\n\n const empty = this.emptyColor() ?? 'var(--wr-calendar-heatmap-empty)';\n const cursor = new Date(start);\n let column = 0;\n while (cursor <= end) {\n for (let row = 0; row < 7; row++) {\n // Stop at `end`. The inner loop always walks a whole week, so once the\n // cursor crossed `end` mid-week it kept going to Saturday — up to six\n // days AFTER the last day to render, drawn as ordinary `value: 0`\n // squares and indistinguishable from a past day of no activity. With\n // the default that is today plus five future days.\n if (cursor > end) break;\n const iso = toIso(cursor);\n const value = map.get(iso) ?? 0;\n // Clamped at the BOTTOM as well as the top. A negative value produced a\n // negative intensity, which is not zero — so `colorFor` painted it in\n // the accent colour and `opacityFor` put it in the lightest band,\n // rendering a day of negative activity exactly like a day of light\n // activity, and unlike the empty day it should have matched. The scale\n // has no negative half; the honest floor is \"nothing\".\n const intensity = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n // Five levels over the days of something, the largest day on the fifth; a day of\n // nothing has none, and is painted as the track.\n const level = intensity === 0 ? 0 : Math.min(STEPS.length, Math.ceil(intensity * STEPS.length - 1e-9));\n const paint = level === 0 ? empty : STEPS[level - 1];\n out.push({ iso, date: new Date(cursor), value, intensity, level, paint, week: column, day: row });\n cursor.setDate(cursor.getDate() + 1);\n }\n column++;\n }\n return out;\n });\n\n /** Every weekday's full name, Sunday first as the rows are: the data table's columns. */\n private readonly weekdayNames = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, row) => formatter.format(new Date(2024, 0, 7 + row)));\n });\n\n /**\n * The figures for `dataTable`: the grid's name as the caption, a column per weekday and\n * a row per week, headed by the week's first and last day drawn — `formatRange`, so the\n * locale writes the span its own way — and every day's count as the tooltip writes it.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const range = this.dateFormat();\n const weeks: (Cell | undefined)[][] = [];\n for (const cell of this.cells()) (weeks[cell.week] ??= [])[cell.day] = cell;\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.weekdayNames(),\n groups: [\n {\n rows: weeks.map(days => {\n const drawn = days.filter((day): day is Cell => day !== undefined);\n return {\n header: range.formatRange(drawn[0].date, drawn[drawn.length - 1].date),\n cells: Array.from({ length: 7 }, (_, d) => (days[d] ? this.numbers.value(days[d].value) : '')),\n };\n }),\n },\n ],\n };\n });\n\n protected readonly monthLabels = computed(() => {\n // Pull the first cell of each visible month → render a label centered\n // over its column.\n const cells = this.cells();\n const seen = new Set<string>();\n // Off the date each cell already carries: its ISO string was parsed again here, twice\n // for a month's first day, 371 string parses a pass.\n return cells\n .filter(({ date }) => {\n if (date.getDate() !== 1) return false;\n const key = `${date.getFullYear()}-${date.getMonth()}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n })\n .map(cell => ({ label: this.monthNames()[cell.date.getMonth()], week: cell.week }));\n });\n\n /** The largest day drawn, which the highest level stands for; 0 with no day of something. */\n private readonly peak = computed(() => this.cells().reduce((max, cell) => Math.max(max, cell.value), 0));\n\n /**\n * The scale key: a day of nothing, then the five levels, between 0 and the largest day\n * as the tooltip writes a count. With no day of something it keys the empty square alone.\n */\n protected readonly legend = computed(() => {\n const peak = this.peak();\n const empty = this.emptyColor() ?? 'var(--wr-calendar-heatmap-empty)';\n return {\n min: this.numbers.value(0),\n max: peak > 0 ? this.numbers.value(peak) : null,\n steps: peak > 0 ? [empty, ...STEPS] : [empty],\n };\n });\n\n /** Whether the chart draws its scale key: with `showLegend`, unless `legendPosition` is `none`. */\n protected readonly legendShown = computed(() => this.showLegend() && this.legendPosition() !== 'none');\n\n /** What the chart shows under its grid in place of the scale key, or `null` while it draws its days. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.data().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n protected readonly columnCount = computed(() => {\n const cells = this.cells();\n return cells.length === 0 ? 0 : cells[cells.length - 1].week + 1;\n });\n\n /** Each day's position in `cells()`, for the square the pointer lands on. */\n private readonly indexByIso = computed(() => new Map(this.cells().map((cell, index) => [cell.iso, index])));\n\n /**\n * One tooltip for the whole year, pointing at the hovered day: above its square,\n * below it when there is no room above, and slid along the viewport edge for the\n * first and last weeks with the arrow still on the square. A listener on the grid\n * rather than one per square: a year is 371 of them.\n *\n * The box is the square's LAYOUT box rather than its client rect. The hovered square\n * grows by `:hover` over a transition, and a rect read part way through it would\n * move the chip by up to a fifth of a square depending on when it was measured;\n * the scale is centred, so the layout box is the rect's centre and the square's\n * own size.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The squares are the container's only children, drawn in `cells()` order.\n const square = cell ? this.daysEl()?.nativeElement.children.item(index) : null;\n if (!cell || !(square instanceof HTMLElement)) return null;\n const rect = square.getBoundingClientRect();\n const width = square.offsetWidth;\n const height = square.offsetHeight;\n return {\n datum: { value: this.cellTitle(cell) },\n anchor: {\n x: (rect.left + rect.right - width) / 2,\n y: (rect.top + rect.bottom - height) / 2,\n width,\n height,\n },\n };\n });\n\n /**\n * Which square the pointer is on, from a `mousemove` on the grid. Over the gap\n * between two squares it is on none, and the tooltip starts to leave.\n */\n private onCellsPointer(event: MouseEvent): void {\n const iso = (event.target as Element | null)?.closest<HTMLElement>('.wr-calendar-heatmap__cell')?.dataset['date'];\n const index = iso === undefined ? undefined : this.indexByIso().get(iso);\n if (index === undefined) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/calendar-heatmap');\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const destroyRef = inject(DestroyRef);\n // Measured after render, in a browser, and again whenever the host or the grid changes\n // size: the host when its container does, the grid when `weeks` or `cellSize` does.\n // The observer's first report is the first measurement, so a year that boots narrower\n // than its container opens on its newest weeks, and so does one that starts to\n // overflow later — a chart that booted hidden, a window made narrow. A host that\n // already scrolled is left where the reader put it.\n // The pointer, heard on the days by two listeners of the chart's own rather than the\n // template's: a template listener checks the whole year again on every event. These\n // run nothing unless the square under the pointer changes.\n afterNextRender(() => {\n const days = this.daysEl()?.nativeElement;\n if (!days) return;\n const move = (event: MouseEvent): void => this.onCellsPointer(event);\n const leave = (event: MouseEvent): void => this.tip.leave(event);\n days.addEventListener('mousemove', move);\n days.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n days.removeEventListener('mousemove', move);\n days.removeEventListener('mouseleave', leave);\n });\n });\n\n // The ring round the day the tooltip reads, set by hand on that one square.\n let ringed: Element | null = null;\n effect(() => {\n const active = this.tip.active();\n const next = active === null ? null : (this.daysEl()?.nativeElement.children.item(active) ?? null);\n if (next === ringed) return;\n ringed?.classList.remove('wr-calendar-heatmap__cell--active');\n next?.classList.add('wr-calendar-heatmap__cell--active');\n ringed = next;\n });\n\n afterNextRender(() => {\n const grid = this.gridEl()?.nativeElement;\n if (typeof ResizeObserver === 'undefined') return;\n const measure = (): void => {\n const overflows = host.scrollWidth > host.clientWidth;\n if (overflows && !this.scrollable()) WrCalendarHeatmap.scrollToEnd(host);\n this.scrollable.set(overflows);\n };\n const observer = new ResizeObserver(measure);\n observer.observe(host);\n if (grid) observer.observe(grid);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Scrolls the host to its inline end, where the newest weeks are: the right in LTR and\n * the left under RTL, where `scrollLeft` runs from 0 down to minus the overflow. The\n * value is clamped by the browser, so either sign of the whole width lands on the end.\n */\n private static scrollToEnd(host: HTMLElement): void {\n const rtl = getComputedStyle(host).direction === 'rtl';\n host.scrollLeft = rtl ? -host.scrollWidth : host.scrollWidth;\n }\n}\n\nexport type { WrHeatmapDatum } from './types';\n","@let shown = state();\n@let key = legend();\n@let keyed = legendShown() && !shown;\n\n@if (keyed && legendPosition() === 'top') {\n <!-- The scale key, before the grid or after it so it is in the DOM where it is on\n screen. Hidden, as an axis' ticks are on every chart: the grid's name is what is\n announced, and the counts are in the data table. -->\n <wr-chart-scale\n class=\"wr-calendar-heatmap__legend\"\n aria-hidden=\"true\"\n position=\"top\"\n [steps]=\"key.steps\"\n [minLabel]=\"key.min\"\n [maxLabel]=\"key.max\"\n />\n}\n\n<div\n #grid\n class=\"wr-calendar-heatmap__grid\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.--wr-calendar-heatmap-cell-size.px]=\"cellSize()\"\n [style.--wr-calendar-heatmap-cell-gap.px]=\"cellGap()\"\n [style.--wr-calendar-heatmap-columns]=\"columnCount()\"\n>\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__weekdays\">\n @for (label of weekdayLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__weekday\">{{ label }}</span>\n }\n </div>\n }\n\n <!-- The pointer is heard here by listeners the component adds itself, and the reading\n day's ring is set by hand: nothing in this template follows the pointer, so a move\n across the year checks no square. A square's paint is its level's, a step of the\n sequential scale, or the track for a day of nothing. -->\n <div #days class=\"wr-calendar-heatmap__cells\">\n @for (cell of cells(); track cell.iso) {\n <span\n class=\"wr-calendar-heatmap__cell\"\n [style.background]=\"cell.paint\"\n [style.grid-column]=\"cell.week + 1\"\n [style.grid-row]=\"cell.day + 1\"\n [attr.title]=\"titles()?.[$index] ?? null\"\n [attr.data-date]=\"cell.iso\"\n [attr.data-value]=\"cell.value\"\n [attr.data-level]=\"cell.level\"\n aria-hidden=\"true\"\n ></span>\n }\n </div>\n\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__months\">\n @for (m of monthLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__month\" [style.grid-column]=\"m.week + 1\">{{ m.label }}</span>\n }\n </div>\n }\n</div>\n\n@if (shown) {\n <!-- Under the grid, in the scale key's place, and never inside the grid's `img`, which\n makes everything it holds presentational: the message is a live region. -->\n <div class=\"wr-calendar-heatmap__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (keyed && legendPosition() === 'bottom') {\n <wr-chart-scale\n class=\"wr-calendar-heatmap__legend\"\n aria-hidden=\"true\"\n position=\"bottom\"\n [steps]=\"key.steps\"\n [minLabel]=\"key.min\"\n [maxLabel]=\"key.max\"\n />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the grid's `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room, draws nothing and adds nothing to the scroll. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkDA,MAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;AACQ;AAGV,MAAM,UAAU;AAGhB,MAAM,+BAAe,IAAI,IAAG;AAM5B,SAAS,WAAW,QAAgB,SAAmC;CACrE,MAAM,MAAM,GAAG,OAAM,GAAI,KAAK,UAAU,OAAO;CAC/C,IAAI,SAAS,aAAa,IAAI,GAAG;CACjC,IAAI,CAAC,QAAQ;EACX,SAAS,IAAI,KAAK,eAAe,QAAQ,OAAO;EAChD,aAAa,IAAI,KAAK,MAAM;CAC9B;CACA,OAAO;AACT;AAEA,SAAS,MAAM,GAAO;CAIpB,OAAO,GAHG,EAAE,YAGF,EAAC,GAFD,OAAO,EAAE,SAAQ,IAAK,CAAC,CAAC,CAAC,SAAS,GAAG,GAEhC,EAAC,GADJ,OAAO,EAAE,QAAO,CAAE,CAAC,CAAC,SAAS,GAAG,GACxB;AACtB;AAEA,SAAS,WAAW,OAAoB;CACtC,OAAO,iBAAiB,OAAO,IAAI,KAAK,KAAK,oBAAI,IAAI,KAAK,GAAG,MAAK,UAAW;AAC/E;AAGA,MAAM,gCAAgB,IAAI,IAAI;CAAC;CAAG;CAAG;AAAC,CAAC;AAWvC,SAAS,OAAO,KAAW;CACzB,OAAO,OAAO,SAAS,GAAG,IAAI,MAAM;AACtC;AAoDA,IAAa,oBAAb,MAAa,kBAAiB;CAMnB,OAAO,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAO3C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,Y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,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEN,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-calendar-heatmap.mjs","names":[],"sources":["../../../projects/lib/charts/calendar-heatmap/calendar-heatmap.ts","../../../projects/lib/charts/calendar-heatmap/calendar-heatmap.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartScale, type WrChartLegendPosition } from 'ngwr/charts/chart-legend';\nimport { WrChartState, WrChartTable, type WrChartTableData, useChartNumbers, useChartState } from 'ngwr/charts/core';\nimport { wrDateLocale } from 'ngwr/date';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrHeatmapDatum } from './types';\n\ninterface Cell {\n readonly iso: string;\n /** The day as the reader's locale writes it — see `cellTitle`. */\n readonly date: Date;\n readonly value: number;\n readonly intensity: number;\n /** Its step on the scale: 0 for a day of nothing, 1 to 5 for a day of something. */\n readonly level: number;\n /** The paint of its level, written on the square. */\n readonly paint: string;\n readonly week: number;\n readonly day: number;\n}\n\n/**\n * The steps of the sequential scale a day of something is painted with, lowest first: the\n * chart's own hooks, which the stylesheet points at `--wr-chart-seq-1` to `-5`. Written\n * out, so each hook is read by name.\n */\nconst STEPS = [\n 'var(--wr-calendar-heatmap-step-1)',\n 'var(--wr-calendar-heatmap-step-2)',\n 'var(--wr-calendar-heatmap-step-3)',\n 'var(--wr-calendar-heatmap-step-4)',\n 'var(--wr-calendar-heatmap-step-5)',\n] as const;\n\n/** A day in the form the data usually gives it, which sorts as a date does: `2026-03-09`. */\nconst ISO_DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/** Every `Intl.DateTimeFormat` the calendars have asked for, by locale and options. */\nconst DATE_FORMATS = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * The `Intl.DateTimeFormat` for `locale` and `options`, built once for the page: every\n * calendar built four of its own, 0.4 ms an instance, and a formatter holds no state.\n */\nfunction dateFormat(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `${locale}|${JSON.stringify(options)}`;\n let format = DATE_FORMATS.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(locale, options);\n DATE_FORMATS.set(key, format);\n }\n return format;\n}\n\nfunction toIso(d: Date): string {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${y}-${m}-${day}`;\n}\n\nfunction parseInput(value: string | Date): Date {\n return value instanceof Date ? new Date(value) : new Date(`${value}T00:00:00`);\n}\n\n/** Which rows carry a weekday label: three of seven, or they do not fit. */\nconst LABELLED_ROWS = new Set([1, 3, 5]);\n\n/**\n * A day's contribution, with anything non-finite read as `0`.\n *\n * One `NaN` used to flatten the entire rendered window rather than its own day:\n * `Math.max(a, NaN)` is `NaN`, so the data set's maximum became `NaN`, `max > 0`\n * was false, and every cell fell to intensity 0 — a map that reads as a stretch\n * with no activity at all. The bad day also printed the literal text `NaN` in its\n * `title`.\n */\nfunction amount(raw: number): number {\n return Number.isFinite(raw) ? raw : 0;\n}\n\n/**\n * GitHub-style year-grid heatmap. One column per ISO week, one row per\n * weekday — cells coloured by `value` relative to the largest day drawn.\n *\n * **The scale.** A day of something takes one of five levels by its share of the largest\n * day, painted with the chart theme's sequential scale: `--wr-chart-seq-1`, a tint of the\n * first palette colour, up to `--wr-chart-seq-5`, the colour itself. `color` steps the same\n * five from a colour of the chart's own. A day of nothing is the theme's track, and every\n * square carries a faint edge, so the lowest level still reads on a dark surface. A scale\n * key under the grid shows the levels from 0 to the largest day (`showLegend`,\n * `legendPosition`).\n *\n * **Empty, loading, error.** With no data the grid keeps its squares and says \"No data\"\n * under them; `loading` and `error` put their own message there.\n *\n * **A year does not reflow.** Its 53 columns are a fixed cell size, so in a container\n * narrower than the grid the host scrolls sideways. While it does, it is a tab stop with\n * the shared focus ring, so the keyboard can scroll it too — WebKit makes no scroller\n * focusable by itself — and it opens on the inline END, the newest weeks, rather than on\n * the oldest. The stop carries no name of its own: focus lands on the grid's picture,\n * named by `ariaLabel`.\n *\n * **What a screen reader gets.** The grid is one named `role=\"img\"` and every square is\n * hidden, so the days' values are not in text anywhere unless `dataTable` renders them;\n * without it, say what the year shows in `ariaLabel`.\n *\n * @example\n * ```html\n * <wr-calendar-heatmap [data]=\"contributions\" />\n * <wr-calendar-heatmap [data]=\"data\" [endDate]=\"today\" [weeks]=\"26\" color=\"#10b981\" />\n * ```\n *\n * @see https://ngwr.dev/charts/calendar-heatmap\n */\n@Component({\n selector: 'wr-calendar-heatmap',\n templateUrl: './calendar-heatmap.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the scale key's room from the grid.\n class: 'wr-calendar-heatmap wr-chart--legend',\n // A colour of the chart's own for the highest level, which the stylesheet then steps\n // the lower ones from. Without one the levels are the chart theme's sequential scale.\n '[class.wr-calendar-heatmap--tinted]': 'color() !== null',\n '[style.--wr-calendar-heatmap-scale-color]': 'color()',\n // A tab stop only while the year is wider than its container: see `scrollable`.\n '[attr.tabindex]': 'scrollable() ? 0 : null',\n },\n imports: [WrChartScale, WrChartState, WrChartTable],\n})\nexport class WrCalendarHeatmap {\n /**\n * One entry per day — `{ date, value }`. Days you pass nothing for render as\n * empty cells, so a sparse array is the normal shape rather than a gap. Rows outside\n * the weeks drawn are skipped, and do not move the scale.\n */\n readonly data = input<readonly WrHeatmapDatum[]>([]);\n\n /**\n * Accessible name of the whole grid. Its cells are bare spans whose `title` a screen\n * reader on a role-less element does not read, so the map used to be several hundred\n * anonymous nodes with no name. Falls back to `calendarHeatmap.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'calendarHeatmap.label', 'Calendar heatmap');\n\n private readonly cellText = useI18nFormatter('calendarHeatmap.cell', '{{date}}: {{count}}');\n\n /**\n * A cell's tooltip, with both halves formatted and the sentence in the catalog.\n *\n * It used to be `` `${cell.iso}: ${cell.value}` `` — a raw ISO date beside an\n * unformatted number, joined by a hard-coded `': '`. Three things were wrong\n * at once and none of them are visible from the template: `2026-09-10` is not\n * how most of the world writes a date, `1234` is not how every locale groups\n * digits (`ar-SA` does not even use these ones), and the separator and order\n * were frozen into a shape a translator could not reach.\n *\n * Both halves go through `Intl`: the date in `WR_DATE_LOCALE`, which the weekday\n * and month labels use too and which follows Angular's `LOCALE_ID` unless\n * `withDates()` pins it, and the count in `LOCALE_ID` itself — or through\n * `valueFormat` — as every chart writes its numbers. The key ships as\n * `{{date}}: {{count}}` everywhere, so nothing reorders today and every locale can.\n */\n protected cellTitle(cell: { readonly date: Date; readonly value: number }): string {\n return this.cellText({ date: this.dateFormat().format(cell.date), count: this.numbers.value(cell.value) });\n }\n\n /**\n * The formatters, built once. They were built per call, and with `tooltip` off\n * the template asks for every square's title on every pass — so each `mousemove`\n * over the grid, which still marks the view for check, built 740 of them: 44,400\n * for 60 moves, measured in dev mode at 907–931ms against 348–358ms with the\n * tooltip on.\n */\n private readonly dateFormat = computed(() => dateFormat(this.locale, { dateStyle: 'medium' }));\n\n /**\n * Every square's `title`, and only while the tooltip is off — the tooltip carries the\n * same sentence, and the browser would open a second copy a moment later. Worked out\n * when the days or the catalog change, not on every pass of the template.\n */\n protected readonly titles = computed(() => (this.tooltip() ? null : this.cells().map(cell => this.cellTitle(cell))));\n\n /** Last day to render. @default today */\n readonly endDate = input<string | Date | null>(null);\n\n /** Number of weeks (columns) to render. @default 53 */\n readonly weeks = input(53, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 53)) });\n\n /**\n * Cell side in CSS pixels. Twelve with a gap of three reads as a grid of days; the\n * eleven and two it was before 16.5 ran the squares together. @default 12\n */\n readonly cellSize = input(12, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 12)) });\n\n /** Pixel gap between cells. @default 3 */\n readonly cellGap = input(3, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 3)) });\n\n /**\n * The colour of the highest level: any CSS colour, `var(--wr-…)` included. The four\n * levels under it are stepped from it toward the surface, as the chart theme steps its\n * own scale. `null` paints the levels with the theme's sequential scale,\n * `--wr-chart-seq-1` to `-5`, which an app retints for every chart at once.\n * @default null\n */\n readonly color = input<string | null>(null);\n\n /**\n * Background colour for zero-value days. `null` takes `--wr-calendar-heatmap-empty`,\n * the chart theme's track. @default null\n */\n readonly emptyColor = input<string | null>(null);\n\n /** Show the scale key: the levels from 0 to the largest day. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Where the scale key sits: under the grid, over it, or `none` for no key at all. It\n * keeps to the inline end, where the newest weeks are, so it stays in sight while the\n * year scrolls. @default 'bottom'\n */\n readonly legendPosition = input<Exclude<WrChartLegendPosition, 'start' | 'end'>>('bottom');\n\n /**\n * A request for the days is in flight: the grid keeps its squares, all empty, and the\n * loading message sits under them. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The days failed to load: the grid keeps its squares, all empty, with the error\n * message under them. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown with no data. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** Show the weekday + month labels around the grid. @default true */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the day and its count on hover. It is the sentence the square's\n * `title` carried, so the `title` is written only while this is off — or the browser\n * would open a second copy a moment later.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes each day's count in the tooltip, the `title` and the data table. `null` uses\n * `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the days' values as a table that only assistive technology reaches: a row per\n * week, headed by its dates, and a column per weekday, each day's count written the way\n * the tooltip writes it. A day after the last one drawn is an empty cell.\n *\n * The grid is one named `role=\"img\"`, which hides everything inside it, so without the\n * table the values are nowhere a screen reader can walk. It is rendered beside the grid,\n * clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** A day's count as the tooltip, the `title` and the data table write it, in `LOCALE_ID`: never compact. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly daysEl = viewChild<ElementRef<HTMLElement>>('days');\n\n private readonly gridEl = viewChild<ElementRef<HTMLElement>>('grid');\n\n /**\n * Whether the year is wider than the host, which then scrolls it — and is a tab stop\n * while it does. `axe`'s `scrollable-region-focusable` named the scroller with no stop\n * at all, and in WebKit, which makes no scroller focusable by itself, a keyboard could\n * not reach the newest weeks. Measured in the browser after render and on every resize;\n * `false` on the server and in jsdom, which lay nothing out.\n */\n protected readonly scrollable = signal(false);\n\n private readonly dateLocale = wrDateLocale();\n\n private get locale(): string {\n return this.dateLocale();\n }\n\n /**\n * Weekday names from the locale rather than a hard-coded English list — the row order is\n * Sunday-first, matching the grid's own alignment, so 7 Jan 2024 (a Sunday) is the\n * reference. Rows without a label stay blank on purpose: seven labels do not fit.\n */\n protected readonly weekdayLabels = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { weekday: 'short' });\n const sunday = new Date(2024, 0, 7);\n return Array.from({ length: 7 }, (_, row) => {\n if (!LABELLED_ROWS.has(row)) return '';\n const day = new Date(sunday);\n day.setDate(sunday.getDate() + row);\n return formatter.format(day);\n });\n });\n\n private readonly monthNames = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { month: 'short' });\n return Array.from({ length: 12 }, (_, month) => formatter.format(new Date(2024, month, 15)));\n });\n\n protected readonly cells = computed<readonly Cell[]>(() => {\n const end = this.endDate() ? parseInput(this.endDate()!) : new Date();\n end.setHours(0, 0, 0, 0);\n const weeks = this.weeks();\n // A state shows the grid as its frame: every square empty.\n const data = this.state() && this.state()?.kind !== 'empty' ? [] : this.data();\n\n // Walk backwards from end day; arrange into columns by week, rows by weekday.\n const out: Cell[] = [];\n // Exactly `weeks` columns, the last of them the week `end` falls in, every\n // column starting on a Sunday (matches GitHub).\n //\n // Counted in WEEKS rather than in days. It used to allocate `weeks * 7`\n // days and then align the start back to a Sunday, which adds up to six\n // more — so any alignment at all produced one column more than asked for:\n // 54 for the default 53, with `--wr-calendar-heatmap-columns` reporting 54 and a\n // container sized from `weeks * (cellSize + cellGap)` one column short.\n const start = new Date(end);\n start.setDate(end.getDate() - end.getDay() - (weeks - 1) * 7);\n\n // Build value lookup, from the rows inside the window only. Ten years of days handed\n // to a year's calendar parsed every one of them, 19 ms for ten thousand rows, to keep\n // 371. A day written `2026-03-09` sorts as a date does, so one outside the window is\n // told by a string compare and never parsed; a week of margin at the start keeps a\n // day the calendar rolls over (`2026-02-31` is 3 March) where it was. A `Date` is\n // told by its time. The largest day is taken over the rows kept.\n const from = new Date(start);\n from.setDate(start.getDate() - 7);\n const firstIso = toIso(from);\n const lastIso = toIso(end);\n const firstTime = start.getTime();\n // The next local midnight, not 24 hours on: a day that ends a DST change is 23 or 25.\n const after = new Date(end);\n after.setDate(end.getDate() + 1);\n const lastTime = after.getTime();\n const map = new Map<string, number>();\n let max = 0;\n for (const d of data) {\n const { date } = d;\n if (typeof date === 'string') {\n if (ISO_DAY.test(date) && (date < firstIso || date > lastIso)) continue;\n } else {\n const time = date.getTime();\n if (time < firstTime || time >= lastTime) continue;\n }\n const iso = toIso(parseInput(date));\n const sum = (map.get(iso) ?? 0) + amount(d.value);\n map.set(iso, sum);\n }\n const startIso = toIso(start);\n for (const [iso, sum] of map) if (iso >= startIso && iso <= lastIso && sum > max) max = sum;\n\n const empty = this.emptyColor() ?? 'var(--wr-calendar-heatmap-empty)';\n const cursor = new Date(start);\n let column = 0;\n while (cursor <= end) {\n for (let row = 0; row < 7; row++) {\n // Stop at `end`. The inner loop always walks a whole week, so once the\n // cursor crossed `end` mid-week it kept going to Saturday — up to six\n // days AFTER the last day to render, drawn as ordinary `value: 0`\n // squares and indistinguishable from a past day of no activity. With\n // the default that is today plus five future days.\n if (cursor > end) break;\n const iso = toIso(cursor);\n const value = map.get(iso) ?? 0;\n // Clamped at the BOTTOM as well as the top. A negative value produced a\n // negative intensity, which is not zero — so `colorFor` painted it in\n // the accent colour and `opacityFor` put it in the lightest band,\n // rendering a day of negative activity exactly like a day of light\n // activity, and unlike the empty day it should have matched. The scale\n // has no negative half; the honest floor is \"nothing\".\n const intensity = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n // Five levels over the days of something, the largest day on the fifth; a day of\n // nothing has none, and is painted as the track.\n const level = intensity === 0 ? 0 : Math.min(STEPS.length, Math.ceil(intensity * STEPS.length - 1e-9));\n const paint = level === 0 ? empty : STEPS[level - 1];\n out.push({ iso, date: new Date(cursor), value, intensity, level, paint, week: column, day: row });\n cursor.setDate(cursor.getDate() + 1);\n }\n column++;\n }\n return out;\n });\n\n /** Every weekday's full name, Sunday first as the rows are: the data table's columns. */\n private readonly weekdayNames = computed<readonly string[]>(() => {\n const formatter = dateFormat(this.locale, { weekday: 'long' });\n return Array.from({ length: 7 }, (_, row) => formatter.format(new Date(2024, 0, 7 + row)));\n });\n\n /**\n * The figures for `dataTable`: the grid's name as the caption, a column per weekday and\n * a row per week, headed by the week's first and last day drawn — `formatRange`, so the\n * locale writes the span its own way — and every day's count as the tooltip writes it.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const range = this.dateFormat();\n const weeks: (Cell | undefined)[][] = [];\n for (const cell of this.cells()) (weeks[cell.week] ??= [])[cell.day] = cell;\n return {\n caption: this.resolvedAriaLabel(),\n columns: this.weekdayNames(),\n groups: [\n {\n rows: weeks.map(days => {\n const drawn = days.filter((day): day is Cell => day !== undefined);\n return {\n header: range.formatRange(drawn[0].date, drawn[drawn.length - 1].date),\n cells: Array.from({ length: 7 }, (_, d) => (days[d] ? this.numbers.value(days[d].value) : '')),\n };\n }),\n },\n ],\n };\n });\n\n protected readonly monthLabels = computed(() => {\n // Pull the first cell of each visible month → render a label centered\n // over its column.\n const cells = this.cells();\n const seen = new Set<string>();\n // Off the date each cell already carries: its ISO string was parsed again here, twice\n // for a month's first day, 371 string parses a pass.\n return cells\n .filter(({ date }) => {\n if (date.getDate() !== 1) return false;\n const key = `${date.getFullYear()}-${date.getMonth()}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n })\n .map(cell => ({ label: this.monthNames()[cell.date.getMonth()], week: cell.week }));\n });\n\n /** The largest day drawn, which the highest level stands for; 0 with no day of something. */\n private readonly peak = computed(() => this.cells().reduce((max, cell) => Math.max(max, cell.value), 0));\n\n /**\n * The scale key: a day of nothing, then the five levels, between 0 and the largest day\n * as the tooltip writes a count. With no day of something it keys the empty square alone.\n */\n protected readonly legend = computed(() => {\n const peak = this.peak();\n const empty = this.emptyColor() ?? 'var(--wr-calendar-heatmap-empty)';\n return {\n min: this.numbers.value(0),\n max: peak > 0 ? this.numbers.value(peak) : null,\n steps: peak > 0 ? [empty, ...STEPS] : [empty],\n };\n });\n\n /** Whether the chart draws its scale key: with `showLegend`, unless `legendPosition` is `none`. */\n protected readonly legendShown = computed(() => this.showLegend() && this.legendPosition() !== 'none');\n\n /** What the chart shows under its grid in place of the scale key, or `null` while it draws its days. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.data().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n protected readonly columnCount = computed(() => {\n const cells = this.cells();\n return cells.length === 0 ? 0 : cells[cells.length - 1].week + 1;\n });\n\n /** Each day's position in `cells()`, for the square the pointer lands on. */\n private readonly indexByIso = computed(() => new Map(this.cells().map((cell, index) => [cell.iso, index])));\n\n /**\n * One tooltip for the whole year, pointing at the hovered day: above its square,\n * below it when there is no room above, and slid along the viewport edge for the\n * first and last weeks with the arrow still on the square. A listener on the grid\n * rather than one per square: a year is 371 of them.\n *\n * The box is the square's LAYOUT box rather than its client rect. The hovered square\n * grows by `:hover` over a transition, and a rect read part way through it would\n * move the chip by up to a fifth of a square depending on when it was measured;\n * the scale is centred, so the layout box is the rect's centre and the square's\n * own size.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const cell = this.cells()[index];\n // The squares are the container's only children, drawn in `cells()` order.\n const square = cell ? this.daysEl()?.nativeElement.children.item(index) : null;\n if (!cell || !(square instanceof HTMLElement)) return null;\n const rect = square.getBoundingClientRect();\n const width = square.offsetWidth;\n const height = square.offsetHeight;\n return {\n datum: { value: this.cellTitle(cell) },\n anchor: {\n x: (rect.left + rect.right - width) / 2,\n y: (rect.top + rect.bottom - height) / 2,\n width,\n height,\n },\n };\n });\n\n /**\n * Which square the pointer is on, from a `mousemove` on the grid. Over the gap\n * between two squares it is on none, and the tooltip starts to leave.\n */\n private onCellsPointer(event: MouseEvent): void {\n const iso = (event.target as Element | null)?.closest<HTMLElement>('.wr-calendar-heatmap__cell')?.dataset['date'];\n const index = iso === undefined ? undefined : this.indexByIso().get(iso);\n if (index === undefined) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/calendar-heatmap');\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const destroyRef = inject(DestroyRef);\n // Measured after render, in a browser, and again whenever the host or the grid changes\n // size: the host when its container does, the grid when `weeks` or `cellSize` does.\n // The observer's first report is the first measurement, so a year that boots narrower\n // than its container opens on its newest weeks, and so does one that starts to\n // overflow later — a chart that booted hidden, a window made narrow. A host that\n // already scrolled is left where the reader put it.\n // The pointer, heard on the days by two listeners of the chart's own rather than the\n // template's: a template listener checks the whole year again on every event. These\n // run nothing unless the square under the pointer changes.\n afterNextRender(() => {\n const days = this.daysEl()?.nativeElement;\n if (!days) return;\n const move = (event: MouseEvent): void => this.onCellsPointer(event);\n const leave = (event: MouseEvent): void => this.tip.leave(event);\n days.addEventListener('mousemove', move);\n days.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n days.removeEventListener('mousemove', move);\n days.removeEventListener('mouseleave', leave);\n });\n });\n\n // The ring round the day the tooltip reads, set by hand on that one square.\n let ringed: Element | null = null;\n effect(() => {\n const active = this.tip.active();\n const next = active === null ? null : (this.daysEl()?.nativeElement.children.item(active) ?? null);\n if (next === ringed) return;\n ringed?.classList.remove('wr-calendar-heatmap__cell--active');\n next?.classList.add('wr-calendar-heatmap__cell--active');\n ringed = next;\n });\n\n afterNextRender(() => {\n const grid = this.gridEl()?.nativeElement;\n if (typeof ResizeObserver === 'undefined') return;\n const measure = (): void => {\n const overflows = host.scrollWidth > host.clientWidth;\n if (overflows && !this.scrollable()) WrCalendarHeatmap.scrollToEnd(host);\n this.scrollable.set(overflows);\n };\n const observer = new ResizeObserver(measure);\n observer.observe(host);\n if (grid) observer.observe(grid);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Scrolls the host to its inline end, where the newest weeks are: the right in LTR and\n * the left under RTL, where `scrollLeft` runs from 0 down to minus the overflow. The\n * value is clamped by the browser, so either sign of the whole width lands on the end.\n */\n private static scrollToEnd(host: HTMLElement): void {\n const rtl = getComputedStyle(host).direction === 'rtl';\n host.scrollLeft = rtl ? -host.scrollWidth : host.scrollWidth;\n }\n}\n\nexport type { WrHeatmapDatum } from './types';\n","@let shown = state();\n@let key = legend();\n@let keyed = legendShown() && !shown;\n\n@if (keyed && legendPosition() === 'top') {\n <!-- The scale key, before the grid or after it so it is in the DOM where it is on\n screen. Hidden, as an axis' ticks are on every chart: the grid's name is what is\n announced, and the counts are in the data table. -->\n <wr-chart-scale\n class=\"wr-calendar-heatmap__legend\"\n aria-hidden=\"true\"\n position=\"top\"\n [steps]=\"key.steps\"\n [minLabel]=\"key.min\"\n [maxLabel]=\"key.max\"\n />\n}\n\n<div\n #grid\n class=\"wr-calendar-heatmap__grid\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.--wr-calendar-heatmap-cell-size.px]=\"cellSize()\"\n [style.--wr-calendar-heatmap-cell-gap.px]=\"cellGap()\"\n [style.--wr-calendar-heatmap-columns]=\"columnCount()\"\n>\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__weekdays\">\n @for (label of weekdayLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__weekday\">{{ label }}</span>\n }\n </div>\n }\n\n <!-- The pointer is heard here by listeners the component adds itself, and the reading\n day's ring is set by hand: nothing in this template follows the pointer, so a move\n across the year checks no square. A square's paint is its level's, a step of the\n sequential scale, or the track for a day of nothing. -->\n <div #days class=\"wr-calendar-heatmap__cells\">\n @for (cell of cells(); track cell.iso) {\n <span\n class=\"wr-calendar-heatmap__cell\"\n [style.background]=\"cell.paint\"\n [style.grid-column]=\"cell.week + 1\"\n [style.grid-row]=\"cell.day + 1\"\n [attr.title]=\"titles()?.[$index] ?? null\"\n [attr.data-date]=\"cell.iso\"\n [attr.data-value]=\"cell.value\"\n [attr.data-level]=\"cell.level\"\n aria-hidden=\"true\"\n ></span>\n }\n </div>\n\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__months\">\n @for (m of monthLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__month\" [style.grid-column]=\"m.week + 1\">{{ m.label }}</span>\n }\n </div>\n }\n</div>\n\n@if (shown) {\n <!-- Under the grid, in the scale key's place, and never inside the grid's `img`, which\n makes everything it holds presentational: the message is a live region. -->\n <div class=\"wr-calendar-heatmap__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (keyed && legendPosition() === 'bottom') {\n <wr-chart-scale\n class=\"wr-calendar-heatmap__legend\"\n aria-hidden=\"true\"\n position=\"bottom\"\n [steps]=\"key.steps\"\n [minLabel]=\"key.min\"\n [maxLabel]=\"key.max\"\n />\n}\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the grid's `img` and never inside it: `img`\n makes everything it holds presentational. Clipped to nothing by its own stylesheet,\n so it takes no room, draws nothing and adds nothing to the scroll. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkDA,MAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;AACQ;AAGV,MAAM,UAAU;AAGhB,MAAM,+BAAe,IAAI,IAAG;AAM5B,SAAS,WAAW,QAAgB,SAAmC;CACrE,MAAM,MAAM,GAAG,OAAM,GAAI,KAAK,UAAU,OAAO;CAC/C,IAAI,SAAS,aAAa,IAAI,GAAG;CACjC,IAAI,CAAC,QAAQ;EACX,SAAS,IAAI,KAAK,eAAe,QAAQ,OAAO;EAChD,aAAa,IAAI,KAAK,MAAM;CAC9B;CACA,OAAO;AACT;AAEA,SAAS,MAAM,GAAO;CAIpB,OAAO,GAHG,EAAE,Y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MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEN,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -340,10 +340,26 @@ function useChartHover(handlers) {
340
340
  const destroyRef = inject(DestroyRef);
341
341
  let index = null;
342
342
  let series = null;
343
+ let relight = null;
344
+ const watch = (on) => {
345
+ if (!on) {
346
+ relight?.disconnect();
347
+ relight = null;
348
+ } else if (!relight && typeof MutationObserver !== "undefined") {
349
+ relight = new MutationObserver(() => {
350
+ if (series !== null) wrChartDim(host, series);
351
+ });
352
+ relight.observe(host, {
353
+ childList: true,
354
+ subtree: true
355
+ });
356
+ }
357
+ };
343
358
  const dim = (key) => {
344
359
  if (key === series) return;
345
360
  series = key;
346
361
  wrChartDim(host, key);
362
+ watch(key !== null);
347
363
  };
348
364
  let current = null;
349
365
  const band = (section) => {
@@ -381,6 +397,7 @@ function useChartHover(handlers) {
381
397
  host.addEventListener("mouseover", over);
382
398
  host.addEventListener("mouseleave", leave);
383
399
  destroyRef.onDestroy(() => {
400
+ watch(false);
384
401
  host.removeEventListener("mouseover", over);
385
402
  host.removeEventListener("mouseleave", leave);
386
403
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-core.mjs","names":[],"sources":["../../../projects/lib/charts/core/axis.ts","../../../projects/lib/charts/core/chart-state.ts","../../../projects/lib/charts/core/chart-state.html","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/interaction.ts","../../../projects/lib/charts/core/labels.ts","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/round.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrRound } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [wrRound(value + step, digits), value, wrRound(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `wrChartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function wrChartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n // A quotient a hair off a whole number (0.3 / 0.025 is 11.999999999999998) is that number.\n const snap = (value: number): number => {\n const q = value / step;\n return Math.abs(q - Math.round(q)) <= 1e-9 * Math.max(1, Math.abs(q)) ? Math.round(q) : q;\n };\n const near = (a: number, b: number): boolean => Math.abs(a - b) <= step * 1e-9;\n let bottomStep = Math.floor(snap(lo));\n let topStep = Math.ceil(snap(hi));\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (near(topStep * step, dataHi)) topStep += 1;\n if (options.symmetric && near(bottomStep * step, dataLo)) bottomStep -= 1;\n const bottom = bottomStep * step;\n const top = topStep * step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const digits = tickDigits(step);\n const gaps = Math.round((top - bottom) / step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\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 { Component, type Signal, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\n/**\n * What a chart shows in place of its marks.\n *\n * @internal\n */\nexport type WrChartStateKind = 'empty' | 'loading' | 'error';\n\n/**\n * The state a chart is in, with the message it shows for it.\n *\n * @internal\n */\nexport interface WrChartStateView {\n readonly kind: WrChartStateKind;\n readonly label: string;\n}\n\n/**\n * The inputs a chart hands {@link useChartState}.\n *\n * @internal\n */\nexport interface WrChartStateOptions {\n /** The chart's `loading` input. */\n readonly loading: Signal<boolean>;\n /** The chart's `error` input. */\n readonly error: Signal<boolean>;\n /** Whether the chart has nothing to draw. */\n readonly empty: Signal<boolean>;\n /** The chart's `emptyLabel`, `loadingLabel` and `errorLabel` inputs: `null` takes the catalog's. */\n readonly emptyLabel: Signal<string | null>;\n readonly loadingLabel: Signal<string | null>;\n readonly errorLabel: Signal<string | null>;\n}\n\n/**\n * The state a chart shows instead of its marks, or `null` while it draws them: loading\n * first, then a failed load, then no data. Each message is the chart's own `*Label`\n * input, then the catalog's `chart.loading` / `chart.error` / `chart.empty`, then\n * English. Call in an injection context.\n *\n * One rule for every chart, so a dashboard whose requests are in flight reads the same\n * in every tile, and a chart with no data is a framed \"No data\" rather than a blank box\n * of whatever height its markup collapses to.\n *\n * @internal\n */\nexport function useChartState(options: WrChartStateOptions): Signal<WrChartStateView | null> {\n const loading = useI18nText(options.loadingLabel, 'chart.loading', 'Loading…');\n const error = useI18nText(options.errorLabel, 'chart.error', 'Could not load');\n const empty = useI18nText(options.emptyLabel, 'chart.empty', 'No data');\n return computed<WrChartStateView | null>(() => {\n if (options.loading()) return { kind: 'loading', label: loading() };\n if (options.error()) return { kind: 'error', label: error() };\n if (options.empty()) return { kind: 'empty', label: empty() };\n return null;\n });\n}\n\n/**\n * The message a chart shows in place of its marks, centred over the frame it keeps.\n *\n * A live region: `role=\"status\"`, so a screen reader hears \"Loading…\" when a chart\n * starts a request and \"No data\" when it comes back with none, without the chart taking\n * focus. A failed load is `role=\"alert\"`, which interrupts, since it is the one of the\n * three a reader has to act on. The chart renders it inside the box its marks are drawn\n * in, which it positions; the grid and the axis under it stay.\n *\n * @example\n * ```html\n * @if (state(); as shown) {\n * <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-state',\n templateUrl: './chart-state.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-state',\n '[class.wr-chart-state--empty]': \"kind() === 'empty'\",\n '[class.wr-chart-state--loading]': \"kind() === 'loading'\",\n '[class.wr-chart-state--error]': \"kind() === 'error'\",\n '[attr.role]': \"kind() === 'error' ? 'alert' : 'status'\",\n },\n})\nexport class WrChartState {\n /** Which of the three states this is. */\n readonly kind = input.required<WrChartStateKind>();\n\n /** The message, already translated. */\n readonly label = input.required<string>();\n}\n","<span class=\"wr-chart-state__plate\">\n @if (kind() === 'loading') {\n <!-- Decoration: the word beside it carries the state. -->\n <span class=\"wr-chart-state__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"wr-chart-state__label\">{{ label() }}</span>\n</span>\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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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 { DestroyRef, ElementRef, type Signal, afterNextRender, afterRenderEffect, inject, signal } from '@angular/core';\n\nconst UNMEASURED: WrChartSize = { width: 0, height: 0 };\n\n/** What each observed element reports to, on the one observer every chart shares. */\nconst listeners = new WeakMap<Element, (size: WrChartSize) => void>();\n\n/** The marks {@link wrChartDim} lit last, per host, so the next call clears them without a scan. */\nconst litMarks = new WeakMap<Element, Element[]>();\n\nlet observer: ResizeObserver | null = null;\n\n/** The constructor `observer` was built with: a page has one, a test suite swaps it. */\nlet observerType: typeof ResizeObserver | null = null;\n\n/**\n * The box a chart measures, in px. Both are 0 until it is laid out.\n *\n * @internal\n */\nexport interface WrChartSize {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Reports `element`'s content box to `listener` whenever it changes, through ONE\n * `ResizeObserver` for every chart on the page. Returns the function that stops it.\n *\n * Seven charts each made an observer of their own, so a dashboard of forty tiles ran\n * forty. An observer is built to watch many targets and delivers them in one callback\n * per frame. One listener per element: observing an element again replaces its listener.\n * Where there is no `ResizeObserver` (a server, an old test environment) nothing is\n * observed and the returned function does nothing.\n *\n * @internal\n */\nexport function wrChartObserveSize(element: Element, listener: (size: WrChartSize) => void): () => void {\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n if (!observer || observerType !== ResizeObserver) {\n observerType = ResizeObserver;\n observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n listeners.get(entry.target)?.({ width, height });\n }\n });\n }\n const shared = observer;\n listeners.set(element, listener);\n shared.observe(element);\n return () => {\n listeners.delete(element);\n shared.unobserve(element);\n };\n}\n\n/**\n * The size of the element `target` holds, as a signal that follows it: `0 × 0` until the\n * element is rendered and laid out, and again once it is gone. On the shared observer of\n * {@link wrChartObserveSize}. Call in an injection context.\n *\n * @internal\n */\nexport function useChartSize(target: Signal<ElementRef<Element> | Element | undefined>): Signal<WrChartSize> {\n const size = signal<WrChartSize>(UNMEASURED);\n let stop: (() => void) | null = null;\n let observed: Element | null = null;\n\n afterRenderEffect(() => {\n const held = target();\n const element = held instanceof ElementRef ? held.nativeElement : (held ?? null);\n if (element === observed) return;\n stop?.();\n observed = element;\n stop = null;\n if (!element) {\n size.set(UNMEASURED);\n return;\n }\n stop = wrChartObserveSize(element, next => {\n const current = size();\n if (current.width !== next.width || current.height !== next.height) size.set(next);\n });\n });\n inject(DestroyRef).onDestroy(() => stop?.());\n return size.asReadonly();\n}\n\n/**\n * What {@link useChartHover} tells a chart.\n *\n * @internal\n */\nexport interface WrChartHoverHandlers {\n /** The pointer is over the section whose `data-wr-index` is `index`. Not repeated while it stays there. */\n enter(index: number): void;\n /** The pointer left the sections: for the chart's box, or for a part of it that is no section. */\n leave(event: MouseEvent): void;\n}\n\n/**\n * Dims every mark of `host` but the ones of series `key`, or none for `null`: the chart\n * takes `wr-chart--dim` and the series' own marks `wr-chart-mark--on`, and the shared\n * stylesheet fades the rest to `--wr-chart-dim`. A mark is anything carrying\n * `data-wr-series`, a legend row included.\n *\n * Classes set by hand rather than bound: a binding on every mark is re-evaluated for\n * every mark on each hover change, and this touches the marks of two series.\n *\n * @internal\n */\nexport function wrChartDim(host: Element, key: string | null): void {\n for (const mark of litMarks.get(host) ?? []) mark.classList.remove('wr-chart-mark--on');\n host.classList.toggle('wr-chart--dim', key !== null);\n if (key === null) {\n litMarks.delete(host);\n return;\n }\n const marks = [...host.querySelectorAll(`[data-wr-series=\"${CSS.escape(key)}\"]`)];\n for (const mark of marks) mark.classList.add('wr-chart-mark--on');\n litMarks.set(host, marks);\n}\n\n/**\n * A chart's hover, from ONE pair of listeners on its host however many sections it draws.\n *\n * A section is any element carrying `data-wr-index`: the listener finds the nearest one\n * above whatever the pointer is on and reports its index, once per section entered. A\n * listener pair on every bar was two per bar, and each one a change detection pass over\n * the whole chart for every bar the pointer crossed; these are native listeners, so a\n * move runs no pass at all unless the chart's own handler writes a signal.\n *\n * A gap the chart marks with `data-wr-hold` keeps the section and the dim as they are, so\n * crossing from one bar to the next does not close and reopen the tooltip; a section in\n * such an area takes `wr-chart-section--on`, so a band the chart paints on it stays too.\n *\n * It also drives the shared hover-dim: the nearest element carrying `data-wr-series`\n * names the series under the pointer, and {@link wrChartDim} fades the rest. Legend rows\n * carry the attribute too, so hovering a row dims the chart the same way.\n *\n * Registered after the first render, in the browser only. Call in an injection context.\n *\n * @internal\n */\nexport function useChartHover(handlers: WrChartHoverHandlers): void {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const destroyRef = inject(DestroyRef);\n let index: number | null = null;\n let series: string | null = null;\n\n const dim = (key: string | null): void => {\n if (key === series) return;\n series = key;\n wrChartDim(host, key);\n };\n\n let current: Element | null = null;\n const band = (section: Element | null): void => {\n current?.classList.remove('wr-chart-section--on');\n current = section?.closest('[data-wr-hold]') ? section : null;\n current?.classList.add('wr-chart-section--on');\n };\n\n const inHost = (el: Element | null | undefined): el is Element => !!el && host.contains(el);\n\n const over = (event: MouseEvent): void => {\n const target = event.target instanceof Element ? event.target : null;\n const section = target?.closest('[data-wr-index]');\n const series = target?.closest('[data-wr-series]');\n // In the room a chart holds open between its marks (`data-wr-hold`, the gaps between\n // its bars), the pointer is still on the drawing: what it last pointed at stays,\n // rather than closing and reopening a few pixels on.\n const held = !inHost(series) && inHost(target?.closest('[data-wr-hold]'));\n if (!held) dim(inHost(series) ? series.getAttribute('data-wr-series') : null);\n if (held && !inHost(section)) return;\n\n const next = inHost(section) ? Number(section.getAttribute('data-wr-index')) : null;\n if (next === index) return;\n index = next;\n if (next === null || !Number.isFinite(next)) {\n band(null);\n handlers.leave(event);\n } else {\n band(section ?? null);\n handlers.enter(next);\n }\n };\n\n const leave = (event: MouseEvent): void => {\n dim(null);\n if (index === null) return;\n index = null;\n band(null);\n handlers.leave(event);\n };\n\n afterNextRender(() => {\n host.addEventListener('mouseover', over);\n host.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n host.removeEventListener('mouseover', over);\n host.removeEventListener('mouseleave', leave);\n });\n });\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\n/**\n * The `limit` longest of `labels`, each once, longest first: the strings worth measuring.\n *\n * A chart sizes a gutter or keeps room past a bar from a hidden copy of the text that goes\n * there. Copying every label made ten thousand hidden spans for ten thousand bars, to learn\n * the width of one. The widest label is almost always among the longest few by character\n * count - a proportional font can put `1,111` under `999`, which is why this returns a few\n * and not one - so a chart renders these and reads the widest.\n *\n * @internal\n */\nexport function wrChartLongest(labels: readonly string[], limit = 3): string[] {\n const longest: string[] = [];\n for (const label of new Set(labels)) {\n if (longest.length === limit && label.length <= longest[longest.length - 1].length) continue;\n let at = longest.findIndex(kept => kept.length < label.length);\n if (at < 0) at = longest.length;\n longest.splice(at, 0, label);\n if (longest.length > limit) longest.pop();\n }\n return longest;\n}\n\n/**\n * How many categories each printed label stands for, so no two labels along an axis run\n * into each other: 1 while every label fits its own band, 2 to print every second one,\n * and so on.\n *\n * `extent` is the axis' length and `count` how many bands share it; `labelSize` is the\n * longest label along the axis, and `gap` the least room between two labels. All in the\n * same unit, px in practice. With nothing measured yet - a server render, a chart not\n * laid out - the answer is 1: every label, as the markup had before it was measured.\n *\n * @internal\n */\nexport function wrChartLabelStep(count: number, extent: number, labelSize: number, gap = 8): number {\n if (!(count > 1) || !(extent > 0) || !(labelSize > 0)) return 1;\n const band = extent / count;\n return Math.max(1, Math.min(count, Math.ceil((labelSize + gap) / band)));\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\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes. Each is a token of the chart theme (`--wr-chart-1` to\n * `--wr-chart-8`, declared by `ngwr/charts/core`'s stylesheet), so an app retints\n * every chart by setting the tokens and a chart's markup never names a hex.\n *\n * The palette is not the status intents: a second series is not a success and a\n * fourth is not a danger. The first is the brand colour and the last the neutral\n * role; neighbours alternate between a deep and a mid tone, so two series next to\n * each other differ in lightness as well as in hue. The stylesheet carries the\n * measured contrast of each.\n *\n * A chart that draws lines still pairs each with a dash (`WR_CHART_DASHES`), and\n * one that draws points with a shape (`WR_CHART_MARKERS`): colour is never the\n * only thing that tells two series apart.\n *\n * @internal\n */\nexport const WR_CHART_PALETTE: readonly string[] = [\n 'var(--wr-chart-1)',\n 'var(--wr-chart-2)',\n 'var(--wr-chart-3)',\n 'var(--wr-chart-4)',\n 'var(--wr-chart-5)',\n 'var(--wr-chart-6)',\n 'var(--wr-chart-7)',\n 'var(--wr-chart-8)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartColor(index: number): string {\n return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];\n}\n\n/**\n * The series colours every chart took before the chart theme: four status intents and\n * the neutral role. Kept for the charts that have not moved onto `--wr-chart-*` yet,\n * so each keeps its look until it does; a chart on the theme reads\n * {@link WR_CHART_PALETTE}.\n *\n * `warning` measures 1.71:1 on a white surface, under the 3:1 a graphic needs, which\n * is one of the reasons the theme's palette replaced it.\n *\n * @internal\n */\nexport const WR_CHART_LEGACY_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The {@link WR_CHART_LEGACY_PALETTE} colour for the series at `index`, wrapping past\n * the end.\n *\n * @internal\n */\nexport function wrChartLegacyColor(index: number): string {\n return WR_CHART_LEGACY_PALETTE[wrap(index, WR_CHART_LEGACY_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * A reader with red-green colour blindness can see two strokes of similar lightness\n * as one grey, and a legend that pairs a coloured dot with a name does not rescue it:\n * matching the dot to the line is exactly the step that needs hue. Distinguishing\n * series by dash is the standard remedy and the only one that survives greyscale,\n * printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const WR_CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartDash(index: number): string {\n return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\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 { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link wrChartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const WR_CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartMarker(index: number): WrChartMarkerShape {\n return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function wrChartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n 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`;\n }\n}\n\n/**\n * How far the marker {@link wrChartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function wrChartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\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 { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/** Every formatter the charts have asked for, by locale and options. */\nconst FORMATTERS = new Map<string, Intl.NumberFormat>();\n\n/**\n * The `Intl.NumberFormat` for `locale` and `options`, built once for the page and shared\n * by every chart on it.\n *\n * Building one costs about a tenth of a millisecond, and the charts built them freely:\n * three per chart instance, and one per tick on every pass over an axis, so a table of a\n * hundred sparklines paid for three hundred identical formatters. A formatter holds no\n * state, so one per distinct key serves them all. The key is the locale and the options\n * in the order given; the charts ask with a handful of shapes, so the map stays small.\n *\n * @internal\n */\nexport function wrChartNumberFormat(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = options ? `${locale}|${JSON.stringify(options)}` : locale;\n let format = FORMATTERS.get(key);\n if (!format) {\n format = new Intl.NumberFormat(locale, options);\n FORMATTERS.set(key, format);\n }\n return format;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = wrChartNumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = wrChartNumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = wrChartNumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);\n const full = wrChartNumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : wrChartNumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;\n return wrChartNumberFormat(locale, { maximumFractionDigits: digits }).format(v);\n };\n\n return { value, label, ticks, exact };\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\n/**\n * `value` rounded to `digits` decimals for an inline style or an SVG attribute, with\n * `-0` folded to `0`: a share of an axis, a percentage, a coordinate.\n *\n * Eleven charts each kept a copy of this under another name (`short`, `percent`,\n * `fixed`), at three precisions. A written geometry value wants few digits - every one\n * past the fourth is bytes in the DOM and a different string for the same pixel - and\n * never `-0`, which `Math.round` produces for a small negative and which prints as `-0`.\n *\n * Not `wrRound` from `ngwr/utils`, which nudges by `Number.EPSILON` to round a decimal\n * tie the way a person expects and keeps the sign of a zero.\n *\n * @internal\n */\nexport function wrChartRound(value: number, digits = 4): number {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor || 0;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,aAAa;AAGnB,MAAM,QAAqB;CAAE,KAAK;CAAG,KAAK;CAAG,MAAM;CAAM,OAAO;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;AAAC;AAGvF,MAAM,SAAS;CAAC;CAAG;CAAK;CAAM;AAAG;AAejC,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,C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,IAAI;EAO3B,MAAM,OAAO,oBAAoB,QAAQ,EAAE,uBAD5B,QAAQ,MAAM,eAAe,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,EAAE,EACA,CAAE;EAC1E,MAAM,QAAQ,OAAO,KAAI,MAAK,KAAK,OAAO,CAAC,CAAC;EAC5C,MAAM,UAAU,OAAO,KAAI,MACzB,MAAM,IACF,KAAK,OAAO,CAAC,IACb,oBAAoB,QAAQ;GAC1B,UAAU;GACV,0BAA0B,QAAQ,UAAU,CAAC,IAAI,OAAO,GAAG,GAAG,EAAE;EACjE,CAAA,CAAC,CAAC,OAAO,CAAC,CAAC;EAElB,MAAM,WAAW,WAAsC,KAAK,IAAI,GAAG,OAAO,KAAI,SAAQ,KAAK,MAAM,CAAC;EAClG,OAAO,QAAQ,OAAO,KAAK,QAAQ,KAAK,IAAI,UAAU;CACxD;CAEA,MAAM,SAAS,GAAW,gBAAwB,GAAG,SAAmB;EACtE,MAAM,SAAS,YAAW;EAC1B,IAAI,QAAQ,OAAO,OAAO,GAAG,GAAG,IAAI;EAEpC,OAAO,oBAAoB,QAAQ,EAAE,uBADtB,OAAO,SAAS,cAAc,IAAI,QAAQ,KAAK,MAAM,cAAc,GAAG,GAAG,EAAE,IAAI,EAC5B,CAAE,CAAC,CAAC,OAAO,CAAC;CAChF;CAEA,OAAO;EAAE;EAAO;EAAO;EAAO;CAAK;AACrC;;;;;;;AC3IA,SAAgB,aAAa,OAAe,SAAS,GAAC;CACpD,MAAM,SAAS,MAAM;CACrB,OAAO,KAAK,MAAM,QAAQ,MAAM,IAAI,UAAU;AAChD"}
1
+ {"version":3,"file":"ngwr-charts-core.mjs","names":[],"sources":["../../../projects/lib/charts/core/axis.ts","../../../projects/lib/charts/core/chart-state.ts","../../../projects/lib/charts/core/chart-state.html","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/interaction.ts","../../../projects/lib/charts/core/labels.ts","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/round.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrRound } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [wrRound(value + step, digits), value, wrRound(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `wrChartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function wrChartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n // A quotient a hair off a whole number (0.3 / 0.025 is 11.999999999999998) is that number.\n const snap = (value: number): number => {\n const q = value / step;\n return Math.abs(q - Math.round(q)) <= 1e-9 * Math.max(1, Math.abs(q)) ? Math.round(q) : q;\n };\n const near = (a: number, b: number): boolean => Math.abs(a - b) <= step * 1e-9;\n let bottomStep = Math.floor(snap(lo));\n let topStep = Math.ceil(snap(hi));\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (near(topStep * step, dataHi)) topStep += 1;\n if (options.symmetric && near(bottomStep * step, dataLo)) bottomStep -= 1;\n const bottom = bottomStep * step;\n const top = topStep * step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const digits = tickDigits(step);\n const gaps = Math.round((top - bottom) / step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\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 { Component, type Signal, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\n/**\n * What a chart shows in place of its marks.\n *\n * @internal\n */\nexport type WrChartStateKind = 'empty' | 'loading' | 'error';\n\n/**\n * The state a chart is in, with the message it shows for it.\n *\n * @internal\n */\nexport interface WrChartStateView {\n readonly kind: WrChartStateKind;\n readonly label: string;\n}\n\n/**\n * The inputs a chart hands {@link useChartState}.\n *\n * @internal\n */\nexport interface WrChartStateOptions {\n /** The chart's `loading` input. */\n readonly loading: Signal<boolean>;\n /** The chart's `error` input. */\n readonly error: Signal<boolean>;\n /** Whether the chart has nothing to draw. */\n readonly empty: Signal<boolean>;\n /** The chart's `emptyLabel`, `loadingLabel` and `errorLabel` inputs: `null` takes the catalog's. */\n readonly emptyLabel: Signal<string | null>;\n readonly loadingLabel: Signal<string | null>;\n readonly errorLabel: Signal<string | null>;\n}\n\n/**\n * The state a chart shows instead of its marks, or `null` while it draws them: loading\n * first, then a failed load, then no data. Each message is the chart's own `*Label`\n * input, then the catalog's `chart.loading` / `chart.error` / `chart.empty`, then\n * English. Call in an injection context.\n *\n * One rule for every chart, so a dashboard whose requests are in flight reads the same\n * in every tile, and a chart with no data is a framed \"No data\" rather than a blank box\n * of whatever height its markup collapses to.\n *\n * @internal\n */\nexport function useChartState(options: WrChartStateOptions): Signal<WrChartStateView | null> {\n const loading = useI18nText(options.loadingLabel, 'chart.loading', 'Loading…');\n const error = useI18nText(options.errorLabel, 'chart.error', 'Could not load');\n const empty = useI18nText(options.emptyLabel, 'chart.empty', 'No data');\n return computed<WrChartStateView | null>(() => {\n if (options.loading()) return { kind: 'loading', label: loading() };\n if (options.error()) return { kind: 'error', label: error() };\n if (options.empty()) return { kind: 'empty', label: empty() };\n return null;\n });\n}\n\n/**\n * The message a chart shows in place of its marks, centred over the frame it keeps.\n *\n * A live region: `role=\"status\"`, so a screen reader hears \"Loading…\" when a chart\n * starts a request and \"No data\" when it comes back with none, without the chart taking\n * focus. A failed load is `role=\"alert\"`, which interrupts, since it is the one of the\n * three a reader has to act on. The chart renders it inside the box its marks are drawn\n * in, which it positions; the grid and the axis under it stay.\n *\n * @example\n * ```html\n * @if (state(); as shown) {\n * <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-state',\n templateUrl: './chart-state.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-state',\n '[class.wr-chart-state--empty]': \"kind() === 'empty'\",\n '[class.wr-chart-state--loading]': \"kind() === 'loading'\",\n '[class.wr-chart-state--error]': \"kind() === 'error'\",\n '[attr.role]': \"kind() === 'error' ? 'alert' : 'status'\",\n },\n})\nexport class WrChartState {\n /** Which of the three states this is. */\n readonly kind = input.required<WrChartStateKind>();\n\n /** The message, already translated. */\n readonly label = input.required<string>();\n}\n","<span class=\"wr-chart-state__plate\">\n @if (kind() === 'loading') {\n <!-- Decoration: the word beside it carries the state. -->\n <span class=\"wr-chart-state__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"wr-chart-state__label\">{{ label() }}</span>\n</span>\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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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 { DestroyRef, ElementRef, type Signal, afterNextRender, afterRenderEffect, inject, signal } from '@angular/core';\n\nconst UNMEASURED: WrChartSize = { width: 0, height: 0 };\n\n/** What each observed element reports to, on the one observer every chart shares. */\nconst listeners = new WeakMap<Element, (size: WrChartSize) => void>();\n\n/** The marks {@link wrChartDim} lit last, per host, so the next call clears them without a scan. */\nconst litMarks = new WeakMap<Element, Element[]>();\n\nlet observer: ResizeObserver | null = null;\n\n/** The constructor `observer` was built with: a page has one, a test suite swaps it. */\nlet observerType: typeof ResizeObserver | null = null;\n\n/**\n * The box a chart measures, in px. Both are 0 until it is laid out.\n *\n * @internal\n */\nexport interface WrChartSize {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Reports `element`'s content box to `listener` whenever it changes, through ONE\n * `ResizeObserver` for every chart on the page. Returns the function that stops it.\n *\n * Seven charts each made an observer of their own, so a dashboard of forty tiles ran\n * forty. An observer is built to watch many targets and delivers them in one callback\n * per frame. One listener per element: observing an element again replaces its listener.\n * Where there is no `ResizeObserver` (a server, an old test environment) nothing is\n * observed and the returned function does nothing.\n *\n * @internal\n */\nexport function wrChartObserveSize(element: Element, listener: (size: WrChartSize) => void): () => void {\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n if (!observer || observerType !== ResizeObserver) {\n observerType = ResizeObserver;\n observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n listeners.get(entry.target)?.({ width, height });\n }\n });\n }\n const shared = observer;\n listeners.set(element, listener);\n shared.observe(element);\n return () => {\n listeners.delete(element);\n shared.unobserve(element);\n };\n}\n\n/**\n * The size of the element `target` holds, as a signal that follows it: `0 × 0` until the\n * element is rendered and laid out, and again once it is gone. On the shared observer of\n * {@link wrChartObserveSize}. Call in an injection context.\n *\n * @internal\n */\nexport function useChartSize(target: Signal<ElementRef<Element> | Element | undefined>): Signal<WrChartSize> {\n const size = signal<WrChartSize>(UNMEASURED);\n let stop: (() => void) | null = null;\n let observed: Element | null = null;\n\n afterRenderEffect(() => {\n const held = target();\n const element = held instanceof ElementRef ? held.nativeElement : (held ?? null);\n if (element === observed) return;\n stop?.();\n observed = element;\n stop = null;\n if (!element) {\n size.set(UNMEASURED);\n return;\n }\n stop = wrChartObserveSize(element, next => {\n const current = size();\n if (current.width !== next.width || current.height !== next.height) size.set(next);\n });\n });\n inject(DestroyRef).onDestroy(() => stop?.());\n return size.asReadonly();\n}\n\n/**\n * What {@link useChartHover} tells a chart.\n *\n * @internal\n */\nexport interface WrChartHoverHandlers {\n /** The pointer is over the section whose `data-wr-index` is `index`. Not repeated while it stays there. */\n enter(index: number): void;\n /** The pointer left the sections: for the chart's box, or for a part of it that is no section. */\n leave(event: MouseEvent): void;\n}\n\n/**\n * Dims every mark of `host` but the ones of series `key`, or none for `null`: the chart\n * takes `wr-chart--dim` and the series' own marks `wr-chart-mark--on`, and the shared\n * stylesheet fades the rest to `--wr-chart-dim`. A mark is anything carrying\n * `data-wr-series`, a legend row included.\n *\n * Classes set by hand rather than bound: a binding on every mark is re-evaluated for\n * every mark on each hover change, and this touches the marks of two series.\n *\n * @internal\n */\nexport function wrChartDim(host: Element, key: string | null): void {\n for (const mark of litMarks.get(host) ?? []) mark.classList.remove('wr-chart-mark--on');\n host.classList.toggle('wr-chart--dim', key !== null);\n if (key === null) {\n litMarks.delete(host);\n return;\n }\n const marks = [...host.querySelectorAll(`[data-wr-series=\"${CSS.escape(key)}\"]`)];\n for (const mark of marks) mark.classList.add('wr-chart-mark--on');\n litMarks.set(host, marks);\n}\n\n/**\n * A chart's hover, from ONE pair of listeners on its host however many sections it draws.\n *\n * A section is any element carrying `data-wr-index`: the listener finds the nearest one\n * above whatever the pointer is on and reports its index, once per section entered. A\n * listener pair on every bar was two per bar, and each one a change detection pass over\n * the whole chart for every bar the pointer crossed; these are native listeners, so a\n * move runs no pass at all unless the chart's own handler writes a signal.\n *\n * A gap the chart marks with `data-wr-hold` keeps the section and the dim as they are, so\n * crossing from one bar to the next does not close and reopen the tooltip; a section in\n * such an area takes `wr-chart-section--on`, so a band the chart paints on it stays too.\n *\n * It also drives the shared hover-dim: the nearest element carrying `data-wr-series`\n * names the series under the pointer, and {@link wrChartDim} fades the rest. Legend rows\n * carry the attribute too, so hovering a row dims the chart the same way.\n *\n * Registered after the first render, in the browser only. Call in an injection context.\n *\n * @internal\n */\nexport function useChartHover(handlers: WrChartHoverHandlers): void {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const destroyRef = inject(DestroyRef);\n let index: number | null = null;\n let series: string | null = null;\n\n // Marks drawn while a series is dimmed (a legend row hides it and shows it again with\n // the pointer still on the row) are new elements that `wrChartDim` never saw: they\n // would stay faded until the pointer moved. Only watched while a series is dimmed.\n let relight: MutationObserver | null = null;\n const watch = (on: boolean): void => {\n if (!on) {\n relight?.disconnect();\n relight = null;\n } else if (!relight && typeof MutationObserver !== 'undefined') {\n relight = new MutationObserver(() => {\n if (series !== null) wrChartDim(host, series);\n });\n relight.observe(host, { childList: true, subtree: true });\n }\n };\n\n const dim = (key: string | null): void => {\n if (key === series) return;\n series = key;\n wrChartDim(host, key);\n watch(key !== null);\n };\n\n let current: Element | null = null;\n const band = (section: Element | null): void => {\n current?.classList.remove('wr-chart-section--on');\n current = section?.closest('[data-wr-hold]') ? section : null;\n current?.classList.add('wr-chart-section--on');\n };\n\n const inHost = (el: Element | null | undefined): el is Element => !!el && host.contains(el);\n\n const over = (event: MouseEvent): void => {\n const target = event.target instanceof Element ? event.target : null;\n const section = target?.closest('[data-wr-index]');\n const series = target?.closest('[data-wr-series]');\n // In the room a chart holds open between its marks (`data-wr-hold`, the gaps between\n // its bars), the pointer is still on the drawing: what it last pointed at stays,\n // rather than closing and reopening a few pixels on.\n const held = !inHost(series) && inHost(target?.closest('[data-wr-hold]'));\n if (!held) dim(inHost(series) ? series.getAttribute('data-wr-series') : null);\n if (held && !inHost(section)) return;\n\n const next = inHost(section) ? Number(section.getAttribute('data-wr-index')) : null;\n if (next === index) return;\n index = next;\n if (next === null || !Number.isFinite(next)) {\n band(null);\n handlers.leave(event);\n } else {\n band(section ?? null);\n handlers.enter(next);\n }\n };\n\n const leave = (event: MouseEvent): void => {\n dim(null);\n if (index === null) return;\n index = null;\n band(null);\n handlers.leave(event);\n };\n\n afterNextRender(() => {\n host.addEventListener('mouseover', over);\n host.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n watch(false);\n host.removeEventListener('mouseover', over);\n host.removeEventListener('mouseleave', leave);\n });\n });\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\n/**\n * The `limit` longest of `labels`, each once, longest first: the strings worth measuring.\n *\n * A chart sizes a gutter or keeps room past a bar from a hidden copy of the text that goes\n * there. Copying every label made ten thousand hidden spans for ten thousand bars, to learn\n * the width of one. The widest label is almost always among the longest few by character\n * count - a proportional font can put `1,111` under `999`, which is why this returns a few\n * and not one - so a chart renders these and reads the widest.\n *\n * @internal\n */\nexport function wrChartLongest(labels: readonly string[], limit = 3): string[] {\n const longest: string[] = [];\n for (const label of new Set(labels)) {\n if (longest.length === limit && label.length <= longest[longest.length - 1].length) continue;\n let at = longest.findIndex(kept => kept.length < label.length);\n if (at < 0) at = longest.length;\n longest.splice(at, 0, label);\n if (longest.length > limit) longest.pop();\n }\n return longest;\n}\n\n/**\n * How many categories each printed label stands for, so no two labels along an axis run\n * into each other: 1 while every label fits its own band, 2 to print every second one,\n * and so on.\n *\n * `extent` is the axis' length and `count` how many bands share it; `labelSize` is the\n * longest label along the axis, and `gap` the least room between two labels. All in the\n * same unit, px in practice. With nothing measured yet - a server render, a chart not\n * laid out - the answer is 1: every label, as the markup had before it was measured.\n *\n * @internal\n */\nexport function wrChartLabelStep(count: number, extent: number, labelSize: number, gap = 8): number {\n if (!(count > 1) || !(extent > 0) || !(labelSize > 0)) return 1;\n const band = extent / count;\n return Math.max(1, Math.min(count, Math.ceil((labelSize + gap) / band)));\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\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes. Each is a token of the chart theme (`--wr-chart-1` to\n * `--wr-chart-8`, declared by `ngwr/charts/core`'s stylesheet), so an app retints\n * every chart by setting the tokens and a chart's markup never names a hex.\n *\n * The palette is not the status intents: a second series is not a success and a\n * fourth is not a danger. The first is the brand colour and the last the neutral\n * role; neighbours alternate between a deep and a mid tone, so two series next to\n * each other differ in lightness as well as in hue. The stylesheet carries the\n * measured contrast of each.\n *\n * A chart that draws lines still pairs each with a dash (`WR_CHART_DASHES`), and\n * one that draws points with a shape (`WR_CHART_MARKERS`): colour is never the\n * only thing that tells two series apart.\n *\n * @internal\n */\nexport const WR_CHART_PALETTE: readonly string[] = [\n 'var(--wr-chart-1)',\n 'var(--wr-chart-2)',\n 'var(--wr-chart-3)',\n 'var(--wr-chart-4)',\n 'var(--wr-chart-5)',\n 'var(--wr-chart-6)',\n 'var(--wr-chart-7)',\n 'var(--wr-chart-8)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartColor(index: number): string {\n return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];\n}\n\n/**\n * The series colours every chart took before the chart theme: four status intents and\n * the neutral role. Kept for the charts that have not moved onto `--wr-chart-*` yet,\n * so each keeps its look until it does; a chart on the theme reads\n * {@link WR_CHART_PALETTE}.\n *\n * `warning` measures 1.71:1 on a white surface, under the 3:1 a graphic needs, which\n * is one of the reasons the theme's palette replaced it.\n *\n * @internal\n */\nexport const WR_CHART_LEGACY_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The {@link WR_CHART_LEGACY_PALETTE} colour for the series at `index`, wrapping past\n * the end.\n *\n * @internal\n */\nexport function wrChartLegacyColor(index: number): string {\n return WR_CHART_LEGACY_PALETTE[wrap(index, WR_CHART_LEGACY_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * A reader with red-green colour blindness can see two strokes of similar lightness\n * as one grey, and a legend that pairs a coloured dot with a name does not rescue it:\n * matching the dot to the line is exactly the step that needs hue. Distinguishing\n * series by dash is the standard remedy and the only one that survives greyscale,\n * printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const WR_CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartDash(index: number): string {\n return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\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 { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link wrChartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const WR_CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartMarker(index: number): WrChartMarkerShape {\n return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function wrChartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n 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`;\n }\n}\n\n/**\n * How far the marker {@link wrChartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function wrChartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\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 { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/** Every formatter the charts have asked for, by locale and options. */\nconst FORMATTERS = new Map<string, Intl.NumberFormat>();\n\n/**\n * The `Intl.NumberFormat` for `locale` and `options`, built once for the page and shared\n * by every chart on it.\n *\n * Building one costs about a tenth of a millisecond, and the charts built them freely:\n * three per chart instance, and one per tick on every pass over an axis, so a table of a\n * hundred sparklines paid for three hundred identical formatters. A formatter holds no\n * state, so one per distinct key serves them all. The key is the locale and the options\n * in the order given; the charts ask with a handful of shapes, so the map stays small.\n *\n * @internal\n */\nexport function wrChartNumberFormat(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = options ? `${locale}|${JSON.stringify(options)}` : locale;\n let format = FORMATTERS.get(key);\n if (!format) {\n format = new Intl.NumberFormat(locale, options);\n FORMATTERS.set(key, format);\n }\n return format;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = wrChartNumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = wrChartNumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = wrChartNumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);\n const full = wrChartNumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : wrChartNumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;\n return wrChartNumberFormat(locale, { maximumFractionDigits: digits }).format(v);\n };\n\n return { value, label, ticks, exact };\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\n/**\n * `value` rounded to `digits` decimals for an inline style or an SVG attribute, with\n * `-0` folded to `0`: a share of an axis, a percentage, a coordinate.\n *\n * Eleven charts each kept a copy of this under another name (`short`, `percent`,\n * `fixed`), at three precisions. A written geometry value wants few digits - every one\n * past the fourth is bytes in the DOM and a different string for the same pixel - and\n * never `-0`, which `Math.round` produces for a small negative and which prints as `-0`.\n *\n * Not `wrRound` from `ngwr/utils`, which nudges by `Number.EPSILON` to round a decimal\n * tie the way a person expects and keeps the sign of a zero.\n *\n * @internal\n */\nexport function wrChartRound(value: number, digits = 4): number {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor || 0;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,aAAa;AAGnB,MAAM,QAAqB;CAAE,KAAK;CAAG,KAAK;CAAG,MAAM;CAAM,OAAO;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;AAAC;AAGvF,MAAM,SAAS;CAAC;CAAG;CAAK;CAAM;AAAG;AAejC,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE;AAcA,SAAS,YAAY,OAAa;CAChC,MAAM,YAAY,KAAK,IAAI,KAAK;CAChC,IAAI,OAAO,cAAc,IAAI,IAAI,YAAY;CAC7C,IAAI,YAAY,GAAG;EACjB,MAAM,MAAM,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC,CAAC;EAC/C,QAAQ,KAAK,IAAI,WAAW,KAAK,WAAW,MAAM,IAAI,YACpD,KAAK,MAAM,QAAQ,QAAQ;GACzB,MAAM,YAAY,OAAO,M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AAA;EAEhC,MAAM,OAAO,UAAU,IAAI;EAO3B,MAAM,OAAO,oBAAoB,QAAQ,EAAE,uBAD5B,QAAQ,MAAM,eAAe,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,EAAE,EACA,CAAE;EAC1E,MAAM,QAAQ,OAAO,KAAI,MAAK,KAAK,OAAO,CAAC,CAAC;EAC5C,MAAM,UAAU,OAAO,KAAI,MACzB,MAAM,IACF,KAAK,OAAO,CAAC,IACb,oBAAoB,QAAQ;GAC1B,UAAU;GACV,0BAA0B,QAAQ,UAAU,CAAC,IAAI,OAAO,GAAG,GAAG,EAAE;EACjE,CAAA,CAAC,CAAC,OAAO,CAAC,CAAC;EAElB,MAAM,WAAW,WAAsC,KAAK,IAAI,GAAG,OAAO,KAAI,SAAQ,KAAK,MAAM,CAAC;EAClG,OAAO,QAAQ,OAAO,KAAK,QAAQ,KAAK,IAAI,UAAU;CACxD;CAEA,MAAM,SAAS,GAAW,gBAAwB,GAAG,SAAmB;EACtE,MAAM,SAAS,YAAW;EAC1B,IAAI,QAAQ,OAAO,OAAO,GAAG,GAAG,IAAI;EAEpC,OAAO,oBAAoB,QAAQ,EAAE,uBADtB,OAAO,SAAS,cAAc,IAAI,QAAQ,KAAK,MAAM,cAAc,GAAG,GAAG,EAAE,IAAI,EAC5B,CAAE,CAAC,CAAC,OAAO,CAAC;CAChF;CAEA,OAAO;EAAE;EAAO;EAAO;EAAO;CAAK;AACrC;;;;;;;AC3IA,SAAgB,aAAa,OAAe,SAAS,GAAC;CACpD,MAAM,SAAS,MAAM;CACrB,OAAO,KAAK,MAAM,QAAQ,MAAM,IAAI,UAAU;AAChD"}
@@ -6,6 +6,17 @@ import { WrChartLegendHarness } from "ngwr/charts/chart-legend/testing";
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
8
8
  */
9
+ var TableRowHarness = class extends ComponentHarness {
10
+ static hostSelector = ".wr-chart-table tbody tr";
11
+ async read() {
12
+ const header = await this.locatorFor("th[scope=\"row\"]")();
13
+ const cells = await this.locatorForAll("td")();
14
+ return {
15
+ header: await header.text(),
16
+ cells: await Promise.all(cells.map((cell) => cell.text()))
17
+ };
18
+ }
19
+ };
9
20
  var WrDonutChartHarness = class WrDonutChartHarness extends ComponentHarness {
10
21
  static hostSelector = "wr-donut-chart";
11
22
  static with(options = {}) {
@@ -39,6 +50,19 @@ var WrDonutChartHarness = class WrDonutChartHarness extends ComponentHarness {
39
50
  value: await values[index]?.text() ?? ""
40
51
  })));
41
52
  }
53
+ async hasDataTable() {
54
+ return await this.locatorForOptional(".wr-chart-table")() !== null;
55
+ }
56
+ async getTableColumns() {
57
+ await this.assertDataTable("getTableColumns");
58
+ const headings = await this.locatorForAll(".wr-chart-table thead th[scope=\"col\"]")();
59
+ return Promise.all(headings.map((heading) => heading.text()));
60
+ }
61
+ async getTableRows() {
62
+ await this.assertDataTable("getTableRows");
63
+ const rows = await this.locatorForAll(TableRowHarness)();
64
+ return Promise.all(rows.map((row) => row.read()));
65
+ }
42
66
  async getCenterValue() {
43
67
  const center = await this.locatorForOptional(".wr-donut-chart__center-value")();
44
68
  return center ? center.text() : null;
@@ -53,6 +77,9 @@ var WrDonutChartHarness = class WrDonutChartHarness extends ComponentHarness {
53
77
  if (!match) throw new Error(`WrDonutChartHarness.getSize(): no inline width on .wr-donut-chart__surface (style: "${style ?? ""}"). The component writes one unconditionally, so its absence is the bug rather than a zero.`);
54
78
  return Number.parseFloat(match[1]);
55
79
  }
80
+ async assertDataTable(method) {
81
+ if (!await this.hasDataTable()) throw new Error(`WrDonutChartHarness.${method}(): the chart renders no data table: \`dataTable\` is off, or there is nothing to tabulate. Ask hasDataTable() first.`);
82
+ }
56
83
  };
57
84
  export { WrDonutChartHarness };
58
85