@chipmobilesdk/rn-chart 0.3.0 → 0.5.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 (373) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +45 -3
  3. package/lib/commonjs/a11y/summary.js +190 -0
  4. package/lib/commonjs/a11y/summary.js.map +1 -0
  5. package/lib/commonjs/contract/datasource.js +64 -0
  6. package/lib/commonjs/contract/datasource.js.map +1 -0
  7. package/lib/commonjs/contract/distribution.js +45 -0
  8. package/lib/commonjs/contract/distribution.js.map +1 -0
  9. package/lib/commonjs/contract/errors.js +88 -0
  10. package/lib/commonjs/contract/errors.js.map +1 -0
  11. package/lib/commonjs/contract/format.js +133 -0
  12. package/lib/commonjs/contract/format.js.map +1 -0
  13. package/lib/commonjs/contract/interaction.js +24 -0
  14. package/lib/commonjs/contract/interaction.js.map +1 -0
  15. package/lib/commonjs/contract/marker.js +55 -0
  16. package/lib/commonjs/contract/marker.js.map +1 -0
  17. package/lib/commonjs/contract/props.js +6 -0
  18. package/lib/commonjs/contract/props.js.map +1 -0
  19. package/lib/commonjs/contract/state.js +68 -0
  20. package/lib/commonjs/contract/state.js.map +1 -0
  21. package/lib/commonjs/contract/strings.js +54 -0
  22. package/lib/commonjs/contract/strings.js.map +1 -0
  23. package/lib/commonjs/contract/theme.js +116 -0
  24. package/lib/commonjs/contract/theme.js.map +1 -0
  25. package/lib/commonjs/contract/value.js +112 -0
  26. package/lib/commonjs/contract/value.js.map +1 -0
  27. package/lib/commonjs/geometry/bar.js +257 -0
  28. package/lib/commonjs/geometry/bar.js.map +1 -0
  29. package/lib/commonjs/geometry/distribution.js +197 -0
  30. package/lib/commonjs/geometry/distribution.js.map +1 -0
  31. package/lib/commonjs/geometry/heatmap.js +186 -0
  32. package/lib/commonjs/geometry/heatmap.js.map +1 -0
  33. package/lib/commonjs/geometry/hitTest.js +117 -0
  34. package/lib/commonjs/geometry/hitTest.js.map +1 -0
  35. package/lib/commonjs/geometry/layout.js +134 -0
  36. package/lib/commonjs/geometry/layout.js.map +1 -0
  37. package/lib/commonjs/geometry/markers.js +59 -0
  38. package/lib/commonjs/geometry/markers.js.map +1 -0
  39. package/lib/commonjs/geometry/path.js +166 -0
  40. package/lib/commonjs/geometry/path.js.map +1 -0
  41. package/lib/commonjs/geometry/progress.js +203 -0
  42. package/lib/commonjs/geometry/progress.js.map +1 -0
  43. package/lib/commonjs/geometry/scale.js +127 -0
  44. package/lib/commonjs/geometry/scale.js.map +1 -0
  45. package/lib/commonjs/geometry/ticks.js +120 -0
  46. package/lib/commonjs/geometry/ticks.js.map +1 -0
  47. package/lib/commonjs/geometry/timeSeries.js +157 -0
  48. package/lib/commonjs/geometry/timeSeries.js.map +1 -0
  49. package/lib/commonjs/geometry/types.js +43 -0
  50. package/lib/commonjs/geometry/types.js.map +1 -0
  51. package/lib/commonjs/index.js +284 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/package.json +1 -0
  54. package/lib/commonjs/react/ChartBoundary.js +82 -0
  55. package/lib/commonjs/react/ChartBoundary.js.map +1 -0
  56. package/lib/commonjs/react/ChartFrame.js +270 -0
  57. package/lib/commonjs/react/ChartFrame.js.map +1 -0
  58. package/lib/commonjs/react/ChartLegend.js +242 -0
  59. package/lib/commonjs/react/ChartLegend.js.map +1 -0
  60. package/lib/commonjs/react/ChartPlot.js +62 -0
  61. package/lib/commonjs/react/ChartPlot.js.map +1 -0
  62. package/lib/commonjs/react/ChartStateOverlay.js +89 -0
  63. package/lib/commonjs/react/ChartStateOverlay.js.map +1 -0
  64. package/lib/commonjs/react/ChartThemeProvider.js +51 -0
  65. package/lib/commonjs/react/ChartThemeProvider.js.map +1 -0
  66. package/lib/commonjs/react/charts.js +108 -0
  67. package/lib/commonjs/react/charts.js.map +1 -0
  68. package/lib/commonjs/react/pointEvent.js +35 -0
  69. package/lib/commonjs/react/pointEvent.js.map +1 -0
  70. package/lib/commonjs/react/useChartA11y.js +97 -0
  71. package/lib/commonjs/react/useChartA11y.js.map +1 -0
  72. package/lib/commonjs/react/useChartFormatters.js +66 -0
  73. package/lib/commonjs/react/useChartFormatters.js.map +1 -0
  74. package/lib/commonjs/react/useChartLayout.js +100 -0
  75. package/lib/commonjs/react/useChartLayout.js.map +1 -0
  76. package/lib/commonjs/react/useChartSelection.js +131 -0
  77. package/lib/commonjs/react/useChartSelection.js.map +1 -0
  78. package/lib/commonjs/react/useChartStatus.js +74 -0
  79. package/lib/commonjs/react/useChartStatus.js.map +1 -0
  80. package/lib/commonjs/render/Axis.js +88 -0
  81. package/lib/commonjs/render/Axis.js.map +1 -0
  82. package/lib/commonjs/render/Marks.js +184 -0
  83. package/lib/commonjs/render/Marks.js.map +1 -0
  84. package/lib/commonjs/validation/budgets.js +106 -0
  85. package/lib/commonjs/validation/budgets.js.map +1 -0
  86. package/lib/commonjs/validation/validateDatasource.js +189 -0
  87. package/lib/commonjs/validation/validateDatasource.js.map +1 -0
  88. package/lib/module/a11y/summary.js +184 -0
  89. package/lib/module/a11y/summary.js.map +1 -0
  90. package/lib/module/contract/datasource.js +57 -0
  91. package/lib/module/contract/datasource.js.map +1 -0
  92. package/lib/module/contract/distribution.js +40 -0
  93. package/lib/module/contract/distribution.js.map +1 -0
  94. package/lib/module/contract/errors.js +80 -0
  95. package/lib/module/contract/errors.js.map +1 -0
  96. package/lib/module/contract/format.js +123 -0
  97. package/lib/module/contract/format.js.map +1 -0
  98. package/lib/module/contract/interaction.js +20 -0
  99. package/lib/module/contract/interaction.js.map +1 -0
  100. package/lib/module/contract/marker.js +49 -0
  101. package/lib/module/contract/marker.js.map +1 -0
  102. package/lib/module/contract/props.js +4 -0
  103. package/lib/module/contract/props.js.map +1 -0
  104. package/lib/module/contract/state.js +61 -0
  105. package/lib/module/contract/state.js.map +1 -0
  106. package/lib/module/contract/strings.js +49 -0
  107. package/lib/module/contract/strings.js.map +1 -0
  108. package/lib/module/contract/theme.js +109 -0
  109. package/lib/module/contract/theme.js.map +1 -0
  110. package/lib/module/contract/value.js +101 -0
  111. package/lib/module/contract/value.js.map +1 -0
  112. package/lib/module/geometry/bar.js +253 -0
  113. package/lib/module/geometry/bar.js.map +1 -0
  114. package/lib/module/geometry/distribution.js +193 -0
  115. package/lib/module/geometry/distribution.js.map +1 -0
  116. package/lib/module/geometry/heatmap.js +182 -0
  117. package/lib/module/geometry/heatmap.js.map +1 -0
  118. package/lib/module/geometry/hitTest.js +110 -0
  119. package/lib/module/geometry/hitTest.js.map +1 -0
  120. package/lib/module/geometry/layout.js +122 -0
  121. package/lib/module/geometry/layout.js.map +1 -0
  122. package/lib/module/geometry/markers.js +53 -0
  123. package/lib/module/geometry/markers.js.map +1 -0
  124. package/lib/module/geometry/path.js +157 -0
  125. package/lib/module/geometry/path.js.map +1 -0
  126. package/lib/module/geometry/progress.js +199 -0
  127. package/lib/module/geometry/progress.js.map +1 -0
  128. package/lib/module/geometry/scale.js +119 -0
  129. package/lib/module/geometry/scale.js.map +1 -0
  130. package/lib/module/geometry/ticks.js +112 -0
  131. package/lib/module/geometry/ticks.js.map +1 -0
  132. package/lib/module/geometry/timeSeries.js +153 -0
  133. package/lib/module/geometry/timeSeries.js.map +1 -0
  134. package/lib/module/geometry/types.js +39 -0
  135. package/lib/module/geometry/types.js.map +1 -0
  136. package/lib/module/index.js +85 -0
  137. package/lib/module/index.js.map +1 -0
  138. package/lib/module/package.json +1 -0
  139. package/lib/module/react/ChartBoundary.js +75 -0
  140. package/lib/module/react/ChartBoundary.js.map +1 -0
  141. package/lib/module/react/ChartFrame.js +263 -0
  142. package/lib/module/react/ChartFrame.js.map +1 -0
  143. package/lib/module/react/ChartLegend.js +234 -0
  144. package/lib/module/react/ChartLegend.js.map +1 -0
  145. package/lib/module/react/ChartPlot.js +56 -0
  146. package/lib/module/react/ChartPlot.js.map +1 -0
  147. package/lib/module/react/ChartStateOverlay.js +82 -0
  148. package/lib/module/react/ChartStateOverlay.js.map +1 -0
  149. package/lib/module/react/ChartThemeProvider.js +44 -0
  150. package/lib/module/react/ChartThemeProvider.js.map +1 -0
  151. package/lib/module/react/charts.js +102 -0
  152. package/lib/module/react/charts.js.map +1 -0
  153. package/lib/module/react/pointEvent.js +30 -0
  154. package/lib/module/react/pointEvent.js.map +1 -0
  155. package/lib/module/react/useChartA11y.js +92 -0
  156. package/lib/module/react/useChartA11y.js.map +1 -0
  157. package/lib/module/react/useChartFormatters.js +61 -0
  158. package/lib/module/react/useChartFormatters.js.map +1 -0
  159. package/lib/module/react/useChartLayout.js +95 -0
  160. package/lib/module/react/useChartLayout.js.map +1 -0
  161. package/lib/module/react/useChartSelection.js +125 -0
  162. package/lib/module/react/useChartSelection.js.map +1 -0
  163. package/lib/module/react/useChartStatus.js +69 -0
  164. package/lib/module/react/useChartStatus.js.map +1 -0
  165. package/lib/module/render/Axis.js +80 -0
  166. package/lib/module/render/Axis.js.map +1 -0
  167. package/lib/module/render/Marks.js +173 -0
  168. package/lib/module/render/Marks.js.map +1 -0
  169. package/lib/module/validation/budgets.js +97 -0
  170. package/lib/module/validation/budgets.js.map +1 -0
  171. package/lib/module/validation/validateDatasource.js +184 -0
  172. package/lib/module/validation/validateDatasource.js.map +1 -0
  173. package/lib/typescript/commonjs/a11y/summary.d.ts +38 -0
  174. package/lib/typescript/commonjs/a11y/summary.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/contract/datasource.d.ts +94 -0
  176. package/lib/typescript/commonjs/contract/datasource.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/contract/distribution.d.ts +17 -0
  178. package/lib/typescript/commonjs/contract/distribution.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/contract/errors.d.ts +53 -0
  180. package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/contract/format.d.ts +63 -0
  182. package/lib/typescript/commonjs/contract/format.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
  184. package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/contract/marker.d.ts +39 -0
  186. package/lib/typescript/commonjs/contract/marker.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/contract/props.d.ts +58 -0
  188. package/lib/typescript/commonjs/contract/props.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/contract/state.d.ts +45 -0
  190. package/lib/typescript/commonjs/contract/state.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/contract/strings.d.ts +39 -0
  192. package/lib/typescript/commonjs/contract/strings.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/contract/theme.d.ts +85 -0
  194. package/lib/typescript/commonjs/contract/theme.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/contract/value.d.ts +69 -0
  196. package/lib/typescript/commonjs/contract/value.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/geometry/bar.d.ts +18 -0
  198. package/lib/typescript/commonjs/geometry/bar.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/geometry/distribution.d.ts +23 -0
  200. package/lib/typescript/commonjs/geometry/distribution.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/geometry/heatmap.d.ts +24 -0
  202. package/lib/typescript/commonjs/geometry/heatmap.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/geometry/hitTest.d.ts +68 -0
  204. package/lib/typescript/commonjs/geometry/hitTest.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/geometry/layout.d.ts +67 -0
  206. package/lib/typescript/commonjs/geometry/layout.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/geometry/markers.d.ts +29 -0
  208. package/lib/typescript/commonjs/geometry/markers.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/geometry/path.d.ts +66 -0
  210. package/lib/typescript/commonjs/geometry/path.d.ts.map +1 -0
  211. package/lib/typescript/commonjs/geometry/progress.d.ts +17 -0
  212. package/lib/typescript/commonjs/geometry/progress.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/geometry/scale.d.ts +55 -0
  214. package/lib/typescript/commonjs/geometry/scale.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/geometry/ticks.d.ts +48 -0
  216. package/lib/typescript/commonjs/geometry/ticks.d.ts.map +1 -0
  217. package/lib/typescript/commonjs/geometry/timeSeries.d.ts +20 -0
  218. package/lib/typescript/commonjs/geometry/timeSeries.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/geometry/types.d.ts +91 -0
  220. package/lib/typescript/commonjs/geometry/types.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/index.d.ts +47 -0
  222. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/package.json +1 -0
  224. package/lib/typescript/commonjs/react/ChartBoundary.d.ts +47 -0
  225. package/lib/typescript/commonjs/react/ChartBoundary.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/react/ChartFrame.d.ts +31 -0
  227. package/lib/typescript/commonjs/react/ChartFrame.d.ts.map +1 -0
  228. package/lib/typescript/commonjs/react/ChartLegend.d.ts +31 -0
  229. package/lib/typescript/commonjs/react/ChartLegend.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/react/ChartPlot.d.ts +19 -0
  231. package/lib/typescript/commonjs/react/ChartPlot.d.ts.map +1 -0
  232. package/lib/typescript/commonjs/react/ChartStateOverlay.d.ts +25 -0
  233. package/lib/typescript/commonjs/react/ChartStateOverlay.d.ts.map +1 -0
  234. package/lib/typescript/commonjs/react/ChartThemeProvider.d.ts +21 -0
  235. package/lib/typescript/commonjs/react/ChartThemeProvider.d.ts.map +1 -0
  236. package/lib/typescript/commonjs/react/charts.d.ts +51 -0
  237. package/lib/typescript/commonjs/react/charts.d.ts.map +1 -0
  238. package/lib/typescript/commonjs/react/pointEvent.d.ts +13 -0
  239. package/lib/typescript/commonjs/react/pointEvent.d.ts.map +1 -0
  240. package/lib/typescript/commonjs/react/useChartA11y.d.ts +37 -0
  241. package/lib/typescript/commonjs/react/useChartA11y.d.ts.map +1 -0
  242. package/lib/typescript/commonjs/react/useChartFormatters.d.ts +21 -0
  243. package/lib/typescript/commonjs/react/useChartFormatters.d.ts.map +1 -0
  244. package/lib/typescript/commonjs/react/useChartLayout.d.ts +27 -0
  245. package/lib/typescript/commonjs/react/useChartLayout.d.ts.map +1 -0
  246. package/lib/typescript/commonjs/react/useChartSelection.d.ts +52 -0
  247. package/lib/typescript/commonjs/react/useChartSelection.d.ts.map +1 -0
  248. package/lib/typescript/commonjs/react/useChartStatus.d.ts +22 -0
  249. package/lib/typescript/commonjs/react/useChartStatus.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/render/Axis.d.ts +31 -0
  251. package/lib/typescript/commonjs/render/Axis.d.ts.map +1 -0
  252. package/lib/typescript/commonjs/render/Marks.d.ts +44 -0
  253. package/lib/typescript/commonjs/render/Marks.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/validation/budgets.d.ts +24 -0
  255. package/lib/typescript/commonjs/validation/budgets.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/validation/validateDatasource.d.ts +26 -0
  257. package/lib/typescript/commonjs/validation/validateDatasource.d.ts.map +1 -0
  258. package/lib/typescript/module/a11y/summary.d.ts +38 -0
  259. package/lib/typescript/module/a11y/summary.d.ts.map +1 -0
  260. package/lib/typescript/module/contract/datasource.d.ts +94 -0
  261. package/lib/typescript/module/contract/datasource.d.ts.map +1 -0
  262. package/lib/typescript/module/contract/distribution.d.ts +17 -0
  263. package/lib/typescript/module/contract/distribution.d.ts.map +1 -0
  264. package/lib/typescript/module/contract/errors.d.ts +53 -0
  265. package/lib/typescript/module/contract/errors.d.ts.map +1 -0
  266. package/lib/typescript/module/contract/format.d.ts +63 -0
  267. package/lib/typescript/module/contract/format.d.ts.map +1 -0
  268. package/lib/typescript/module/contract/interaction.d.ts +53 -0
  269. package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
  270. package/lib/typescript/module/contract/marker.d.ts +39 -0
  271. package/lib/typescript/module/contract/marker.d.ts.map +1 -0
  272. package/lib/typescript/module/contract/props.d.ts +58 -0
  273. package/lib/typescript/module/contract/props.d.ts.map +1 -0
  274. package/lib/typescript/module/contract/state.d.ts +45 -0
  275. package/lib/typescript/module/contract/state.d.ts.map +1 -0
  276. package/lib/typescript/module/contract/strings.d.ts +39 -0
  277. package/lib/typescript/module/contract/strings.d.ts.map +1 -0
  278. package/lib/typescript/module/contract/theme.d.ts +85 -0
  279. package/lib/typescript/module/contract/theme.d.ts.map +1 -0
  280. package/lib/typescript/module/contract/value.d.ts +69 -0
  281. package/lib/typescript/module/contract/value.d.ts.map +1 -0
  282. package/lib/typescript/module/geometry/bar.d.ts +18 -0
  283. package/lib/typescript/module/geometry/bar.d.ts.map +1 -0
  284. package/lib/typescript/module/geometry/distribution.d.ts +23 -0
  285. package/lib/typescript/module/geometry/distribution.d.ts.map +1 -0
  286. package/lib/typescript/module/geometry/heatmap.d.ts +24 -0
  287. package/lib/typescript/module/geometry/heatmap.d.ts.map +1 -0
  288. package/lib/typescript/module/geometry/hitTest.d.ts +68 -0
  289. package/lib/typescript/module/geometry/hitTest.d.ts.map +1 -0
  290. package/lib/typescript/module/geometry/layout.d.ts +67 -0
  291. package/lib/typescript/module/geometry/layout.d.ts.map +1 -0
  292. package/lib/typescript/module/geometry/markers.d.ts +29 -0
  293. package/lib/typescript/module/geometry/markers.d.ts.map +1 -0
  294. package/lib/typescript/module/geometry/path.d.ts +66 -0
  295. package/lib/typescript/module/geometry/path.d.ts.map +1 -0
  296. package/lib/typescript/module/geometry/progress.d.ts +17 -0
  297. package/lib/typescript/module/geometry/progress.d.ts.map +1 -0
  298. package/lib/typescript/module/geometry/scale.d.ts +55 -0
  299. package/lib/typescript/module/geometry/scale.d.ts.map +1 -0
  300. package/lib/typescript/module/geometry/ticks.d.ts +48 -0
  301. package/lib/typescript/module/geometry/ticks.d.ts.map +1 -0
  302. package/lib/typescript/module/geometry/timeSeries.d.ts +20 -0
  303. package/lib/typescript/module/geometry/timeSeries.d.ts.map +1 -0
  304. package/lib/typescript/module/geometry/types.d.ts +91 -0
  305. package/lib/typescript/module/geometry/types.d.ts.map +1 -0
  306. package/lib/typescript/module/index.d.ts +47 -0
  307. package/lib/typescript/module/index.d.ts.map +1 -0
  308. package/lib/typescript/module/package.json +1 -0
  309. package/lib/typescript/module/react/ChartBoundary.d.ts +47 -0
  310. package/lib/typescript/module/react/ChartBoundary.d.ts.map +1 -0
  311. package/lib/typescript/module/react/ChartFrame.d.ts +31 -0
  312. package/lib/typescript/module/react/ChartFrame.d.ts.map +1 -0
  313. package/lib/typescript/module/react/ChartLegend.d.ts +31 -0
  314. package/lib/typescript/module/react/ChartLegend.d.ts.map +1 -0
  315. package/lib/typescript/module/react/ChartPlot.d.ts +19 -0
  316. package/lib/typescript/module/react/ChartPlot.d.ts.map +1 -0
  317. package/lib/typescript/module/react/ChartStateOverlay.d.ts +25 -0
  318. package/lib/typescript/module/react/ChartStateOverlay.d.ts.map +1 -0
  319. package/lib/typescript/module/react/ChartThemeProvider.d.ts +21 -0
  320. package/lib/typescript/module/react/ChartThemeProvider.d.ts.map +1 -0
  321. package/lib/typescript/module/react/charts.d.ts +51 -0
  322. package/lib/typescript/module/react/charts.d.ts.map +1 -0
  323. package/lib/typescript/module/react/pointEvent.d.ts +13 -0
  324. package/lib/typescript/module/react/pointEvent.d.ts.map +1 -0
  325. package/lib/typescript/module/react/useChartA11y.d.ts +37 -0
  326. package/lib/typescript/module/react/useChartA11y.d.ts.map +1 -0
  327. package/lib/typescript/module/react/useChartFormatters.d.ts +21 -0
  328. package/lib/typescript/module/react/useChartFormatters.d.ts.map +1 -0
  329. package/lib/typescript/module/react/useChartLayout.d.ts +27 -0
  330. package/lib/typescript/module/react/useChartLayout.d.ts.map +1 -0
  331. package/lib/typescript/module/react/useChartSelection.d.ts +52 -0
  332. package/lib/typescript/module/react/useChartSelection.d.ts.map +1 -0
  333. package/lib/typescript/module/react/useChartStatus.d.ts +22 -0
  334. package/lib/typescript/module/react/useChartStatus.d.ts.map +1 -0
  335. package/lib/typescript/module/render/Axis.d.ts +31 -0
  336. package/lib/typescript/module/render/Axis.d.ts.map +1 -0
  337. package/lib/typescript/module/render/Marks.d.ts +44 -0
  338. package/lib/typescript/module/render/Marks.d.ts.map +1 -0
  339. package/lib/typescript/module/validation/budgets.d.ts +24 -0
  340. package/lib/typescript/module/validation/budgets.d.ts.map +1 -0
  341. package/lib/typescript/module/validation/validateDatasource.d.ts +26 -0
  342. package/lib/typescript/module/validation/validateDatasource.d.ts.map +1 -0
  343. package/package.json +40 -15
  344. package/skills/sdk-rn-chart/SKILL.md +49 -14
  345. package/src/a11y/summary.ts +34 -15
  346. package/src/contract/distribution.ts +44 -0
  347. package/src/contract/errors.ts +6 -0
  348. package/src/contract/interaction.ts +2 -2
  349. package/src/contract/strings.ts +2 -0
  350. package/src/geometry/bar.ts +27 -16
  351. package/src/geometry/distribution.ts +11 -6
  352. package/src/geometry/heatmap.ts +34 -17
  353. package/src/geometry/hitTest.ts +35 -0
  354. package/src/geometry/progress.ts +0 -1
  355. package/src/geometry/ticks.ts +0 -13
  356. package/src/geometry/timeSeries.ts +7 -2
  357. package/src/geometry/types.ts +11 -0
  358. package/src/index.ts +4 -1
  359. package/src/react/ChartFrame.tsx +126 -373
  360. package/src/react/ChartLegend.tsx +60 -3
  361. package/src/react/ChartPlot.tsx +57 -0
  362. package/src/react/ChartStateOverlay.tsx +94 -0
  363. package/src/react/charts.tsx +27 -12
  364. package/src/react/pointEvent.ts +40 -0
  365. package/src/react/useChartA11y.ts +113 -0
  366. package/src/react/useChartFormatters.ts +105 -0
  367. package/src/react/useChartLayout.ts +5 -2
  368. package/src/react/useChartSelection.ts +77 -40
  369. package/src/react/useChartStatus.ts +85 -0
  370. package/src/render/Axis.tsx +26 -22
  371. package/src/render/Marks.tsx +2 -9
  372. package/src/validation/budgets.ts +6 -4
  373. package/src/validation/validateDatasource.ts +38 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,134 @@
1
1
  # @chipmobilesdk/rn-chart
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Every package now ships built JavaScript with declaration files, instead of asking the
8
+ app to compile its TypeScript. ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22))
9
+
10
+ Each tarball carries `lib/commonjs`, `lib/module` and `lib/typescript` (built with
11
+ `react-native-builder-bob`), and `src/` alongside them. What that changes for a
12
+ consumer:
13
+
14
+ - **Nothing to add to `transformIgnorePatterns`.** `require` resolves to the CommonJS
15
+ build, so an app's Jest loads this package without being told to transform it. That
16
+ was the one thing every consuming app had to know about us (DEP-04).
17
+ - **Typechecking reads our `.d.ts`** rather than compiling our source under our
18
+ `tsconfig`. A consumer's stricter — or looser — settings no longer meet our code.
19
+ - **`import` resolves to ESM**, so a bundler can tree-shake what it does not use.
20
+
21
+ No exported name changed, and no subpath moved: `.`, `./testing`, `./push`,
22
+ `./advanced`, `./app-auth`, `./keychain` and rn-core's twelve subpaths resolve exactly
23
+ as before, each now with its own declarations for both module systems. publint and
24
+ `attw --profile node16` pass on all twelve packages, which they could not before.
25
+
26
+ Inside the monorepo nothing changed either, and that is deliberate: every subpath also
27
+ declares a private `chipmobilesdk-source` condition pointing at its TypeScript, and
28
+ Metro, Jest and `tsc` here ask for that condition first. The demo app bundles 371
29
+ modules straight from `packages/*/src`, so editing a package still changes the app with
30
+ no build step, and coverage is still measured on the source. The condition is named for
31
+ this organization rather than using the conventional `source` because third-party
32
+ packages declare that one too — `@dr.pogodin/react-native-fs` does — and asking for it
33
+ pulled their sources into our stricter compile.
34
+
35
+ `npm run build:packages` builds everything, `prepack` rebuilds before any `npm pack`,
36
+ and `lib/` is git-ignored: the published bytes are produced by the release, never
37
+ committed. `npm run check:manifests` now fails a package whose `main`, `module`,
38
+ `types`, `source` condition, `files`, build script or `prepack` do not match this shape.
39
+
40
+ ### Patch Changes
41
+
42
+ - Every peer range has an upper bound, and no package declares a peer it does not use. ([#21](https://github.com/operationd8979/chip-mobile-sdk/pull/21))
43
+
44
+ A peer range is now a caret, a tilde or an explicit `<`, except for `react` and
45
+ `react-native`: an app brings exactly one of each, so a floor is the only useful thing
46
+ to say about them. Every other peer is a library the app installs beside us, and an
47
+ open `>=` was a promise about versions nobody had run — mmkv 3→4 lost entitlements and
48
+ pending purchases exactly that way.
49
+
50
+ **Four of the new ceilings exclude a version that is already published**, so an app
51
+ that took the open range at its word may now see a peer warning. The new bound is the
52
+ major this release is tested against, which is the thing the old range failed to say:
53
+
54
+ | Peer | Was | Now | Published above the ceiling |
55
+ |---|---|---|---|
56
+ | `react-native-app-auth` (rn-auth) | `>=8` | `^8.0.0` | 9.0.0 |
57
+ | `react-native-keychain` (rn-auth) | `>=10` | `^10.0.0` | 11.0.0 |
58
+ | `@op-engineering/op-sqlite` (rn-local-db) | `>=17.1.0` | `^17.1.0` | 18.x, 19.x |
59
+ | `@react-native-firebase/messaging` (rn-notification) | `>=26.0.0` | `^26.0.0` | 27.x |
60
+
61
+ The others — `react-native-vision-camera` `^5.1.1`, `react-native-svg` `^15.15.0`,
62
+ `react-native-unistyles` `^3.2.0`, `@dr.pogodin/react-native-fs` `^2.39.2`,
63
+ `react-native-quick-crypto` `^1.0.0`, `react-native-notify-kit` `^10.5.0`,
64
+ `react-native-localize` `^3.7.0`, `react-native-mmkv` `^4.0.0` — exclude nothing that
65
+ exists today. rn-payment's mmkv range was already bounded (`>=4.0.0 <5`) and is now
66
+ written as the caret that means the same thing.
67
+
68
+ Peers nothing imports are gone. `rn-theme`, `rn-local-db` and `rn-notification` asked
69
+ for `react` without having a component or a hook between them; `rn-auth`, `rn-ai` and
70
+ `rn-i18n` asked for `react-native` without touching a React Native API (rn-auth reaches
71
+ both native modules through `lazyPeer`, rn-i18n formats on `Intl`); `rn-notification`
72
+ asked for `@react-native-firebase/app`, which messaging declares itself. `rn-ai` no
73
+ longer peers on `@chipmobilesdk/rn-auth` at all — it asks for a `TokenProvider`, a
74
+ two-method interface rn-auth's `auth` satisfies, so an app with its own token source
75
+ installs nothing extra. An app that enables push or signs in through rn-auth installs
76
+ the same packages as before; it is the manifest that stopped overstating.
77
+
78
+ `react-native-localize` is declared optional, which is what the code already did: the
79
+ time-zone reader goes through `lazyPeer` and falls back to `Intl` without it. The
80
+ `peerDependenciesMeta` entries that said `optional: false` are gone — that is npm's
81
+ default, and writing it down only invited the question of which peers were undecided.
82
+
83
+ `npm run check:manifests` now fails on an unbounded peer range, a peer nothing in
84
+ `src/` imports, and a `peerDependenciesMeta` entry for either, so the policy holds
85
+ without anyone remembering it.
86
+
87
+ - Each package's public API and its weight are now recorded in the repository, so a change
88
+ to either is reviewed rather than discovered. ([#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23))
89
+
90
+ `packages/<pkg>/etc/*.api.md` is an api-extractor report per entrypoint — twenty-seven
91
+ of them, generated from the declarations the package publishes and committed. A renamed
92
+ type, a widened union, one more optional field: all of it shows up in a pull request's
93
+ diff. `npm run check:api` fails when a report is out of date and `npm run api:update`
94
+ rewrites them.
95
+
96
+ A report that moves now needs a **minor or major** changeset for that package.
97
+ `check:changesets` enforces it, because the report is generated from what the package
98
+ publishes, and a patch release that moves the public surface is how a consumer's build
99
+ breaks on `npm update`. A report added for the first time is a baseline, not a change.
100
+ `./testing` deliberately has no report: test doubles are not a surface a release is
101
+ gated on.
102
+
103
+ `npm run check:size` holds every entrypoint to a budget in `.size-limit.json`, measured
104
+ on the ESM build with peers and rn-core treated as external — they are what an app
105
+ installs beside us, not our weight. Each budget started at today's measurement plus five
106
+ per cent, so growth becomes a decision someone makes instead of a drift nobody sees. The
107
+ current figures run from 500 B (`rn-core/lazy`) to 19 kB (rn-notification).
108
+
109
+ No behaviour or API changed in this release; the entry is here so the changelog records
110
+ when the reports and the budgets began.
111
+ - Updated dependencies ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22), [#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23)):
112
+ - @chipmobilesdk/rn-core@0.2.0
113
+
114
+ ## 0.4.0
115
+
116
+ ### Minor Changes
117
+
118
+ - Props and formatters that were declared but never read now have an effect. `formatters.legendLabel` labels legend entries, `formatters.summary` words the values a screen reader hears, and `theme.radius` rounds bars and heatmap cells. `accessibility.summaryFormatter` already worked; `ProgressChart.orientation`, which did nothing, is gone, and the `segmentPress` and `seriesSelect` event kinds, which were never emitted, are gone from the interaction types. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
119
+
120
+ Tapping the selected point again clears the selection and now reports `(null, null)` instead of the point the chart just stopped highlighting. Screen-reader stepping moves the selection rather than toggling it, so a chart with one point stays on that point. A screen reader hears a position in the app's own words through `formatters.axisLabel` rather than a raw epoch number, and the summary names the highest and lowest points by when or where they are — a single time series used to report one value and lose its lowest.
121
+
122
+ Values are checked rather than guessed at. `NaN` or `Infinity` in a known value or an instant is a `nonFiniteValue` validation error instead of a mark drawn at the origin, and a negative distribution segment is a `negativeDistributionValue` one. `DistributionChart` takes `valuesAre` to say whether its numbers are proportions or absolute amounts; inference no longer reads two counts of 1 as two full circles. A donut or pie segment is hit by the angle and radius under the finger, so the edge of a large segment selects that segment.
123
+
124
+ `HeatmapChart` draws the names of its rows and columns, and a key to its colours — the lowest and highest value with the ramp between them, as one accessible element. `ColorScaleLegend` and `ColorScale` are exported for apps that lay it out themselves. Bar charts label their value axis in round steps and put instant categories in time order, as the time-series chart does.
125
+
126
+ ### Patch Changes
127
+
128
+ - Charts keep their memoization under the way apps actually write props. `formatters` and `TimeSeriesChart`'s `range` are compared by what they carry rather than by object identity, so writing either inline no longer rebuilds every scale and path string on each parent render. The hidden-series set, the selection callbacks and the legend toggle keep one identity, the drawn geometry is memoized apart from the selection so highlighting a point no longer reconciles the whole SVG tree, and the dataset budget is measured only in development builds. Text size is read reactively, so changing the system font size re-lays-out the chart immediately. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
129
+
130
+ Internally, the chart shell is split into `useChartStatus`, `useChartFormatters`, `useChartA11y`, `ChartPlot` and `ChartStateOverlay` instead of one 600-line component; the budget warning runs in an effect rather than during render; and the bar, time-series and heatmap builders each make one pass over their points where they made several.
131
+
3
132
  ## 0.3.0
4
133
 
5
134
  ### Minor Changes
package/README.md CHANGED
@@ -43,7 +43,7 @@ app-level data-access concept, not an operating-system permission.
43
43
  |---|---|
44
44
  | React | 19.2+ |
45
45
  | React Native | 0.85+ |
46
- | `react-native-svg` | 15.15+ |
46
+ | `react-native-svg` | `^15.15.0` |
47
47
  | Android | `minSdkVersion` 24, `targetSdkVersion` 36 |
48
48
  | iOS | 15.1+ |
49
49
 
@@ -150,6 +150,11 @@ Axis labels have room reserved for them: the plot shrinks to fit the widest
150
150
  value label on the left and one line of time or category labels below, so no
151
151
  label is clipped by the chart's edge.
152
152
 
153
+ Every known value, and every instant, must be a **finite number**. `NaN` or
154
+ `Infinity` is a validation error (`nonFiniteValue`) rather than a mark drawn at
155
+ the origin: data that arrived broken is reported as broken. Use `unknown()` for
156
+ a value you do not have.
157
+
153
158
  ## States
154
159
 
155
160
  Seven, and the package derives the two that only the data can determine:
@@ -212,6 +217,12 @@ ownership; the same callbacks fire either way.
212
217
  Every payload carries the point id, series id, value, position, and whatever
213
218
  metadata you attached. The package never navigates, fetches, or mutates.
214
219
 
220
+ Tapping the selected point again clears the selection, and the callback is told
221
+ so: `(null, null)`. Empty space clears it the same way. Screen-reader stepping
222
+ moves the selection rather than toggling it, so a chart with one point stays on
223
+ that point. A donut or pie is hit by the segment the finger is in — its angle
224
+ and radius — not by distance to its label.
225
+
215
226
  Legends can also toggle series visibility. The state is uncontrolled unless
216
227
  you supply `hiddenSeriesIds`:
217
228
 
@@ -252,6 +263,18 @@ correctly in light and dark.
252
263
  Meaning never rides on colour alone: series carry dash patterns as well as
253
264
  colours, and non-value classes use textures.
254
265
 
266
+ `DistributionChart` reads its numbers either as **proportions** (each in 0..1,
267
+ summing to 1) or as **absolute** amounts it normalises by their own total. It
268
+ infers which from the data, and a short sum of proportions is drawn short and
269
+ reported incomplete rather than stretched to fill the circle. Two counts of `1`
270
+ are ambiguous, so say what you mean when counts can be small:
271
+
272
+ ```tsx
273
+ <DistributionChart datasource={ds} valuesAre="absolute" />
274
+ ```
275
+
276
+ A negative segment is a validation error: a share of a whole cannot be negative.
277
+
255
278
  `DistributionChart` colours **segments**, not series. Palette entries are taken
256
279
  in order across every point, so one series of four points and four series of
257
280
  one point both give four colours. A point's own `color` overrides its segment;
@@ -275,6 +298,18 @@ default applies — the package never infers or converts a business unit. A
275
298
  formatter that throws degrades to the default **for that one label** and does
276
299
  not crash the screen.
277
300
 
301
+ Four slots: `value` (drawn labels), `axisLabel` (axis ticks, and how a position
302
+ is spoken to a screen reader), `legendLabel` (legend entries) and `summary` (the
303
+ values inside the accessible summary; falls back to `value`).
304
+
305
+ The `formatters` object itself may be written inline — the chart depends on the
306
+ functions it carries, not on the object. The **functions** must be stable:
307
+ define them at module scope or hold them in `useCallback`/`useMemo`, as with
308
+ `datasource`. A formatter rebuilt every render rebuilds every scale and path
309
+ string, which is the one thing `FR-073` exists to prevent. The same goes for
310
+ `range` on `TimeSeriesChart`, which is compared by its `from` and `to`, so
311
+ `range={{ from, to }}` inline is free.
312
+
278
313
  ## Accessibility
279
314
 
280
315
  Each chart is a single accessible element with a composed summary: what it is,
@@ -295,6 +330,11 @@ summary entirely, and `accessibility.label` replaces everything.
295
330
  <BarChart datasource={steps} title="Bước" strings={{ 'chart.family.bar': 'biểu đồ cột' }} />
296
331
  ```
297
332
 
333
+ `HeatmapChart` names its rows and columns along the edges of the plot and shows
334
+ the key to its colours — the lowest and highest value with the ramp between them
335
+ — below it, as one accessible element. Pass `legend={false}` to leave the key
336
+ out.
337
+
298
338
  Axis labels are thinned to fit rather than overlapped, and scale with the system
299
339
  text size up to **1.6×**; beyond that the growth is capped so the plot area
300
340
  survives.
@@ -309,8 +349,9 @@ survives.
309
349
  | Progress | 8 metrics |
310
350
  | Heatmap | 1,000 cells |
311
351
 
312
- Over budget, a chart **still renders and drops nothing**. It warns once per
313
- chart in development builds, and never in production. Aggregating or
352
+ Over budget, a chart **still renders and drops nothing**: nothing is enforced
353
+ and nothing is refused. It warns once per chart in development builds, and in
354
+ production the dataset is not even measured. Aggregating or
314
355
  downsampling above these sizes is your call — the package will not silently
315
356
  decide what data to discard.
316
357
 
@@ -359,6 +400,7 @@ The single entrypoint exports these public groups:
359
400
  `STATUS_PRECEDENCE`, `DATASET_BUDGETS`, `checkBudget`, error/failure types,
360
401
  and `isChartError`
361
402
  - Interaction: selection and series interaction types plus `sameSelection`
403
+ - Heatmap colour key: `ColorScaleLegend` and `ColorScale`
362
404
  - Theme and formatting: `defaultChartTheme`, `resolveSeriesColor`, default
363
405
  formatter helpers, `NON_VALUE_TEXT`, and public theme/formatter contracts
364
406
  - Accessibility: `buildChartSummary`, `buildPointAnnouncement`, and
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildChartSummary = buildChartSummary;
7
+ exports.buildPointAnnouncement = buildPointAnnouncement;
8
+ exports.buildTotalAnnouncement = buildTotalAnnouncement;
9
+ var _format = require("../contract/format.js");
10
+ var _rnCore = require("@chipmobilesdk/rn-core");
11
+ var _strings = require("../contract/strings.js");
12
+ var _value = require("../contract/value.js");
13
+ /**
14
+ * Composed accessible summaries (FR-067, FR-068, FR-069, FR-072).
15
+ *
16
+ * Exposing 2,500 individual points to a screen reader would be unusable even
17
+ * if it were cheap. A composed summary covers the same need: what the chart is,
18
+ * what it shows, where the extremes are, and what any target says.
19
+ *
20
+ * Withheld values never enter a summary — that would leak exactly what the
21
+ * withheld class exists to protect (FR-033).
22
+ */
23
+
24
+ const FAMILY_NOUN = {
25
+ progress: 'chart.family.progress',
26
+ distribution: 'chart.family.distribution',
27
+ timeSeries: 'chart.family.timeSeries',
28
+ bar: 'chart.family.bar',
29
+ heatmap: 'chart.family.heatmap'
30
+ };
31
+
32
+ /**
33
+ * What a screen reader hears when the chart is not showing data. Announcing
34
+ * the state beats silence, and beats announcing a stale value as if current.
35
+ */
36
+ const STATUS_PHRASE = {
37
+ loading: 'chart.status.loading',
38
+ empty: 'chart.status.empty',
39
+ error: 'chart.status.error',
40
+ stale: 'chart.status.stale',
41
+ noPermission: 'chart.status.noPermission',
42
+ partial: 'chart.status.partial',
43
+ ready: undefined
44
+ };
45
+ function describeExtremes(datasource, formatValue, strings, formatPosition) {
46
+ let min;
47
+ let max;
48
+ const several = datasource.series.length > 1;
49
+ for (const series of datasource.series) {
50
+ for (const point of series.points) {
51
+ // Withheld and unknown values are skipped entirely.
52
+ if (!(0, _value.isKnown)(point.value)) {
53
+ continue;
54
+ }
55
+ // Named by where the point is. A time series used to name both
56
+ // extremes after the series, so a one-series chart reported a single
57
+ // value and lost its lowest (CHT-07). Built lazily: only two are read.
58
+ const label = () => {
59
+ if (point.position.kind === 'category') {
60
+ return point.position.category;
61
+ }
62
+ if (point.position.kind === 'matrix') {
63
+ return `${point.position.row} ${point.position.column}`;
64
+ }
65
+ const at = formatPosition(point.position);
66
+ return several ? `${series.label} ${at}` : at;
67
+ };
68
+ if (!min || point.value.value < min.value) {
69
+ min = {
70
+ label,
71
+ value: point.value.value,
72
+ point
73
+ };
74
+ }
75
+ if (!max || point.value.value > max.value) {
76
+ max = {
77
+ label,
78
+ value: point.value.value,
79
+ point
80
+ };
81
+ }
82
+ }
83
+ }
84
+ if (!min || !max) {
85
+ return '';
86
+ }
87
+ const maxText = formatValue({
88
+ kind: 'known',
89
+ value: max.value
90
+ });
91
+ // One figure only when the highest and the lowest are the same point.
92
+ if (min.point === max.point) {
93
+ return (0, _rnCore.formatMessage)(strings['chart.summary.single'], {
94
+ value: maxText
95
+ });
96
+ }
97
+ return (0, _rnCore.formatMessage)(strings['chart.summary.extremes'], {
98
+ maxLabel: max.label(),
99
+ max: maxText,
100
+ minLabel: min.label(),
101
+ min: formatValue({
102
+ kind: 'known',
103
+ value: min.value
104
+ })
105
+ });
106
+ }
107
+ function describeMarkers(markers, formatValue, strings) {
108
+ if (!markers || markers.length === 0) {
109
+ return '';
110
+ }
111
+ const parts = [];
112
+ for (const marker of markers) {
113
+ if (!(0, _value.isKnown)(marker.value)) {
114
+ continue;
115
+ }
116
+ const name = marker.label ?? marker.kind;
117
+ parts.push((0, _rnCore.formatMessage)(strings['chart.summary.marker'], {
118
+ name,
119
+ value: formatValue(marker.value)
120
+ }));
121
+ }
122
+ return parts.length > 0 ? `${parts.join('. ')}.` : '';
123
+ }
124
+
125
+ /**
126
+ * Builds the label read aloud for the chart as a whole.
127
+ *
128
+ * Non-ready statuses replace the data description rather than appending to it,
129
+ * so a loading chart never announces figures it is not showing.
130
+ */
131
+ function buildChartSummary(input) {
132
+ const strings = input.strings ?? _strings.chartStrings.defaults;
133
+ const noun = strings[FAMILY_NOUN[input.family]];
134
+ const heading = input.title ? (0, _rnCore.formatMessage)(strings['chart.summary.heading'], {
135
+ title: input.title,
136
+ noun
137
+ }) : (0, _rnCore.formatMessage)(strings['chart.summary.headingUntitled'], {
138
+ noun
139
+ });
140
+ const statusKey = STATUS_PHRASE[input.status];
141
+ const statusPhrase = statusKey ? strings[statusKey] : undefined;
142
+ if (input.status !== 'ready' && input.status !== 'partial' && input.status !== 'stale') {
143
+ return `${heading} ${statusPhrase ?? ''}`.trim();
144
+ }
145
+ const seriesCount = input.datasource.series.length;
146
+ const pointCount = input.datasource.series.reduce((acc, s) => acc + s.points.length, 0);
147
+ const scale = seriesCount > 1 ? (0, _rnCore.formatMessage)(strings['chart.summary.scale'], {
148
+ series: seriesCount,
149
+ points: pointCount
150
+ }) : (0, _rnCore.formatMessage)(strings['chart.summary.scaleSingle'], {
151
+ points: pointCount
152
+ });
153
+ const parts = [heading, statusPhrase, scale, describeExtremes(input.datasource, input.formatValue, strings, input.formatPosition ?? _format.formatPositionDefault), describeMarkers(input.datasource.markers, input.formatValue, strings), input.incomplete ? strings['chart.summary.incomplete'] : ''];
154
+ return parts.filter(Boolean).join(' ').replace(/\s+/g, ' ').trim();
155
+ }
156
+
157
+ /** Announced for the currently selected point on an adjustable chart. */
158
+ function buildPointAnnouncement(seriesLabel, positionLabel, value, formatValue, strings = _strings.chartStrings.defaults) {
159
+ const vars = {
160
+ position: positionLabel,
161
+ series: seriesLabel
162
+ };
163
+ if (value.kind === 'withheld') {
164
+ return (0, _rnCore.formatMessage)(strings['chart.point.withheld'], vars);
165
+ }
166
+ if (!(0, _value.isKnown)(value)) {
167
+ return (0, _rnCore.formatMessage)(strings['chart.point.noData'], vars);
168
+ }
169
+ return (0, _rnCore.formatMessage)(strings['chart.point.value'], {
170
+ ...vars,
171
+ value: formatValue(value)
172
+ });
173
+ }
174
+
175
+ /** Total plus an explicit note when it is not the whole picture (FR-013). */
176
+ function buildTotalAnnouncement(datasource, formatValue, strings = _strings.chartStrings.defaults) {
177
+ const values = datasource.series.flatMap(s => s.points.map(p => p.value));
178
+ const total = (0, _value.sumKnown)(values);
179
+ const value = formatValue({
180
+ kind: 'known',
181
+ value: total.total
182
+ });
183
+ return total.incomplete ? (0, _rnCore.formatMessage)(strings['chart.total.incomplete'], {
184
+ value,
185
+ count: total.excludedPoints
186
+ }) : (0, _rnCore.formatMessage)(strings['chart.total'], {
187
+ value
188
+ });
189
+ }
190
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_format","require","_rnCore","_strings","_value","FAMILY_NOUN","progress","distribution","timeSeries","bar","heatmap","STATUS_PHRASE","loading","empty","error","stale","noPermission","partial","ready","undefined","describeExtremes","datasource","formatValue","strings","formatPosition","min","max","several","series","length","point","points","isKnown","value","label","position","kind","category","row","column","at","maxText","formatMessage","maxLabel","minLabel","describeMarkers","markers","parts","marker","name","push","join","buildChartSummary","input","chartStrings","defaults","noun","family","heading","title","statusKey","status","statusPhrase","trim","seriesCount","pointCount","reduce","acc","s","scale","formatPositionDefault","incomplete","filter","Boolean","replace","buildPointAnnouncement","seriesLabel","positionLabel","vars","buildTotalAnnouncement","values","flatMap","map","p","total","sumKnown","count","excludedPoints"],"sourceRoot":"../../../src","sources":["a11y/summary.ts"],"mappings":";;;;;;;;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AG,IAAAC,eAAQ,EAACL,MAAM,CAAC;EAC9B,MAAM/C,KAAK,GAAGX,WAAW,CAAC;IAAEc,IAAI,EAAE,OAAO;IAAEH,KAAK,EAAEmD,KAAK,CAACA;EAAM,CAAC,CAAC;EAChE,OAAOA,KAAK,CAACb,UAAU,GACpB,IAAA7B,qBAAa,EAACnB,OAAO,CAAC,wBAAwB,CAAC,EAAE;IAAEU,KAAK;IAAEqD,KAAK,EAAEF,KAAK,CAACG;EAAe,CAAC,CAAC,GACxF,IAAA7C,qBAAa,EAACnB,OAAO,CAAC,aAAa,CAAC,EAAE;IAAEU;EAAM,CAAC,CAAC;AACpD","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FAMILY_POSITION_KINDS = void 0;
7
+ exports.familyAcceptsPositionKind = familyAcceptsPositionKind;
8
+ exports.resolveFormat = resolveFormat;
9
+ exports.resolveUnit = resolveUnit;
10
+ /**
11
+ * The shared datasource contract (FR-007, FR-007a).
12
+ *
13
+ * One contract spans every chart family: each point carries the same envelope —
14
+ * identity, value state, optional unit and format hint, opaque metadata — and
15
+ * only its **position** varies by kind. Families that accept the same position
16
+ * kind consume one another's datasources unchanged; anything else is a
17
+ * validation error rather than a rendering guess.
18
+ *
19
+ * See specs/007-rn-chart-package/data-model.md §2–§6.
20
+ */
21
+
22
+ /** A named bucket: a category axis, a distribution segment, a progress metric. */
23
+
24
+ /**
25
+ * An absolute instant as epoch milliseconds, UTC.
26
+ *
27
+ * A number rather than a `Date` or an ISO string: cheap to compare and
28
+ * memoize, no per-render parsing across hundreds of points, no identity churn
29
+ * that would defeat the re-render guarantee, and no ambiguous offset. All
30
+ * date wording comes from app formatters (FR-016).
31
+ */
32
+
33
+ /** A cell in a row-by-column matrix, for heatmaps. */
34
+
35
+ /** Non-colour encoding for a series, so meaning never rides on hue alone (FR-064). */
36
+
37
+ /**
38
+ * Which position kinds each family accepts.
39
+ *
40
+ * Bar accepting both `category` and `instant` is what makes swapping a
41
+ * time-series chart for a bar chart free — the datasource does not change.
42
+ */
43
+ const FAMILY_POSITION_KINDS = exports.FAMILY_POSITION_KINDS = {
44
+ progress: ['category'],
45
+ distribution: ['category'],
46
+ bar: ['category', 'instant'],
47
+ timeSeries: ['instant'],
48
+ heatmap: ['matrix']
49
+ };
50
+ function familyAcceptsPositionKind(family, kind) {
51
+ return FAMILY_POSITION_KINDS[family].includes(kind);
52
+ }
53
+
54
+ /**
55
+ * Resolves unit and format through the documented precedence:
56
+ * point -> series -> datasource -> undefined (caller falls back to its default).
57
+ */
58
+ function resolveFormat(point, series, datasource) {
59
+ return point?.format ?? series?.format ?? datasource.format;
60
+ }
61
+ function resolveUnit(point, series, datasource) {
62
+ return point?.unit ?? series?.unit ?? datasource.unit;
63
+ }
64
+ //# sourceMappingURL=datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FAMILY_POSITION_KINDS","exports","progress","distribution","bar","timeSeries","heatmap","familyAcceptsPositionKind","family","kind","includes","resolveFormat","point","series","datasource","format","resolveUnit","unit"],"sourceRoot":"../../../src","sources":["contract/datasource.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;;AAUA;;AA2CA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,qBAA6E,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAC5FE,QAAQ,EAAE,CAAC,UAAU,CAAC;EACtBC,YAAY,EAAE,CAAC,UAAU,CAAC;EAC1BC,GAAG,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;EAC5BC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,OAAO,EAAE,CAAC,QAAQ;AACnB,CAAC;AAEM,SAASC,yBAAyBA,CAACC,MAAmB,EAAEC,IAAkB,EAAW;EAC3F,OAAOT,qBAAqB,CAACQ,MAAM,CAAC,CAACE,QAAQ,CAACD,IAAI,CAAC;AACpD;;AAEA;AACA;AACA;AACA;AACO,SAASE,aAAaA,CAC5BC,KAA+B,EAC/BC,MAA6B,EAC7BC,UAA8B,EACL;EACzB,OAAOF,KAAK,EAAEG,MAAM,IAAIF,MAAM,EAAEE,MAAM,IAAID,UAAU,CAACC,MAAM;AAC5D;AAEO,SAASC,WAAWA,CAC1BJ,KAA+B,EAC/BC,MAA6B,EAC7BC,UAA8B,EACT;EACrB,OAAOF,KAAK,EAAEK,IAAI,IAAIJ,MAAM,EAAEI,IAAI,IAAIH,UAAU,CAACG,IAAI;AACtD","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DISTRIBUTION_SUM_TOLERANCE = void 0;
7
+ exports.resolveDistributionValues = resolveDistributionValues;
8
+ var _value = require("./value.js");
9
+ /**
10
+ * What the numbers of a distribution mean (CHT-10).
11
+ *
12
+ * `proportions`: each value is already a share of the whole, in 0..1. A sum
13
+ * short of 1 is drawn short and reported incomplete. `absolute`: counts or
14
+ * amounts, normalised by their own total.
15
+ *
16
+ * Until 0.4.0 this was guessed from the values alone: anything in 0..1 was a
17
+ * proportion, so two segments counting 1 each drew two full circles on top of
18
+ * one another. The guess now also requires the shares to fit in one whole, and
19
+ * an app that knows can say so.
20
+ */
21
+
22
+ const DISTRIBUTION_SUM_TOLERANCE = exports.DISTRIBUTION_SUM_TOLERANCE = 0.001;
23
+ function resolveDistributionValues(datasource, declared) {
24
+ if (declared !== undefined) {
25
+ return declared;
26
+ }
27
+ if (datasource.format?.kind === 'percent') {
28
+ return 'proportions';
29
+ }
30
+ let sum = 0;
31
+ for (const series of datasource.series) {
32
+ for (const point of series.points) {
33
+ if (!(0, _value.isKnown)(point.value)) {
34
+ continue;
35
+ }
36
+ const value = point.value.value;
37
+ if (value < 0 || value > 1) {
38
+ return 'absolute';
39
+ }
40
+ sum += value;
41
+ }
42
+ }
43
+ return sum <= 1 + DISTRIBUTION_SUM_TOLERANCE ? 'proportions' : 'absolute';
44
+ }
45
+ //# sourceMappingURL=distribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_value","require","DISTRIBUTION_SUM_TOLERANCE","exports","resolveDistributionValues","datasource","declared","undefined","format","kind","sum","series","point","points","isKnown","value"],"sourceRoot":"../../../src","sources":["contract/distribution.ts"],"mappings":";;;;;;;AAaA,IAAAA,MAAA,GAAAC,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAMC,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,KAAK;AAExC,SAASE,yBAAyBA,CACxCC,UAA8B,EAC9BC,QAA6B,EACR;EACrB,IAAIA,QAAQ,KAAKC,SAAS,EAAE;IAC3B,OAAOD,QAAQ;EAChB;EACA,IAAID,UAAU,CAACG,MAAM,EAAEC,IAAI,KAAK,SAAS,EAAE;IAC1C,OAAO,aAAa;EACrB;EACA,IAAIC,GAAG,GAAG,CAAC;EACX,KAAK,MAAMC,MAAM,IAAIN,UAAU,CAACM,MAAM,EAAE;IACvC,KAAK,MAAMC,KAAK,IAAID,MAAM,CAACE,MAAM,EAAE;MAClC,IAAI,CAAC,IAAAC,cAAO,EAACF,KAAK,CAACG,KAAK,CAAC,EAAE;QAC1B;MACD;MACA,MAAMA,KAAK,GAAGH,KAAK,CAACG,KAAK,CAACA,KAAK;MAC/B,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;QAC3B,OAAO,UAAU;MAClB;MACAL,GAAG,IAAIK,KAAK;IACb;EACD;EACA,OAAOL,GAAG,IAAI,CAAC,GAAGR,0BAA0B,GAAG,aAAa,GAAG,UAAU;AAC1E","ignoreList":[]}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.chartError = chartError;
7
+ exports.failureSignature = failureSignature;
8
+ exports.isChartError = isChartError;
9
+ exports.toFailureReport = toFailureReport;
10
+ exports.validationError = validationError;
11
+ /**
12
+ * Typed error taxonomy and failure reporting (FR-038, FR-038a, FR-038b).
13
+ *
14
+ * Messages come from a **fixed catalogue with no interpolated data**. That is
15
+ * what makes the redaction guarantee structural rather than a rule someone has
16
+ * to remember: because the package never builds a message out of a value or a
17
+ * label, a failure report cannot carry patient data or account balances into a
18
+ * consuming app's crash reporting.
19
+ */
20
+
21
+ /**
22
+ * Fixed message catalogue. Every entry is a constant string — no template
23
+ * holes, so no data can leak through a message.
24
+ */
25
+ const MESSAGES = {
26
+ duplicateSeriesId: 'Datasource contains duplicate series identifiers. Series ids must be unique.',
27
+ duplicatePointId: 'A series contains duplicate point identifiers. Point ids must be unique within their series.',
28
+ positionKindMismatch: 'A data point position kind does not match the datasource positionKind.',
29
+ familyPositionKindUnsupported: 'This chart family does not accept the datasource position kind.',
30
+ inconsistentMatrix: 'Matrix datasource rows and columns are inconsistent across points.',
31
+ distributionNotWhole: 'Distribution segments do not sum to the whole. The chart marks the total incomplete rather than rescaling.',
32
+ nonFiniteValue: 'A known value or an instant is not a finite number. Use an unknown value for missing data.',
33
+ negativeDistributionValue: 'A distribution segment has a negative value. A share of a whole cannot be negative.',
34
+ declaredByApp: 'The application declared this chart to be in an error state.',
35
+ renderException: 'The chart failed while rendering and was contained. See the report for details.'
36
+ };
37
+ function chartError(category, code, extra) {
38
+ return {
39
+ category,
40
+ code,
41
+ message: MESSAGES[code],
42
+ ...extra
43
+ };
44
+ }
45
+ function validationError(code, extra) {
46
+ return chartError('validation', code, extra);
47
+ }
48
+ function isChartError(e) {
49
+ if (typeof e !== 'object' || e === null) {
50
+ return false;
51
+ }
52
+ const candidate = e;
53
+ return typeof candidate.code === 'string' && typeof candidate.message === 'string' && (candidate.category === 'validation' || candidate.category === 'declared' || candidate.category === 'render');
54
+ }
55
+
56
+ /**
57
+ * Builds the report handed to the app after a contained render exception.
58
+ *
59
+ * A `ChartError` thrown by the package keeps its catalogue message. Anything
60
+ * else — a defect in the rendering library, say — is reported under the generic
61
+ * `renderException` message. We do **not** copy a third-party exception's own
62
+ * message into the report, because we cannot promise it is free of data.
63
+ */
64
+ function toFailureReport(family, thrown, chartId, componentStack) {
65
+ const error = isChartError(thrown) ? {
66
+ ...thrown,
67
+ chartId,
68
+ family
69
+ } : chartError('render', 'renderException', {
70
+ chartId,
71
+ family
72
+ });
73
+ return {
74
+ chartId,
75
+ family,
76
+ error,
77
+ componentStack
78
+ };
79
+ }
80
+
81
+ /**
82
+ * Stable identity for a failure, used to de-duplicate reports so an unrelated
83
+ * parent re-render does not re-report the same problem.
84
+ */
85
+ function failureSignature(report) {
86
+ return `${report.chartId ?? 'anon'}:${report.family}:${report.error.code}`;
87
+ }
88
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MESSAGES","duplicateSeriesId","duplicatePointId","positionKindMismatch","familyPositionKindUnsupported","inconsistentMatrix","distributionNotWhole","nonFiniteValue","negativeDistributionValue","declaredByApp","renderException","chartError","category","code","extra","message","validationError","isChartError","e","candidate","toFailureReport","family","thrown","chartId","componentStack","error","failureSignature","report"],"sourceRoot":"../../../src","sources":["contract/errors.ts"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA,MAAMA,QAAkD,GAAG;EAC1DC,iBAAiB,EAAE,8EAA8E;EACjGC,gBAAgB,EACf,8FAA8F;EAC/FC,oBAAoB,EAAE,wEAAwE;EAC9FC,6BAA6B,EAAE,iEAAiE;EAChGC,kBAAkB,EAAE,oEAAoE;EACxFC,oBAAoB,EACnB,4GAA4G;EAC7GC,cAAc,EACb,4FAA4F;EAC7FC,yBAAyB,EACxB,qFAAqF;EACtFC,aAAa,EAAE,8DAA8D;EAC7EC,eAAe,EACd;AACF,CAAC;AA4BM,SAAS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