@chipmobilesdk/rn-chart 0.4.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 (343) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +1 -1
  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
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Composed accessible summaries (FR-067, FR-068, FR-069, FR-072).
5
+ *
6
+ * Exposing 2,500 individual points to a screen reader would be unusable even
7
+ * if it were cheap. A composed summary covers the same need: what the chart is,
8
+ * what it shows, where the extremes are, and what any target says.
9
+ *
10
+ * Withheld values never enter a summary — that would leak exactly what the
11
+ * withheld class exists to protect (FR-033).
12
+ */
13
+
14
+ import { formatPositionDefault } from "../contract/format.js";
15
+ import { formatMessage } from '@chipmobilesdk/rn-core';
16
+ import { chartStrings } from "../contract/strings.js";
17
+ import { isKnown, sumKnown } from "../contract/value.js";
18
+ const FAMILY_NOUN = {
19
+ progress: 'chart.family.progress',
20
+ distribution: 'chart.family.distribution',
21
+ timeSeries: 'chart.family.timeSeries',
22
+ bar: 'chart.family.bar',
23
+ heatmap: 'chart.family.heatmap'
24
+ };
25
+
26
+ /**
27
+ * What a screen reader hears when the chart is not showing data. Announcing
28
+ * the state beats silence, and beats announcing a stale value as if current.
29
+ */
30
+ const STATUS_PHRASE = {
31
+ loading: 'chart.status.loading',
32
+ empty: 'chart.status.empty',
33
+ error: 'chart.status.error',
34
+ stale: 'chart.status.stale',
35
+ noPermission: 'chart.status.noPermission',
36
+ partial: 'chart.status.partial',
37
+ ready: undefined
38
+ };
39
+ function describeExtremes(datasource, formatValue, strings, formatPosition) {
40
+ let min;
41
+ let max;
42
+ const several = datasource.series.length > 1;
43
+ for (const series of datasource.series) {
44
+ for (const point of series.points) {
45
+ // Withheld and unknown values are skipped entirely.
46
+ if (!isKnown(point.value)) {
47
+ continue;
48
+ }
49
+ // Named by where the point is. A time series used to name both
50
+ // extremes after the series, so a one-series chart reported a single
51
+ // value and lost its lowest (CHT-07). Built lazily: only two are read.
52
+ const label = () => {
53
+ if (point.position.kind === 'category') {
54
+ return point.position.category;
55
+ }
56
+ if (point.position.kind === 'matrix') {
57
+ return `${point.position.row} ${point.position.column}`;
58
+ }
59
+ const at = formatPosition(point.position);
60
+ return several ? `${series.label} ${at}` : at;
61
+ };
62
+ if (!min || point.value.value < min.value) {
63
+ min = {
64
+ label,
65
+ value: point.value.value,
66
+ point
67
+ };
68
+ }
69
+ if (!max || point.value.value > max.value) {
70
+ max = {
71
+ label,
72
+ value: point.value.value,
73
+ point
74
+ };
75
+ }
76
+ }
77
+ }
78
+ if (!min || !max) {
79
+ return '';
80
+ }
81
+ const maxText = formatValue({
82
+ kind: 'known',
83
+ value: max.value
84
+ });
85
+ // One figure only when the highest and the lowest are the same point.
86
+ if (min.point === max.point) {
87
+ return formatMessage(strings['chart.summary.single'], {
88
+ value: maxText
89
+ });
90
+ }
91
+ return formatMessage(strings['chart.summary.extremes'], {
92
+ maxLabel: max.label(),
93
+ max: maxText,
94
+ minLabel: min.label(),
95
+ min: formatValue({
96
+ kind: 'known',
97
+ value: min.value
98
+ })
99
+ });
100
+ }
101
+ function describeMarkers(markers, formatValue, strings) {
102
+ if (!markers || markers.length === 0) {
103
+ return '';
104
+ }
105
+ const parts = [];
106
+ for (const marker of markers) {
107
+ if (!isKnown(marker.value)) {
108
+ continue;
109
+ }
110
+ const name = marker.label ?? marker.kind;
111
+ parts.push(formatMessage(strings['chart.summary.marker'], {
112
+ name,
113
+ value: formatValue(marker.value)
114
+ }));
115
+ }
116
+ return parts.length > 0 ? `${parts.join('. ')}.` : '';
117
+ }
118
+
119
+ /**
120
+ * Builds the label read aloud for the chart as a whole.
121
+ *
122
+ * Non-ready statuses replace the data description rather than appending to it,
123
+ * so a loading chart never announces figures it is not showing.
124
+ */
125
+ export function buildChartSummary(input) {
126
+ const strings = input.strings ?? chartStrings.defaults;
127
+ const noun = strings[FAMILY_NOUN[input.family]];
128
+ const heading = input.title ? formatMessage(strings['chart.summary.heading'], {
129
+ title: input.title,
130
+ noun
131
+ }) : formatMessage(strings['chart.summary.headingUntitled'], {
132
+ noun
133
+ });
134
+ const statusKey = STATUS_PHRASE[input.status];
135
+ const statusPhrase = statusKey ? strings[statusKey] : undefined;
136
+ if (input.status !== 'ready' && input.status !== 'partial' && input.status !== 'stale') {
137
+ return `${heading} ${statusPhrase ?? ''}`.trim();
138
+ }
139
+ const seriesCount = input.datasource.series.length;
140
+ const pointCount = input.datasource.series.reduce((acc, s) => acc + s.points.length, 0);
141
+ const scale = seriesCount > 1 ? formatMessage(strings['chart.summary.scale'], {
142
+ series: seriesCount,
143
+ points: pointCount
144
+ }) : formatMessage(strings['chart.summary.scaleSingle'], {
145
+ points: pointCount
146
+ });
147
+ const parts = [heading, statusPhrase, scale, describeExtremes(input.datasource, input.formatValue, strings, input.formatPosition ?? formatPositionDefault), describeMarkers(input.datasource.markers, input.formatValue, strings), input.incomplete ? strings['chart.summary.incomplete'] : ''];
148
+ return parts.filter(Boolean).join(' ').replace(/\s+/g, ' ').trim();
149
+ }
150
+
151
+ /** Announced for the currently selected point on an adjustable chart. */
152
+ export function buildPointAnnouncement(seriesLabel, positionLabel, value, formatValue, strings = chartStrings.defaults) {
153
+ const vars = {
154
+ position: positionLabel,
155
+ series: seriesLabel
156
+ };
157
+ if (value.kind === 'withheld') {
158
+ return formatMessage(strings['chart.point.withheld'], vars);
159
+ }
160
+ if (!isKnown(value)) {
161
+ return formatMessage(strings['chart.point.noData'], vars);
162
+ }
163
+ return formatMessage(strings['chart.point.value'], {
164
+ ...vars,
165
+ value: formatValue(value)
166
+ });
167
+ }
168
+
169
+ /** Total plus an explicit note when it is not the whole picture (FR-013). */
170
+ export function buildTotalAnnouncement(datasource, formatValue, strings = chartStrings.defaults) {
171
+ const values = datasource.series.flatMap(s => s.points.map(p => p.value));
172
+ const total = sumKnown(values);
173
+ const value = formatValue({
174
+ kind: 'known',
175
+ value: total.total
176
+ });
177
+ return total.incomplete ? formatMessage(strings['chart.total.incomplete'], {
178
+ value,
179
+ count: total.excludedPoints
180
+ }) : formatMessage(strings['chart.total'], {
181
+ value
182
+ });
183
+ }
184
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatPositionDefault","formatMessage","chartStrings","isKnown","sumKnown","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","value","label","position","kind","category","row","column","at","maxText","maxLabel","minLabel","describeMarkers","markers","parts","marker","name","push","join","buildChartSummary","input","defaults","noun","family","heading","title","statusKey","status","statusPhrase","trim","seriesCount","pointCount","reduce","acc","s","scale","incomplete","filter","Boolean","replace","buildPointAnnouncement","seriesLabel","positionLabel","vars","buildTotalAnnouncement","values","flatMap","map","p","total","count","excludedPoints"],"sourceRoot":"../../../src","sources":["a11y/summary.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,QAAQ,uBAAoB;AAG1D,SAASC,aAAa,QAAQ,wBAAwB;AAEtD,SAASC,YAAY,QAA2B,wBAAqB;AACrE,SAASC,OAAO,EAAEC,QAAQ,QAAyB,sBAAmB;AAEtE,MAAMC,WAAoD,GAAG;EAC5DC,QAAQ,EAAE,uBAAuB;EACjCC,YAAY,EAAE,2BAA2B;EACzCC,UAAU,EAAE,yBAAyB;EACrCC,GAAG,EAAE,kBAAkB;EACvBC,OAAO,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAkE,GAAG;EAC1EC,OAAO,EAAE,sBAAsB;EAC/BC,KAAK,EAAE,oBAAoB;EAC3BC,K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xC,KAAK,CAACG,IAAI,KAAK,UAAU,EAAE;IAC9B,OAAOlC,aAAa,CAACsB,OAAO,CAAC,sBAAsB,CAAC,EAAEmD,IAAI,CAAC;EAC5D;EACA,IAAI,CAACvE,OAAO,CAAC6B,KAAK,CAAC,EAAE;IACpB,OAAO/B,aAAa,CAACsB,OAAO,CAAC,oBAAoB,CAAC,EAAEmD,IAAI,CAAC;EAC1D;EACA,OAAOzE,aAAa,CAACsB,OAAO,CAAC,mBAAmB,CAAC,EAAE;IAAE,GAAGmD,IAAI;IAAE1C,KAAK,EAAEV,WAAW,CAACU,KAAK;EAAE,CAAC,CAAC;AAC3F;;AAEA;AACA,OAAO,SAAS2C,sBAAsBA,CACrCtD,UAA8B,EAC9BC,WAAsC,EACtCC,OAAqB,GAAGrB,YAAY,CAACkD,QAAQ,EACpC;EACT,MAAMwB,MAAM,GAAGvD,UAAU,CAACO,MAAM,CAACiD,OAAO,CAACZ,CAAC,IAAIA,CAAC,CAAClC,MAAM,CAAC+C,GAAG,CAACC,CAAC,IAAIA,CAAC,CAAC/C,KAAK,CAAC,CAAC;EACzE,MAAMgD,KAAK,GAAG5E,QAAQ,CAACwE,MAAM,CAAC;EAC9B,MAAM5C,KAAK,GAAGV,WAAW,CAAC;IAAEa,IAAI,EAAE,OAAO;IAAEH,KAAK,EAAEgD,KAAK,CAACA;EAAM,CAAC,CAAC;EAChE,OAAOA,KAAK,CAACb,UAAU,GACpBlE,aAAa,CAACsB,OAAO,CAAC,wBAAwB,CAAC,EAAE;IAAES,KAAK;IAAEiD,KAAK,EAAED,KAAK,CAACE;EAAe,CAAC,CAAC,GACxFjF,aAAa,CAACsB,OAAO,CAAC,aAAa,CAAC,EAAE;IAAES;EAAM,CAAC,CAAC;AACpD","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The shared datasource contract (FR-007, FR-007a).
5
+ *
6
+ * One contract spans every chart family: each point carries the same envelope —
7
+ * identity, value state, optional unit and format hint, opaque metadata — and
8
+ * only its **position** varies by kind. Families that accept the same position
9
+ * kind consume one another's datasources unchanged; anything else is a
10
+ * validation error rather than a rendering guess.
11
+ *
12
+ * See specs/007-rn-chart-package/data-model.md §2–§6.
13
+ */
14
+
15
+ /** A named bucket: a category axis, a distribution segment, a progress metric. */
16
+
17
+ /**
18
+ * An absolute instant as epoch milliseconds, UTC.
19
+ *
20
+ * A number rather than a `Date` or an ISO string: cheap to compare and
21
+ * memoize, no per-render parsing across hundreds of points, no identity churn
22
+ * that would defeat the re-render guarantee, and no ambiguous offset. All
23
+ * date wording comes from app formatters (FR-016).
24
+ */
25
+
26
+ /** A cell in a row-by-column matrix, for heatmaps. */
27
+
28
+ /** Non-colour encoding for a series, so meaning never rides on hue alone (FR-064). */
29
+
30
+ /**
31
+ * Which position kinds each family accepts.
32
+ *
33
+ * Bar accepting both `category` and `instant` is what makes swapping a
34
+ * time-series chart for a bar chart free — the datasource does not change.
35
+ */
36
+ export const FAMILY_POSITION_KINDS = {
37
+ progress: ['category'],
38
+ distribution: ['category'],
39
+ bar: ['category', 'instant'],
40
+ timeSeries: ['instant'],
41
+ heatmap: ['matrix']
42
+ };
43
+ export function familyAcceptsPositionKind(family, kind) {
44
+ return FAMILY_POSITION_KINDS[family].includes(kind);
45
+ }
46
+
47
+ /**
48
+ * Resolves unit and format through the documented precedence:
49
+ * point -> series -> datasource -> undefined (caller falls back to its default).
50
+ */
51
+ export function resolveFormat(point, series, datasource) {
52
+ return point?.format ?? series?.format ?? datasource.format;
53
+ }
54
+ export function resolveUnit(point, series, datasource) {
55
+ return point?.unit ?? series?.unit ?? datasource.unit;
56
+ }
57
+ //# sourceMappingURL=datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FAMILY_POSITION_KINDS","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;AACA,OAAO,MAAMA,qBAA6E,GAAG;EAC5FC,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;AAED,OAAO,SAASC,yBAAyBA,CAACC,MAAmB,EAAEC,IAAkB,EAAW;EAC3F,OAAOR,qBAAqB,CAACO,MAAM,CAAC,CAACE,QAAQ,CAACD,IAAI,CAAC;AACpD;;AAEA;AACA;AACA;AACA;AACA,OAAO,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;AAEA,OAAO,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,40 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * What the numbers of a distribution mean (CHT-10).
5
+ *
6
+ * `proportions`: each value is already a share of the whole, in 0..1. A sum
7
+ * short of 1 is drawn short and reported incomplete. `absolute`: counts or
8
+ * amounts, normalised by their own total.
9
+ *
10
+ * Until 0.4.0 this was guessed from the values alone: anything in 0..1 was a
11
+ * proportion, so two segments counting 1 each drew two full circles on top of
12
+ * one another. The guess now also requires the shares to fit in one whole, and
13
+ * an app that knows can say so.
14
+ */
15
+
16
+ import { isKnown } from "./value.js";
17
+ export const DISTRIBUTION_SUM_TOLERANCE = 0.001;
18
+ export function resolveDistributionValues(datasource, declared) {
19
+ if (declared !== undefined) {
20
+ return declared;
21
+ }
22
+ if (datasource.format?.kind === 'percent') {
23
+ return 'proportions';
24
+ }
25
+ let sum = 0;
26
+ for (const series of datasource.series) {
27
+ for (const point of series.points) {
28
+ if (!isKnown(point.value)) {
29
+ continue;
30
+ }
31
+ const value = point.value.value;
32
+ if (value < 0 || value > 1) {
33
+ return 'absolute';
34
+ }
35
+ sum += value;
36
+ }
37
+ }
38
+ return sum <= 1 + DISTRIBUTION_SUM_TOLERANCE ? 'proportions' : 'absolute';
39
+ }
40
+ //# sourceMappingURL=distribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isKnown","DISTRIBUTION_SUM_TOLERANCE","resolveDistributionValues","datasource","declared","undefined","format","kind","sum","series","point","points","value"],"sourceRoot":"../../../src","sources":["contract/distribution.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,YAAS;AAIjC,OAAO,MAAMC,0BAA0B,GAAG,KAAK;AAE/C,OAAO,SAASC,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,CAACX,OAAO,CAACU,KAAK,CAACE,KAAK,CAAC,EAAE;QAC1B;MACD;MACA,MAAMA,KAAK,GAAGF,KAAK,CAACE,KAAK,CAACA,KAAK;MAC/B,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;QAC3B,OAAO,UAAU;MAClB;MACAJ,GAAG,IAAII,KAAK;IACb;EACD;EACA,OAAOJ,GAAG,IAAI,CAAC,GAAGP,0BAA0B,GAAG,aAAa,GAAG,UAAU;AAC1E","ignoreList":[]}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Typed error taxonomy and failure reporting (FR-038, FR-038a, FR-038b).
5
+ *
6
+ * Messages come from a **fixed catalogue with no interpolated data**. That is
7
+ * what makes the redaction guarantee structural rather than a rule someone has
8
+ * to remember: because the package never builds a message out of a value or a
9
+ * label, a failure report cannot carry patient data or account balances into a
10
+ * consuming app's crash reporting.
11
+ */
12
+
13
+ /**
14
+ * Fixed message catalogue. Every entry is a constant string — no template
15
+ * holes, so no data can leak through a message.
16
+ */
17
+ const MESSAGES = {
18
+ duplicateSeriesId: 'Datasource contains duplicate series identifiers. Series ids must be unique.',
19
+ duplicatePointId: 'A series contains duplicate point identifiers. Point ids must be unique within their series.',
20
+ positionKindMismatch: 'A data point position kind does not match the datasource positionKind.',
21
+ familyPositionKindUnsupported: 'This chart family does not accept the datasource position kind.',
22
+ inconsistentMatrix: 'Matrix datasource rows and columns are inconsistent across points.',
23
+ distributionNotWhole: 'Distribution segments do not sum to the whole. The chart marks the total incomplete rather than rescaling.',
24
+ nonFiniteValue: 'A known value or an instant is not a finite number. Use an unknown value for missing data.',
25
+ negativeDistributionValue: 'A distribution segment has a negative value. A share of a whole cannot be negative.',
26
+ declaredByApp: 'The application declared this chart to be in an error state.',
27
+ renderException: 'The chart failed while rendering and was contained. See the report for details.'
28
+ };
29
+ export function chartError(category, code, extra) {
30
+ return {
31
+ category,
32
+ code,
33
+ message: MESSAGES[code],
34
+ ...extra
35
+ };
36
+ }
37
+ export function validationError(code, extra) {
38
+ return chartError('validation', code, extra);
39
+ }
40
+ export function isChartError(e) {
41
+ if (typeof e !== 'object' || e === null) {
42
+ return false;
43
+ }
44
+ const candidate = e;
45
+ return typeof candidate.code === 'string' && typeof candidate.message === 'string' && (candidate.category === 'validation' || candidate.category === 'declared' || candidate.category === 'render');
46
+ }
47
+
48
+ /**
49
+ * Builds the report handed to the app after a contained render exception.
50
+ *
51
+ * A `ChartError` thrown by the package keeps its catalogue message. Anything
52
+ * else — a defect in the rendering library, say — is reported under the generic
53
+ * `renderException` message. We do **not** copy a third-party exception's own
54
+ * message into the report, because we cannot promise it is free of data.
55
+ */
56
+ export function toFailureReport(family, thrown, chartId, componentStack) {
57
+ const error = isChartError(thrown) ? {
58
+ ...thrown,
59
+ chartId,
60
+ family
61
+ } : chartError('render', 'renderException', {
62
+ chartId,
63
+ family
64
+ });
65
+ return {
66
+ chartId,
67
+ family,
68
+ error,
69
+ componentStack
70
+ };
71
+ }
72
+
73
+ /**
74
+ * Stable identity for a failure, used to de-duplicate reports so an unrelated
75
+ * parent re-render does not re-report the same problem.
76
+ */
77
+ export function failureSignature(report) {
78
+ return `${report.chartId ?? 'anon'}:${report.family}:${report.error.code}`;
79
+ }
80
+ //# 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;EAC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;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,gBAAgBA,CAACC,MAA0B,EAAU;EACpE,OAAO,GAAGA,MAAM,CAACJ,OAAO,IAAI,MAAM,IAAII,MAAM,CAACN,MAAM,IAAIM,MAAM,CAACF,KAAK,CAACZ,IAAI,EAAE;AAC3E","ignoreList":[]}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Formatting contract (FR-055 to FR-059).
5
+ *
6
+ * The package never invents or converts a business unit. It accepts a hint,
7
+ * applies a documented locale-neutral default, and uses app-supplied formatter
8
+ * output verbatim whenever one is given.
9
+ */
10
+ import { createDiagnosticChannel } from '@chipmobilesdk/rn-core';
11
+ import { isKnown } from "./value.js";
12
+
13
+ /** Chart diagnostics also reach the app's SDK sinks (`installSdkSink`, CORE-08). */
14
+ const channel = createDiagnosticChannel('rn-chart');
15
+ /**
16
+ * Placeholders for the three non-value classes. Deliberately not "0" and not
17
+ * an empty string, so a reader can tell a gap from a zero at a glance.
18
+ */
19
+ export const NON_VALUE_TEXT = {
20
+ unknown: '—',
21
+ notApplicable: 'n/a',
22
+ withheld: '••'
23
+ };
24
+ function trimTrailingZeros(text) {
25
+ return text.includes('.') ? text.replace(/\.?0+$/, '') : text;
26
+ }
27
+
28
+ /**
29
+ * Locale-neutral default formatting (FR-057).
30
+ *
31
+ * Deliberately plain: no thousands separators, no currency symbol lookup, no
32
+ * month names. Anything locale-dependent belongs to the consuming app, which
33
+ * owns an i18n system the package does not.
34
+ */
35
+ export function formatValueDefault(v, ctx = {
36
+ slot: 'value'
37
+ }) {
38
+ if (!isKnown(v)) {
39
+ return NON_VALUE_TEXT[v.kind] ?? NON_VALUE_TEXT.unknown;
40
+ }
41
+ const hint = ctx.hint;
42
+ const n = v.value;
43
+ switch (hint?.kind) {
44
+ case 'percent':
45
+ {
46
+ const decimals = hint.decimals ?? 0;
47
+ return `${(n * 100).toFixed(decimals)}%`;
48
+ }
49
+ case 'currency':
50
+ // Code rather than symbol: symbol placement is locale-dependent and
51
+ // therefore the app's decision.
52
+ return `${n.toFixed(2)} ${hint.currency}`;
53
+ case 'duration':
54
+ return `${trimTrailingZeros(n.toFixed(2))}${hint.unit}`;
55
+ case 'count':
56
+ return String(Math.round(n));
57
+ case 'custom':
58
+ return `${trimTrailingZeros(n.toFixed(2))} ${hint.unit}`;
59
+ case 'number':
60
+ return hint.decimals === undefined ? trimTrailingZeros(n.toFixed(2)) : n.toFixed(hint.decimals);
61
+ default:
62
+ return trimTrailingZeros(n.toFixed(2));
63
+ }
64
+ }
65
+ export function formatPositionDefault(p) {
66
+ switch (p.kind) {
67
+ case 'category':
68
+ return p.category;
69
+ case 'matrix':
70
+ return `${p.row} / ${p.column}`;
71
+ case 'instant':
72
+ // Epoch milliseconds as-is. Any human-readable date belongs to an app
73
+ // formatter, which alone knows the locale and the display timezone
74
+ // (FR-016).
75
+ return String(p.at);
76
+ }
77
+ }
78
+ export function formatLegendDefault(series) {
79
+ return series.label;
80
+ }
81
+
82
+ /**
83
+ * Runs an app formatter, falling back to the package default for that single
84
+ * label if it throws (FR-059). One bad formatter must not take down a screen.
85
+ *
86
+ * The dev-only warning is intentionally value-free: it names the slot, never
87
+ * the data.
88
+ */
89
+ export function safeFormat(run, fallback, slot, onceKey) {
90
+ try {
91
+ return run();
92
+ } catch (e) {
93
+ if (__DEV__) {
94
+ warnFormatterFailureOnce(slot, onceKey, e);
95
+ }
96
+ return fallback();
97
+ }
98
+ }
99
+ const warnedFormatters = new Set();
100
+ function warnFormatterFailureOnce(slot, onceKey, error) {
101
+ const key = `${slot}:${onceKey ?? 'default'}`;
102
+ if (warnedFormatters.has(key)) {
103
+ return;
104
+ }
105
+ warnedFormatters.add(key);
106
+ channel.emit('formatter_threw', 'warn', {
107
+ slot
108
+ });
109
+ const reason = error instanceof Error ? error.message : 'unknown error';
110
+ console.warn(`[rn-chart] A supplied "${slot}" formatter threw (${reason}). ` + 'Falling back to the built-in default for that label. ' + 'This warning appears once per formatter slot and never in production builds.');
111
+ }
112
+
113
+ /** Test-only reset so warning-once behaviour can be asserted repeatedly. */
114
+ export function __resetFormatterWarnings() {
115
+ warnedFormatters.clear();
116
+ }
117
+ export function seriesRef(series) {
118
+ return {
119
+ id: series.id,
120
+ label: series.label
121
+ };
122
+ }
123
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDiagnosticChannel","isKnown","channel","NON_VALUE_TEXT","unknown","notApplicable","withheld","trimTrailingZeros","text","includes","replace","formatValueDefault","v","ctx","slot","kind","hint","n","value","decimals","toFixed","currency","unit","String","Math","round","undefined","formatPositionDefault","p","category","row","column","at","formatLegendDefault","series","label","safeFormat","run","fallback","onceKey","e","__DEV__","warnFormatterFailureOnce","warnedFormatters","Set","error","key","has","add","emit","reason","Error","message","console","warn","__resetFormatterWarnings","clear","seriesRef","id"],"sourceRoot":"../../../src","sources":["contract/format.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuB,QAAQ,wBAAwB;AAGhE,SAASC,OAAO,QAAyB,YAAS;;AAElD;AACA,MAAMC,OAAO,GAAGF,uBAAuB,CAAoB,UAAU,CAAC;AAgCtE;AACA;AACA;AACA;AACA,OAAO,MAAMG,cAAgD,GAAG;EAC/DC,OAAO,EAAE,GAAG;EACZC,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAE;AACX,CAAC;AAED,SAASC,iBAAiBA,CAACC,IAAY,EAAU;EAChD,OAAOA,IAAI,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,IAAI,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAGF,IAAI;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,kBAAkBA,CAACC,CAAa,EAAEC,GAAkB,GAAG;EAAEC,IAAI,EAAE;AAAQ,CAAC,EAAU;EACjG,IAAI,CAACb,OAAO,CAACW,CAAC,CAAC,EAAE;IAChB,OAAOT,c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,gBAAgB,CAACa,KAAK,CAAC,CAAC;AACzB;AAEA,OAAO,SAASC,SAASA,CAAIvB,MAAiB,EAAa;EAC1D,OAAO;IAAEwB,EAAE,EAAExB,MAAM,CAACwB,EAAE;IAAEvB,KAAK,EAAED,MAAM,CAACC;EAAM,CAAC;AAC9C","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Interaction contract (FR-048 to FR-054a).
5
+ *
6
+ * The package reports what the user touched and does nothing else: no
7
+ * navigation, no fetching, no datasource mutation, no business rules.
8
+ *
9
+ * Selection is **uncontrolled by default and controlled when the app supplies a
10
+ * value** — the standard React pattern. The same callbacks fire either way, so
11
+ * a consumer can move between the two without rewriting handlers.
12
+ */
13
+
14
+ export function sameSelection(a, b) {
15
+ if (!a || !b) {
16
+ return !a && !b;
17
+ }
18
+ return a.seriesId === b.seriesId && a.pointId === b.pointId;
19
+ }
20
+ //# sourceMappingURL=interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sameSelection","a","b","seriesId","pointId"],"sourceRoot":"../../../src","sources":["contract/interaction.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoDA,OAAO,SAASA,aAAaA,CAC5BC,CAAkC,EAClCC,CAAkC,EACxB;EACV,IAAI,CAACD,CAAC,IAAI,CAACC,CAAC,EAAE;IACb,OAAO,CAACD,CAAC,IAAI,CAACC,CAAC;EAChB;EACA,OAAOD,CAAC,CAACE,QAAQ,KAAKD,CAAC,CAACC,QAAQ,IAAIF,CAAC,CAACG,OAAO,KAAKF,CAAC,CAACE,OAAO;AAC5D","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Reference markers: targets, baselines, and thresholds (FR-008, FR-021, FR-022).
5
+ *
6
+ * The important rule lives here: a marker whose value is not `known`, or whose
7
+ * target is zero or negative, produces **no completion proportion**. A chart
8
+ * shows the current value alone rather than inventing a percentage.
9
+ */
10
+
11
+ import { isKnown } from "./value.js";
12
+ /**
13
+ * A target only supports a proportion when it is known and strictly positive.
14
+ * Zero and negative targets make "percent complete" meaningless, so we decline
15
+ * to compute one rather than divide and produce a nonsense figure.
16
+ */
17
+ export function isUsableTarget(marker) {
18
+ if (!marker || marker.kind !== 'target') {
19
+ return false;
20
+ }
21
+ return isKnown(marker.value) && marker.value.value > 0;
22
+ }
23
+ export function readProgress(current, target) {
24
+ if (!isKnown(current) || !isUsableTarget(target) || !target) {
25
+ return {
26
+ current,
27
+ target,
28
+ proportion: undefined,
29
+ overshoot: false
30
+ };
31
+ }
32
+
33
+ // isUsableTarget already proved the target is known and positive.
34
+ const targetValue = target.value.value;
35
+ const proportion = current.value / targetValue;
36
+ return {
37
+ current,
38
+ target,
39
+ proportion,
40
+ overshoot: proportion > 1
41
+ };
42
+ }
43
+ export function findTarget(markers, id) {
44
+ if (!markers) {
45
+ return undefined;
46
+ }
47
+ return markers.find(m => m.kind === 'target' && (!id || m.id === id));
48
+ }
49
+ //# sourceMappingURL=marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isKnown","isUsableTarget","marker","kind","value","readProgress","current","target","proportion","undefined","overshoot","targetValue","findTarget","markers","id","find","m"],"sourceRoot":"../../../src","sources":["contract/marker.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAyB,YAAS;AAYlD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,MAAmC,EAAW;EAC5E,IAAI,CAACA,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAK,QAAQ,EAAE;IACxC,OAAO,KAAK;EACb;EACA,OAAOH,OAAO,CAACE,MAAM,CAACE,KAAK,CAAC,IAAIF,MAAM,CAACE,KAAK,CAACA,KAAK,GAAG,CAAC;AACvD;AAgBA,OAAO,SAASC,YAAYA,CAC3BC,OAAmB,EACnBC,MAAmC,EACjB;EAClB,IAAI,CAACP,OAAO,CAACM,OAAO,CAAC,IAAI,CAACL,cAAc,CAACM,MAAM,CAAC,IAAI,CAACA,MAAM,EAAE;IAC5D,OAAO;MAAED,OAAO;MAAEC,MAAM;MAAEC,UAAU,EAAEC,SAAS;MAAEC,SAAS,EAAE;IAAM,CAAC;EACpE;;EAEA;EACA,MAAMC,WAAW,GAAIJ,MAAM,CAACH,KAAK,CAAuBA,KAAK;EAC7D,MAAMI,UAAU,GAAGF,OAAO,CAACF,KAAK,GAAGO,WAAW;EAE9C,OAAO;IACNL,OAAO;IACPC,MAAM;IACNC,UAAU;IACVE,SAAS,EAAEF,UAAU,GAAG;EACzB,CAAC;AACF;AAEA,OAAO,SAASI,UAAUA,CACzBC,OAA+C,EAC/CC,EAAW,EACmB;EAC9B,IAAI,CAACD,OAAO,EAAE;IACb,OAAOJ,SAAS;EACjB;EACA,OAAOI,OAAO,CAACE,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACb,IAAI,KAAK,QAAQ,KAAK,CAACW,EAAE,IAAIE,CAAC,CAACF,EAAE,KAAKA,EAAE,CAAC,CAAC;AACtE","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["contract/props.ts"],"mappings":"","ignoreList":[]}