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,11 +1,11 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, ViewEncapsulation, computed, input, model, viewChild, viewChildren } from "@angular/core";
2
+ import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input, model, viewChild, viewChildren } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { NgTemplateOutlet } from "@angular/common";
5
5
  import { wrCheckStyles } from "ngwr/utils";
6
- import { useI18nText } from "ngwr/i18n";
6
+ import { useI18nText, wrReadI18nText } from "ngwr/i18n";
7
7
  import { WR_CHART_LEGEND_BLOCK, WrChartLegend } from "ngwr/charts/chart-legend";
8
- import { WrChartState, useChartHover, useChartNumbers, useChartState, wrChartColor, wrChartRound } from "ngwr/charts/core";
8
+ import { WrChartState, WrChartTable, useChartHover, useChartNumbers, useChartState, wrChartColor, wrChartNumberFormat, wrChartRound } from "ngwr/charts/core";
9
9
  import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
10
10
  /**
11
11
  * @license
@@ -58,7 +58,22 @@ var WrMeterGroup = class WrMeterGroup {
58
58
  transform: wrCoerceChartTooltip
59
59
  });
60
60
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
61
+ dataTable = input(false, {
62
+ ...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
63
+ transform: coerceBooleanProperty
64
+ });
65
+ valueName = wrReadI18nText("meterGroup.value", "Value");
66
+ shareName = wrReadI18nText("meterGroup.share", "Share");
61
67
  numbers = useChartNumbers(this.valueFormat);
68
+ locale = inject(LOCALE_ID);
69
+ shares = wrChartNumberFormat(this.locale, {
70
+ style: "percent",
71
+ maximumFractionDigits: 1
72
+ });
73
+ smallShares = wrChartNumberFormat(this.locale, {
74
+ style: "percent",
75
+ maximumSignificantDigits: 2
76
+ });
62
77
  barEl = viewChild.required("bar", ...ngDevMode ? [{ debugName: "barEl" }] : /* istanbul ignore next */ []);
63
78
  sliceEls = viewChildren("slice", ...ngDevMode ? [{ debugName: "sliceEls" }] : /* istanbul ignore next */ []);
64
79
  static amount(raw) {
@@ -113,6 +128,17 @@ var WrMeterGroup = class WrMeterGroup {
113
128
  value: values ? text : null
114
129
  }));
115
130
  }, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
131
+ tableData = computed(() => ({
132
+ caption: this.resolvedAriaLabel(),
133
+ columns: [this.valueName(), this.shareName()],
134
+ groups: [{ rows: this.slices().filter((slice) => !slice.hidden).map((slice) => {
135
+ const share = slice.percent / 100;
136
+ return {
137
+ header: slice.label,
138
+ cells: [slice.text, share > 0 ? (share < .01 ? this.smallShares : this.shares).format(share) : ""]
139
+ };
140
+ }) }]
141
+ }), ...ngDevMode ? [{ debugName: "tableData" }] : /* istanbul ignore next */ []);
116
142
  tip = useChartTooltip(this.tooltip, (index) => {
117
143
  const at = this.bands().findIndex((band) => band.index === index);
118
144
  const band = this.bands()[at];
@@ -278,6 +304,13 @@ var WrMeterGroup = class WrMeterGroup {
278
304
  isSignal: true,
279
305
  isRequired: false,
280
306
  transformFunction: null
307
+ },
308
+ dataTable: {
309
+ classPropertyName: "dataTable",
310
+ publicName: "dataTable",
311
+ isSignal: true,
312
+ isRequired: false,
313
+ transformFunction: null
281
314
  }
282
315
  },
283
316
  outputs: { hiddenSegments: "hiddenSegmentsChange" },
@@ -298,7 +331,7 @@ var WrMeterGroup = class WrMeterGroup {
298
331
  isSignal: true
299
332
  }],
300
333
  ngImport: i0,
301
- template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n",
334
+ template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
302
335
  dependencies: [
303
336
  {
304
337
  kind: "directive",
@@ -329,6 +362,12 @@ var WrMeterGroup = class WrMeterGroup {
329
362
  type: WrChartState,
330
363
  selector: "wr-chart-state",
331
364
  inputs: ["kind", "label"]
365
+ },
366
+ {
367
+ kind: "component",
368
+ type: WrChartTable,
369
+ selector: "wr-chart-table",
370
+ inputs: ["data"]
332
371
  }
333
372
  ],
334
373
  viewProviders: [{
@@ -355,13 +394,14 @@ i0.ɵɵngDeclareClassMetadata({
355
394
  imports: [
356
395
  NgTemplateOutlet,
357
396
  WrChartLegend,
358
- WrChartState
397
+ WrChartState,
398
+ WrChartTable
359
399
  ],
360
400
  viewProviders: [{
361
401
  provide: WR_CHART_LEGEND_BLOCK,
362
402
  useValue: "wr-meter-group"
363
403
  }],
364
- template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n"
404
+ template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
365
405
  }]
366
406
  }],
367
407
  ctorParameters: () => [],
@@ -489,6 +529,14 @@ i0.ɵɵngDeclareClassMetadata({
489
529
  required: false
490
530
  }]
491
531
  }],
532
+ dataTable: [{
533
+ type: i0.Input,
534
+ args: [{
535
+ isSignal: true,
536
+ alias: "dataTable",
537
+ required: false
538
+ }]
539
+ }],
492
540
  barEl: [{
493
541
  type: i0.ViewChild,
494
542
  args: ["bar", { isSignal: true }]
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-meter-group.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/meter-group.ts","../../../projects/lib/charts/meter-group/meter-group.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 { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n input,\n model,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartColor,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMeterSegment } from './types';\n\n/**\n * Stacked-segment progress bar. Visualises a breakdown of a total —\n * disk usage, budget, vote share, etc. Each segment contributes a slice\n * proportional to its `value` relative to the sum of the segments shown (or the\n * explicit `max`).\n *\n * @example\n * ```html\n * <wr-meter-group\n * [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Reserved', value: 25, color: 'var(--wr-color-warning)' }\n * ]\"\n * [max]=\"100\"\n * />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their segments through `hiddenSegments`.\n * `legendPosition` puts it under the bar, over it or beside it.\n *\n * **On the chart theme.** A segment with no `color` takes the next colour of the chart\n * palette (`--wr-chart-1` to `-8`), solid, and a 1px line in the surface parts two\n * segments. Hovering a segment or its legend row dims the others. With no segment the\n * bar is an empty track with \"No data\" under it; `loading` and `error` put their own\n * message there.\n *\n * @see https://ngwr.dev/charts/meter-group\n */\n@Component({\n selector: 'wr-meter-group',\n templateUrl: './meter-group.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the bar.\n class: 'wr-meter-group wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-meter-group__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-meter-group' }],\n})\nexport class WrMeterGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/meter-group');\n // One pair of listeners on the host, not two on every band: the band under the pointer\n // is the nearest element up from it carrying `data-wr-index`, its segment's position.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /** Accessible name — the role needs one. Falls back to `meterGroup.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'meterGroup.label', 'Meter');\n\n /**\n * The parts of the bar, in order. Each segment is drawn as its share of `max` when\n * set, else of the sum of the segments shown, so they need not add up to anything in\n * particular.\n */\n readonly segments = input<readonly WrMeterSegment[]>([]);\n\n /** Explicit total, a capacity the segments fill. `0` (default) uses the sum of the segments shown. @default 0 */\n readonly max = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Show the labelled legend. `'auto'` leaves it out for a single segment, which has\n * nothing to tell apart; `true` shows it for one too, since the row carries the value.\n * @default true\n */\n readonly showLegend = input<boolean | 'auto', unknown>(true, {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the bar as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a segment from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the meter's data is in flight: the bar empties and the loading message\n * takes the legend's place. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The meter's data failed to load: the bar empties and the error message takes the\n * legend's place. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is no segment. 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 each segment's value in the legend, next to its label. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its segment, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its segment is\n * shown, so the legend becomes one tab stop per segment. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the segments that are hidden. Positions rather than\n * labels, since two segments may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden segment is left out of the bar and out of the sum. With no `max`, the\n * segments still shown share the whole bar between them, each at its share of their\n * own total, as `wr-donut-chart`'s slices do: the bar is the whole of what it draws.\n * An explicit `max` is a capacity rather than a sum, so it stays, and the hidden\n * segment's share becomes empty track. Either way the bar announces the total of the\n * segments shown (`aria-valuenow`, `aria-valuetext`), since that is what it draws, and\n * the tooltip cannot open on a segment that is not drawn. The legend keeps the hidden\n * segment's row, struck through and with its own value, so it can be shown again; the\n * row says \"hidden\" to a screen reader as well, through `aria-pressed` on a toggle and\n * a visually hidden word otherwise. A position past the end of `segments` is kept and\n * ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /**\n * Show a tooltip with the segment's label and value on hover. It replaces the band's\n * `title`, which is written only while this is off — or the browser would open a\n * 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 every value in the legend and the tooltip, and the total the bar announces\n * as `aria-valuetext`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n * `aria-valuenow` stays a number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Each value as the legend, the tooltip and the bar print it: never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly barEl = viewChild.required<ElementRef<HTMLElement>>('bar');\n private readonly sliceEls = viewChildren<ElementRef<HTMLElement>>('slice');\n\n /**\n * A segment's contribution, floored at `0` and with anything non-finite read\n * as `0`. One `NaN` used to poison the whole bar: the sum is `NaN` as soon as\n * one value is, so the total fell back to `1` and every OTHER segment was\n * asked for a width of `value * 100`%, while `aria-valuenow` announced `NaN`.\n */\n private static amount(raw: number): number {\n return Number.isFinite(raw) ? Math.max(0, raw) : 0;\n }\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n /** What the segments still shown add up to (see `hiddenSegments`). */\n private readonly shownSum = computed(() => {\n const hidden = this.hidden();\n return this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : WrMeterGroup.amount(s.value)), 0);\n });\n\n protected readonly resolvedMax = computed(() => {\n const explicit = this.max();\n if (explicit > 0) return explicit;\n const sum = this.shownSum();\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Sum of the segments, for `aria-valuenow`. `role=\"progressbar\"` without it\n * announces no value at all, so the bar was invisible to assistive tech.\n *\n * Capped at the total, because segments summing past an explicit `max` used\n * to announce a value outside the range they were announced against.\n */\n protected readonly totalValue = computed(() => Math.min(this.resolvedMax(), this.shownSum()));\n\n /**\n * The total as the bar announces it — `aria-valuetext`, written the way the legend\n * writes each figure — so a `valueFormat` that adds a unit reaches a screen reader\n * too, rather than a bare percentage of `aria-valuemax`. The gauge does the same.\n */\n protected readonly totalText = computed(() => this.numbers.value(this.totalValue()));\n\n protected readonly slices = computed(() => {\n const hidden = this.hidden();\n const max = this.resolvedMax();\n return this.segments().map((segment, i) => ({\n index: i,\n label: segment.label,\n // The legend keeps a negative value visible — it is data the caller gave\n // us — but not a non-finite one, which reads as the literal text `NaN`.\n text: this.numbers.value(Number.isFinite(segment.value) ? segment.value : 0),\n color: segment.color ?? wrChartColor(i),\n hidden: hidden.has(i),\n percent: hidden.has(i) ? 0 : (WrMeterGroup.amount(segment.value) / max) * 100,\n }));\n });\n\n /**\n * The bands drawn, in order: every segment but the hidden ones. A hidden band is left\n * out rather than drawn at zero width, since a zero band still lays its gap over the\n * boundary and would leave a double one.\n */\n protected readonly bands = computed(() => {\n const shown = this.slices().filter(slice => !slice.hidden);\n let end = 0;\n return shown.map((slice, at) => {\n const size = slice.percent / 100;\n const start = end;\n end = Math.min(1, end + size);\n return {\n ...slice,\n /** Where its visible part starts, as a share of the bar: the end of the band before it. */\n start: wrChartRound(start, 5),\n /** Its share of the bar, 0 to 1. */\n size: wrChartRound(size, 5),\n /**\n * Where it ends, as a share of the bar from its start. Every band is as wide as the\n * bar and slid back so that it ends here, under the bands before it: its length on\n * screen is then a transform, and a new value lays nothing out.\n */\n end: wrChartRound(end, 5),\n /** Its place in the pile: the first band on top, so each covers the start of the next. */\n layer: shown.length - at,\n };\n });\n });\n\n /** The legend's rows: every segment, hidden ones included, with its value unless `showValues` is off. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() => {\n const values = this.showValues();\n return this.slices().map(({ label, color, text }) => ({ label, color, value: values ? text : null }));\n });\n\n /**\n * One tooltip for the whole bar, pointing at the hovered band, with the value as\n * the legend prints it. Asked by the segment's own position, and the drawn bands are\n * only the shown ones, so the band is found among them by that position.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const at = this.bands().findIndex(band => band.index === index);\n const band = this.bands()[at];\n const el = this.sliceEls()[at]?.nativeElement;\n if (!band || !el) return null;\n // The band's own box is as wide as the bar, most of it out of sight under the bands\n // before it, so the chip points at the part of the bar the band shows.\n const bar = this.barEl().nativeElement;\n const box = bar.getBoundingClientRect();\n const rtl = getComputedStyle(bar).direction === 'rtl';\n const width = (band.end - band.start) * box.width;\n const x = rtl ? box.right - band.end * box.width : box.left + band.start * box.width;\n return {\n datum: { label: band.label, value: band.text, color: band.color },\n anchor: { x, y: box.top, width, height: box.height },\n };\n });\n\n /**\n * Whether the meter draws its legend: unless `showLegend` is off, `legendPosition` is\n * `none`, or there is no segment. Under `showLegend=\"auto\"` a single segment draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.slices().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the bar, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the bar rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** What the meter shows in place of its legend, or `null` while it draws its segments. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.segments().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n}\n","@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoFA,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;EAGrF,cAAc;GAAE,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;GAAG,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;EAAC,CAAE;CAChG;CAGS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,oBAAoB,OAAO;CAOrF,WAAW,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAG/C,MAAM,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,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,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,kBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,sBAAA;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,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACR,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-meter-group.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/meter-group.ts","../../../projects/lib/charts/meter-group/meter-group.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 { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartColor,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText, wrReadI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMeterSegment } from './types';\n\n/**\n * Stacked-segment progress bar. Visualises a breakdown of a total —\n * disk usage, budget, vote share, etc. Each segment contributes a slice\n * proportional to its `value` relative to the sum of the segments shown (or the\n * explicit `max`).\n *\n * @example\n * ```html\n * <wr-meter-group\n * [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Reserved', value: 25, color: 'var(--wr-color-warning)' }\n * ]\"\n * [max]=\"100\"\n * />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their segments through `hiddenSegments`.\n * `legendPosition` puts it under the bar, over it or beside it.\n *\n * **On the chart theme.** A segment with no `color` takes the next colour of the chart\n * palette (`--wr-chart-1` to `-8`), solid, and a 1px line in the surface parts two\n * segments. Hovering a segment or its legend row dims the others. With no segment the\n * bar is an empty track with \"No data\" under it; `loading` and `error` put their own\n * message there.\n *\n * **What a screen reader gets.** The bar is a `role=\"progressbar\"` that announces the\n * total, so each segment's figure is in text only in the legend, which `showLegend` and\n * `showValues` can leave out. `dataTable` renders every segment shown with its value and\n * its share of the total as a table a reader can walk cell by cell.\n *\n * @see https://ngwr.dev/charts/meter-group\n */\n@Component({\n selector: 'wr-meter-group',\n templateUrl: './meter-group.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the bar.\n class: 'wr-meter-group wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState, WrChartTable],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-meter-group__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-meter-group' }],\n})\nexport class WrMeterGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/meter-group');\n // One pair of listeners on the host, not two on every band: the band under the pointer\n // is the nearest element up from it carrying `data-wr-index`, its segment's position.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /** Accessible name — the role needs one. Also the caption of the data table. Falls back to `meterGroup.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'meterGroup.label', 'Meter');\n\n /**\n * The parts of the bar, in order. Each segment is drawn as its share of `max` when\n * set, else of the sum of the segments shown, so they need not add up to anything in\n * particular.\n */\n readonly segments = input<readonly WrMeterSegment[]>([]);\n\n /** Explicit total, a capacity the segments fill. `0` (default) uses the sum of the segments shown. @default 0 */\n readonly max = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Show the labelled legend. `'auto'` leaves it out for a single segment, which has\n * nothing to tell apart; `true` shows it for one too, since the row carries the value.\n * @default true\n */\n readonly showLegend = input<boolean | 'auto', unknown>(true, {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the bar as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a segment from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the meter's data is in flight: the bar empties and the loading message\n * takes the legend's place. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The meter's data failed to load: the bar empties and the error message takes the\n * legend's place. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is no segment. 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 each segment's value in the legend, next to its label. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its segment, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its segment is\n * shown, so the legend becomes one tab stop per segment. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the segments that are hidden. Positions rather than\n * labels, since two segments may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden segment is left out of the bar and out of the sum. With no `max`, the\n * segments still shown share the whole bar between them, each at its share of their\n * own total, as `wr-donut-chart`'s slices do: the bar is the whole of what it draws.\n * An explicit `max` is a capacity rather than a sum, so it stays, and the hidden\n * segment's share becomes empty track. Either way the bar announces the total of the\n * segments shown (`aria-valuenow`, `aria-valuetext`), since that is what it draws, and\n * the tooltip cannot open on a segment that is not drawn. The legend keeps the hidden\n * segment's row, struck through and with its own value, so it can be shown again; the\n * row says \"hidden\" to a screen reader as well, through `aria-pressed` on a toggle and\n * a visually hidden word otherwise. A position past the end of `segments` is kept and\n * ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /**\n * Show a tooltip with the segment's label and value on hover. It replaces the band's\n * `title`, which is written only while this is off — or the browser would open a\n * 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 every value in the legend, the tooltip and the data table, and the total the\n * bar announces as `aria-valuetext`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n * `aria-valuenow` stays a number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the meter's figures as a table that only assistive technology reaches: a row\n * per segment shown, headed by its label, with its value as the legend writes it and\n * its share of the total the bar is drawn against, a percentage in `LOCALE_ID`: of\n * `max` when one is set, else of the sum of the segments shown. A segment hidden\n * through `hiddenSegments` has no row, and one that draws nothing has an empty share.\n * The values are listed whatever `showValues` says. The table gives way with the legend\n * while the meter is empty, `loading` or in `error`.\n *\n * The bar announces the total alone, and the legend is optional, so without the table\n * the segments' figures may be nowhere a screen reader can walk. It is rendered beside\n * the bar, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The headings of the data table's two columns. */\n private readonly valueName = wrReadI18nText('meterGroup.value', 'Value');\n private readonly shareName = wrReadI18nText('meterGroup.share', 'Share');\n\n /** Each value as the legend, the tooltip, the data table and the bar print it: never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly locale = inject(LOCALE_ID);\n /** Shares from one percent up, to one decimal. */\n private readonly shares = wrChartNumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Shares below one percent, to two significant digits, so a sliver does not read `0%`. */\n private readonly smallShares = wrChartNumberFormat(this.locale, { style: 'percent', maximumSignificantDigits: 2 });\n\n private readonly barEl = viewChild.required<ElementRef<HTMLElement>>('bar');\n private readonly sliceEls = viewChildren<ElementRef<HTMLElement>>('slice');\n\n /**\n * A segment's contribution, floored at `0` and with anything non-finite read\n * as `0`. One `NaN` used to poison the whole bar: the sum is `NaN` as soon as\n * one value is, so the total fell back to `1` and every OTHER segment was\n * asked for a width of `value * 100`%, while `aria-valuenow` announced `NaN`.\n */\n private static amount(raw: number): number {\n return Number.isFinite(raw) ? Math.max(0, raw) : 0;\n }\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n /** What the segments still shown add up to (see `hiddenSegments`). */\n private readonly shownSum = computed(() => {\n const hidden = this.hidden();\n return this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : WrMeterGroup.amount(s.value)), 0);\n });\n\n protected readonly resolvedMax = computed(() => {\n const explicit = this.max();\n if (explicit > 0) return explicit;\n const sum = this.shownSum();\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Sum of the segments, for `aria-valuenow`. `role=\"progressbar\"` without it\n * announces no value at all, so the bar was invisible to assistive tech.\n *\n * Capped at the total, because segments summing past an explicit `max` used\n * to announce a value outside the range they were announced against.\n */\n protected readonly totalValue = computed(() => Math.min(this.resolvedMax(), this.shownSum()));\n\n /**\n * The total as the bar announces it — `aria-valuetext`, written the way the legend\n * writes each figure — so a `valueFormat` that adds a unit reaches a screen reader\n * too, rather than a bare percentage of `aria-valuemax`. The gauge does the same.\n */\n protected readonly totalText = computed(() => this.numbers.value(this.totalValue()));\n\n protected readonly slices = computed(() => {\n const hidden = this.hidden();\n const max = this.resolvedMax();\n return this.segments().map((segment, i) => ({\n index: i,\n label: segment.label,\n // The legend keeps a negative value visible — it is data the caller gave\n // us — but not a non-finite one, which reads as the literal text `NaN`.\n text: this.numbers.value(Number.isFinite(segment.value) ? segment.value : 0),\n color: segment.color ?? wrChartColor(i),\n hidden: hidden.has(i),\n percent: hidden.has(i) ? 0 : (WrMeterGroup.amount(segment.value) / max) * 100,\n }));\n });\n\n /**\n * The bands drawn, in order: every segment but the hidden ones. A hidden band is left\n * out rather than drawn at zero width, since a zero band still lays its gap over the\n * boundary and would leave a double one.\n */\n protected readonly bands = computed(() => {\n const shown = this.slices().filter(slice => !slice.hidden);\n let end = 0;\n return shown.map((slice, at) => {\n const size = slice.percent / 100;\n const start = end;\n end = Math.min(1, end + size);\n return {\n ...slice,\n /** Where its visible part starts, as a share of the bar: the end of the band before it. */\n start: wrChartRound(start, 5),\n /** Its share of the bar, 0 to 1. */\n size: wrChartRound(size, 5),\n /**\n * Where it ends, as a share of the bar from its start. Every band is as wide as the\n * bar and slid back so that it ends here, under the bands before it: its length on\n * screen is then a transform, and a new value lays nothing out.\n */\n end: wrChartRound(end, 5),\n /** Its place in the pile: the first band on top, so each covers the start of the next. */\n layer: shown.length - at,\n };\n });\n });\n\n /** The legend's rows: every segment, hidden ones included, with its value unless `showValues` is off. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() => {\n const values = this.showValues();\n return this.slices().map(({ label, color, text }) => ({ label, color, value: values ? text : null }));\n });\n\n /**\n * The figures for `dataTable`: the meter's name as the caption, a row per segment shown,\n * and its value and its share of the total as the columns.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.slices()\n .filter(slice => !slice.hidden)\n .map(slice => {\n const share = slice.percent / 100;\n return {\n header: slice.label,\n cells: [slice.text, share > 0 ? (share < 0.01 ? this.smallShares : this.shares).format(share) : ''],\n };\n }),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole bar, pointing at the hovered band, with the value as\n * the legend prints it. Asked by the segment's own position, and the drawn bands are\n * only the shown ones, so the band is found among them by that position.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const at = this.bands().findIndex(band => band.index === index);\n const band = this.bands()[at];\n const el = this.sliceEls()[at]?.nativeElement;\n if (!band || !el) return null;\n // The band's own box is as wide as the bar, most of it out of sight under the bands\n // before it, so the chip points at the part of the bar the band shows.\n const bar = this.barEl().nativeElement;\n const box = bar.getBoundingClientRect();\n const rtl = getComputedStyle(bar).direction === 'rtl';\n const width = (band.end - band.start) * box.width;\n const x = rtl ? box.right - band.end * box.width : box.left + band.start * box.width;\n return {\n datum: { label: band.label, value: band.text, color: band.color },\n anchor: { x, y: box.top, width, height: box.height },\n };\n });\n\n /**\n * Whether the meter draws its legend: unless `showLegend` is off, `legendPosition` is\n * `none`, or there is no segment. Under `showLegend=\"auto\"` a single segment draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.slices().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the bar, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the bar rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** What the meter shows in place of its legend, or `null` while it draws its segments. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.segments().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n}\n","@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8FA,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;EAG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;CAAA;AAAA,CAAA"}
@@ -5,6 +5,17 @@ import { ComponentHarness, HarnessPredicate } from "@angular/cdk/testing";
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
7
7
  */
8
+ var TableRowHarness = class extends ComponentHarness {
9
+ static hostSelector = ".wr-chart-table tbody tr";
10
+ async read() {
11
+ const header = await this.locatorFor("th[scope=\"row\"]")();
12
+ const cells = await this.locatorForAll("td")();
13
+ return {
14
+ header: await header.text(),
15
+ cells: await Promise.all(cells.map((cell) => cell.text()))
16
+ };
17
+ }
18
+ };
8
19
  var WrSparklineHarness = class WrSparklineHarness extends ComponentHarness {
9
20
  static hostSelector = "wr-sparkline";
10
21
  static with(options = {}) {
@@ -33,6 +44,22 @@ var WrSparklineHarness = class WrSparklineHarness extends ComponentHarness {
33
44
  const line = await this.locatorForOptional(".wr-sparkline__line")();
34
45
  return line ? line.getAttribute("stroke") : null;
35
46
  }
47
+ async hasDataTable() {
48
+ return await this.locatorForOptional(".wr-chart-table")() !== null;
49
+ }
50
+ async getTableColumns() {
51
+ await this.assertDataTable("getTableColumns");
52
+ const headings = await this.locatorForAll(".wr-chart-table thead th[scope=\"col\"]")();
53
+ return Promise.all(headings.map((heading) => heading.text()));
54
+ }
55
+ async getTableRows() {
56
+ await this.assertDataTable("getTableRows");
57
+ const rows = await this.locatorForAll(TableRowHarness)();
58
+ return Promise.all(rows.map((row) => row.read()));
59
+ }
60
+ async assertDataTable(method) {
61
+ if (!await this.hasDataTable()) throw new Error(`WrSparklineHarness.${method}(): the sparkline renders no data table: \`dataTable\` is off, or it has no \`ariaLabel\` to caption one. Ask hasDataTable() first.`);
62
+ }
36
63
  };
37
64
  export { WrSparklineHarness };
38
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-sparkline-testing.mjs","names":[],"sources":["../../../projects/lib/charts/sparkline/testing/wr-sparkline-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSparklineHarnessFilters } from './types';\n\n/**\n * Test harness for `<wr-sparkline>`.\n *\n * **The interesting assertion here is the ARIA one.** A sparkline is a trend line\n * with no axes and no labels, so it is either given an `ariaLabel` — in which case it\n * announces itself as an image — or it is decoration, and must be `aria-hidden` so a\n * screen reader does not stop on a nameless graphic. The component switches between\n * those two states on one input, and {@link isDecorative} is how a spec pins which\n * one it is in.\n *\n * The line itself is an SVG path, and a path's `d` is not something a spec should\n * assert: it is a rendering detail that changes with the viewBox, the stroke width\n * and the smoothing. What IS worth asserting is whether the parts are there —\n * {@link hasLine}, {@link hasArea}, {@link hasTip} — since each is an input the\n * consumer set, and an empty dataset draws none of them.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSparklineHarness extends ComponentHarness {\n static hostSelector = 'wr-sparkline';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSparklineHarnessFilters = {}): HarnessPredicate<WrSparklineHarness> {\n return new HarnessPredicate(WrSparklineHarness, options).addOption(\n 'ariaLabel',\n options.ariaLabel,\n (harness, label) => HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n );\n }\n\n private readonly svg = this.locatorFor('svg');\n\n /** The name the chart announces, or `null` when it is decoration. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.svg()).getAttribute('aria-label');\n }\n\n /** The role the chart claims — `img` when it is named, `null` when it is not. */\n async getRole(): Promise<string | null> {\n return (await this.svg()).getAttribute('role');\n }\n\n /**\n * Whether the chart is hidden from assistive tech.\n *\n * The other half of {@link getAccessibleName}, and the pairing worth asserting\n * together: a named sparkline must NOT be hidden, and an unnamed one must be, or a\n * screen reader announces a graphic with nothing to say about it.\n */\n async isDecorative(): Promise<boolean> {\n return (await (await this.svg()).getAttribute('aria-hidden')) === 'true';\n }\n\n /**\n * Whether a trend line was drawn — `false` for an empty dataset. A single point is a\n * line that returns to its start, which the round cap paints as a dot, so it is `true`.\n */\n async hasLine(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__line')()) !== null;\n }\n\n /** Whether the area under the line is filled (`showArea`). */\n async hasArea(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__area')()) !== null;\n }\n\n /** Whether the last point is marked with a dot (`showTip`). */\n async hasTip(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__tip')()) !== null;\n }\n\n /** The stroke colour as the component passed it through — a CSS value, not a resolved one. */\n async getColor(): Promise<string | null> {\n const line = await this.locatorForOptional('.wr-sparkline__line')();\n return line ? line.getAttribute('stroke') : null;\n }\n}\n"],"mappings":";;;;;;;AA6BA,IAAa,qBAAb,MAAa,2BAA2B,iBAAgB;CACtD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAAI,iBAAiB,oBAAoB,OAAO,CAAC,CAAC,UACvD,aACA,QAAQ,YACP,SAAS,UAAU,iBAAiB,cAAc,QAAQ,kBAAiB,GAAI,KAAK,CAAC;CAE1F;CAEiB,MAAM,KAAK,WAAW,KAAK;CAG5C,MAAM,oBAAiB;EACrB,QAAQ,MAAM,KAAK,IAAG,EAAA,CAAI,aAAa,YAAY;CACrD;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,IAAG,EAAA,CAAI,aAAa,MAAM;CAC/C;CASA,MAAM,eAAY;EAChB,OAAQ,OAAO,MAAM,KAAK,IAAG,EAAA,CAAI,aAAa,aAAa,MAAO;CACpE;CAMA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA,MAAQ;CACtE;CAGA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA,MAAQ;CACtE;CAGA,MAAM,SAAM;EACV,OAAQ,MAAM,KAAK,mBAAmB,oBAAoB,CAAC,CAAA,MAAQ;CACrE;CAGA,MAAM,WAAQ;EACZ,MAAM,OAAO,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA;EACjE,OAAO,OAAO,KAAK,aAAa,QAAQ,IAAI;CAC9C"}
1
+ {"version":3,"file":"ngwr-charts-sparkline-testing.mjs","names":[],"sources":["../../../projects/lib/charts/sparkline/testing/wr-sparkline-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSparklineHarnessFilters, WrSparklineTableRow } from './types';\n\n/**\n * One body row of the sparkline's data table, so its header and cell are read off the row\n * they sit in rather than matched up by position across the whole table.\n */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrSparklineTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/**\n * Test harness for `<wr-sparkline>`.\n *\n * **The interesting assertion here is the ARIA one.** A sparkline is a trend line\n * with no axes and no labels, so it is either given an `ariaLabel` — in which case it\n * announces itself as an image — or it is decoration, and must be `aria-hidden` so a\n * screen reader does not stop on a nameless graphic. The component switches between\n * those two states on one input, and {@link isDecorative} is how a spec pins which\n * one it is in.\n *\n * The line itself is an SVG path, and a path's `d` is not something a spec should\n * assert: it is a rendering detail that changes with the viewBox, the stroke width\n * and the smoothing. What IS worth asserting is whether the parts are there —\n * {@link hasLine}, {@link hasArea}, {@link hasTip} — since each is an input the\n * consumer set, and an empty dataset draws none of them. The values themselves are in\n * text only in the data table: {@link getTableRows}, for a named sparkline with\n * `dataTable` on.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSparklineHarness extends ComponentHarness {\n static hostSelector = 'wr-sparkline';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSparklineHarnessFilters = {}): HarnessPredicate<WrSparklineHarness> {\n return new HarnessPredicate(WrSparklineHarness, options).addOption(\n 'ariaLabel',\n options.ariaLabel,\n (harness, label) => HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n );\n }\n\n private readonly svg = this.locatorFor('svg');\n\n /** The name the chart announces, or `null` when it is decoration. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.svg()).getAttribute('aria-label');\n }\n\n /** The role the chart claims — `img` when it is named, `null` when it is not. */\n async getRole(): Promise<string | null> {\n return (await this.svg()).getAttribute('role');\n }\n\n /**\n * Whether the chart is hidden from assistive tech.\n *\n * The other half of {@link getAccessibleName}, and the pairing worth asserting\n * together: a named sparkline must NOT be hidden, and an unnamed one must be, or a\n * screen reader announces a graphic with nothing to say about it.\n */\n async isDecorative(): Promise<boolean> {\n return (await (await this.svg()).getAttribute('aria-hidden')) === 'true';\n }\n\n /**\n * Whether a trend line was drawn — `false` for an empty dataset. A single point is a\n * line that returns to its start, which the round cap paints as a dot, so it is `true`.\n */\n async hasLine(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__line')()) !== null;\n }\n\n /** Whether the area under the line is filled (`showArea`). */\n async hasArea(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__area')()) !== null;\n }\n\n /** Whether the last point is marked with a dot (`showTip`). */\n async hasTip(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-sparkline__tip')()) !== null;\n }\n\n /** The stroke colour as the component passed it through — a CSS value, not a resolved one. */\n async getColor(): Promise<string | null> {\n const line = await this.locatorForOptional('.wr-sparkline__line')();\n return line ? line.getAttribute('stroke') : null;\n }\n\n /** Whether the hidden data table is rendered (`dataTable`, on a sparkline with an `ariaLabel`). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the value's name.\n *\n * Throws when the sparkline renders no table (`dataTable` off, or no `ariaLabel`)\n * rather than answering with no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n const headings = await this.locatorForAll('.wr-chart-table thead th[scope=\"col\"]')();\n return Promise.all(headings.map(heading => heading.text()));\n }\n\n /**\n * The data table's rows, one per point drawn, in order: its position, counted from one,\n * and its value, as a screen reader walks them.\n *\n * Throws when the sparkline renders no table, for the reason {@link getTableColumns}\n * gives.\n */\n async getTableRows(): Promise<WrSparklineTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrSparklineHarness.${method}(): the sparkline renders no data table: \\`dataTable\\` is off, or it ` +\n 'has no `ariaLabel` to caption one. Ask hasDataTable() first.'\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAeA,IAAM,kBAAN,cAA8B,iBAAgB;CAC5C,OAAO,eAAe;CAEtB,MAAM,OAAI;EACR,MAAM,SAAS,MAAM,KAAK,WAAW,mBAAiB,CAAC,CAAA;EACvD,MAAM,QAAQ,MAAM,KAAK,cAAc,IAAI,CAAC,CAAA;EAC5C,OAAO;GAAE,QAAQ,MAAM,OAAO,KAAI;GAAI,OAAO,MAAM,QAAQ,IAAI,MAAM,KAAI,SAAQ,KAAK,KAAI,CAAE,CAAC;EAAC;CAChG;;AAuBF,IAAa,qBAAb,MAAa,2BAA2B,iBAAgB;CACtD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAAI,iBAAiB,oBAAoB,OAAO,CAAC,CAAC,UACvD,aACA,QAAQ,YACP,SAAS,UAAU,iBAAiB,cAAc,QAAQ,kBAAiB,GAAI,KAAK,CAAC;CAE1F;CAEiB,MAAM,KAAK,WAAW,KAAK;CAG5C,MAAM,oB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2
- import { Component, ElementRef, ViewEncapsulation, computed, inject, input, viewChild } from "@angular/core";
2
+ import { Component, ElementRef, LOCALE_ID, ViewEncapsulation, computed, inject, input, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { wrCheckStyles } from "ngwr/utils";
5
- import { useChartNumbers } from "ngwr/charts/core";
5
+ import { wrReadI18nText } from "ngwr/i18n";
6
+ import { WrChartTable, useChartNumbers, wrChartNumberFormat } from "ngwr/charts/core";
6
7
  import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
7
8
  /**
8
9
  * @license
@@ -36,7 +37,13 @@ var WrSparkline = class WrSparkline {
36
37
  transform: wrCoerceChartTooltip
37
38
  });
38
39
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
40
+ dataTable = input(false, {
41
+ ...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
42
+ transform: coerceBooleanProperty
43
+ });
44
+ valueName = wrReadI18nText("sparkline.value", "Value");
39
45
  numbers = useChartNumbers(this.valueFormat);
46
+ positions = wrChartNumberFormat(inject(LOCALE_ID));
40
47
  host = inject(ElementRef);
41
48
  svg = viewChild("svg", ...ngDevMode ? [{ debugName: "svg" }] : /* istanbul ignore next */ []);
42
49
  marker = viewChild("marker", ...ngDevMode ? [{ debugName: "marker" }] : /* istanbul ignore next */ []);
@@ -44,6 +51,18 @@ var WrSparkline = class WrSparkline {
44
51
  vbH = 40;
45
52
  padding = 2;
46
53
  values = computed(() => this.data().filter((v) => Number.isFinite(v)), ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
54
+ tableData = computed(() => {
55
+ const caption = this.ariaLabel();
56
+ if (!this.dataTable() || !caption) return null;
57
+ return {
58
+ caption,
59
+ columns: [this.valueName()],
60
+ groups: [{ rows: this.values().map((value, index) => ({
61
+ header: this.positions.format(index + 1),
62
+ cells: [this.numbers.value(value)]
63
+ })) }]
64
+ };
65
+ }, ...ngDevMode ? [{ debugName: "tableData" }] : /* istanbul ignore next */ []);
47
66
  points = computed(() => {
48
67
  const data = this.values();
49
68
  if (data.length === 0) return [];
@@ -225,6 +244,13 @@ var WrSparkline = class WrSparkline {
225
244
  isSignal: true,
226
245
  isRequired: false,
227
246
  transformFunction: null
247
+ },
248
+ dataTable: {
249
+ classPropertyName: "dataTable",
250
+ publicName: "dataTable",
251
+ isSignal: true,
252
+ isRequired: false,
253
+ transformFunction: null
228
254
  }
229
255
  },
230
256
  host: { classAttribute: "wr-sparkline" },
@@ -242,7 +268,13 @@ var WrSparkline = class WrSparkline {
242
268
  isSignal: true
243
269
  }],
244
270
  ngImport: i0,
245
- template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n",
271
+ template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n@if (tableData(); as table) {\n <!-- The values for a screen reader, beside the drawing rather than inside its `img`,\n which would make them presentational. Clipped to nothing by its own stylesheet, so\n it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"table\" />\n}\n",
272
+ dependencies: [{
273
+ kind: "component",
274
+ type: WrChartTable,
275
+ selector: "wr-chart-table",
276
+ inputs: ["data"]
277
+ }],
246
278
  encapsulation: i0.ViewEncapsulation.None
247
279
  });
248
280
  };
@@ -257,7 +289,8 @@ i0.ɵɵngDeclareClassMetadata({
257
289
  selector: "wr-sparkline",
258
290
  encapsulation: ViewEncapsulation.None,
259
291
  host: { class: "wr-sparkline" },
260
- template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n"
292
+ imports: [WrChartTable],
293
+ template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n@if (tableData(); as table) {\n <!-- The values for a screen reader, beside the drawing rather than inside its `img`,\n which would make them presentational. Clipped to nothing by its own stylesheet, so\n it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"table\" />\n}\n"
261
294
  }]
262
295
  }],
263
296
  ctorParameters: () => [],
@@ -342,6 +375,14 @@ i0.ɵɵngDeclareClassMetadata({
342
375
  required: false
343
376
  }]
344
377
  }],
378
+ dataTable: [{
379
+ type: i0.Input,
380
+ args: [{
381
+ isSignal: true,
382
+ alias: "dataTable",
383
+ required: false
384
+ }]
385
+ }],
345
386
  svg: [{
346
387
  type: i0.ViewChild,
347
388
  args: ["svg", { isSignal: true }]
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-sparkline.mjs","names":[],"sources":["../../../projects/lib/charts/sparkline/sparkline.ts","../../../projects/lib/charts/sparkline/sparkline.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, computed, inject, input, viewChild } from '@angular/core';\n\nimport { useChartNumbers } from 'ngwr/charts/core';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Tiny inline trend line. SVG path drawn from `[data]: number[]` — no\n * axes, no labels, just the shape. Optional area fill + tip dot.\n *\n * The line is the first colour of the chart palette (`--wr-chart-1`) unless `color`\n * says otherwise. The drawing is inset from its box by the tip dot's radius, so the dot\n * on a last point at the edge, or on the highest or lowest one, stays inside `width` by\n * `height` and no ancestor that clips at the box cuts it.\n *\n * @example\n * ```html\n * <wr-sparkline [data]=\"[12, 14, 9, 17, 21, 18, 23]\" />\n * <wr-sparkline [data]=\"prices\" [showArea]=\"true\" color=\"var(--wr-color-success)\" />\n * ```\n *\n * @see https://ngwr.dev/charts/sparkline\n */\n@Component({\n selector: 'wr-sparkline',\n templateUrl: './sparkline.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sparkline' },\n})\nexport class WrSparkline {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/sparkline');\n }\n\n /**\n * The values, left to right. Evenly spaced — a sparkline carries no x axis, so\n * pass an already-ordered series rather than points with their own timestamps.\n */\n readonly data = input<readonly number[]>([]);\n\n /**\n * Accessible name. A sparkline usually sits beside the number it summarises, where\n * announcing it again is noise — so it is `aria-hidden` by default and becomes a\n * named `role=\"img\"` only when a consumer says what it shows.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stroke colour. The first colour of the chart palette, which is the brand colour\n * unless the theme says otherwise. @default 'var(--wr-chart-1)'\n */\n readonly color = input<string>('var(--wr-chart-1)');\n\n /**\n * Line thickness in CSS pixels — `vector-effect=\"non-scaling-stroke\"` keeps it at\n * that width whatever the box is stretched to, so it is NOT in viewBox units.\n * @default 1.5\n */\n readonly strokeWidth = input(1.5, {\n transform: (v: unknown): number => Math.max(0.1, coerceNumberProperty(v, 1.5)),\n });\n\n /** Fill the area below the line, faintly (`--wr-sparkline-area-opacity`). @default false */\n readonly showArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show a dot at the last data point. @default true */\n readonly showTip = input(true, { transform: coerceBooleanProperty });\n\n /** CSS width. @default '8rem' */\n readonly width = input<string>('8rem');\n\n /** CSS height. @default '2rem' */\n readonly height = input<string>('2rem');\n\n /**\n * Show a tooltip with the value of the point nearest the pointer, marking that point,\n * and named by `ariaLabel` when one is given. Pointer only.\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 the value in the tooltip. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The value as the tooltip writes it — in full, never compact, to `Intl`'s default precision. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n private readonly marker = viewChild<ElementRef<HTMLElement>>('marker');\n\n // Drawn in a 100×40 viewBox — scales smoothly to any CSS size.\n private readonly vbW = 100;\n private readonly vbH = 40;\n private readonly padding = 2;\n\n /**\n * The data as drawn. Non-finite values are dropped rather than scaled: every\n * `min`/`max` comparison against a NaN is false, so it survived into the scale and\n * `toFixed(2)` wrote the literal text `NaN` into the path `d` — invalid geometry,\n * and the line vanishes. The tooltip reads this list too, so the value it shows is\n * the one under the point it marks.\n */\n private readonly values = computed(() => this.data().filter(v => Number.isFinite(v)));\n\n /** Mapped `{ x, y }` points for the path. */\n protected readonly points = computed(() => {\n const data = this.values();\n if (data.length === 0) return [] as readonly { x: number; y: number }[];\n if (data.length === 1) return [{ x: this.vbW / 2, y: this.vbH / 2 }];\n\n let min = data[0];\n let max = data[0];\n for (const v of data) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n const pad = this.padding;\n const w = this.vbW - pad * 2;\n const h = this.vbH - pad * 2;\n // A series with no spread has no shape, and dividing by the old `|| 1` fallback\n // pinned every point to `pad + h` — the bottom edge — so a steady series at 500\n // read as rock bottom. Centred instead, which is what a lone datum already does.\n if (max === min) {\n return data.map((_, i) => ({ x: pad + (i / (data.length - 1)) * w, y: this.vbH / 2 }));\n }\n const span = max - min;\n return data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * w,\n y: pad + h - ((v - min) / span) * h,\n }));\n });\n\n /**\n * The line through every point. A lone point repeats itself: a subpath of one `M` is\n * never stroked, so a one-value sparkline with `showTip` off drew nothing at all, and\n * the round cap paints the repeat as a dot of the line's width.\n */\n protected readonly linePath = computed(() => {\n const points = this.points();\n const path = points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n return points.length === 1 ? `${path} L ${points[0].x.toFixed(2)} ${points[0].y.toFixed(2)}` : path;\n });\n\n protected readonly areaPath = computed(() => {\n const pts = this.points();\n if (pts.length < 2) return '';\n const baseY = this.vbH - this.padding;\n const start = `M ${pts[0].x.toFixed(2)} ${baseY}`;\n const line = pts.map(p => `L ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n const close = `L ${pts[pts.length - 1].x.toFixed(2)} ${baseY} Z`;\n return `${start} ${line} ${close}`;\n });\n\n /** A zero-length line at the last point, which a round cap paints as the tip dot. */\n protected readonly tipPath = computed(() => {\n const last = this.points().at(-1);\n return last ? `M ${last.x.toFixed(2)} ${last.y.toFixed(2)} h 0` : null;\n });\n\n protected readonly viewBox = `0 0 ${this.vbW} ${this.vbH}`;\n\n /**\n * How far the drawing sits in from the edge of its box, in px: the radius of the tip\n * dot, three times the line's width across, or half the line's width with no dot. It is\n * the SVG's padding, so the viewport the points are scaled into is that much smaller on\n * every side and nothing drawn at an edge reaches past `width` by `height`. The dot of\n * a last point used to hang over the box, where a table cell or a card cut it off.\n */\n protected readonly inset = computed(() => (this.showTip() ? this.strokeWidth() * 1.5 : this.strokeWidth() / 2));\n\n /** The box the viewBox is stretched over: the SVG's box, less its padding. */\n private drawing(box: DOMRect): { left: number; top: number; width: number; height: number } {\n const inset = this.inset();\n return {\n left: box.left + inset,\n top: box.top + inset,\n width: Math.max(0, box.width - 2 * inset),\n height: Math.max(0, box.height - 2 * inset),\n };\n }\n\n /**\n * One tooltip, pointing at the hovered point: above its marker, below it when there\n * is no room. The marker is the anchor element itself, drawn for the point the\n * tooltip reads — it renders before this runs, since both follow `tip.active()`.\n *\n * The chip sits INSIDE the drawing, over the stretch of line above the marker, so the\n * helper is also told which point any spot over the drawing reads: a pointer scrubbing\n * along the top of a sparkline would otherwise land on the chip and stop there.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const value = this.values()[index];\n const marker = this.marker()?.nativeElement;\n if (value === undefined || !marker) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.numbers.value(value), color: this.color() },\n anchor: marker,\n };\n },\n (x, y) => {\n const svg = this.svg()?.nativeElement;\n if (!svg) return null;\n const box = svg.getBoundingClientRect();\n if (x < box.left || x > box.right || y < box.top || y > box.bottom) return null;\n return this.indexAt(x, box);\n }\n );\n\n /**\n * The marker's place in pixels from the host's padding edge, measured off the\n * DRAWING's box. An element rather than a `<circle>`: the drawing stretches to\n * any box with `preserveAspectRatio=\"none\"`, which would squash a circle into an\n * ellipse.\n *\n * Not percentages of the host, which is what it was: the host is only the\n * drawing's size until something stretches it — `width: 100%` on the element,\n * `display: block`, a column flex parent — while the drawing keeps its `width`.\n * Measured in Chromium, WebKit and Firefox on a 327px host round the default\n * 128px drawing, the marker for a point at 115px landed at 292px, out in empty\n * space with the chip above it. Read when a point is hovered, so the boxes are\n * laid out; `tip.active()` is never set on the server.\n */\n protected readonly markerAt = computed(() => {\n const index = this.tip.active();\n const point = index === null ? undefined : this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg) return null;\n const host = this.host.nativeElement;\n const outer = host.getBoundingClientRect();\n const box = this.drawing(svg.getBoundingClientRect());\n return {\n x: box.left - outer.left - host.clientLeft + (point.x / this.vbW) * box.width,\n y: box.top - outer.top - host.clientTop + (point.y / this.vbH) * box.height,\n };\n });\n\n protected onPointerMove(event: MouseEvent): void {\n const index = this.indexAt(event.clientX, (event.currentTarget as Element).getBoundingClientRect());\n if (index !== null) this.tip.enter(index);\n }\n\n /**\n * The point nearest the pointer, along x only — the points are evenly spaced, so\n * that is a rounding rather than a search. A box with no width (nothing laid out\n * yet) answers nothing rather than a NaN index.\n */\n private indexAt(clientX: number, box: DOMRect): number | null {\n const count = this.points().length;\n const drawing = this.drawing(box);\n if (count === 0 || drawing.width <= 0) return null;\n if (count === 1) return 0;\n const x = ((clientX - drawing.left) / drawing.width) * this.vbW;\n const step = (this.vbW - this.padding * 2) / (count - 1);\n return Math.min(count - 1, Math.max(0, Math.round((x - this.padding) / step)));\n }\n}\n","<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left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AAA"}
1
+ {"version":3,"file":"ngwr-charts-sparkline.mjs","names":[],"sources":["../../../projects/lib/charts/sparkline/sparkline.ts","../../../projects/lib/charts/sparkline/sparkline.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, LOCALE_ID, ViewEncapsulation, computed, inject, input, viewChild } from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, useChartNumbers, wrChartNumberFormat } from 'ngwr/charts/core';\nimport { wrReadI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Tiny inline trend line. SVG path drawn from `[data]: number[]` — no\n * axes, no labels, just the shape. Optional area fill + tip dot.\n *\n * The line is the first colour of the chart palette (`--wr-chart-1`) unless `color`\n * says otherwise. The drawing is inset from its box by the tip dot's radius, so the dot\n * on a last point at the edge, or on the highest or lowest one, stays inside `width` by\n * `height` and no ancestor that clips at the box cuts it.\n *\n * @example\n * ```html\n * <wr-sparkline [data]=\"[12, 14, 9, 17, 21, 18, 23]\" />\n * <wr-sparkline [data]=\"prices\" [showArea]=\"true\" color=\"var(--wr-color-success)\" />\n * ```\n *\n * **What a screen reader gets.** Nothing by default: the drawing is `aria-hidden` until\n * `ariaLabel` names it, and then it is one `role=\"img\"` with that name and no figure.\n * `dataTable` renders the values of a named sparkline as a table a reader can walk.\n *\n * @see https://ngwr.dev/charts/sparkline\n */\n@Component({\n selector: 'wr-sparkline',\n templateUrl: './sparkline.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sparkline' },\n imports: [WrChartTable],\n})\nexport class WrSparkline {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/sparkline');\n }\n\n /**\n * The values, left to right. Evenly spaced — a sparkline carries no x axis, so\n * pass an already-ordered series rather than points with their own timestamps.\n */\n readonly data = input<readonly number[]>([]);\n\n /**\n * Accessible name. A sparkline usually sits beside the number it summarises, where\n * announcing it again is noise — so it is `aria-hidden` by default and becomes a\n * named `role=\"img\"` only when a consumer says what it shows. It is also the caption of\n * the data table, which an unnamed sparkline does not render.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stroke colour. The first colour of the chart palette, which is the brand colour\n * unless the theme says otherwise. @default 'var(--wr-chart-1)'\n */\n readonly color = input<string>('var(--wr-chart-1)');\n\n /**\n * Line thickness in CSS pixels — `vector-effect=\"non-scaling-stroke\"` keeps it at\n * that width whatever the box is stretched to, so it is NOT in viewBox units.\n * @default 1.5\n */\n readonly strokeWidth = input(1.5, {\n transform: (v: unknown): number => Math.max(0.1, coerceNumberProperty(v, 1.5)),\n });\n\n /** Fill the area below the line, faintly (`--wr-sparkline-area-opacity`). @default false */\n readonly showArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show a dot at the last data point. @default true */\n readonly showTip = input(true, { transform: coerceBooleanProperty });\n\n /** CSS width. @default '8rem' */\n readonly width = input<string>('8rem');\n\n /** CSS height. @default '2rem' */\n readonly height = input<string>('2rem');\n\n /**\n * Show a tooltip with the value of the point nearest the pointer, marking that point,\n * and named by `ariaLabel` when one is given. Pointer only.\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 the value in the tooltip and in the data table. `null` uses `Intl.NumberFormat`\n * in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the sparkline's values as a table that only assistive technology reaches: a\n * row per point drawn, headed by its position in the series, counted from one, with its\n * value as the tooltip writes it. A value that is not a number is not drawn and has no\n * row.\n *\n * Only with `ariaLabel`, which is the table's caption: a sparkline with no name is\n * decoration, hidden from a screen reader as a whole, and renders no table. The drawing\n * is one named `role=\"img\"`, which carries the name and no figure, so without the table\n * the values are nowhere a screen reader can walk. It is rendered beside the drawing,\n * clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n *\n * The table is a real `<table>` inside the host, so under SSR keep a sparkline that\n * renders one out of a `<p>`: the HTML parser ends a paragraph at a table, and hydration\n * then meets a tree the server did not render. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The heading of the data table's one column. */\n private readonly valueName = wrReadI18nText('sparkline.value', 'Value');\n\n /** The value as the tooltip and the data table write it — in full, never compact, to `Intl`'s default precision. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** A point's position in the series, in `LOCALE_ID`'s digits. */\n private readonly positions = wrChartNumberFormat(inject(LOCALE_ID));\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n private readonly marker = viewChild<ElementRef<HTMLElement>>('marker');\n\n // Drawn in a 100×40 viewBox — scales smoothly to any CSS size.\n private readonly vbW = 100;\n private readonly vbH = 40;\n private readonly padding = 2;\n\n /**\n * The data as drawn. Non-finite values are dropped rather than scaled: every\n * `min`/`max` comparison against a NaN is false, so it survived into the scale and\n * `toFixed(2)` wrote the literal text `NaN` into the path `d` — invalid geometry,\n * and the line vanishes. The tooltip reads this list too, so the value it shows is\n * the one under the point it marks.\n */\n private readonly values = computed(() => this.data().filter(v => Number.isFinite(v)));\n\n /**\n * The figures for `dataTable`, or `null` while there is no table to render: `dataTable`\n * is off, or the sparkline has no name to caption it with. A row per point drawn, headed\n * by its position, and its value as the one column.\n */\n protected readonly tableData = computed<WrChartTableData | null>(() => {\n const caption = this.ariaLabel();\n if (!this.dataTable() || !caption) return null;\n return {\n caption,\n columns: [this.valueName()],\n groups: [\n {\n rows: this.values().map((value, index) => ({\n header: this.positions.format(index + 1),\n cells: [this.numbers.value(value)],\n })),\n },\n ],\n };\n });\n\n /** Mapped `{ x, y }` points for the path. */\n protected readonly points = computed(() => {\n const data = this.values();\n if (data.length === 0) return [] as readonly { x: number; y: number }[];\n if (data.length === 1) return [{ x: this.vbW / 2, y: this.vbH / 2 }];\n\n let min = data[0];\n let max = data[0];\n for (const v of data) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n const pad = this.padding;\n const w = this.vbW - pad * 2;\n const h = this.vbH - pad * 2;\n // A series with no spread has no shape, and dividing by the old `|| 1` fallback\n // pinned every point to `pad + h` — the bottom edge — so a steady series at 500\n // read as rock bottom. Centred instead, which is what a lone datum already does.\n if (max === min) {\n return data.map((_, i) => ({ x: pad + (i / (data.length - 1)) * w, y: this.vbH / 2 }));\n }\n const span = max - min;\n return data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * w,\n y: pad + h - ((v - min) / span) * h,\n }));\n });\n\n /**\n * The line through every point. A lone point repeats itself: a subpath of one `M` is\n * never stroked, so a one-value sparkline with `showTip` off drew nothing at all, and\n * the round cap paints the repeat as a dot of the line's width.\n */\n protected readonly linePath = computed(() => {\n const points = this.points();\n const path = points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n return points.length === 1 ? `${path} L ${points[0].x.toFixed(2)} ${points[0].y.toFixed(2)}` : path;\n });\n\n protected readonly areaPath = computed(() => {\n const pts = this.points();\n if (pts.length < 2) return '';\n const baseY = this.vbH - this.padding;\n const start = `M ${pts[0].x.toFixed(2)} ${baseY}`;\n const line = pts.map(p => `L ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n const close = `L ${pts[pts.length - 1].x.toFixed(2)} ${baseY} Z`;\n return `${start} ${line} ${close}`;\n });\n\n /** A zero-length line at the last point, which a round cap paints as the tip dot. */\n protected readonly tipPath = computed(() => {\n const last = this.points().at(-1);\n return last ? `M ${last.x.toFixed(2)} ${last.y.toFixed(2)} h 0` : null;\n });\n\n protected readonly viewBox = `0 0 ${this.vbW} ${this.vbH}`;\n\n /**\n * How far the drawing sits in from the edge of its box, in px: the radius of the tip\n * dot, three times the line's width across, or half the line's width with no dot. It is\n * the SVG's padding, so the viewport the points are scaled into is that much smaller on\n * every side and nothing drawn at an edge reaches past `width` by `height`. The dot of\n * a last point used to hang over the box, where a table cell or a card cut it off.\n */\n protected readonly inset = computed(() => (this.showTip() ? this.strokeWidth() * 1.5 : this.strokeWidth() / 2));\n\n /** The box the viewBox is stretched over: the SVG's box, less its padding. */\n private drawing(box: DOMRect): { left: number; top: number; width: number; height: number } {\n const inset = this.inset();\n return {\n left: box.left + inset,\n top: box.top + inset,\n width: Math.max(0, box.width - 2 * inset),\n height: Math.max(0, box.height - 2 * inset),\n };\n }\n\n /**\n * One tooltip, pointing at the hovered point: above its marker, below it when there\n * is no room. The marker is the anchor element itself, drawn for the point the\n * tooltip reads — it renders before this runs, since both follow `tip.active()`.\n *\n * The chip sits INSIDE the drawing, over the stretch of line above the marker, so the\n * helper is also told which point any spot over the drawing reads: a pointer scrubbing\n * along the top of a sparkline would otherwise land on the chip and stop there.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const value = this.values()[index];\n const marker = this.marker()?.nativeElement;\n if (value === undefined || !marker) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.numbers.value(value), color: this.color() },\n anchor: marker,\n };\n },\n (x, y) => {\n const svg = this.svg()?.nativeElement;\n if (!svg) return null;\n const box = svg.getBoundingClientRect();\n if (x < box.left || x > box.right || y < box.top || y > box.bottom) return null;\n return this.indexAt(x, box);\n }\n );\n\n /**\n * The marker's place in pixels from the host's padding edge, measured off the\n * DRAWING's box. An element rather than a `<circle>`: the drawing stretches to\n * any box with `preserveAspectRatio=\"none\"`, which would squash a circle into an\n * ellipse.\n *\n * Not percentages of the host, which is what it was: the host is only the\n * drawing's size until something stretches it — `width: 100%` on the element,\n * `display: block`, a column flex parent — while the drawing keeps its `width`.\n * Measured in Chromium, WebKit and Firefox on a 327px host round the default\n * 128px drawing, the marker for a point at 115px landed at 292px, out in empty\n * space with the chip above it. Read when a point is hovered, so the boxes are\n * laid out; `tip.active()` is never set on the server.\n */\n protected readonly markerAt = computed(() => {\n const index = this.tip.active();\n const point = index === null ? undefined : this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg) return null;\n const host = this.host.nativeElement;\n const outer = host.getBoundingClientRect();\n const box = this.drawing(svg.getBoundingClientRect());\n return {\n x: box.left - outer.left - host.clientLeft + (point.x / this.vbW) * box.width,\n y: box.top - outer.top - host.clientTop + (point.y / this.vbH) * box.height,\n };\n });\n\n protected onPointerMove(event: MouseEvent): void {\n const index = this.indexAt(event.clientX, (event.currentTarget as Element).getBoundingClientRect());\n if (index !== null) this.tip.enter(index);\n }\n\n /**\n * The point nearest the pointer, along x only — the points are evenly spaced, so\n * that is a rounding rather than a search. A box with no width (nothing laid out\n * yet) answers nothing rather than a NaN index.\n */\n private indexAt(clientX: number, box: DOMRect): number | null {\n const count = this.points().length;\n const drawing = this.drawing(box);\n if (count === 0 || drawing.width <= 0) return null;\n if (count === 1) return 0;\n const x = ((clientX - drawing.left) / drawing.width) * this.vbW;\n const step = (this.vbW - this.padding * 2) / (count - 1);\n return Math.min(count - 1, Math.max(0, Math.round((x - this.padding) / step)));\n }\n}\n","<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n@if (tableData(); as table) {\n <!-- The values for a screen reader, beside the drawing rather than inside its `img`,\n which would make them presentational. Clipped to nothing by its own stylesheet, so\n it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"table\" />\n}\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,kBAAkB;CACrF;CAMS,OAAO,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQnC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,QAAQ,MAAc,qBAAoB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAO1C,cAAc,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA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