@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
+ * Datasource validation (FR-015, FR-017, FR-007a).
5
+ *
6
+ * Rules V1-V8 from specs/007-rn-chart-package/data-model.md §6. Every failure
7
+ * returns a `ChartError` built from the fixed message catalogue, so validation
8
+ * output can never carry a data value or a series label.
9
+ *
10
+ * Note V8: an empty datasource is **not** an error. It resolves to the empty
11
+ * state, which is a first-class outcome rather than a failure.
12
+ */
13
+ import { familyAcceptsPositionKind } from "../contract/datasource.js";
14
+ import { DISTRIBUTION_SUM_TOLERANCE, resolveDistributionValues } from "../contract/distribution.js";
15
+ import { validationError } from "../contract/errors.js";
16
+ import { isKnown } from "../contract/value.js";
17
+ export function validateDatasource(datasource, family, chartId, /** What a distribution's values mean, when the app says; inferred otherwise. */
18
+ distributionValues) {
19
+ const base = {
20
+ isEmpty: true,
21
+ isPartial: false,
22
+ totalIncomplete: false
23
+ };
24
+
25
+ // V4 — the receiving family must accept the declared position kind. Checked
26
+ // first because a mismatch here makes everything downstream meaningless.
27
+ if (!familyAcceptsPositionKind(family, datasource.positionKind)) {
28
+ return {
29
+ ...base,
30
+ isEmpty: false,
31
+ error: validationError('familyPositionKindUnsupported', {
32
+ chartId,
33
+ family,
34
+ detail: {
35
+ actualKind: datasource.positionKind
36
+ }
37
+ })
38
+ };
39
+ }
40
+
41
+ // V1 — series ids unique.
42
+ const seenSeriesIds = new Set();
43
+ for (const series of datasource.series) {
44
+ if (seenSeriesIds.has(series.id)) {
45
+ return {
46
+ ...base,
47
+ isEmpty: false,
48
+ error: validationError('duplicateSeriesId', {
49
+ chartId,
50
+ family,
51
+ detail: {
52
+ occurrences: seenSeriesIds.size
53
+ }
54
+ })
55
+ };
56
+ }
57
+ seenSeriesIds.add(series.id);
58
+ }
59
+ let totalPoints = 0;
60
+ let knownPoints = 0;
61
+ const matrixRows = new Set();
62
+ const matrixColumns = new Set();
63
+ for (const series of datasource.series) {
64
+ // V2 — point ids unique within their series.
65
+ const seenPointIds = new Set();
66
+ for (const point of series.points) {
67
+ if (seenPointIds.has(point.id)) {
68
+ return {
69
+ ...base,
70
+ isEmpty: false,
71
+ error: validationError('duplicatePointId', {
72
+ chartId,
73
+ family,
74
+ detail: {
75
+ occurrences: seenPointIds.size
76
+ }
77
+ })
78
+ };
79
+ }
80
+ seenPointIds.add(point.id);
81
+
82
+ // V3 — every point matches the declared position kind.
83
+ if (point.position.kind !== datasource.positionKind) {
84
+ return {
85
+ ...base,
86
+ isEmpty: false,
87
+ error: validationError('positionKindMismatch', {
88
+ chartId,
89
+ family,
90
+ detail: {
91
+ expectedKind: datasource.positionKind,
92
+ actualKind: point.position.kind
93
+ }
94
+ })
95
+ };
96
+ }
97
+ if (point.position.kind === 'matrix') {
98
+ matrixRows.add(point.position.row);
99
+ matrixColumns.add(point.position.column);
100
+ }
101
+
102
+ // V9 — a known value is a finite number, and so is an instant. NaN or
103
+ // Infinity used to be drawn at the origin without a word (CHT-10).
104
+ const finite = (!isKnown(point.value) || Number.isFinite(point.value.value)) && (point.position.kind !== 'instant' || Number.isFinite(point.position.at));
105
+ if (!finite) {
106
+ return {
107
+ ...base,
108
+ isEmpty: false,
109
+ error: validationError('nonFiniteValue', {
110
+ chartId,
111
+ family
112
+ })
113
+ };
114
+ }
115
+ // V10 — a share of a whole cannot be negative.
116
+ if (family === 'distribution' && isKnown(point.value) && point.value.value < 0) {
117
+ return {
118
+ ...base,
119
+ isEmpty: false,
120
+ error: validationError('negativeDistributionValue', {
121
+ chartId,
122
+ family
123
+ })
124
+ };
125
+ }
126
+ totalPoints += 1;
127
+ if (isKnown(point.value)) {
128
+ knownPoints += 1;
129
+ }
130
+ }
131
+ }
132
+
133
+ // V5 — a matrix must be rectangular: every row/column pair accounted for.
134
+ if (datasource.positionKind === 'matrix' && totalPoints > 0) {
135
+ const expected = matrixRows.size * matrixColumns.size;
136
+ if (totalPoints !== expected) {
137
+ return {
138
+ ...base,
139
+ isEmpty: false,
140
+ error: validationError('inconsistentMatrix', {
141
+ chartId,
142
+ family,
143
+ detail: {
144
+ occurrences: Math.abs(expected - totalPoints)
145
+ }
146
+ })
147
+ };
148
+ }
149
+ }
150
+
151
+ // V6 — distribution segments that do not sum to the whole are flagged, never
152
+ // rescaled. This is a flag rather than a rejection: the chart still renders
153
+ // and marks the total incomplete.
154
+ let totalIncomplete = knownPoints < totalPoints;
155
+ if (family === 'distribution' && totalPoints > 0) {
156
+ totalIncomplete = totalIncomplete || !distributionSumsToWhole(datasource, distributionValues);
157
+ }
158
+ return {
159
+ isEmpty: totalPoints === 0,
160
+ isPartial: totalPoints > 0 && knownPoints > 0 && knownPoints < totalPoints,
161
+ totalIncomplete
162
+ };
163
+ }
164
+
165
+ /**
166
+ * Only proportions can be checked for wholeness, and only when every point is
167
+ * known. Absolute values are a whole by definition once they sum to something.
168
+ */
169
+ function distributionSumsToWhole(datasource, declared) {
170
+ let sum = 0;
171
+ for (const series of datasource.series) {
172
+ for (const point of series.points) {
173
+ if (!isKnown(point.value)) {
174
+ return false;
175
+ }
176
+ sum += point.value.value;
177
+ }
178
+ }
179
+ if (resolveDistributionValues(datasource, declared) === 'absolute') {
180
+ return sum > 0;
181
+ }
182
+ return Math.abs(sum - 1) <= DISTRIBUTION_SUM_TOLERANCE;
183
+ }
184
+ //# sourceMappingURL=validateDatasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["familyAcceptsPositionKind","DISTRIBUTION_SUM_TOLERANCE","resolveDistributionValues","validationError","isKnown","validateDatasource","datasource","family","chartId","distributionValues","base","isEmpty","isPartial","totalIncomplete","positionKind","error","detail","actualKind","seenSeriesIds","Set","series","has","id","occurrences","size","add","totalPoints","knownPoints","matrixRows","matrixColumns","seenPointIds","point","points","position","kind","expectedKind","row","column","finite","value","Number","isFinite","at","expected","Math","abs","distributionSumsToWhole","declared","sum"],"sourceRoot":"../../../src","sources":["validation/validateDatasource.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACCA,yBAAyB,QAGnB,2BAAwB;AAC/B,SACCC,0BAA0B,EAC1BC,yBAAyB,QAEnB,6BAA0B;AACjC,SAASC,eAAe,QAAyB,uBAAoB;AACrE,SAASC,OAAO,QAAQ,sBAAmB;AAY3C,OAAO,SAASC,kBAAkBA,CACjCC,UAA8B,EAC9BC,MAAmB,EACnBC,OAAgB,EAChB;AACAC,kBAAuC,EACpB;EACnB,MAAMC,IAAI,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,SAAS,EAAE,KAAK;IAAEC,eAAe,EAAE;EAAM,CAAC;;EAExE;EACA;EACA,IAAI,CAACb,yBAAyB,CAACO,MAAM,EAAED,UAAU,CAACQ,YAAY,CAAC,EAAE;IAChE,OAAO;MACN,GAAGJ,IAAI;MACPC,OAAO,EAAE,KAAK;MACdI,KAAK,EAAEZ,eAAe,CAAC,+BAA+B,EAAE;QACvDK,OAAO;QACPD,MAAM;QACNS,MAAM,EAAE;UAAEC,UAAU,EAAEX,UAAU,CAACQ;QAAa;MAC/C,CAAC;IACF,CAAC;EACF;;EAEA;EACA,MAAMI,aAAa,GAAG,IAAIC,GAAG,CAAS,CAAC;EACvC,KAAK,MAAMC,MAAM,IAAId,UAAU,CAACc,MAAM,EAAE;IACvC,IAAIF,aAAa,CAACG,GAAG,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;MACjC,OAAO;QACN,GAAGZ,IAAI;QACPC,OAAO,EAAE,KAAK;QACdI,KAAK,EAAEZ,eAAe,CAAC,mBAAmB,EAA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vD","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Composed accessible summaries (FR-067, FR-068, FR-069, FR-072).
3
+ *
4
+ * Exposing 2,500 individual points to a screen reader would be unusable even
5
+ * if it were cheap. A composed summary covers the same need: what the chart is,
6
+ * what it shows, where the extremes are, and what any target says.
7
+ *
8
+ * Withheld values never enter a summary — that would leak exactly what the
9
+ * withheld class exists to protect (FR-033).
10
+ */
11
+ import type { ChartDatasource, ChartFamily, Position } from '../contract/datasource';
12
+ import type { ChartStatus } from '../contract/state';
13
+ import { type ChartStrings } from '../contract/strings';
14
+ import { type ValueState } from '../contract/value';
15
+ export interface SummaryInput<M = unknown> {
16
+ readonly datasource: ChartDatasource<M>;
17
+ readonly family: ChartFamily;
18
+ readonly status: ChartStatus;
19
+ readonly title?: string;
20
+ readonly formatValue: (value: ValueState) => string;
21
+ /** How a position is spoken; the app's axis formatter when it has one. */
22
+ readonly formatPosition?: (position: Position) => string;
23
+ readonly incomplete?: boolean;
24
+ /** The texts to speak; the English defaults when omitted. */
25
+ readonly strings?: ChartStrings;
26
+ }
27
+ /**
28
+ * Builds the label read aloud for the chart as a whole.
29
+ *
30
+ * Non-ready statuses replace the data description rather than appending to it,
31
+ * so a loading chart never announces figures it is not showing.
32
+ */
33
+ export declare function buildChartSummary<M>(input: SummaryInput<M>): string;
34
+ /** Announced for the currently selected point on an adjustable chart. */
35
+ export declare function buildPointAnnouncement(seriesLabel: string, positionLabel: string, value: ValueState, formatValue: (v: ValueState) => string, strings?: ChartStrings): string;
36
+ /** Total plus an explicit note when it is not the whole picture (FR-013). */
37
+ export declare function buildTotalAnnouncement<M>(datasource: ChartDatasource<M>, formatValue: (v: ValueState) => string, strings?: ChartStrings): string;
38
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../../../src/a11y/summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,E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U,KAAK,MAAM,EACtC,OAAO,GAAE,YAAoC,GAC3C,MAAM,CAOR"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The shared datasource contract (FR-007, FR-007a).
3
+ *
4
+ * One contract spans every chart family: each point carries the same envelope —
5
+ * identity, value state, optional unit and format hint, opaque metadata — and
6
+ * only its **position** varies by kind. Families that accept the same position
7
+ * kind consume one another's datasources unchanged; anything else is a
8
+ * validation error rather than a rendering guess.
9
+ *
10
+ * See specs/007-rn-chart-package/data-model.md §2–§6.
11
+ */
12
+ import type { FormatHint } from './format';
13
+ import type { ReferenceMarker } from './marker';
14
+ import type { ValueState } from './value';
15
+ export type ChartFamily = 'progress' | 'distribution' | 'timeSeries' | 'bar' | 'heatmap';
16
+ /** A named bucket: a category axis, a distribution segment, a progress metric. */
17
+ export interface CategoryPosition {
18
+ readonly kind: 'category';
19
+ readonly category: string;
20
+ }
21
+ /**
22
+ * An absolute instant as epoch milliseconds, UTC.
23
+ *
24
+ * A number rather than a `Date` or an ISO string: cheap to compare and
25
+ * memoize, no per-render parsing across hundreds of points, no identity churn
26
+ * that would defeat the re-render guarantee, and no ambiguous offset. All
27
+ * date wording comes from app formatters (FR-016).
28
+ */
29
+ export interface InstantPosition {
30
+ readonly kind: 'instant';
31
+ readonly at: number;
32
+ }
33
+ /** A cell in a row-by-column matrix, for heatmaps. */
34
+ export interface MatrixPosition {
35
+ readonly kind: 'matrix';
36
+ readonly row: string;
37
+ readonly column: string;
38
+ }
39
+ export type Position = CategoryPosition | InstantPosition | MatrixPosition;
40
+ export type PositionKind = Position['kind'];
41
+ /** Non-colour encoding for a series, so meaning never rides on hue alone (FR-064). */
42
+ export type SeriesPattern = 'solid' | 'dashed' | 'dotted' | 'dashDot';
43
+ export interface DataPoint<M = unknown> {
44
+ /** Stable and unique within its series. Duplicates are a validation error. */
45
+ readonly id: string;
46
+ readonly position: Position;
47
+ readonly value: ValueState;
48
+ /** Overrides the series unit. */
49
+ readonly unit?: string;
50
+ /** Overrides the series format hint. */
51
+ readonly format?: FormatHint;
52
+ /** Colour of this point's segment in a distribution chart. Ignored elsewhere. */
53
+ readonly color?: string;
54
+ /** Opaque to the package: never read, never logged, returned unchanged. */
55
+ readonly metadata?: M;
56
+ }
57
+ export interface Series<M = unknown> {
58
+ /** Stable and unique within the datasource. */
59
+ readonly id: string;
60
+ readonly label: string;
61
+ readonly points: readonly DataPoint<M>[];
62
+ readonly unit?: string;
63
+ readonly format?: FormatHint;
64
+ /** Explicit colour override; otherwise the theme palette assigns one. */
65
+ readonly color?: string;
66
+ readonly pattern?: SeriesPattern;
67
+ /** Initial visibility. Runtime toggling is controlled separately. */
68
+ readonly hidden?: boolean;
69
+ readonly metadata?: M;
70
+ }
71
+ export interface ChartDatasource<M = unknown> {
72
+ /** Declared once, then validated against every point and the receiving family. */
73
+ readonly positionKind: PositionKind;
74
+ readonly series: readonly Series<M>[];
75
+ readonly markers?: readonly ReferenceMarker[];
76
+ readonly unit?: string;
77
+ readonly format?: FormatHint;
78
+ readonly metadata?: M;
79
+ }
80
+ /**
81
+ * Which position kinds each family accepts.
82
+ *
83
+ * Bar accepting both `category` and `instant` is what makes swapping a
84
+ * time-series chart for a bar chart free — the datasource does not change.
85
+ */
86
+ export declare const FAMILY_POSITION_KINDS: Readonly<Record<ChartFamily, readonly PositionKind[]>>;
87
+ export declare function familyAcceptsPositionKind(family: ChartFamily, kind: PositionKind): boolean;
88
+ /**
89
+ * Resolves unit and format through the documented precedence:
90
+ * point -> series -> datasource -> undefined (caller falls back to its default).
91
+ */
92
+ export declare function resolveFormat<M>(point: DataPoint<M> | undefined, series: Series<M> | undefined, datasource: ChartDatasource<M>): FormatHint | undefined;
93
+ export declare function resolveUnit<M>(point: DataPoint<M> | undefined, series: Series<M> | undefined, datasource: ChartDatasource<M>): string | undefined;
94
+ //# sourceMappingURL=datasource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../../src/contract/datasource.ts"],"names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AE,SAAS,YAAY,EAAE,CAAC,CAMxF,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAE1F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC9B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,EAC7B,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,GAC5B,UAAU,GAAG,SAAS,CAExB;AAED,wBAAgB,WAAW,CAAC,CAAC,EAC5B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,EAC7B,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,GAC5B,MAAM,GAAG,SAAS,CAEpB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * What the numbers of a distribution mean (CHT-10).
3
+ *
4
+ * `proportions`: each value is already a share of the whole, in 0..1. A sum
5
+ * short of 1 is drawn short and reported incomplete. `absolute`: counts or
6
+ * amounts, normalised by their own total.
7
+ *
8
+ * Until 0.4.0 this was guessed from the values alone: anything in 0..1 was a
9
+ * proportion, so two segments counting 1 each drew two full circles on top of
10
+ * one another. The guess now also requires the shares to fit in one whole, and
11
+ * an app that knows can say so.
12
+ */
13
+ import type { ChartDatasource } from './datasource';
14
+ export type DistributionValues = 'proportions' | 'absolute';
15
+ export declare const DISTRIBUTION_SUM_TOLERANCE = 0.001;
16
+ export declare function resolveDistributionValues<M>(datasource: ChartDatasource<M>, declared?: DistributionValues): DistributionValues;
17
+ //# sourceMappingURL=distribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../../../../src/contract/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,UAAU,CAAC;AAE5D,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAEhD,wBAAgB,yBAAyB,CAAC,CAAC,EAC1C,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,EAC9B,QAAQ,CAAC,EAAE,kBAAkB,GAC3B,kBAAkB,CAqBpB"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Typed error taxonomy and failure reporting (FR-038, FR-038a, FR-038b).
3
+ *
4
+ * Messages come from a **fixed catalogue with no interpolated data**. That is
5
+ * what makes the redaction guarantee structural rather than a rule someone has
6
+ * to remember: because the package never builds a message out of a value or a
7
+ * label, a failure report cannot carry patient data or account balances into a
8
+ * consuming app's crash reporting.
9
+ */
10
+ import type { ChartFamily, PositionKind } from './datasource';
11
+ export type ChartErrorCategory = 'validation' | 'declared' | 'render';
12
+ export type ChartErrorCode = 'duplicateSeriesId' | 'duplicatePointId' | 'positionKindMismatch' | 'familyPositionKindUnsupported' | 'inconsistentMatrix' | 'distributionNotWhole' | 'nonFiniteValue' | 'negativeDistributionValue' | 'declaredByApp' | 'renderException';
13
+ export interface ChartError {
14
+ readonly category: ChartErrorCategory;
15
+ readonly code: ChartErrorCode;
16
+ readonly message: string;
17
+ readonly chartId?: string;
18
+ readonly family?: ChartFamily;
19
+ /**
20
+ * Structural detail that is safe to expose: counts and kinds only, never a
21
+ * value or a label.
22
+ */
23
+ readonly detail?: {
24
+ readonly expectedKind?: PositionKind;
25
+ readonly actualKind?: PositionKind;
26
+ readonly occurrences?: number;
27
+ };
28
+ }
29
+ export interface ChartFailureReport {
30
+ readonly chartId?: string;
31
+ readonly family: ChartFamily;
32
+ readonly error: ChartError;
33
+ readonly componentStack?: string;
34
+ }
35
+ export type ChartFailureHandler = (report: ChartFailureReport) => void;
36
+ export declare function chartError(category: ChartErrorCategory, code: ChartErrorCode, extra?: Omit<ChartError, 'category' | 'code' | 'message'>): ChartError;
37
+ export declare function validationError(code: ChartErrorCode, extra?: Omit<ChartError, 'category' | 'code' | 'message'>): ChartError;
38
+ export declare function isChartError(e: unknown): e is ChartError;
39
+ /**
40
+ * Builds the report handed to the app after a contained render exception.
41
+ *
42
+ * A `ChartError` thrown by the package keeps its catalogue message. Anything
43
+ * else — a defect in the rendering library, say — is reported under the generic
44
+ * `renderException` message. We do **not** copy a third-party exception's own
45
+ * message into the report, because we cannot promise it is free of data.
46
+ */
47
+ export declare function toFailureReport(family: ChartFamily, thrown: unknown, chartId?: string, componentStack?: string): ChartFailureReport;
48
+ /**
49
+ * Stable identity for a failure, used to de-duplicate reports so an unrelated
50
+ * parent re-render does not re-report the same problem.
51
+ */
52
+ export declare function failureSignature(report: ChartFailureReport): string;
53
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/contract/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,cAAc,GACvB,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,+BAA+B,GAC/B,oBAAoB,GACpB,sBAAsB,GACtB,gBAAgB,GAChB,2BAA2B,GAC3B,eAAe,GACf,iBAAiB,CAAC;AAwBrB,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjB,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;QACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,CAAC;QACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACF;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEvE,wBAAgB,UAAU,CACzB,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE,cAAc,EACpB,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC,GACvD,UAAU,CAOZ;AAED,wBAAgB,eAAe,CAC9B,IAAI,EAAE,cAAc,EACpB,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC,GACvD,UAAU,CAEZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAYxD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,GACrB,kBAAkB,CAMpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,63 @@
1
+ import type { Position, Series } from './datasource';
2
+ import { type ValueState } from './value';
3
+ export type FormatHint = {
4
+ readonly kind: 'number';
5
+ readonly decimals?: number;
6
+ } | {
7
+ readonly kind: 'percent';
8
+ readonly decimals?: number;
9
+ } | {
10
+ readonly kind: 'currency';
11
+ readonly currency: string;
12
+ } | {
13
+ readonly kind: 'duration';
14
+ readonly unit: 'ms' | 's' | 'min' | 'h';
15
+ } | {
16
+ readonly kind: 'count';
17
+ } | {
18
+ readonly kind: 'custom';
19
+ readonly unit: string;
20
+ };
21
+ export interface FormatContext {
22
+ readonly hint?: FormatHint;
23
+ readonly unit?: string;
24
+ /** Where the text will appear, so a formatter can adapt its verbosity. */
25
+ readonly slot: 'axis' | 'value' | 'legend' | 'summary';
26
+ }
27
+ export interface SeriesRef {
28
+ readonly id: string;
29
+ readonly label: string;
30
+ }
31
+ export interface ChartFormatters {
32
+ readonly axisLabel?: (v: ValueState | Position, ctx: FormatContext) => string;
33
+ readonly value?: (v: ValueState, ctx: FormatContext) => string;
34
+ readonly legendLabel?: (series: SeriesRef, ctx: FormatContext) => string;
35
+ readonly summary?: (v: ValueState, ctx: FormatContext) => string;
36
+ }
37
+ /**
38
+ * Placeholders for the three non-value classes. Deliberately not "0" and not
39
+ * an empty string, so a reader can tell a gap from a zero at a glance.
40
+ */
41
+ export declare const NON_VALUE_TEXT: Readonly<Record<string, string>>;
42
+ /**
43
+ * Locale-neutral default formatting (FR-057).
44
+ *
45
+ * Deliberately plain: no thousands separators, no currency symbol lookup, no
46
+ * month names. Anything locale-dependent belongs to the consuming app, which
47
+ * owns an i18n system the package does not.
48
+ */
49
+ export declare function formatValueDefault(v: ValueState, ctx?: FormatContext): string;
50
+ export declare function formatPositionDefault(p: Position): string;
51
+ export declare function formatLegendDefault(series: SeriesRef): string;
52
+ /**
53
+ * Runs an app formatter, falling back to the package default for that single
54
+ * label if it throws (FR-059). One bad formatter must not take down a screen.
55
+ *
56
+ * The dev-only warning is intentionally value-free: it names the slot, never
57
+ * the data.
58
+ */
59
+ export declare function safeFormat(run: () => string, fallback: () => string, slot: FormatContext['slot'], onceKey?: string): string;
60
+ /** Test-only reset so warning-once behaviour can be asserted repeatedly. */
61
+ export declare function __resetFormatterWarnings(): void;
62
+ export declare function seriesRef<M>(series: Series<M>): SeriesRef;
63
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/contract/format.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAKnD,MAAM,MAAM,UAAU,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACxD;IACA,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;CACvC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,SAAS;I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D"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Interaction contract (FR-048 to FR-054a).
3
+ *
4
+ * The package reports what the user touched and does nothing else: no
5
+ * navigation, no fetching, no datasource mutation, no business rules.
6
+ *
7
+ * Selection is **uncontrolled by default and controlled when the app supplies a
8
+ * value** — the standard React pattern. The same callbacks fire either way, so
9
+ * a consumer can move between the two without rewriting handlers.
10
+ */
11
+ import type { Position } from './datasource';
12
+ import type { ValueState } from './value';
13
+ export interface SelectionRef {
14
+ readonly seriesId: string;
15
+ /** Absent for a whole-series selection. */
16
+ readonly pointId?: string;
17
+ }
18
+ export interface PointInteractionEvent<M = unknown> {
19
+ readonly type: 'pointSelect';
20
+ readonly seriesId: string;
21
+ readonly pointId: string;
22
+ readonly value: ValueState;
23
+ readonly position: Position;
24
+ readonly metadata?: M;
25
+ }
26
+ export interface SeriesInteractionEvent<M = unknown> {
27
+ readonly type: 'visibilityChange';
28
+ readonly seriesId: string;
29
+ readonly visible?: boolean;
30
+ readonly metadata?: M;
31
+ }
32
+ export type ChartInteractionEvent<M = unknown> = PointInteractionEvent<M> | SeriesInteractionEvent<M>;
33
+ export interface InteractionProps<M = unknown> {
34
+ /**
35
+ * Omit for uncontrolled selection. Supply — including `null` — to take
36
+ * ownership; the chart then renders exactly what this says.
37
+ */
38
+ readonly selection?: SelectionRef | null;
39
+ readonly onSelectionChange?: (next: SelectionRef | null, event: PointInteractionEvent<M> | null) => void;
40
+ /**
41
+ * Fires when an app-controlled selection no longer resolves against the
42
+ * current datasource, so the app can correct its own state rather than
43
+ * having the package silently ignore it.
44
+ */
45
+ readonly onSelectionUnresolvable?: (ref: SelectionRef) => void;
46
+ /** Omit for uncontrolled visibility. Supply to take ownership. */
47
+ readonly hiddenSeriesIds?: readonly string[];
48
+ readonly onVisibilityChange?: (event: SeriesInteractionEvent<M>) => void;
49
+ /** Series toggling stays off unless the app opts in (FR-049). */
50
+ readonly seriesToggleEnabled?: boolean;
51
+ }
52
+ export declare function sameSelection(a: SelectionRef | null | undefined, b: SelectionRef | null | undefined): boolean;
53
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../src/contract/interaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,OAAO;IACjD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IAClD,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;CACtB;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAC5C,qBAAqB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAEtD,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC5C;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAC5B,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI,KAClC,IAAI,CAAC;IACV;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/D,kEAAkE;IAClE,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACzE,iEAAiE;IACjE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,wBAAgB,aAAa,CAC5B,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EAClC,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAChC,OAAO,CAKT"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Reference markers: targets, baselines, and thresholds (FR-008, FR-021, FR-022).
3
+ *
4
+ * The important rule lives here: a marker whose value is not `known`, or whose
5
+ * target is zero or negative, produces **no completion proportion**. A chart
6
+ * shows the current value alone rather than inventing a percentage.
7
+ */
8
+ import type { FormatHint } from './format';
9
+ import { type ValueState } from './value';
10
+ export type MarkerKind = 'target' | 'baseline' | 'threshold';
11
+ export interface ReferenceMarker {
12
+ readonly id: string;
13
+ readonly kind: MarkerKind;
14
+ readonly value: ValueState;
15
+ readonly label?: string;
16
+ readonly format?: FormatHint;
17
+ }
18
+ /**
19
+ * A target only supports a proportion when it is known and strictly positive.
20
+ * Zero and negative targets make "percent complete" meaningless, so we decline
21
+ * to compute one rather than divide and produce a nonsense figure.
22
+ */
23
+ export declare function isUsableTarget(marker: ReferenceMarker | undefined): boolean;
24
+ export interface ProgressReading {
25
+ /** The current value, when known. */
26
+ readonly current: ValueState;
27
+ /** The target, when one was supplied. */
28
+ readonly target?: ReferenceMarker;
29
+ /**
30
+ * Completion as a ratio of current to target. `undefined` whenever no
31
+ * proportion can honestly be computed — this is never defaulted to 0 or 1.
32
+ */
33
+ readonly proportion?: number;
34
+ /** True when the current value exceeds the target: shown, never clamped. */
35
+ readonly overshoot: boolean;
36
+ }
37
+ export declare function readProgress(current: ValueState, target: ReferenceMarker | undefined): ProgressReading;
38
+ export declare function findTarget(markers: readonly ReferenceMarker[] | undefined, id?: string): ReferenceMarker | undefined;
39
+ //# sourceMappingURL=marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../../src/contract/marker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAK3E;AAED,MAAM,WAAW,eAAe;IAC/B,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,eAAe,GAAG,SAAS,GACjC,eAAe,CAejB;AAED,wBAAgB,UAAU,CACzB,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EAC/C,EAAE,CAAC,EAAE,MAAM,GACT,eAAe,GAAG,SAAS,CAK7B"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Props shared by every chart family.
3
+ *
4
+ * See specs/007-rn-chart-package/contracts/public-api.md §2 for the contract
5
+ * behind each field.
6
+ */
7
+ import type { ChartStrings } from './strings';
8
+ import type { ReactNode } from 'react';
9
+ import type { StyleProp, ViewStyle } from 'react-native';
10
+ import type { ChartDatasource } from './datasource';
11
+ import type { ChartFailureHandler } from './errors';
12
+ import type { ChartFormatters, FormatContext } from './format';
13
+ import type { InteractionProps } from './interaction';
14
+ import type { ChartStateContent, DeclarableChartStatus } from './state';
15
+ import type { ChartTheme } from './theme';
16
+ import type { ValueState } from './value';
17
+ export interface ChartAccessibility<M = unknown> {
18
+ /** Replaces the composed summary entirely. */
19
+ readonly label?: string;
20
+ readonly summaryFormatter?: (datasource: ChartDatasource<M>, ctx: FormatContext) => string;
21
+ /** Defaults to true when `onSelectionChange` is supplied. */
22
+ readonly interactive?: boolean;
23
+ }
24
+ export interface BaseChartProps<M = unknown> extends InteractionProps<M> {
25
+ /**
26
+ * Must be referentially stable across renders, or memoization is defeated.
27
+ * Hold it in state or a memo rather than building it inline.
28
+ */
29
+ readonly datasource: ChartDatasource<M>;
30
+ /**
31
+ * `empty` and `partial` are derived from the data and are not accepted here
32
+ * (FR-036).
33
+ */
34
+ readonly status?: DeclarableChartStatus;
35
+ readonly stateContent?: ChartStateContent;
36
+ readonly chartId?: string;
37
+ readonly onFailure?: ChartFailureHandler;
38
+ readonly theme?: ChartTheme;
39
+ readonly formatters?: ChartFormatters;
40
+ readonly title?: string;
41
+ readonly legend?: boolean | {
42
+ readonly position: 'top' | 'bottom';
43
+ };
44
+ readonly accessibility?: ChartAccessibility<M>;
45
+ /**
46
+ * The package's own texts in the app's language: summaries, announcements,
47
+ * action labels, built-in state text, legend hints (`chartStrings` holds the
48
+ * keys and English defaults).
49
+ */
50
+ readonly strings?: Partial<ChartStrings>;
51
+ /** Width always comes from the container. */
52
+ readonly height?: number;
53
+ readonly style?: StyleProp<ViewStyle>;
54
+ /** Rendered below the plot, inside the chart's own bounds. */
55
+ readonly footer?: ReactNode;
56
+ }
57
+ export type ValueFormatter = (value: ValueState) => string;
58
+ //# sourceMappingURL=props.d.ts.map