stream-charts 1.2.0 → 2.0.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 (463) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +809 -1022
  3. package/changes.md +40 -0
  4. package/dist/app/charts/Chart.d.ts +35 -139
  5. package/dist/app/charts/Chart.d.ts.map +1 -0
  6. package/dist/app/charts/Chart.js +74 -65
  7. package/dist/app/charts/Chart.js.map +1 -1
  8. package/dist/app/charts/axes/AxesState.d.ts +26 -18
  9. package/dist/app/charts/axes/AxesState.d.ts.map +1 -0
  10. package/dist/app/charts/axes/AxesState.js +26 -24
  11. package/dist/app/charts/axes/AxesState.js.map +1 -1
  12. package/dist/app/charts/axes/AxisInterval.d.ts +44 -26
  13. package/dist/app/charts/axes/AxisInterval.d.ts.map +1 -0
  14. package/dist/app/charts/axes/AxisInterval.js +48 -29
  15. package/dist/app/charts/axes/AxisInterval.js.map +1 -1
  16. package/dist/app/charts/axes/BaseAxisRange.d.ts +46 -22
  17. package/dist/app/charts/axes/BaseAxisRange.d.ts.map +1 -0
  18. package/dist/app/charts/axes/BaseAxisRange.js +17 -12
  19. package/dist/app/charts/axes/BaseAxisRange.js.map +1 -1
  20. package/dist/app/charts/axes/ContinuousAxis.d.ts +47 -6
  21. package/dist/app/charts/axes/ContinuousAxis.d.ts.map +1 -0
  22. package/dist/app/charts/axes/ContinuousAxis.js +160 -27
  23. package/dist/app/charts/axes/ContinuousAxis.js.map +1 -1
  24. package/dist/app/charts/axes/ContinuousAxisRange.d.ts +29 -10
  25. package/dist/app/charts/axes/ContinuousAxisRange.d.ts.map +1 -0
  26. package/dist/app/charts/axes/ContinuousAxisRange.js +29 -11
  27. package/dist/app/charts/axes/ContinuousAxisRange.js.map +1 -1
  28. package/dist/app/charts/axes/EmptyAxis.d.ts +5 -2
  29. package/dist/app/charts/axes/EmptyAxis.d.ts.map +1 -0
  30. package/dist/app/charts/axes/EmptyAxis.js +30 -9
  31. package/dist/app/charts/axes/EmptyAxis.js.map +1 -1
  32. package/dist/app/charts/axes/OrdinalAxis.d.ts +5 -3
  33. package/dist/app/charts/axes/OrdinalAxis.d.ts.map +1 -0
  34. package/dist/app/charts/axes/OrdinalAxis.js +39 -16
  35. package/dist/app/charts/axes/OrdinalAxis.js.map +1 -1
  36. package/dist/app/charts/axes/OrdinalAxisRange.d.ts +76 -13
  37. package/dist/app/charts/axes/OrdinalAxisRange.d.ts.map +1 -0
  38. package/dist/app/charts/axes/OrdinalAxisRange.js +95 -16
  39. package/dist/app/charts/axes/OrdinalAxisRange.js.map +1 -1
  40. package/dist/app/charts/axes/autoScale.d.ts +111 -0
  41. package/dist/app/charts/axes/autoScale.d.ts.map +1 -0
  42. package/dist/app/charts/axes/autoScale.js +188 -0
  43. package/dist/app/charts/axes/autoScale.js.map +1 -0
  44. package/dist/app/charts/axes/axes.d.ts +273 -150
  45. package/dist/app/charts/axes/axes.d.ts.map +1 -0
  46. package/dist/app/charts/axes/axes.js +808 -583
  47. package/dist/app/charts/axes/axes.js.map +1 -1
  48. package/dist/app/charts/d3types.d.ts +40 -11
  49. package/dist/app/charts/d3types.d.ts.map +1 -0
  50. package/dist/app/charts/d3types.js +3 -0
  51. package/dist/app/charts/d3types.js.map +1 -1
  52. package/dist/app/charts/datasources/StreamingDataSource.d.ts +149 -0
  53. package/dist/app/charts/datasources/StreamingDataSource.d.ts.map +1 -0
  54. package/dist/app/charts/datasources/StreamingDataSource.js +110 -0
  55. package/dist/app/charts/datasources/StreamingDataSource.js.map +1 -0
  56. package/dist/app/charts/datasources/iteratesDataSource.d.ts +73 -0
  57. package/dist/app/charts/datasources/iteratesDataSource.d.ts.map +1 -0
  58. package/dist/app/charts/datasources/iteratesDataSource.js +87 -0
  59. package/dist/app/charts/datasources/iteratesDataSource.js.map +1 -0
  60. package/dist/app/charts/datasources/ordinalDataSource.d.ts +75 -0
  61. package/dist/app/charts/datasources/ordinalDataSource.d.ts.map +1 -0
  62. package/dist/app/charts/datasources/ordinalDataSource.js +135 -0
  63. package/dist/app/charts/datasources/ordinalDataSource.js.map +1 -0
  64. package/dist/app/charts/datasources/outlierDataSource.d.ts +53 -0
  65. package/dist/app/charts/datasources/outlierDataSource.d.ts.map +1 -0
  66. package/dist/app/charts/datasources/outlierDataSource.js +57 -0
  67. package/dist/app/charts/datasources/outlierDataSource.js.map +1 -0
  68. package/dist/app/charts/datasources/timeSeriesDataSource.d.ts +77 -0
  69. package/dist/app/charts/datasources/timeSeriesDataSource.d.ts.map +1 -0
  70. package/dist/app/charts/datasources/timeSeriesDataSource.js +85 -0
  71. package/dist/app/charts/datasources/timeSeriesDataSource.js.map +1 -0
  72. package/dist/app/charts/filters/regexFilter.d.ts +31 -4
  73. package/dist/app/charts/filters/regexFilter.d.ts.map +1 -0
  74. package/dist/app/charts/filters/regexFilter.js +38 -4
  75. package/dist/app/charts/filters/regexFilter.js.map +1 -1
  76. package/dist/app/charts/hooks/AxesProvider.d.ts +21 -0
  77. package/dist/app/charts/hooks/AxesProvider.d.ts.map +1 -0
  78. package/dist/app/charts/hooks/AxesProvider.js +213 -0
  79. package/dist/app/charts/hooks/AxesProvider.js.map +1 -0
  80. package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts +25 -0
  81. package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts.map +1 -0
  82. package/dist/app/charts/hooks/CanvasSurfaceProvider.js +76 -0
  83. package/dist/app/charts/hooks/CanvasSurfaceProvider.js.map +1 -0
  84. package/dist/app/charts/hooks/ChartProvider.d.ts +40 -0
  85. package/dist/app/charts/hooks/ChartProvider.d.ts.map +1 -0
  86. package/dist/app/charts/hooks/ChartProvider.js +33 -0
  87. package/dist/app/charts/hooks/ChartProvider.js.map +1 -0
  88. package/dist/app/charts/hooks/InteractionProvider.d.ts +23 -0
  89. package/dist/app/charts/hooks/InteractionProvider.d.ts.map +1 -0
  90. package/dist/app/charts/hooks/InteractionProvider.js +60 -0
  91. package/dist/app/charts/hooks/InteractionProvider.js.map +1 -0
  92. package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts +16 -0
  93. package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts.map +1 -0
  94. package/dist/app/charts/hooks/PlotDimensionsProvider.js +76 -0
  95. package/dist/app/charts/hooks/PlotDimensionsProvider.js.map +1 -0
  96. package/dist/app/charts/hooks/defaultAxesValues.d.ts +11 -0
  97. package/dist/app/charts/hooks/defaultAxesValues.d.ts.map +1 -0
  98. package/dist/app/charts/hooks/defaultAxesValues.js +36 -0
  99. package/dist/app/charts/hooks/defaultAxesValues.js.map +1 -0
  100. package/dist/app/charts/hooks/defaultMouseValues.d.ts +9 -0
  101. package/dist/app/charts/hooks/defaultMouseValues.d.ts.map +1 -0
  102. package/dist/app/charts/hooks/defaultMouseValues.js +23 -0
  103. package/dist/app/charts/hooks/defaultMouseValues.js.map +1 -0
  104. package/dist/app/charts/hooks/defaultPlotDimensions.d.ts +13 -0
  105. package/dist/app/charts/hooks/defaultPlotDimensions.d.ts.map +1 -0
  106. package/dist/app/charts/hooks/defaultPlotDimensions.js +23 -0
  107. package/dist/app/charts/hooks/defaultPlotDimensions.js.map +1 -0
  108. package/dist/app/charts/hooks/defaultTooltipValues.d.ts +9 -0
  109. package/dist/app/charts/hooks/defaultTooltipValues.d.ts.map +1 -0
  110. package/dist/app/charts/hooks/defaultTooltipValues.js +21 -0
  111. package/dist/app/charts/hooks/defaultTooltipValues.js.map +1 -0
  112. package/dist/app/charts/hooks/defaultUseChartValues.d.ts +14 -0
  113. package/dist/app/charts/hooks/defaultUseChartValues.d.ts.map +1 -0
  114. package/dist/app/charts/hooks/defaultUseChartValues.js +30 -0
  115. package/dist/app/charts/hooks/defaultUseChartValues.js.map +1 -0
  116. package/dist/app/charts/hooks/useAxes.d.ts +49 -36
  117. package/dist/app/charts/hooks/useAxes.d.ts.map +1 -0
  118. package/dist/app/charts/hooks/useAxes.js +16 -176
  119. package/dist/app/charts/hooks/useAxes.js.map +1 -1
  120. package/dist/app/charts/hooks/useCanvasSurface.d.ts +25 -0
  121. package/dist/app/charts/hooks/useCanvasSurface.d.ts.map +1 -0
  122. package/dist/app/charts/hooks/useCanvasSurface.js +18 -0
  123. package/dist/app/charts/hooks/useCanvasSurface.js.map +1 -0
  124. package/dist/app/charts/hooks/useChart.d.ts +30 -44
  125. package/dist/app/charts/hooks/useChart.d.ts.map +1 -0
  126. package/dist/app/charts/hooks/useChart.js +26 -48
  127. package/dist/app/charts/hooks/useChart.js.map +1 -1
  128. package/dist/app/charts/hooks/useDataSource.d.ts +68 -0
  129. package/dist/app/charts/hooks/useDataSource.d.ts.map +1 -0
  130. package/dist/app/charts/hooks/useDataSource.js +63 -0
  131. package/dist/app/charts/hooks/useDataSource.js.map +1 -0
  132. package/dist/app/charts/hooks/useHoveredSeries.d.ts +25 -0
  133. package/dist/app/charts/hooks/useHoveredSeries.d.ts.map +1 -0
  134. package/dist/app/charts/hooks/useHoveredSeries.js +15 -0
  135. package/dist/app/charts/hooks/useHoveredSeries.js.map +1 -0
  136. package/dist/app/charts/hooks/useMouse.d.ts +46 -22
  137. package/dist/app/charts/hooks/useMouse.d.ts.map +1 -0
  138. package/dist/app/charts/hooks/useMouse.js +12 -56
  139. package/dist/app/charts/hooks/useMouse.js.map +1 -1
  140. package/dist/app/charts/hooks/usePlotDimensions.d.ts +25 -13
  141. package/dist/app/charts/hooks/usePlotDimensions.d.ts.map +1 -0
  142. package/dist/app/charts/hooks/usePlotDimensions.js +6 -62
  143. package/dist/app/charts/hooks/usePlotDimensions.js.map +1 -1
  144. package/dist/app/charts/hooks/useTooltip.d.ts +24 -26
  145. package/dist/app/charts/hooks/useTooltip.d.ts.map +1 -0
  146. package/dist/app/charts/hooks/useTooltip.js +12 -42
  147. package/dist/app/charts/hooks/useTooltip.js.map +1 -1
  148. package/dist/app/charts/index.d.ts +66 -0
  149. package/dist/app/charts/index.d.ts.map +1 -0
  150. package/dist/app/charts/index.js +87 -0
  151. package/dist/app/charts/index.js.map +1 -0
  152. package/dist/app/charts/legends/Legend.d.ts +33 -12
  153. package/dist/app/charts/legends/Legend.d.ts.map +1 -0
  154. package/dist/app/charts/legends/Legend.js +138 -379
  155. package/dist/app/charts/legends/Legend.js.map +1 -1
  156. package/dist/app/charts/legends/constants.d.ts +19 -0
  157. package/dist/app/charts/legends/constants.d.ts.map +1 -0
  158. package/dist/app/charts/legends/constants.js +34 -0
  159. package/dist/app/charts/legends/constants.js.map +1 -0
  160. package/dist/app/charts/observables/ChartData.d.ts +1 -0
  161. package/dist/app/charts/observables/ChartData.d.ts.map +1 -0
  162. package/dist/app/charts/observables/iterates.d.ts +13 -7
  163. package/dist/app/charts/observables/iterates.d.ts.map +1 -0
  164. package/dist/app/charts/observables/iterates.js +42 -9
  165. package/dist/app/charts/observables/iterates.js.map +1 -1
  166. package/dist/app/charts/observables/ordinals.d.ts +70 -12
  167. package/dist/app/charts/observables/ordinals.d.ts.map +1 -0
  168. package/dist/app/charts/observables/ordinals.js +127 -48
  169. package/dist/app/charts/observables/ordinals.js.map +1 -1
  170. package/dist/app/charts/observables/outliers.d.ts +18 -0
  171. package/dist/app/charts/observables/outliers.d.ts.map +1 -0
  172. package/dist/app/charts/observables/outliers.js +2 -0
  173. package/dist/app/charts/observables/outliers.js.map +1 -0
  174. package/dist/app/charts/plots/BarPlot.d.ts +87 -13
  175. package/dist/app/charts/plots/BarPlot.d.ts.map +1 -0
  176. package/dist/app/charts/plots/BarPlot.js +603 -356
  177. package/dist/app/charts/plots/BarPlot.js.map +1 -1
  178. package/dist/app/charts/plots/OutlierPlot.d.ts +123 -0
  179. package/dist/app/charts/plots/OutlierPlot.d.ts.map +1 -0
  180. package/dist/app/charts/plots/OutlierPlot.js +430 -0
  181. package/dist/app/charts/plots/OutlierPlot.js.map +1 -0
  182. package/dist/app/charts/plots/PoincarePlot.d.ts +92 -14
  183. package/dist/app/charts/plots/PoincarePlot.d.ts.map +1 -0
  184. package/dist/app/charts/plots/PoincarePlot.js +523 -364
  185. package/dist/app/charts/plots/PoincarePlot.js.map +1 -1
  186. package/dist/app/charts/plots/RasterPlot.d.ts +31 -10
  187. package/dist/app/charts/plots/RasterPlot.d.ts.map +1 -0
  188. package/dist/app/charts/plots/RasterPlot.js +198 -306
  189. package/dist/app/charts/plots/RasterPlot.js.map +1 -1
  190. package/dist/app/charts/plots/ScatterPlot.d.ts +77 -21
  191. package/dist/app/charts/plots/ScatterPlot.d.ts.map +1 -0
  192. package/dist/app/charts/plots/ScatterPlot.js +359 -302
  193. package/dist/app/charts/plots/ScatterPlot.js.map +1 -1
  194. package/dist/app/charts/plots/autoScaleYAxes.d.ts +43 -0
  195. package/dist/app/charts/plots/autoScaleYAxes.d.ts.map +1 -0
  196. package/dist/app/charts/plots/autoScaleYAxes.js +71 -0
  197. package/dist/app/charts/plots/autoScaleYAxes.js.map +1 -0
  198. package/dist/app/charts/plots/colorizedLine.d.ts +61 -0
  199. package/dist/app/charts/plots/colorizedLine.d.ts.map +1 -0
  200. package/dist/app/charts/plots/colorizedLine.js +157 -0
  201. package/dist/app/charts/plots/colorizedLine.js.map +1 -0
  202. package/dist/app/charts/plots/constants.d.ts +7 -0
  203. package/dist/app/charts/plots/constants.d.ts.map +1 -0
  204. package/dist/app/charts/plots/constants.js +11 -0
  205. package/dist/app/charts/plots/constants.js.map +1 -0
  206. package/dist/app/charts/plots/hitTesting.d.ts +88 -0
  207. package/dist/app/charts/plots/hitTesting.d.ts.map +1 -0
  208. package/dist/app/charts/plots/hitTesting.js +136 -0
  209. package/dist/app/charts/plots/hitTesting.js.map +1 -0
  210. package/dist/app/charts/plots/plot.d.ts +52 -16
  211. package/dist/app/charts/plots/plot.d.ts.map +1 -0
  212. package/dist/app/charts/plots/plot.js +108 -35
  213. package/dist/app/charts/plots/plot.js.map +1 -1
  214. package/dist/app/charts/plots/useCanvasZoomPan.d.ts +119 -0
  215. package/dist/app/charts/plots/useCanvasZoomPan.d.ts.map +1 -0
  216. package/dist/app/charts/plots/useCanvasZoomPan.js +113 -0
  217. package/dist/app/charts/plots/useCanvasZoomPan.js.map +1 -0
  218. package/dist/app/charts/plots/useStreamingTimeAxes.d.ts +103 -0
  219. package/dist/app/charts/plots/useStreamingTimeAxes.d.ts.map +1 -0
  220. package/dist/app/charts/plots/useStreamingTimeAxes.js +257 -0
  221. package/dist/app/charts/plots/useStreamingTimeAxes.js.map +1 -0
  222. package/dist/app/charts/series/baseSeries.d.ts +60 -8
  223. package/dist/app/charts/series/baseSeries.d.ts.map +1 -0
  224. package/dist/app/charts/series/baseSeries.js +53 -8
  225. package/dist/app/charts/series/baseSeries.js.map +1 -1
  226. package/dist/app/charts/series/iterateSeries.d.ts +9 -8
  227. package/dist/app/charts/series/iterateSeries.d.ts.map +1 -0
  228. package/dist/app/charts/series/iterateSeries.js +7 -7
  229. package/dist/app/charts/series/iterateSeries.js.map +1 -1
  230. package/dist/app/charts/series/ordinalSeries.d.ts +27 -13
  231. package/dist/app/charts/series/ordinalSeries.d.ts.map +1 -0
  232. package/dist/app/charts/series/ordinalSeries.js +29 -15
  233. package/dist/app/charts/series/ordinalSeries.js.map +1 -1
  234. package/dist/app/charts/series/outlierSeries.d.ts +142 -0
  235. package/dist/app/charts/series/outlierSeries.d.ts.map +1 -0
  236. package/dist/app/charts/series/outlierSeries.js +82 -0
  237. package/dist/app/charts/series/outlierSeries.js.map +1 -0
  238. package/dist/app/charts/series/timeSeries.d.ts +13 -9
  239. package/dist/app/charts/series/timeSeries.d.ts.map +1 -0
  240. package/dist/app/charts/series/timeSeries.js +6 -3
  241. package/dist/app/charts/series/timeSeries.js.map +1 -1
  242. package/dist/app/charts/series/timeSeriesChartData.d.ts +18 -10
  243. package/dist/app/charts/series/timeSeriesChartData.d.ts.map +1 -0
  244. package/dist/app/charts/series/timeSeriesChartData.js +28 -14
  245. package/dist/app/charts/series/timeSeriesChartData.js.map +1 -1
  246. package/dist/app/charts/styling/barPlotStyle.d.ts +46 -2
  247. package/dist/app/charts/styling/barPlotStyle.d.ts.map +1 -0
  248. package/dist/app/charts/styling/barPlotStyle.js +37 -3
  249. package/dist/app/charts/styling/barPlotStyle.js.map +1 -1
  250. package/dist/app/charts/styling/canvasStyle.d.ts +53 -0
  251. package/dist/app/charts/styling/canvasStyle.d.ts.map +1 -0
  252. package/dist/app/charts/styling/canvasStyle.js +71 -0
  253. package/dist/app/charts/styling/canvasStyle.js.map +1 -0
  254. package/dist/app/charts/styling/margins.d.ts +21 -2
  255. package/dist/app/charts/styling/margins.d.ts.map +1 -0
  256. package/dist/app/charts/styling/margins.js +25 -4
  257. package/dist/app/charts/styling/margins.js.map +1 -1
  258. package/dist/app/charts/styling/svgStyle.d.ts +10 -56
  259. package/dist/app/charts/styling/svgStyle.d.ts.map +1 -0
  260. package/dist/app/charts/styling/svgStyle.js +3 -78
  261. package/dist/app/charts/styling/svgStyle.js.map +1 -1
  262. package/dist/app/charts/subscriptions/viewDrivers.d.ts +124 -0
  263. package/dist/app/charts/subscriptions/viewDrivers.d.ts.map +1 -0
  264. package/dist/app/charts/subscriptions/viewDrivers.js +338 -0
  265. package/dist/app/charts/subscriptions/viewDrivers.js.map +1 -0
  266. package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts +12 -78
  267. package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts.map +1 -0
  268. package/dist/app/charts/tooltips/BarPlotTooltipContent.js +65 -257
  269. package/dist/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -1
  270. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts +9 -0
  271. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts.map +1 -0
  272. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js +16 -0
  273. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js.map +1 -0
  274. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts +30 -0
  275. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts.map +1 -0
  276. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js +26 -0
  277. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js.map +1 -0
  278. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +22 -72
  279. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts.map +1 -0
  280. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js +104 -171
  281. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -1
  282. package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts +32 -8
  283. package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts.map +1 -0
  284. package/dist/app/charts/tooltips/RasterPlotTooltipContent.js +62 -115
  285. package/dist/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -1
  286. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts +39 -12
  287. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts.map +1 -0
  288. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js +162 -134
  289. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -1
  290. package/dist/app/charts/tooltips/Tooltip.d.ts +27 -32
  291. package/dist/app/charts/tooltips/Tooltip.d.ts.map +1 -0
  292. package/dist/app/charts/tooltips/Tooltip.js +37 -81
  293. package/dist/app/charts/tooltips/Tooltip.js.map +1 -1
  294. package/dist/app/charts/tooltips/TooltipContent.d.ts +81 -0
  295. package/dist/app/charts/tooltips/TooltipContent.d.ts.map +1 -0
  296. package/dist/app/charts/tooltips/TooltipContent.js +99 -0
  297. package/dist/app/charts/tooltips/TooltipContent.js.map +1 -0
  298. package/dist/app/charts/tooltips/tooltipUtils.d.ts +186 -36
  299. package/dist/app/charts/tooltips/tooltipUtils.d.ts.map +1 -0
  300. package/dist/app/charts/tooltips/tooltipUtils.js +277 -48
  301. package/dist/app/charts/tooltips/tooltipUtils.js.map +1 -1
  302. package/dist/app/charts/tooltips/useOutlierTooltip.d.ts +59 -0
  303. package/dist/app/charts/tooltips/useOutlierTooltip.d.ts.map +1 -0
  304. package/dist/app/charts/tooltips/useOutlierTooltip.js +16 -0
  305. package/dist/app/charts/tooltips/useOutlierTooltip.js.map +1 -0
  306. package/dist/app/charts/tooltips/useTooltipPlacement.d.ts +51 -0
  307. package/dist/app/charts/tooltips/useTooltipPlacement.d.ts.map +1 -0
  308. package/dist/app/charts/tooltips/useTooltipPlacement.js +52 -0
  309. package/dist/app/charts/tooltips/useTooltipPlacement.js.map +1 -0
  310. package/dist/app/charts/tooltips/useTooltipStyle.d.ts +11 -0
  311. package/dist/app/charts/tooltips/useTooltipStyle.d.ts.map +1 -0
  312. package/dist/app/charts/tooltips/useTooltipStyle.js +14 -0
  313. package/dist/app/charts/tooltips/useTooltipStyle.js.map +1 -0
  314. package/dist/app/charts/trackers/Tracker.d.ts +22 -6
  315. package/dist/app/charts/trackers/Tracker.d.ts.map +1 -0
  316. package/dist/app/charts/trackers/Tracker.js +36 -22
  317. package/dist/app/charts/trackers/Tracker.js.map +1 -1
  318. package/dist/app/charts/trackers/trackerUtils.d.ts +40 -18
  319. package/dist/app/charts/trackers/trackerUtils.d.ts.map +1 -0
  320. package/dist/app/charts/trackers/trackerUtils.js +213 -300
  321. package/dist/app/charts/trackers/trackerUtils.js.map +1 -1
  322. package/dist/app/charts/utils.d.ts +72 -33
  323. package/dist/app/charts/utils.d.ts.map +1 -0
  324. package/dist/app/charts/utils.js +87 -42
  325. package/dist/app/charts/utils.js.map +1 -1
  326. package/dist/index.d.ts +2 -45
  327. package/dist/index.d.ts.map +1 -0
  328. package/dist/index.js +2 -72
  329. package/dist/index.js.map +1 -1
  330. package/package.json +87 -46
  331. package/src/app/charts/Chart.tsx +132 -168
  332. package/src/app/charts/axes/AxesState.ts +27 -29
  333. package/src/app/charts/axes/AxisInterval.ts +57 -32
  334. package/src/app/charts/axes/BaseAxisRange.ts +47 -27
  335. package/src/app/charts/axes/ContinuousAxis.tsx +235 -39
  336. package/src/app/charts/axes/ContinuousAxisRange.ts +29 -11
  337. package/src/app/charts/axes/EmptyAxis.tsx +52 -17
  338. package/src/app/charts/axes/OrdinalAxis.tsx +54 -28
  339. package/src/app/charts/axes/OrdinalAxisRange.ts +96 -16
  340. package/src/app/charts/axes/autoScale.ts +244 -0
  341. package/src/app/charts/axes/axes.ts +954 -735
  342. package/src/app/charts/d3types.ts +42 -13
  343. package/src/app/charts/datasources/StreamingDataSource.ts +214 -0
  344. package/src/app/charts/datasources/iteratesDataSource.ts +122 -0
  345. package/src/app/charts/datasources/ordinalDataSource.ts +205 -0
  346. package/src/app/charts/datasources/outlierDataSource.ts +90 -0
  347. package/src/app/charts/datasources/timeSeriesDataSource.ts +133 -0
  348. package/src/app/charts/filters/regexFilter.ts +45 -5
  349. package/src/app/charts/hooks/AxesProvider.tsx +301 -0
  350. package/src/app/charts/hooks/CanvasSurfaceProvider.tsx +117 -0
  351. package/src/app/charts/hooks/ChartProvider.tsx +79 -0
  352. package/src/app/charts/hooks/InteractionProvider.tsx +88 -0
  353. package/src/app/charts/hooks/PlotDimensionsProvider.tsx +109 -0
  354. package/src/app/charts/hooks/defaultAxesValues.ts +40 -0
  355. package/src/app/charts/hooks/defaultMouseValues.ts +24 -0
  356. package/src/app/charts/hooks/defaultPlotDimensions.ts +27 -0
  357. package/src/app/charts/hooks/defaultTooltipValues.tsx +23 -0
  358. package/src/app/charts/hooks/defaultUseChartValues.tsx +36 -0
  359. package/src/app/charts/hooks/useAxes.tsx +60 -228
  360. package/src/app/charts/hooks/useCanvasSurface.tsx +35 -0
  361. package/src/app/charts/hooks/useChart.tsx +47 -106
  362. package/src/app/charts/hooks/useDataSource.tsx +106 -0
  363. package/src/app/charts/hooks/useHoveredSeries.tsx +33 -0
  364. package/src/app/charts/hooks/useMouse.tsx +58 -82
  365. package/src/app/charts/hooks/usePlotDimensions.tsx +25 -89
  366. package/src/app/charts/hooks/useTooltip.tsx +32 -63
  367. package/src/app/charts/index.ts +213 -0
  368. package/src/app/charts/legends/Legend.tsx +198 -479
  369. package/src/app/charts/legends/constants.ts +37 -0
  370. package/src/app/charts/observables/iterates.ts +32 -12
  371. package/src/app/charts/observables/ordinals.ts +141 -67
  372. package/src/app/charts/observables/outliers.ts +20 -0
  373. package/src/app/charts/plots/BarPlot.tsx +784 -666
  374. package/src/app/charts/plots/OutlierPlot.tsx +685 -0
  375. package/src/app/charts/plots/PoincarePlot.tsx +707 -489
  376. package/src/app/charts/plots/RasterPlot.tsx +253 -445
  377. package/src/app/charts/plots/ScatterPlot.tsx +480 -463
  378. package/src/app/charts/plots/autoScaleYAxes.ts +102 -0
  379. package/src/app/charts/plots/colorizedLine.ts +185 -0
  380. package/src/app/charts/plots/constants.ts +16 -0
  381. package/src/app/charts/plots/hitTesting.ts +198 -0
  382. package/src/app/charts/plots/plot.ts +138 -44
  383. package/src/app/charts/plots/useCanvasZoomPan.ts +240 -0
  384. package/src/app/charts/plots/useStreamingTimeAxes.ts +384 -0
  385. package/src/app/charts/series/baseSeries.ts +81 -14
  386. package/src/app/charts/series/iterateSeries.ts +8 -8
  387. package/src/app/charts/series/ordinalSeries.ts +35 -20
  388. package/src/app/charts/series/outlierSeries.ts +188 -0
  389. package/src/app/charts/series/timeSeries.ts +14 -12
  390. package/src/app/charts/series/timeSeriesChartData.ts +31 -17
  391. package/src/app/charts/styling/barPlotStyle.ts +48 -5
  392. package/src/app/charts/styling/canvasStyle.ts +86 -0
  393. package/src/app/charts/styling/margins.ts +28 -4
  394. package/src/app/charts/styling/svgStyle.ts +10 -91
  395. package/src/app/charts/subscriptions/viewDrivers.ts +447 -0
  396. package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +156 -380
  397. package/src/app/charts/tooltips/DefaultOutlierTooltipContent.tsx +40 -0
  398. package/src/app/charts/tooltips/OutlierPlotTooltipContent.tsx +67 -0
  399. package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +229 -292
  400. package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +164 -217
  401. package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +373 -236
  402. package/src/app/charts/tooltips/Tooltip.tsx +58 -124
  403. package/src/app/charts/tooltips/TooltipContent.tsx +177 -0
  404. package/src/app/charts/tooltips/tooltipUtils.ts +359 -61
  405. package/src/app/charts/tooltips/useOutlierTooltip.tsx +68 -0
  406. package/src/app/charts/tooltips/useTooltipPlacement.ts +86 -0
  407. package/src/app/charts/tooltips/useTooltipStyle.ts +15 -0
  408. package/src/app/charts/trackers/Tracker.tsx +68 -33
  409. package/src/app/charts/trackers/trackerUtils.ts +263 -376
  410. package/src/app/charts/utils.ts +90 -48
  411. package/src/index.ts +2 -322
  412. package/dist/app/charts/axes/AxesState.test.d.ts +0 -1
  413. package/dist/app/charts/axes/AxesState.test.js +0 -30
  414. package/dist/app/charts/axes/AxesState.test.js.map +0 -1
  415. package/dist/app/charts/axes/AxisInterval.test.d.ts +0 -1
  416. package/dist/app/charts/axes/AxisInterval.test.js +0 -120
  417. package/dist/app/charts/axes/AxisInterval.test.js.map +0 -1
  418. package/dist/app/charts/axes/ContinuousAxisRange.test.d.ts +0 -1
  419. package/dist/app/charts/axes/ContinuousAxisRange.test.js +0 -47
  420. package/dist/app/charts/axes/ContinuousAxisRange.test.js.map +0 -1
  421. package/dist/app/charts/axes/OrdinalAxisRange.test.d.ts +0 -1
  422. package/dist/app/charts/axes/OrdinalAxisRange.test.js +0 -48
  423. package/dist/app/charts/axes/OrdinalAxisRange.test.js.map +0 -1
  424. package/dist/app/charts/filters/regexFilter.test.d.ts +0 -1
  425. package/dist/app/charts/filters/regexFilter.test.js +0 -11
  426. package/dist/app/charts/filters/regexFilter.test.js.map +0 -1
  427. package/dist/app/charts/hooks/useDataObservable.d.ts +0 -72
  428. package/dist/app/charts/hooks/useDataObservable.js +0 -74
  429. package/dist/app/charts/hooks/useDataObservable.js.map +0 -1
  430. package/dist/app/charts/hooks/useInitialData.d.ts +0 -36
  431. package/dist/app/charts/hooks/useInitialData.js +0 -28
  432. package/dist/app/charts/hooks/useInitialData.js.map +0 -1
  433. package/dist/app/charts/observables/iterates.test.d.ts +0 -1
  434. package/dist/app/charts/observables/iterates.test.js +0 -180
  435. package/dist/app/charts/observables/iterates.test.js.map +0 -1
  436. package/dist/app/charts/observables/ordinals.test.d.ts +0 -1
  437. package/dist/app/charts/observables/ordinals.test.js +0 -102
  438. package/dist/app/charts/observables/ordinals.test.js.map +0 -1
  439. package/dist/app/charts/series/datumSeries.test.d.ts +0 -1
  440. package/dist/app/charts/series/datumSeries.test.js +0 -50
  441. package/dist/app/charts/series/datumSeries.test.js.map +0 -1
  442. package/dist/app/charts/styling/margins.test.d.ts +0 -1
  443. package/dist/app/charts/styling/margins.test.js +0 -19
  444. package/dist/app/charts/styling/margins.test.js.map +0 -1
  445. package/dist/app/charts/subscriptions/subscription.test.d.ts +0 -1
  446. package/dist/app/charts/subscriptions/subscription.test.js +0 -395
  447. package/dist/app/charts/subscriptions/subscription.test.js.map +0 -1
  448. package/dist/app/charts/subscriptions/subscriptions.d.ts +0 -100
  449. package/dist/app/charts/subscriptions/subscriptions.js +0 -449
  450. package/dist/app/charts/subscriptions/subscriptions.js.map +0 -1
  451. package/src/app/charts/axes/AxesState.test.ts +0 -34
  452. package/src/app/charts/axes/AxisInterval.test.ts +0 -143
  453. package/src/app/charts/axes/ContinuousAxisRange.test.ts +0 -55
  454. package/src/app/charts/axes/OrdinalAxisRange.test.ts +0 -55
  455. package/src/app/charts/filters/regexFilter.test.ts +0 -13
  456. package/src/app/charts/hooks/useDataObservable.tsx +0 -170
  457. package/src/app/charts/hooks/useInitialData.tsx +0 -64
  458. package/src/app/charts/observables/iterates.test.ts +0 -201
  459. package/src/app/charts/observables/ordinals.test.ts +0 -135
  460. package/src/app/charts/series/datumSeries.test.ts +0 -60
  461. package/src/app/charts/styling/margins.test.ts +0 -22
  462. package/src/app/charts/subscriptions/subscription.test.ts +0 -499
  463. package/src/app/charts/subscriptions/subscriptions.ts +0 -635
package/changes.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # change history
2
2
 
3
+ ## version 2.0.0 (data sources, canvas rendering, outlier plot)
4
+
5
+ A redesign of how charts get their data and how they're drawn. Code written for 1.x needs updating; see "migrating from 1.x" in the [README](README.md).
6
+
7
+ **Breaking changes**
8
+ 1. Charts read their data from an application-owned *data source* (`TimeSeriesDataSource`, `IteratesDataSource`, `OrdinalDataSource`, `OutlierDataSource`), handed to the chart through its new `dataSource` property. The data source subscribes to a *generator* (a function that creates the RxJS observable) when started, and unsubscribes when stopped. The `<Chart>`'s `initialData`, `seriesObservable`, `shouldSubscribe`, `onSubscribe`, and `onUpdateData` properties are gone: the initial data and `onUpdateData` are now data-source options, and running is controlled with `dataSource.start()` and `dataSource.stop()`.
9
+ 2. `dropDataAfter` moved from the plots to the data sources (and can be changed with `setDropDataAfter`).
10
+ 3. Charts are drawn on a single `<canvas>` rather than SVG elements. The `svgStyle` property still styles the chart's container.
11
+ 4. `Datum` is now `{x, y}` rather than `{time, value}` (create one with `datumOf(time, value)`), and `seriesFromTuples` is now `timeSeriesFromTuples`. Series data is held in a `FastShiftArray`, so dropping old data is cheap.
12
+ 5. `TrackerLabelLocation.WithMouse` was removed (`ByAxis` is the default, and `Nowhere` hides the labels).
13
+ 6. `zoomKeyModifiersRequired` now defaults to `true` (hold shift or ctrl while scrolling to zoom).
14
+ 7. The `useDataObservable` and `useInitialData` hooks were replaced by `useDataSource` and `useDataSourceRunning`.
15
+ 8. The public API is everything exported from the package root (`import {...} from "stream-charts"`); anything else is internal. Several 1.x exports were renamed or removed.
16
+
17
+ **New**
18
+ 1. Data keeps streaming while a chart is unmounted (for example, when the user navigates to another page), and a restarted data source carries on from its latest data rather than starting over.
19
+ 2. Added the `<OutlierPlot>`, which plots a series with a confidence band for each measure (for example 1σ, 2σ, 3σ), and marks the points outside a band. Includes the `<OutlierPlotTooltipContent>`, which accepts custom content through `useOutlierTooltip`.
20
+ 3. Added the `<EmptyAxis>`, a plain line for a side of the plot that has no axis.
21
+ 4. Continuous y-axes can auto-scale (grow to fit the data on screen) in the scatter, bar, and outlier plots (`autoScale`, `autoScaleMin`, `autoScaleMax`, `autoScalePadding`, `autoScaledDomain`, `onAutoScale`).
22
+ 5. The scatter plot can draw markers at each point (`markerRadius`, `hideMarkersWhileRunning`).
23
+ 6. The Poincaré plot can colorize its lines by age (`colorizeLines`, `lineStartColor`, `lineEndColor`, `lineColorSteps`).
24
+ 7. All plots can highlight the axes of the hovered series (`highlightAxesOnMouseOver`), and hand back a `resetZoom` function (`onZoomReset`) for resetting the zoom along with the axes.
25
+ 8. The bar and Poincaré plots' zoom can survive remounting (`zoomState`, `onZoomStateChange`).
26
+ 9. The chart takes a `dataUpdatePeriod`, which gives smoother scrolling when the data arrives at a known, regular period.
27
+ 10. Custom tooltip content can be built on the new `<TooltipContent>` component. The raster, bar, and Poincaré tooltips now include sparklines.
28
+ 11. Series filters are screened for regular expressions that risk catastrophic backtracking (`regexFilter`, `literalFilter`, `isSafeRegex`).
29
+ 12. A plot on the wrong kind of axis (for example, a bar plot whose x-axis is a `<ContinuousAxis>`) reports which plot, which axis, and which axis component it needs, rather than naming the old axis types. The Poincaré plot now checks its axes too. See "which axes each plot takes" in the [README](README.md).
30
+ 13. The bar plot zooms in the same direction as the other plots for the same wheel or trackpad gesture (it used to zoom the opposite way).
31
+ 14. `<ScatterPlotTooltipContent>` and `<RasterPlotTooltipContent>` take an `intervalFormatter` for the mean interval between points (or spikes), a duration, which used to be formatted by the `xValueFormatter` (or `xFormatter`), and still is, by default.
32
+ 15. A bottom x-axis' label is drawn above the chart's bottom edge, so that its descenders (as in `(ms)` or `f[n](x)`) are no longer cut off.
33
+
34
+ **Packaging and documentation**
35
+ 1. Dependencies are now declared correctly (in 1.x they were all listed only as development dependencies, so none were installed with the package). React 19, RxJS 7, and d3 7 are peer dependencies, so the library shares the application's copies (`npm install stream-charts react react-dom rxjs d3`). The small utilities the library uses internally (`result-fn`, `fast-shift-array`, `safe-regex`), and d3's type definitions, are installed with the package.
36
+ 2. Built with TypeScript 6 and tested with Jest 30.
37
+ 3. Rewrote the README for the new API, with a quick start, a migration guide, and links to the example project's guides and tutorials. The API docs now cover the public API only.
38
+
39
+ ## version 1.2.1 (doc update)
40
+
41
+ Added videos of the charts to the documentation.
42
+
3
43
  ## version 1.2.0 (legend)
4
44
 
5
45
  Added a legend that can be external to the chart or internal (under the SVG element). When mousing over a legend item, the corresponding series is highlighted. And when mousing over a series, the corresponding legend item is highlighted.
@@ -1,40 +1,37 @@
1
- import { JSX } from 'react';
2
- import { Margin } from "./styling/margins";
3
- import { SvgStyle } from "./styling/svgStyle";
4
- import { SeriesStyle } from "./axes/axes";
5
- import { Observable, Subscription } from "rxjs";
6
- import { BaseSeries } from "./series/baseSeries";
7
- import { ChartData } from "./observables/ChartData";
1
+ import { type JSX } from 'react';
2
+ import { type Margin } from "./styling/margins";
3
+ import type { SvgStyle } from "./styling/svgStyle";
4
+ import type { BaseAxis, SeriesStyle } from "./axes/axes";
5
+ import type { ChartData } from "./observables/ChartData";
8
6
  import { AxisInterval } from "./axes/AxisInterval";
7
+ import type { BaseAxisRange } from "./axes/BaseAxisRange";
8
+ import type { StreamingDataSource } from "./datasources/StreamingDataSource";
9
9
  /**
10
- * @param chartId A unique identifier for the chart. This is used to identify the chart in the DOM.
10
+ * @param chartId A unique identifier for the chart. This is used to namespace draw-handles registered
11
+ * with the chart's canvas context.
11
12
  * @param width The width of the chart container
12
13
  * @param height The height of the chart container
13
14
  * @param margin The margin between the edges of the chart container and the axes
14
- * @param color The base/default color of the chart lines. This can be overridden by the {@link Props.svgStyle} property.
15
- * @param backgroundColor The base/default background color. This can be overridden by the {@link Props.svgStyle} property.
16
- * @param svgStyle Overrides for the SVG style
15
+ * @param color The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
16
+ * @param backgroundColor The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
17
+ * @param svgStyle Overrides for the chart container's CSS style
17
18
  * @param seriesStyles Map holding the series name to the series style associated with that series.
18
- * @param initialData Initial (static) data to plot before subscribing to the {@link ChartData} observable.
19
- * @param asChartData Optional conversion function that converts an array of base-series with datum type D to a
20
- * descendent of a {@link ChartData} object
21
19
  * @param seriesFilter Regular expression that filters which series to display on the plot. Can be update while streaming
22
- * @param seriesObservable {@link ChartData} RxJS `Observable` that feeds the chart data to display (i.e. the data stream).
20
+ * @param dataSource The application-owned {@link StreamingDataSource} that holds (and ingests) the chart's data
23
21
  * @param windowingTime The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
24
22
  * a lever to reduce the lag between real-time and chart-time when a large amount of data is being
25
- * sourced by the observable. Smaller time-windows result in smoother scrolling, but more updates, and
23
+ * ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
26
24
  * possibly a larger lag.
27
- * @param shouldSubscribe When switching to `true` from `false`, subscribes to the {@link seriesObservable}. When switching
28
- * to `false` from `true`, unsubscribes from the {@link seriesObservable}.
29
- * @param onSubscribe Callback when the chart subscribes to the {@link ChartData} observable
25
+ * @param dataUpdatePeriod The period (ms) at which the data source's generator emits new data, when known
30
26
  * @param onUpdateAxesBounds Callback when the time range changes. This is generally used by plots where the
31
27
  * x-axis starts to scroll as the data streams in past the end of the current time
32
28
  * @param onUpdateChartTime Callback for updating the current chart time. This is generally used by plots
29
+ * whose axes don't represent time (e.g. the Poincaré plot)
33
30
  * @template CD refers to the chart-data that is used by the Observable that has the stream of data.
34
31
  * @template D refers to the datum in the data-series
35
32
  * @template S refers to the type for the series style
36
33
  */
37
- export interface Props<CD, D, S extends SeriesStyle> {
34
+ export interface Props<CD extends ChartData, D, S extends SeriesStyle> {
38
35
  chartId: number;
39
36
  /**
40
37
  * The width of the chart container
@@ -49,56 +46,48 @@ export interface Props<CD, D, S extends SeriesStyle> {
49
46
  */
50
47
  margin?: Partial<Margin>;
51
48
  /**
52
- * The base/default color of the chart lines. This can be overridden by the {@link Props.svgStyle} property.
49
+ * The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
53
50
  */
54
51
  color?: string;
55
52
  /**
56
- * The base/default background color. This can be overridden by the {@link Props.svgStyle} property.
53
+ * The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
57
54
  */
58
55
  backgroundColor?: string;
59
56
  /**
60
- * Overrides for the SVG style
57
+ * Overrides for the chart container's CSS style
61
58
  */
62
59
  svgStyle?: Partial<SvgStyle>;
63
60
  /**
64
61
  * Map holding the series name to the series style associated with that series.
65
62
  */
66
63
  seriesStyles?: Map<string, S>;
67
- /**
68
- * Initial (static) data to plot before subscribing to the {@link ChartData} observable.
69
- */
70
- initialData: Array<BaseSeries<D>>;
71
- /**
72
- * Optional conversion function that converts an array of base-series with datum type D to a
73
- * descendent of a {@link ChartData} object
74
- * @param initialData The initial array of series
75
- */
76
- asChartData?: (initialData: Array<BaseSeries<D>>) => CD;
77
64
  /**
78
65
  * Regular expression that filters which series to display on the plot. Can be update while streaming
79
66
  */
80
67
  seriesFilter?: RegExp;
81
68
  /**
82
- * {@link ChartData} RxJS `Observable` that feeds the chart data to display (i.e. the data stream).
69
+ * The application-owned source of the chart's data (see {@link StreamingDataSource}). The chart
70
+ * and its plots read their series from the data source, and redraw as it ingests new data --
71
+ * they never subscribe to the data stream themselves. The application starts and stops the
72
+ * data source (e.g. Run/Pause), and the data source keeps ingesting while the chart is
73
+ * unmounted (e.g. the user navigated to another page), so the chart picks up where it left
74
+ * off when it remounts.
83
75
  */
84
- seriesObservable?: Observable<CD>;
76
+ dataSource: StreamingDataSource<CD, D>;
85
77
  /**
86
78
  * The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
87
79
  * a lever to reduce the lag between real-time and chart-time when a large amount of data is being
88
- * sourced by the observable. Smaller time-windows result in smoother scrolling, but more updates, and
80
+ * ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
89
81
  * possibly a larger lag.
90
82
  */
91
83
  windowingTime?: number;
92
84
  /**
93
- * When switching to `true` from `false`, subscribes to the {@link seriesObservable}. When switching
94
- * to `false` from `true`, unsubscribes from the {@link seriesObservable}.
85
+ * The period (ms) at which the data source's generator emits new data, when known. When
86
+ * provided, buffering switches from wall-clock-based to a fixed tick count derived from
87
+ * `windowingTime / dataUpdatePeriod`, avoiding a jittery scroll that can otherwise result once
88
+ * the axis auto-scrolls (see the view drivers in `subscriptions/viewDrivers.ts`).
95
89
  */
96
- shouldSubscribe?: boolean;
97
- /**
98
- * Callback when the chart subscribes to the {@link ChartData} observable
99
- * @param subscription The RxJS subscription
100
- */
101
- onSubscribe?: (subscription: Subscription) => void;
90
+ dataUpdatePeriod?: number;
102
91
  /**
103
92
  * Callback when the time range changes. This is generally used by plots where the
104
93
  * x-axis starts to scroll as the data streams in past the end of the current time
@@ -115,103 +104,10 @@ export interface Props<CD, D, S extends SeriesStyle> {
115
104
  * @param time The current chart time
116
105
  */
117
106
  onUpdateChartTime?: (time: number) => void;
118
- /**
119
- * Callback function that is called when new data arrives to the chart.
120
- * @param seriesName The name of the series for which new data arrived
121
- * @param data The new data that arrived in the windowing tine
122
- * @see UseChartValues.windowingTime
123
- */
124
- onUpdateData?: (seriesName: string, data: Array<D>) => void;
125
107
  /**
126
108
  * The child components of the chart (i.e. the axis, plot, tracker, tooltip)
127
109
  */
128
110
  children: JSX.Element | Array<JSX.Element>;
129
111
  }
130
- /**
131
- * The chart container that holds the axes, plot, tracker, and tooltip. The chart manages the
132
- * subscription, sets up the {@link useChart} hook via the {@link ChartProvider}.
133
- * @param props The properties of the chart
134
- * @template CD Chart data
135
- * @template D The type of the datum type held in a series
136
- * @template S The type of the series style
137
- * @template TM The type of the tooltip metadata (the data about the series). If not specified,
138
- * defaults to an empty object
139
- * @example
140
- *
141
-
142
- <Chart
143
- width={useGridCellWidth()}
144
- height={useGridCellHeight()}
145
- margin={{...defaultMargin, top: 60, right: 75, left: 70}}
146
- color={theme.color}
147
- backgroundColor={theme.backgroundColor}
148
- seriesStyles={new Map([
149
- ['neuron1', {
150
- ...defaultLineStyle,
151
- color: 'orange',
152
- lineWidth: 2,
153
- highlightColor: 'orange'
154
- }],
155
- ['neuron6', {
156
- ...defaultLineStyle,
157
- color: theme.name === 'light' ? 'blue' : 'gray',
158
- lineWidth: 3,
159
- highlightColor: theme.name === 'light' ? 'blue' : 'gray',
160
- highlightWidth: 5
161
- }],
162
- ])}
163
- initialData={initialDataRef.current}
164
- seriesFilter={filter}
165
- seriesObservable={observableRef.current}
166
- shouldSubscribe={running}
167
- onUpdateTime={handleChartTimeUpdate}
168
- windowingTime={150}
169
- >
170
- <ContinuousAxis
171
- axisId="x-axis-1"
172
- location={AxisLocation.Bottom}
173
- domain={[0, 5000]}
174
- label="t (ms)"
175
- />
176
- <CategoryAxis
177
- axisId="y-axis-1"
178
- location={AxisLocation.Left}
179
- categories={initialDataRef.current.map(series => series.name)}
180
- label="neuron"
181
- />
182
- <CategoryAxis
183
- axisId="y-axis-2"
184
- location={AxisLocation.Right}
185
- categories={initialDataRef.current.map(series => series.name)}
186
- label="neuron"
187
- />
188
- <Tracker
189
- visible={visibility.tracker}
190
- labelLocation={TrackerLabelLocation.WithMouse}
191
- style={{color: theme.color}}
192
- font={{color: theme.color}}
193
- />
194
- <Tooltip
195
- visible={visibility.tooltip}
196
- style={{
197
- fontColor: theme.color,
198
- backgroundColor: theme.backgroundColor,
199
- borderColor: theme.color,
200
- backgroundOpacity: 0.9,
201
- }}
202
- >
203
- <RasterPlotTooltipContent
204
- xFormatter={value => formatNumber(value, " ,.0f") + ' ms'}
205
- yFormatter={value => formatNumber(value, " ,.1f") + ' mV'}
206
- />
207
- </Tooltip>
208
- <RasterPlot
209
- spikeMargin={1}
210
- dropDataAfter={5000}
211
- panEnabled={true}
212
- zoomEnabled={true}
213
- zoomKeyModifiersRequired={true}
214
- />
215
- </Chart>
216
- */
217
- export declare function Chart<CD extends ChartData, D, S extends SeriesStyle, TM>(props: Props<CD, D, S>): JSX.Element;
112
+ export declare function Chart<CD extends ChartData, D, S extends SeriesStyle, TM, AR extends BaseAxisRange, A extends BaseAxis>(props: Props<CD, D, S>): JSX.Element;
113
+ //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AE,EAAE,CAAC,CAAC,CAAA;IACtC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,IAAI,CAAA;IAChE;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAE1C;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CAC9C;AAuGD,wBAAgB,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,SAAS,aAAa,EAAE,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAyF3J"}
@@ -1,22 +1,32 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef } from 'react';
3
- import { plotDimensionsFrom } from "./styling/margins";
4
- import { initialSvgStyle } from "./styling/svgStyle";
5
- import ChartProvider from "./hooks/useChart";
6
- import PlotDimensionsProvider, { defaultMargin } from "./hooks/usePlotDimensions";
7
- import * as d3 from "d3";
8
- import { createPlotContainer } from "./plots/plot";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
9
3
  import { noop } from "./utils";
10
- import AxesProvider from "./hooks/useAxes";
11
- import MouseProvider from "./hooks/useMouse";
12
- import TooltipProvider from "./hooks/useTooltip";
13
- import DataObservableProvider from './hooks/useDataObservable';
14
- import InitialDataProvider from "./hooks/useInitialData";
4
+ import { defaultMargin } from "./hooks/defaultPlotDimensions";
5
+ import PlotDimensionsProvider from "./hooks/PlotDimensionsProvider";
6
+ import CanvasSurfaceProvider from "./hooks/CanvasSurfaceProvider";
7
+ import InteractionProvider from "./hooks/InteractionProvider";
8
+ import ChartProvider from "./hooks/ChartProvider";
9
+ import AxesProvider from "./hooks/AxesProvider";
10
+ import { isSafeRegex } from "./filters/regexFilter";
11
+ import { ChartDataContext } from "./hooks/useDataSource";
15
12
  const defaultBackground = '#202020';
16
13
  /**
17
- * The chart container that holds the axes, plot, tracker, and tooltip. The chart manages the
18
- * subscription, sets up the {@link useChart} hook via the {@link ChartProvider}.
14
+ * The chart container that holds the axes, plot, tracker, and tooltip. The chart reads its data
15
+ * from the application-owned data source (its `dataSource` prop), and sets up the
16
+ * {@link useChart} hook via the {@link ChartProvider}.
17
+ *
18
+ * Internally, the chart is backed by a single `<canvas>` element rather than an SVG element tree.
19
+ * The canvas itself is created and sized by {@link CanvasSurfaceProvider}, which derives its size
20
+ * from {@link usePlotDimensions} (the single source of truth for the chart's dimensions) rather
21
+ * than from this component's `width`/`height` props directly -- this keeps the canvas correctly
22
+ * sized even if dimensions are ever updated via `usePlotDimensions().updateDimensions(...)`
23
+ * independent of a prop change. Axes, plots, and the tracker don't create/mutate their own DOM
24
+ * nodes -- they register a draw function with the {@link CanvasContext} (exposed via
25
+ * `useChart().canvasContext`, itself sourced from {@link CanvasSurfaceProvider} via
26
+ * `useCanvasSurface()`), and the canvas context clears and repaints all registered draw functions
27
+ * whenever a redraw is requested.
19
28
  * @param props The properties of the chart
29
+ * @return The chart, with its children inside the chart's context providers
20
30
  * @template CD Chart data
21
31
  * @template D The type of the datum type held in a series
22
32
  * @template S The type of the series style
@@ -33,24 +43,22 @@ const defaultBackground = '#202020';
33
43
  backgroundColor={theme.backgroundColor}
34
44
  seriesStyles={new Map([
35
45
  ['neuron1', {
36
- ...defaultLineStyle,
46
+ ...defaultLineStyle(),
37
47
  color: 'orange',
38
48
  lineWidth: 2,
39
49
  highlightColor: 'orange'
40
50
  }],
41
51
  ['neuron6', {
42
- ...defaultLineStyle,
52
+ ...defaultLineStyle(),
43
53
  color: theme.name === 'light' ? 'blue' : 'gray',
44
54
  lineWidth: 3,
45
55
  highlightColor: theme.name === 'light' ? 'blue' : 'gray',
46
56
  highlightWidth: 5
47
57
  }],
48
58
  ])}
49
- initialData={initialDataRef.current}
59
+ dataSource={dataSource}
50
60
  seriesFilter={filter}
51
- seriesObservable={observableRef.current}
52
- shouldSubscribe={running}
53
- onUpdateTime={handleChartTimeUpdate}
61
+ onUpdateAxesBounds={handleChartTimeUpdate}
54
62
  windowingTime={150}
55
63
  >
56
64
  <ContinuousAxis
@@ -59,16 +67,16 @@ const defaultBackground = '#202020';
59
67
  domain={[0, 5000]}
60
68
  label="t (ms)"
61
69
  />
62
- <CategoryAxis
70
+ <OrdinalAxis
63
71
  axisId="y-axis-1"
64
72
  location={AxisLocation.Left}
65
- categories={initialDataRef.current.map(series => series.name)}
73
+ categories={dataSource.seriesList().map(series => series.name)}
66
74
  label="neuron"
67
75
  />
68
- <CategoryAxis
76
+ <OrdinalAxis
69
77
  axisId="y-axis-2"
70
78
  location={AxisLocation.Right}
71
- categories={initialDataRef.current.map(series => series.name)}
79
+ categories={dataSource.seriesList().map(series => series.name)}
72
80
  label="neuron"
73
81
  />
74
82
  <Tracker
@@ -93,52 +101,53 @@ const defaultBackground = '#202020';
93
101
  </Tooltip>
94
102
  <RasterPlot
95
103
  spikeMargin={1}
96
- dropDataAfter={5000}
97
104
  panEnabled={true}
98
105
  zoomEnabled={true}
99
106
  zoomKeyModifiersRequired={true}
100
107
  />
101
108
  </Chart>
102
109
  */
110
+ // the defaults (constants, so that their identity doesn't change from one render to the next)
111
+ const NO_SERIES_STYLES = new Map();
112
+ const MATCH_EVERYTHING = /./;
103
113
  export function Chart(props) {
104
- const { chartId, width, height, color = '#d2933f', backgroundColor = defaultBackground, seriesStyles = new Map(), initialData, asChartData, seriesFilter = /./, seriesObservable, windowingTime = 100, shouldSubscribe = true, onSubscribe = noop, onUpdateAxesBounds = noop, onUpdateChartTime = noop, onUpdateData = noop, children, } = props;
105
- // override the defaults with the parent's properties, leaving any unset values as the default value
106
- const margin = Object.assign(Object.assign({}, defaultMargin), props.margin);
107
- const svgStyle = useMemo(() => (Object.assign(Object.assign(Object.assign({}, initialSvgStyle), props.svgStyle), { width: props.width, height: props.height })), [props.height, props.svgStyle, props.width]);
108
- // hold a reference to the current width and the plot dimensions
109
- const plotDimRef = useRef(plotDimensionsFrom(width, height, margin));
110
- // the container that holds the d3 svg element
111
- const mainGRef = useRef(null);
112
- const containerRef = useRef(null);
113
- const hoveredSeriesRef = useRef(null);
114
- // creates the main <g> element for the chart if it doesn't already exist, otherwise
115
- // updates the svg element with the updated dimensions or style properties
116
- useEffect(() => {
117
- if (containerRef.current) {
118
- // create the main SVG element if it doesn't already exist
119
- if (!mainGRef.current) {
120
- mainGRef.current = createPlotContainer(chartId, containerRef.current, plotDimRef.current, color);
121
- }
122
- // build up the svg style from the defaults and any svg style object
123
- // passed in as properties
124
- const style = Object.getOwnPropertyNames(svgStyle)
125
- .map(name => `${name}: ${svgStyle[name]}; `)
126
- .join("");
127
- // when the chart "backgroundColor" property is set (i.e. not the default value),
128
- // then we need add it to the styles, overwriting any color that may have been
129
- // set in the svg style object
130
- const background = backgroundColor !== defaultBackground ?
131
- `background-color: ${backgroundColor}; ` :
132
- '';
133
- // update the dimension and style
134
- d3.select(containerRef.current)
135
- .attr('width', width)
136
- .attr('height', height)
137
- .attr('style', style + background + ` color: ${color}`);
138
- }
139
- }, [color, backgroundColor, height, svgStyle, width, chartId]);
140
- return (_jsxs(_Fragment, { children: [_jsx("svg", { ref: containerRef }), _jsx(PlotDimensionsProvider, { containerDimensions: { width, height }, margin: margin, children: _jsx(AxesProvider, { onUpdateAxesInterval: onUpdateAxesBounds, children: _jsx(MouseProvider, { children: _jsx(TooltipProvider, { children: _jsx(InitialDataProvider, { initialData: initialData, asChartData: asChartData, children: _jsx(DataObservableProvider, { seriesObservable: seriesObservable, windowingTime: windowingTime, shouldSubscribe: shouldSubscribe, onSubscribe: onSubscribe, onUpdateData: onUpdateData, onUpdateChartTime: onUpdateChartTime, children: _jsx(ChartProvider, { chartId: chartId, container: containerRef.current, mainG: mainGRef.current, color: color, backgroundColor: backgroundColor, svgStyle: svgStyle, seriesStyles: seriesStyles, seriesFilter: seriesFilter, hoveredSeriesRef: hoveredSeriesRef, children:
141
- // the chart elements are the children
142
- children }) }) }) }) }) }) })] }));
114
+ const { chartId, width, height, color = '#d2933f', backgroundColor = defaultBackground, seriesStyles = NO_SERIES_STYLES, seriesFilter = MATCH_EVERYTHING, dataSource, windowingTime = 100, dataUpdatePeriod, onUpdateAxesBounds = noop, onUpdateChartTime = noop, children, } = props;
115
+ // the series the data source held when it was handed to the chart. Memoized on the data source
116
+ // ALONE: a new data source means new initial data, and the plots reset themselves when the
117
+ // initial data changes -- so it must not change when anything else does (e.g. a new
118
+ // `onUpdateChartTime` callback on every render of the chart's parent, which would otherwise
119
+ // reset the plots on every render)
120
+ const initialData = useMemo(() => dataSource.seriesList(), [dataSource]);
121
+ // the chart's data: the data source, its initial data, and the streaming settings
122
+ const chartData = useMemo(() => ({
123
+ dataSource: dataSource,
124
+ initialData,
125
+ windowingTime,
126
+ dataUpdatePeriod,
127
+ onUpdateChartTime
128
+ }), [dataSource, initialData, windowingTime, dataUpdatePeriod, onUpdateChartTime]);
129
+ // override the defaults with the parent's properties, leaving any unset values as the default
130
+ // value (memoized on the margin's values, so that a new `margin` object with the same values
131
+ // doesn't change the plot dimensions' context)
132
+ const { top, bottom, left, right } = { ...defaultMargin, ...props.margin };
133
+ const margin = useMemo(() => ({ top, bottom, left, right }), [top, bottom, left, right]);
134
+ const containerDimensions = useMemo(() => ({ width, height }), [width, height]);
135
+ // `seriesFilter` is tested against every series name on every redraw frame by each plot
136
+ // component (not just once), so an unvetted pattern -- e.g. one built directly from
137
+ // free-text user input without going through the `regexFilter` helper, which already screens
138
+ // for this -- could freeze the whole render loop with catastrophic backtracking. This is the
139
+ // one place every `seriesFilter`, however it was constructed, necessarily passes through
140
+ // before reaching a plot, so it's checked here too, falling back to the safe match-everything
141
+ // default rather than ever handing plots something that could hang them.
142
+ const safeSeriesFilter = useMemo(() => {
143
+ if (isSafeRegex(seriesFilter))
144
+ return seriesFilter;
145
+ console.warn(`seriesFilter regex risks catastrophic backtracking and was ignored; ` +
146
+ `falling back to the default (match-everything) filter; pattern: ${seriesFilter}`);
147
+ return MATCH_EVERYTHING;
148
+ }, [seriesFilter]);
149
+ return (_jsx(PlotDimensionsProvider, { containerDimensions: containerDimensions, margin: margin, children: _jsx(CanvasSurfaceProvider, { chartId: chartId, color: color, backgroundColor: backgroundColor, svgStyle: props.svgStyle, children: _jsx(AxesProvider, { onUpdateAxesInterval: onUpdateAxesBounds, children: _jsx(InteractionProvider, { children: _jsx(ChartDataContext.Provider, { value: chartData, children: _jsx(ChartProvider, { chartId: chartId, color: color, backgroundColor: backgroundColor, seriesStyles: seriesStyles, seriesFilter: safeSeriesFilter, children:
150
+ // the chart elements are the children
151
+ children }) }) }) }) }) }));
143
152
  }
144
153
  //# sourceMappingURL=Chart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/app/charts/Chart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAA;AACrD,OAAO,EAAqB,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,eAAe,EAAW,MAAM,oBAAoB,CAAC;AAE7D,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,sBAAsB,EAAE,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,C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IACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,gBAAgB;4BAG1B,sCAAsC;4BACtC,QAAQ,GAEA,GACQ,GACV,GACX,GACK,GACH,CAC5B,CAAC;AACN,CAAC"}
@@ -1,14 +1,18 @@
1
- import { BaseAxis } from "./axes";
1
+ import type { BaseAxis } from "./axes";
2
2
  import { Optional } from "result-fn";
3
3
  /**
4
- * Holds the information to allow mapping axes names to the underlying axes objects.
5
- * These objects hold the axis ID, its location on the chart (i.e. left, right, bottom, upper)
6
- * and the underlying d3 selection objects for managing the axes. Axis objects that extend
7
- * the `BaseAxis` class may have additional properties.
4
+ * Holds the information to allow mapping axes IDs to the underlying axes objects (of either the
5
+ * x-axes or the y-axes). These objects hold the axis ID, its location on the chart (i.e. left,
6
+ * right, bottom, top), its type, and (for the axis types that extend `BaseAxis`) its scale and the
7
+ * functions for updating and drawing it.
8
8
  * @typeParam A The type of the axes (must extend `BaseAxis`)
9
9
  */
10
10
  export declare class AxesState<A extends BaseAxis> {
11
11
  readonly axes: Map<string, A>;
12
+ /**
13
+ * Use {@link from} or {@link empty} to create an axes state
14
+ * @param axes Mapping of the axes IDs to the axes
15
+ */
12
16
  private constructor();
13
17
  /**
14
18
  * Creates a new axes state from the specified map of axes.
@@ -26,12 +30,8 @@ export declare class AxesState<A extends BaseAxis> {
26
30
  */
27
31
  isEmpty(): boolean;
28
32
  /**
29
- * Creates a deep copy of the current axes state.
30
- * @return A deep copy of the current axes state.
31
- */
32
- copy(): AxesState<A>;
33
- /**
34
- * Adds an axis to the current axis state and returns a new axis state. This is an internal state
33
+ * Adds an axis to this axes state's map of axes (in place), and returns a new axes state holding
34
+ * that same map (a new object, so that React sees the change). This is an internal state
35
35
  * management function. This should generally not be used. Instead, use the {@link UseAxesValues.addXAxis}
36
36
  * and {@link UseAxesValues.addYAxis} functions to add axes.
37
37
  * @param axis The axis to add
@@ -42,23 +42,31 @@ export declare class AxesState<A extends BaseAxis> {
42
42
  */
43
43
  addAxis(axis: A, id: string): AxesState<A>;
44
44
  /**
45
- * Attempts to retrieve the x-axis for the specified ID
46
- * @param axisId The unique ID of the axis
47
- * @return The axis, or undefined if no axis with the specified ID is found
45
+ * Attempts to retrieve the axis for the specified ID.
46
+ * @param axisId The unique ID of the axis, or `""` to request the default axis (the
47
+ * convention used throughout this library wherever a series has no explicit axis
48
+ * assignment -- see e.g. each plot component's own `axesFor` helper).
49
+ * @return The axis matching `axisId`; the default axis (see {@link defaultAxis}) if
50
+ * `axisId` is `""` and at least one axis exists; otherwise an empty `Optional`. A non-empty
51
+ * `axisId` that doesn't match any axis is deliberately treated as "not found" rather than
52
+ * silently substituting an unrelated axis -- that used to happen for *any* unmatched ID,
53
+ * which masked stale/mistyped axis IDs as if they'd resolved correctly.
48
54
  */
49
55
  axisFor(axisId: string): Optional<A>;
50
56
  /**
51
- * Returns the default axis
52
- * @return The default axis
57
+ * Returns the default axis: the first axis added
58
+ * @return The default axis, or an empty `Optional` when there are no axes
53
59
  * @see axisDefaultId
54
60
  */
55
61
  defaultAxis(): Optional<A>;
56
62
  /**
57
- * @return An array holding all existing the x-axis IDs
63
+ * @return An array holding the IDs of all the axes
58
64
  */
59
65
  axisIds(): Array<string>;
60
66
  /**
61
- * @return The default name of the x-axis (in case only on default axis was added)
67
+ * @return The ID of the default axis (the first axis added), or an empty `Optional` when there
68
+ * are no axes
62
69
  */
63
70
  axisDefaultId(): Optional<string>;
64
71
  }
72
+ //# sourceMappingURL=AxesState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxesState.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxesState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,QAAQ;IACrC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAE7B;;;OAGG;IACH,OAAO;IAIP;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAInE;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;IAIhD;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAK1C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;IAQpC;;;;OAIG;IACH,WAAW,IAAI,QAAQ,CAAC,CAAC,CAAC;IAO1B;;OAEG;IACH,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;IAIxB;;;OAGG;IACH,aAAa,IAAI,QAAQ,CAAC,MAAM,CAAC;CAMpC"}