@sqlrooms/mosaic 0.29.0-rc.3 → 0.29.0-rc.5

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 (472) hide show
  1. package/README.md +90 -1
  2. package/dist/MosaicChartBuilder.d.ts +0 -4
  3. package/dist/MosaicChartBuilder.d.ts.map +1 -1
  4. package/dist/MosaicChartBuilder.js +0 -6
  5. package/dist/MosaicChartBuilder.js.map +1 -1
  6. package/dist/MosaicSlice.d.ts +17 -10
  7. package/dist/MosaicSlice.d.ts.map +1 -1
  8. package/dist/MosaicSlice.js +4 -1
  9. package/dist/MosaicSlice.js.map +1 -1
  10. package/dist/boxplot/BoxPlotClient.d.ts +58 -0
  11. package/dist/boxplot/BoxPlotClient.d.ts.map +1 -0
  12. package/dist/boxplot/BoxPlotClient.js +264 -0
  13. package/dist/boxplot/BoxPlotClient.js.map +1 -0
  14. package/dist/chart/MosaicDashboardChart.d.ts +14 -0
  15. package/dist/chart/MosaicDashboardChart.d.ts.map +1 -0
  16. package/dist/chart/MosaicDashboardChart.js +21 -0
  17. package/dist/chart/MosaicDashboardChart.js.map +1 -0
  18. package/dist/chart/MosaicDashboardChartContent.d.ts +16 -0
  19. package/dist/chart/MosaicDashboardChartContent.d.ts.map +1 -0
  20. package/dist/chart/MosaicDashboardChartContent.js +18 -0
  21. package/dist/chart/MosaicDashboardChartContent.js.map +1 -0
  22. package/dist/chart/MosaicDashboardChartHeaderActions.d.ts +4 -0
  23. package/dist/chart/MosaicDashboardChartHeaderActions.d.ts.map +1 -0
  24. package/dist/chart/MosaicDashboardChartHeaderActions.js +16 -0
  25. package/dist/chart/MosaicDashboardChartHeaderActions.js.map +1 -0
  26. package/dist/chart/MosaicDashboardChartRenderer.d.ts +3 -0
  27. package/dist/chart/MosaicDashboardChartRenderer.d.ts.map +1 -0
  28. package/dist/chart/MosaicDashboardChartRenderer.js +31 -0
  29. package/dist/chart/MosaicDashboardChartRenderer.js.map +1 -0
  30. package/dist/chart/MosaicDashboardComponentChart.d.ts +14 -0
  31. package/dist/chart/MosaicDashboardComponentChart.d.ts.map +1 -0
  32. package/dist/chart/MosaicDashboardComponentChart.js +11 -0
  33. package/dist/chart/MosaicDashboardComponentChart.js.map +1 -0
  34. package/dist/chart/MosaicDashboardVgPlotChart.d.ts +10 -0
  35. package/dist/chart/MosaicDashboardVgPlotChart.d.ts.map +1 -0
  36. package/dist/chart/MosaicDashboardVgPlotChart.js +10 -0
  37. package/dist/chart/MosaicDashboardVgPlotChart.js.map +1 -0
  38. package/dist/chart/MosaicDashboardVgPlotError.d.ts +8 -0
  39. package/dist/chart/MosaicDashboardVgPlotError.d.ts.map +1 -0
  40. package/dist/chart/MosaicDashboardVgPlotError.js +11 -0
  41. package/dist/chart/MosaicDashboardVgPlotError.js.map +1 -0
  42. package/dist/{dashboard → chart}/chart-settings/ChartSettings.d.ts +12 -7
  43. package/dist/chart/chart-settings/ChartSettings.d.ts.map +1 -0
  44. package/dist/chart/chart-settings/ChartSettings.js +71 -0
  45. package/dist/chart/chart-settings/ChartSettings.js.map +1 -0
  46. package/dist/chart/chart-settings/ChartSettingsContent.d.ts +13 -0
  47. package/dist/chart/chart-settings/ChartSettingsContent.d.ts.map +1 -0
  48. package/dist/chart/chart-settings/ChartSettingsContent.js +18 -0
  49. package/dist/chart/chart-settings/ChartSettingsContent.js.map +1 -0
  50. package/dist/chart/chart-settings/ChartSettingsContext.d.ts +27 -0
  51. package/dist/chart/chart-settings/ChartSettingsContext.d.ts.map +1 -0
  52. package/dist/chart/chart-settings/ChartSettingsContext.js +35 -0
  53. package/dist/chart/chart-settings/ChartSettingsContext.js.map +1 -0
  54. package/dist/chart/chart-settings/ChartSettingsPanel.d.ts +14 -0
  55. package/dist/chart/chart-settings/ChartSettingsPanel.d.ts.map +1 -0
  56. package/dist/chart/chart-settings/ChartSettingsPanel.js +17 -0
  57. package/dist/chart/chart-settings/ChartSettingsPanel.js.map +1 -0
  58. package/dist/chart/chart-settings/ChartSpecViewerPanel.d.ts +9 -0
  59. package/dist/chart/chart-settings/ChartSpecViewerPanel.d.ts.map +1 -0
  60. package/dist/chart/chart-settings/ChartSpecViewerPanel.js +11 -0
  61. package/dist/chart/chart-settings/ChartSpecViewerPanel.js.map +1 -0
  62. package/dist/chart/chart-settings/ChartTypeSelector.d.ts +9 -0
  63. package/dist/chart/chart-settings/ChartTypeSelector.d.ts.map +1 -0
  64. package/dist/chart/chart-settings/ChartTypeSelector.js +16 -0
  65. package/dist/chart/chart-settings/ChartTypeSelector.js.map +1 -0
  66. package/dist/chart/chart-settings/useTableColumns.d.ts.map +1 -0
  67. package/dist/{dashboard → chart}/chart-settings/useTableColumns.js +1 -1
  68. package/dist/chart/chart-settings/useTableColumns.js.map +1 -0
  69. package/dist/chart/useBrushSelectionParams.d.ts +3 -0
  70. package/dist/chart/useBrushSelectionParams.d.ts.map +1 -0
  71. package/dist/chart/useBrushSelectionParams.js +16 -0
  72. package/dist/chart/useBrushSelectionParams.js.map +1 -0
  73. package/dist/chart/useChartRetainer.d.ts +3 -0
  74. package/dist/chart/useChartRetainer.d.ts.map +1 -0
  75. package/dist/chart/useChartRetainer.js +11 -0
  76. package/dist/chart/useChartRetainer.js.map +1 -0
  77. package/dist/chart/useGenerateSpec.d.ts +13 -0
  78. package/dist/chart/useGenerateSpec.d.ts.map +1 -0
  79. package/dist/chart/useGenerateSpec.js +32 -0
  80. package/dist/chart/useGenerateSpec.js.map +1 -0
  81. package/dist/chart-builders/AggregationSelector.d.ts +11 -0
  82. package/dist/chart-builders/AggregationSelector.d.ts.map +1 -0
  83. package/dist/chart-builders/AggregationSelector.js +9 -0
  84. package/dist/chart-builders/AggregationSelector.js.map +1 -0
  85. package/dist/chart-builders/ChartBuilderActions.d.ts +2 -2
  86. package/dist/chart-builders/ChartBuilderActions.d.ts.map +1 -1
  87. package/dist/chart-builders/ChartBuilderActions.js +24 -16
  88. package/dist/chart-builders/ChartBuilderActions.js.map +1 -1
  89. package/dist/chart-builders/ChartBuilderContent.d.ts +4 -6
  90. package/dist/chart-builders/ChartBuilderContent.d.ts.map +1 -1
  91. package/dist/chart-builders/ChartBuilderContent.js.map +1 -1
  92. package/dist/chart-builders/ChartBuilderContext.d.ts +5 -6
  93. package/dist/chart-builders/ChartBuilderContext.d.ts.map +1 -1
  94. package/dist/chart-builders/ChartBuilderContext.js.map +1 -1
  95. package/dist/chart-builders/ChartBuilderDialog.d.ts +7 -10
  96. package/dist/chart-builders/ChartBuilderDialog.d.ts.map +1 -1
  97. package/dist/chart-builders/ChartBuilderDialog.js +1 -1
  98. package/dist/chart-builders/ChartBuilderDialog.js.map +1 -1
  99. package/dist/chart-builders/ChartBuilderFields.d.ts +2 -2
  100. package/dist/chart-builders/ChartBuilderFields.d.ts.map +1 -1
  101. package/dist/chart-builders/ChartBuilderFields.js +28 -14
  102. package/dist/chart-builders/ChartBuilderFields.js.map +1 -1
  103. package/dist/chart-builders/ChartBuilderRoot.d.ts +4 -6
  104. package/dist/chart-builders/ChartBuilderRoot.d.ts.map +1 -1
  105. package/dist/chart-builders/ChartBuilderRoot.js +9 -28
  106. package/dist/chart-builders/ChartBuilderRoot.js.map +1 -1
  107. package/dist/chart-builders/ColumnSelector.d.ts +15 -0
  108. package/dist/chart-builders/ColumnSelector.d.ts.map +1 -0
  109. package/dist/chart-builders/ColumnSelector.js +31 -0
  110. package/dist/chart-builders/ColumnSelector.js.map +1 -0
  111. package/dist/chart-builders/Field.d.ts +11 -0
  112. package/dist/chart-builders/Field.d.ts.map +1 -0
  113. package/dist/chart-builders/Field.js +9 -0
  114. package/dist/chart-builders/Field.js.map +1 -0
  115. package/dist/chart-builders/FieldSelectorInput.d.ts +2 -1
  116. package/dist/chart-builders/FieldSelectorInput.d.ts.map +1 -1
  117. package/dist/chart-builders/FieldSelectorInput.js +5 -5
  118. package/dist/chart-builders/FieldSelectorInput.js.map +1 -1
  119. package/dist/chart-builders/MultiFieldSelector.d.ts +14 -0
  120. package/dist/chart-builders/MultiFieldSelector.d.ts.map +1 -0
  121. package/dist/chart-builders/MultiFieldSelector.js +53 -0
  122. package/dist/chart-builders/MultiFieldSelector.js.map +1 -0
  123. package/dist/chart-builders/TemporalGranularitySelector.d.ts +10 -0
  124. package/dist/chart-builders/TemporalGranularitySelector.d.ts.map +1 -0
  125. package/dist/chart-builders/TemporalGranularitySelector.js +37 -0
  126. package/dist/chart-builders/TemporalGranularitySelector.js.map +1 -0
  127. package/dist/chart-builders/chartSpecTitle.d.ts +1 -1
  128. package/dist/chart-builders/chartSpecTitle.d.ts.map +1 -1
  129. package/dist/chart-builders/chartSpecTitle.js.map +1 -1
  130. package/dist/chart-builders/chartTypeUtils.d.ts +5 -9
  131. package/dist/chart-builders/chartTypeUtils.d.ts.map +1 -1
  132. package/dist/chart-builders/chartTypeUtils.js +24 -32
  133. package/dist/chart-builders/chartTypeUtils.js.map +1 -1
  134. package/dist/chart-builders/constants.d.ts +5 -0
  135. package/dist/chart-builders/constants.d.ts.map +1 -1
  136. package/dist/chart-builders/constants.js +13 -0
  137. package/dist/chart-builders/constants.js.map +1 -1
  138. package/dist/chart-builders/createChartBuilderStore.d.ts +5 -5
  139. package/dist/chart-builders/createChartBuilderStore.d.ts.map +1 -1
  140. package/dist/chart-builders/createChartBuilderStore.js.map +1 -1
  141. package/dist/chart-types/base-types.d.ts +112 -18
  142. package/dist/chart-types/base-types.d.ts.map +1 -1
  143. package/dist/chart-types/base-types.js +6 -1
  144. package/dist/chart-types/base-types.js.map +1 -1
  145. package/dist/chart-types/box-plot/BoxPlotSettings.d.ts +3 -0
  146. package/dist/chart-types/box-plot/BoxPlotSettings.d.ts.map +1 -0
  147. package/dist/chart-types/box-plot/BoxPlotSettings.js +9 -0
  148. package/dist/chart-types/box-plot/BoxPlotSettings.js.map +1 -0
  149. package/dist/chart-types/box-plot/definition.d.ts +3 -3
  150. package/dist/chart-types/box-plot/definition.d.ts.map +1 -1
  151. package/dist/chart-types/box-plot/definition.js +10 -36
  152. package/dist/chart-types/box-plot/definition.js.map +1 -1
  153. package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.d.ts +18 -0
  154. package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.d.ts.map +1 -0
  155. package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.js +28 -0
  156. package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.js.map +1 -0
  157. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts +9 -0
  158. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts.map +1 -0
  159. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +115 -0
  160. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -0
  161. package/dist/chart-types/box-plot/renderer/constants.d.ts +24 -0
  162. package/dist/chart-types/box-plot/renderer/constants.d.ts.map +1 -0
  163. package/dist/chart-types/box-plot/renderer/constants.js +17 -0
  164. package/dist/chart-types/box-plot/renderer/constants.js.map +1 -0
  165. package/dist/chart-types/box-plot/renderer/plot.d.ts +14 -0
  166. package/dist/chart-types/box-plot/renderer/plot.d.ts.map +1 -0
  167. package/dist/chart-types/box-plot/renderer/plot.js +91 -0
  168. package/dist/chart-types/box-plot/renderer/plot.js.map +1 -0
  169. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +14 -0
  170. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -0
  171. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js +45 -0
  172. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -0
  173. package/dist/chart-types/box-plot/renderer/utils.d.ts +6 -0
  174. package/dist/chart-types/box-plot/renderer/utils.d.ts.map +1 -0
  175. package/dist/chart-types/box-plot/renderer/utils.js +34 -0
  176. package/dist/chart-types/box-plot/renderer/utils.js.map +1 -0
  177. package/dist/chart-types/box-plot/schema.d.ts +4 -5
  178. package/dist/chart-types/box-plot/schema.d.ts.map +1 -1
  179. package/dist/chart-types/box-plot/schema.js +2 -3
  180. package/dist/chart-types/box-plot/schema.js.map +1 -1
  181. package/dist/chart-types/box-plot/tool.d.ts +44 -0
  182. package/dist/chart-types/box-plot/tool.d.ts.map +1 -0
  183. package/dist/chart-types/box-plot/tool.js +59 -0
  184. package/dist/chart-types/box-plot/tool.js.map +1 -0
  185. package/dist/chart-types/bubble-chart/BubbleChartSettings.d.ts +3 -0
  186. package/dist/chart-types/bubble-chart/BubbleChartSettings.d.ts.map +1 -0
  187. package/dist/chart-types/bubble-chart/BubbleChartSettings.js +9 -0
  188. package/dist/chart-types/bubble-chart/BubbleChartSettings.js.map +1 -0
  189. package/dist/chart-types/bubble-chart/definition.d.ts +3 -3
  190. package/dist/chart-types/bubble-chart/definition.d.ts.map +1 -1
  191. package/dist/chart-types/bubble-chart/definition.js +10 -39
  192. package/dist/chart-types/bubble-chart/definition.js.map +1 -1
  193. package/dist/chart-types/bubble-chart/schema.d.ts +2 -1
  194. package/dist/chart-types/bubble-chart/schema.d.ts.map +1 -1
  195. package/dist/chart-types/bubble-chart/schema.js +6 -3
  196. package/dist/chart-types/bubble-chart/schema.js.map +1 -1
  197. package/dist/chart-types/bubble-chart/spec.d.ts +4 -0
  198. package/dist/chart-types/bubble-chart/spec.d.ts.map +1 -0
  199. package/dist/chart-types/bubble-chart/spec.js +31 -0
  200. package/dist/chart-types/bubble-chart/spec.js.map +1 -0
  201. package/dist/chart-types/bubble-chart/tool.d.ts +46 -0
  202. package/dist/chart-types/bubble-chart/tool.d.ts.map +1 -0
  203. package/dist/chart-types/bubble-chart/tool.js +58 -0
  204. package/dist/chart-types/bubble-chart/tool.js.map +1 -0
  205. package/dist/chart-types/chart-config.d.ts +92 -0
  206. package/dist/chart-types/chart-config.d.ts.map +1 -0
  207. package/dist/chart-types/chart-config.js +47 -0
  208. package/dist/chart-types/chart-config.js.map +1 -0
  209. package/dist/chart-types/count-plot/CountPlotSettings.d.ts +3 -0
  210. package/dist/chart-types/count-plot/CountPlotSettings.d.ts.map +1 -0
  211. package/dist/chart-types/count-plot/CountPlotSettings.js +9 -0
  212. package/dist/chart-types/count-plot/CountPlotSettings.js.map +1 -0
  213. package/dist/chart-types/count-plot/definition.d.ts +3 -3
  214. package/dist/chart-types/count-plot/definition.d.ts.map +1 -1
  215. package/dist/chart-types/count-plot/definition.js +10 -41
  216. package/dist/chart-types/count-plot/definition.js.map +1 -1
  217. package/dist/chart-types/count-plot/schema.d.ts +0 -1
  218. package/dist/chart-types/count-plot/schema.d.ts.map +1 -1
  219. package/dist/chart-types/count-plot/schema.js +4 -2
  220. package/dist/chart-types/count-plot/schema.js.map +1 -1
  221. package/dist/chart-types/count-plot/spec.d.ts +4 -0
  222. package/dist/chart-types/count-plot/spec.d.ts.map +1 -0
  223. package/dist/chart-types/count-plot/spec.js +49 -0
  224. package/dist/chart-types/count-plot/spec.js.map +1 -0
  225. package/dist/chart-types/count-plot/tool.d.ts +42 -0
  226. package/dist/chart-types/count-plot/tool.d.ts.map +1 -0
  227. package/dist/chart-types/count-plot/tool.js +55 -0
  228. package/dist/chart-types/count-plot/tool.js.map +1 -0
  229. package/dist/chart-types/custom-spec/CustomSpecSettings.d.ts +7 -0
  230. package/dist/chart-types/custom-spec/CustomSpecSettings.d.ts.map +1 -0
  231. package/dist/chart-types/custom-spec/CustomSpecSettings.js +30 -0
  232. package/dist/chart-types/custom-spec/CustomSpecSettings.js.map +1 -0
  233. package/dist/chart-types/custom-spec/definition.d.ts +3 -3
  234. package/dist/chart-types/custom-spec/definition.d.ts.map +1 -1
  235. package/dist/chart-types/custom-spec/definition.js +8 -19
  236. package/dist/chart-types/custom-spec/definition.js.map +1 -1
  237. package/dist/chart-types/custom-spec/schema.d.ts +6 -3
  238. package/dist/chart-types/custom-spec/schema.d.ts.map +1 -1
  239. package/dist/chart-types/custom-spec/schema.js +3 -2
  240. package/dist/chart-types/custom-spec/schema.js.map +1 -1
  241. package/dist/chart-types/custom-spec/spec.d.ts +4 -0
  242. package/dist/chart-types/custom-spec/spec.d.ts.map +1 -0
  243. package/dist/chart-types/custom-spec/spec.js +24 -0
  244. package/dist/chart-types/custom-spec/spec.js.map +1 -0
  245. package/dist/chart-types/errors.d.ts +23 -0
  246. package/dist/chart-types/errors.d.ts.map +1 -0
  247. package/dist/chart-types/errors.js +26 -0
  248. package/dist/chart-types/errors.js.map +1 -0
  249. package/dist/chart-types/heatmap/HeatmapSettings.d.ts +3 -0
  250. package/dist/chart-types/heatmap/HeatmapSettings.d.ts.map +1 -0
  251. package/dist/chart-types/heatmap/HeatmapSettings.js +9 -0
  252. package/dist/chart-types/heatmap/HeatmapSettings.js.map +1 -0
  253. package/dist/chart-types/heatmap/definition.d.ts +3 -3
  254. package/dist/chart-types/heatmap/definition.d.ts.map +1 -1
  255. package/dist/chart-types/heatmap/definition.js +10 -40
  256. package/dist/chart-types/heatmap/definition.js.map +1 -1
  257. package/dist/chart-types/heatmap/schema.d.ts +0 -1
  258. package/dist/chart-types/heatmap/schema.d.ts.map +1 -1
  259. package/dist/chart-types/heatmap/schema.js +2 -3
  260. package/dist/chart-types/heatmap/schema.js.map +1 -1
  261. package/dist/chart-types/heatmap/spec.d.ts +4 -0
  262. package/dist/chart-types/heatmap/spec.d.ts.map +1 -0
  263. package/dist/chart-types/heatmap/spec.js +32 -0
  264. package/dist/chart-types/heatmap/spec.js.map +1 -0
  265. package/dist/chart-types/heatmap/tool.d.ts +44 -0
  266. package/dist/chart-types/heatmap/tool.d.ts.map +1 -0
  267. package/dist/chart-types/heatmap/tool.js +59 -0
  268. package/dist/chart-types/heatmap/tool.js.map +1 -0
  269. package/dist/chart-types/histogram/HistogramSettings.d.ts +3 -0
  270. package/dist/chart-types/histogram/HistogramSettings.d.ts.map +1 -0
  271. package/dist/chart-types/histogram/HistogramSettings.js +9 -0
  272. package/dist/chart-types/histogram/HistogramSettings.js.map +1 -0
  273. package/dist/chart-types/histogram/definition.d.ts +3 -3
  274. package/dist/chart-types/histogram/definition.d.ts.map +1 -1
  275. package/dist/chart-types/histogram/definition.js +10 -40
  276. package/dist/chart-types/histogram/definition.js.map +1 -1
  277. package/dist/chart-types/histogram/schema.d.ts +0 -1
  278. package/dist/chart-types/histogram/schema.d.ts.map +1 -1
  279. package/dist/chart-types/histogram/schema.js +4 -2
  280. package/dist/chart-types/histogram/schema.js.map +1 -1
  281. package/dist/chart-types/histogram/spec.d.ts +4 -0
  282. package/dist/chart-types/histogram/spec.d.ts.map +1 -0
  283. package/dist/chart-types/histogram/spec.js +36 -0
  284. package/dist/chart-types/histogram/spec.js.map +1 -0
  285. package/dist/chart-types/histogram/tool.d.ts +42 -0
  286. package/dist/chart-types/histogram/tool.d.ts.map +1 -0
  287. package/dist/chart-types/histogram/tool.js +55 -0
  288. package/dist/chart-types/histogram/tool.js.map +1 -0
  289. package/dist/chart-types/index.d.ts +102 -96
  290. package/dist/chart-types/index.d.ts.map +1 -1
  291. package/dist/chart-types/index.js +71 -41
  292. package/dist/chart-types/index.js.map +1 -1
  293. package/dist/chart-types/line-chart/LineChartSettings.d.ts +7 -0
  294. package/dist/chart-types/line-chart/LineChartSettings.d.ts.map +1 -0
  295. package/dist/chart-types/line-chart/LineChartSettings.js +22 -0
  296. package/dist/chart-types/line-chart/LineChartSettings.js.map +1 -0
  297. package/dist/chart-types/line-chart/definition.d.ts +3 -3
  298. package/dist/chart-types/line-chart/definition.d.ts.map +1 -1
  299. package/dist/chart-types/line-chart/definition.js +10 -37
  300. package/dist/chart-types/line-chart/definition.js.map +1 -1
  301. package/dist/chart-types/line-chart/schema.d.ts +69 -3
  302. package/dist/chart-types/line-chart/schema.d.ts.map +1 -1
  303. package/dist/chart-types/line-chart/schema.js +30 -3
  304. package/dist/chart-types/line-chart/schema.js.map +1 -1
  305. package/dist/chart-types/line-chart/spec.d.ts +4 -0
  306. package/dist/chart-types/line-chart/spec.d.ts.map +1 -0
  307. package/dist/chart-types/line-chart/spec.js +91 -0
  308. package/dist/chart-types/line-chart/spec.js.map +1 -0
  309. package/dist/chart-types/line-chart/tool.d.ts +68 -0
  310. package/dist/chart-types/line-chart/tool.d.ts.map +1 -0
  311. package/dist/chart-types/line-chart/tool.js +66 -0
  312. package/dist/chart-types/line-chart/tool.js.map +1 -0
  313. package/dist/chart-types/tool-schemas.d.ts +8 -0
  314. package/dist/chart-types/tool-schemas.d.ts.map +1 -0
  315. package/dist/chart-types/tool-schemas.js +18 -0
  316. package/dist/chart-types/tool-schemas.js.map +1 -0
  317. package/dist/chart-types/tool-types.d.ts +26 -0
  318. package/dist/chart-types/tool-types.d.ts.map +1 -0
  319. package/dist/chart-types/tool-types.js +2 -0
  320. package/dist/chart-types/tool-types.js.map +1 -0
  321. package/dist/chart-types/tool-validation.d.ts +3 -0
  322. package/dist/chart-types/tool-validation.d.ts.map +1 -0
  323. package/dist/chart-types/tool-validation.js +11 -0
  324. package/dist/chart-types/tool-validation.js.map +1 -0
  325. package/dist/chart-types/useChartTypeDefinition.d.ts +3 -0
  326. package/dist/chart-types/useChartTypeDefinition.d.ts.map +1 -0
  327. package/dist/chart-types/useChartTypeDefinition.js +8 -0
  328. package/dist/chart-types/useChartTypeDefinition.js.map +1 -0
  329. package/dist/dashboard/MosaicDashboard.d.ts.map +1 -1
  330. package/dist/dashboard/MosaicDashboard.js +7 -11
  331. package/dist/dashboard/MosaicDashboard.js.map +1 -1
  332. package/dist/dashboard/MosaicDashboardEmptyState.d.ts +2 -0
  333. package/dist/dashboard/MosaicDashboardEmptyState.d.ts.map +1 -0
  334. package/dist/dashboard/MosaicDashboardEmptyState.js +50 -0
  335. package/dist/dashboard/MosaicDashboardEmptyState.js.map +1 -0
  336. package/dist/dashboard/MosaicDashboardPanelLayout.d.ts.map +1 -1
  337. package/dist/dashboard/MosaicDashboardPanelLayout.js +23 -2
  338. package/dist/dashboard/MosaicDashboardPanelLayout.js.map +1 -1
  339. package/dist/dashboard/MosaicDashboardPanels.d.ts.map +1 -1
  340. package/dist/dashboard/MosaicDashboardPanels.js +2 -1
  341. package/dist/dashboard/MosaicDashboardPanels.js.map +1 -1
  342. package/dist/dashboard/MosaicDashboardSlice.d.ts +212 -87
  343. package/dist/dashboard/MosaicDashboardSlice.d.ts.map +1 -1
  344. package/dist/dashboard/MosaicDashboardSlice.js +65 -18
  345. package/dist/dashboard/MosaicDashboardSlice.js.map +1 -1
  346. package/dist/dashboard/MosaicDashboardToolbar.d.ts.map +1 -1
  347. package/dist/dashboard/MosaicDashboardToolbar.js +9 -4
  348. package/dist/dashboard/MosaicDashboardToolbar.js.map +1 -1
  349. package/dist/dashboard/defaultPanelRenderers.d.ts.map +1 -1
  350. package/dist/dashboard/defaultPanelRenderers.js +6 -4
  351. package/dist/dashboard/defaultPanelRenderers.js.map +1 -1
  352. package/dist/dashboard/utils.d.ts +3 -0
  353. package/dist/dashboard/utils.d.ts.map +1 -0
  354. package/dist/dashboard/utils.js +16 -0
  355. package/dist/dashboard/utils.js.map +1 -0
  356. package/dist/index.d.ts +6 -9
  357. package/dist/index.d.ts.map +1 -1
  358. package/dist/index.js +5 -7
  359. package/dist/index.js.map +1 -1
  360. package/dist/{dashboard → profiler}/MosaicDashboardProfilerPanelRenderer.d.ts +1 -1
  361. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts.map +1 -0
  362. package/dist/{dashboard → profiler}/MosaicDashboardProfilerPanelRenderer.js +2 -2
  363. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js.map +1 -0
  364. package/dist/text/MosaicDashboardTextRenderer.d.ts +3 -0
  365. package/dist/text/MosaicDashboardTextRenderer.d.ts.map +1 -0
  366. package/dist/text/MosaicDashboardTextRenderer.js +46 -0
  367. package/dist/text/MosaicDashboardTextRenderer.js.map +1 -0
  368. package/package.json +38 -35
  369. package/dist/chart-builders/builders.d.ts +0 -34
  370. package/dist/chart-builders/builders.d.ts.map +0 -1
  371. package/dist/chart-builders/builders.js +0 -51
  372. package/dist/chart-builders/builders.js.map +0 -1
  373. package/dist/chart-builders/describeChartSpecs.d.ts +0 -9
  374. package/dist/chart-builders/describeChartSpecs.d.ts.map +0 -1
  375. package/dist/chart-builders/describeChartSpecs.js +0 -41
  376. package/dist/chart-builders/describeChartSpecs.js.map +0 -1
  377. package/dist/chart-builders/hooks/useChartFieldForm.d.ts +0 -13
  378. package/dist/chart-builders/hooks/useChartFieldForm.d.ts.map +0 -1
  379. package/dist/chart-builders/hooks/useChartFieldForm.js +0 -12
  380. package/dist/chart-builders/hooks/useChartFieldForm.js.map +0 -1
  381. package/dist/chart-builders/types.d.ts +0 -23
  382. package/dist/chart-builders/types.d.ts.map +0 -1
  383. package/dist/chart-builders/types.js +0 -17
  384. package/dist/chart-builders/types.js.map +0 -1
  385. package/dist/chart-types/box-plot/index.d.ts +0 -3
  386. package/dist/chart-types/box-plot/index.d.ts.map +0 -1
  387. package/dist/chart-types/box-plot/index.js +0 -3
  388. package/dist/chart-types/box-plot/index.js.map +0 -1
  389. package/dist/chart-types/bubble-chart/index.d.ts +0 -3
  390. package/dist/chart-types/bubble-chart/index.d.ts.map +0 -1
  391. package/dist/chart-types/bubble-chart/index.js +0 -3
  392. package/dist/chart-types/bubble-chart/index.js.map +0 -1
  393. package/dist/chart-types/count-plot/index.d.ts +0 -3
  394. package/dist/chart-types/count-plot/index.d.ts.map +0 -1
  395. package/dist/chart-types/count-plot/index.js +0 -3
  396. package/dist/chart-types/count-plot/index.js.map +0 -1
  397. package/dist/chart-types/custom-spec/index.d.ts +0 -3
  398. package/dist/chart-types/custom-spec/index.d.ts.map +0 -1
  399. package/dist/chart-types/custom-spec/index.js +0 -3
  400. package/dist/chart-types/custom-spec/index.js.map +0 -1
  401. package/dist/chart-types/ecdf/definition.d.ts +0 -4
  402. package/dist/chart-types/ecdf/definition.d.ts.map +0 -1
  403. package/dist/chart-types/ecdf/definition.js +0 -47
  404. package/dist/chart-types/ecdf/definition.js.map +0 -1
  405. package/dist/chart-types/ecdf/index.d.ts +0 -3
  406. package/dist/chart-types/ecdf/index.d.ts.map +0 -1
  407. package/dist/chart-types/ecdf/index.js +0 -3
  408. package/dist/chart-types/ecdf/index.js.map +0 -1
  409. package/dist/chart-types/ecdf/schema.d.ts +0 -15
  410. package/dist/chart-types/ecdf/schema.d.ts.map +0 -1
  411. package/dist/chart-types/ecdf/schema.js +0 -11
  412. package/dist/chart-types/ecdf/schema.js.map +0 -1
  413. package/dist/chart-types/heatmap/index.d.ts +0 -3
  414. package/dist/chart-types/heatmap/index.d.ts.map +0 -1
  415. package/dist/chart-types/heatmap/index.js +0 -3
  416. package/dist/chart-types/heatmap/index.js.map +0 -1
  417. package/dist/chart-types/histogram/index.d.ts +0 -3
  418. package/dist/chart-types/histogram/index.d.ts.map +0 -1
  419. package/dist/chart-types/histogram/index.js +0 -3
  420. package/dist/chart-types/histogram/index.js.map +0 -1
  421. package/dist/chart-types/line-chart/index.d.ts +0 -3
  422. package/dist/chart-types/line-chart/index.d.ts.map +0 -1
  423. package/dist/chart-types/line-chart/index.js +0 -3
  424. package/dist/chart-types/line-chart/index.js.map +0 -1
  425. package/dist/chart-types/registry.d.ts +0 -5
  426. package/dist/chart-types/registry.d.ts.map +0 -1
  427. package/dist/chart-types/registry.js +0 -28
  428. package/dist/chart-types/registry.js.map +0 -1
  429. package/dist/dashboard/MosaicDashboardProfilerPanelRenderer.d.ts.map +0 -1
  430. package/dist/dashboard/MosaicDashboardProfilerPanelRenderer.js.map +0 -1
  431. package/dist/dashboard/MosaicDashboardVgPlotHeaderActions.d.ts +0 -4
  432. package/dist/dashboard/MosaicDashboardVgPlotHeaderActions.d.ts.map +0 -1
  433. package/dist/dashboard/MosaicDashboardVgPlotHeaderActions.js +0 -29
  434. package/dist/dashboard/MosaicDashboardVgPlotHeaderActions.js.map +0 -1
  435. package/dist/dashboard/MosaicDashboardVgPlotPanelRenderer.d.ts +0 -3
  436. package/dist/dashboard/MosaicDashboardVgPlotPanelRenderer.d.ts.map +0 -1
  437. package/dist/dashboard/MosaicDashboardVgPlotPanelRenderer.js +0 -68
  438. package/dist/dashboard/MosaicDashboardVgPlotPanelRenderer.js.map +0 -1
  439. package/dist/dashboard/VgPlotSpecPopoverEditor.d.ts +0 -8
  440. package/dist/dashboard/VgPlotSpecPopoverEditor.d.ts.map +0 -1
  441. package/dist/dashboard/VgPlotSpecPopoverEditor.js +0 -40
  442. package/dist/dashboard/VgPlotSpecPopoverEditor.js.map +0 -1
  443. package/dist/dashboard/chart-settings/ChartSettings.d.ts.map +0 -1
  444. package/dist/dashboard/chart-settings/ChartSettings.js +0 -90
  445. package/dist/dashboard/chart-settings/ChartSettings.js.map +0 -1
  446. package/dist/dashboard/chart-settings/ChartSettingsContext.d.ts +0 -20
  447. package/dist/dashboard/chart-settings/ChartSettingsContext.d.ts.map +0 -1
  448. package/dist/dashboard/chart-settings/ChartSettingsContext.js +0 -14
  449. package/dist/dashboard/chart-settings/ChartSettingsContext.js.map +0 -1
  450. package/dist/dashboard/chart-settings/ChartSettingsPanel.d.ts +0 -11
  451. package/dist/dashboard/chart-settings/ChartSettingsPanel.d.ts.map +0 -1
  452. package/dist/dashboard/chart-settings/ChartSettingsPanel.js +0 -8
  453. package/dist/dashboard/chart-settings/ChartSettingsPanel.js.map +0 -1
  454. package/dist/dashboard/chart-settings/ChartTypeSelector.d.ts +0 -11
  455. package/dist/dashboard/chart-settings/ChartTypeSelector.d.ts.map +0 -1
  456. package/dist/dashboard/chart-settings/ChartTypeSelector.js +0 -17
  457. package/dist/dashboard/chart-settings/ChartTypeSelector.js.map +0 -1
  458. package/dist/dashboard/chart-settings/DynamicChartSettings.d.ts +0 -11
  459. package/dist/dashboard/chart-settings/DynamicChartSettings.d.ts.map +0 -1
  460. package/dist/dashboard/chart-settings/DynamicChartSettings.js +0 -19
  461. package/dist/dashboard/chart-settings/DynamicChartSettings.js.map +0 -1
  462. package/dist/dashboard/chart-settings/index.d.ts +0 -6
  463. package/dist/dashboard/chart-settings/index.d.ts.map +0 -1
  464. package/dist/dashboard/chart-settings/index.js +0 -6
  465. package/dist/dashboard/chart-settings/index.js.map +0 -1
  466. package/dist/dashboard/chart-settings/useTableColumns.d.ts.map +0 -1
  467. package/dist/dashboard/chart-settings/useTableColumns.js.map +0 -1
  468. package/dist/dashboard/generateMosaicChartSpec.d.ts +0 -15
  469. package/dist/dashboard/generateMosaicChartSpec.d.ts.map +0 -1
  470. package/dist/dashboard/generateMosaicChartSpec.js +0 -30
  471. package/dist/dashboard/generateMosaicChartSpec.js.map +0 -1
  472. /package/dist/{dashboard → chart}/chart-settings/useTableColumns.d.ts +0 -0
@@ -1,51 +1,59 @@
1
1
  // Re-export base types
2
2
  export * from './base-types';
3
- // Re-export all schemas and types
4
- export * from './histogram';
5
- export * from './line-chart';
6
- export * from './count-plot';
7
- export * from './ecdf';
8
- export * from './heatmap';
9
- export * from './box-plot';
10
- export * from './bubble-chart';
11
- export * from './custom-spec';
12
- export * from './registry';
3
+ // Re-export error classes for chart definitions
4
+ export * from './errors';
5
+ // CRITICAL: Export ChartConfig FIRST, before importing Settings components
6
+ // Export ChartConfig from separate file to avoid circular dependencies
7
+ // (chart-types/index imports Settings components, which import ChartSettingsContext,
8
+ // which imports ChartConfig)
9
+ export { ChartConfig } from './chart-config';
10
+ // Re-export schemas
11
+ export * from './histogram/schema';
12
+ export * from './line-chart/schema';
13
+ export * from './count-plot/schema';
14
+ export * from './heatmap/schema';
15
+ export * from './box-plot/schema';
16
+ export * from './bubble-chart/schema';
17
+ export * from './custom-spec/schema';
18
+ // Re-export Settings components
19
+ export { HistogramSettingsComponent } from './histogram/HistogramSettings';
20
+ export { LineChartSettingsComponent } from './line-chart/LineChartSettings';
21
+ export { CountPlotSettingsComponent } from './count-plot/CountPlotSettings';
22
+ export { HeatmapSettingsComponent } from './heatmap/HeatmapSettings';
23
+ export { BoxPlotSettingsComponent } from './box-plot/BoxPlotSettings';
24
+ export { BubbleChartSettingsComponent } from './bubble-chart/BubbleChartSettings';
25
+ export { CustomSpecSettingsComponent } from './custom-spec/CustomSpecSettings';
26
+ // Re-export definitions
27
+ export * from './histogram/definition';
28
+ export * from './line-chart/definition';
29
+ export * from './count-plot/definition';
30
+ export * from './heatmap/definition';
31
+ export * from './box-plot/definition';
32
+ export * from './bubble-chart/definition';
33
+ export * from './custom-spec/definition';
34
+ // Re-export tool types, schemas, validation, and AI tool creators
35
+ export * from './tool-types';
36
+ export * from './tool-schemas';
37
+ export * from './tool-validation';
38
+ export * from './histogram/tool';
39
+ export * from './line-chart/tool';
40
+ export * from './count-plot/tool';
41
+ export * from './heatmap/tool';
42
+ export * from './bubble-chart/tool';
43
+ export * from './box-plot/tool';
13
44
  // Import chart type definitions for legacy exports
14
- import { histogramChartType } from './histogram';
15
- import { lineChartChartType } from './line-chart';
16
- import { countPlotChartType } from './count-plot';
17
- import { ecdfChartType } from './ecdf';
18
- import { heatmapChartType } from './heatmap';
19
- import { boxPlotChartType } from './box-plot';
20
- import { bubbleChartChartType } from './bubble-chart';
21
- import { customSpecChartType } from './custom-spec';
22
- // Import Zod configs for discriminated union
23
- import { HistogramChartConfig as HistogramChartConfigSchema } from './histogram';
24
- import { CountPlotChartConfig as CountPlotChartConfigSchema } from './count-plot';
25
- import { EcdfChartConfig as EcdfChartConfigSchema } from './ecdf';
26
- import { LineChartConfig as LineChartConfigSchema } from './line-chart';
27
- import { BubbleChartConfig as BubbleChartConfigSchema } from './bubble-chart';
28
- import { HeatmapChartConfig as HeatmapChartConfigSchema } from './heatmap';
29
- import { BoxPlotChartConfig as BoxPlotChartConfigSchema } from './box-plot';
30
- import { CustomSpecChartConfig as CustomSpecChartConfigSchema } from './custom-spec';
31
- import { z } from 'zod';
32
- // Zod schema for VgPlotChartConfig (discriminated union)
33
- export const VgPlotChartConfig = z.discriminatedUnion('chartType', [
34
- HistogramChartConfigSchema,
35
- CountPlotChartConfigSchema,
36
- EcdfChartConfigSchema,
37
- LineChartConfigSchema,
38
- BubbleChartConfigSchema,
39
- HeatmapChartConfigSchema,
40
- BoxPlotChartConfigSchema,
41
- CustomSpecChartConfigSchema,
42
- ]);
45
+ import { histogramChartType } from './histogram/definition';
46
+ import { lineChartChartType } from './line-chart/definition';
47
+ import { countPlotChartType } from './count-plot/definition';
48
+ import { heatmapChartType } from './heatmap/definition';
49
+ import { boxPlotChartType } from './box-plot/definition';
50
+ import { bubbleChartChartType } from './bubble-chart/definition';
51
+ import { customSpecChartType } from './custom-spec/definition';
43
52
  // Legacy compatibility exports
44
53
  export const mosaicChartTypes = {
45
54
  histogram: histogramChartType,
46
55
  countPlot: countPlotChartType,
47
56
  lineChart: lineChartChartType,
48
- ecdf: ecdfChartType,
49
57
  heatmap: heatmapChartType,
50
58
  boxPlot: boxPlotChartType,
51
59
  bubbleChart: bubbleChartChartType,
@@ -57,7 +65,6 @@ export function createDefaultChartTypes(options) {
57
65
  histogramChartType,
58
66
  countPlotChartType,
59
67
  lineChartChartType,
60
- ecdfChartType,
61
68
  heatmapChartType,
62
69
  boxPlotChartType,
63
70
  bubbleChartChartType,
@@ -67,4 +74,27 @@ export function createDefaultChartTypes(options) {
67
74
  }
68
75
  return chartTypes;
69
76
  }
77
+ /**
78
+ * Dynamically generate AI tools from chart type definitions.
79
+ *
80
+ * @param chartTypes Array of chart type definitions
81
+ * @param deps Dependencies needed by tool creators (resolveResources, createChart)
82
+ * @param toolNamePrefix Prefix for generated tool names (default: 'create_dashboard_')
83
+ * @returns Record mapping tool names to tool instances
84
+ *
85
+ * @example
86
+ * const chartTypes = createDefaultChartTypes({includeCustomSpec: false});
87
+ * const tools = createChartTools(chartTypes, deps);
88
+ * // Returns: { create_dashboard_histogram: ..., create_dashboard_line_chart: ..., ... }
89
+ */
90
+ export function createChartTools(chartTypes, deps, toolNamePrefix = 'create_dashboard_') {
91
+ const tools = {};
92
+ for (const chartType of chartTypes) {
93
+ if (chartType.createTool) {
94
+ const toolName = `${toolNamePrefix}${chartType.id.replace(/-/g, '_')}`;
95
+ tools[toolName] = chartType.createTool(deps);
96
+ }
97
+ }
98
+ return tools;
99
+ }
70
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3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AAC;AAC1E,OAAO,EAAC,qBAAqB,IAAI,2BAA2B,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC,WAAW,EAAE;IACjE,0BAA0B;IAC1B,0BAA0B;IAC1B,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,2BAA2B;CAC5B,CAAC,CAAC;AAKH,+BAA+B;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAE,kBAAkB;IAC7B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,gBAAgB;IACzB,WAAW,EAAE,oBAAoB;IACjC,UAAU,EAAE,mBAAmB;CACvB,CAAC;AAEX,MAAM,UAAU,uBAAuB,CAAC,OAEvC;IACC,MAAM,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,IAAI,CAAC;IAC7D,MAAM,UAAU,GAAG;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,kBAAkB;QAClB,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,oBAAoB;KACrB,CAAC;IAEF,IAAI,iBAAiB,EAAE,CAAC;QACtB,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Re-export base types\nexport * from './base-types';\n\n// Re-export all schemas and types\nexport * from './histogram';\nexport * from './line-chart';\nexport * from './count-plot';\nexport * from './ecdf';\nexport * from './heatmap';\nexport * from './box-plot';\nexport * from './bubble-chart';\nexport * from './custom-spec';\nexport * from './registry';\n\n// Import chart type definitions for legacy exports\nimport {histogramChartType} from './histogram';\nimport {lineChartChartType} from './line-chart';\nimport {countPlotChartType} from './count-plot';\nimport {ecdfChartType} from './ecdf';\nimport {heatmapChartType} from './heatmap';\nimport {boxPlotChartType} from './box-plot';\nimport {bubbleChartChartType} from './bubble-chart';\nimport {customSpecChartType} from './custom-spec';\n\n// Import Zod configs for discriminated union\nimport {HistogramChartConfig as HistogramChartConfigSchema} from './histogram';\nimport {CountPlotChartConfig as CountPlotChartConfigSchema} from './count-plot';\nimport {EcdfChartConfig as EcdfChartConfigSchema} from './ecdf';\nimport {LineChartConfig as LineChartConfigSchema} from './line-chart';\nimport {BubbleChartConfig as BubbleChartConfigSchema} from './bubble-chart';\nimport {HeatmapChartConfig as HeatmapChartConfigSchema} from './heatmap';\nimport {BoxPlotChartConfig as BoxPlotChartConfigSchema} from './box-plot';\nimport {CustomSpecChartConfig as CustomSpecChartConfigSchema} from './custom-spec';\nimport {z} from 'zod';\n\n// Zod schema for VgPlotChartConfig (discriminated union)\nexport const VgPlotChartConfig = z.discriminatedUnion('chartType', [\n HistogramChartConfigSchema,\n CountPlotChartConfigSchema,\n EcdfChartConfigSchema,\n LineChartConfigSchema,\n BubbleChartConfigSchema,\n HeatmapChartConfigSchema,\n BoxPlotChartConfigSchema,\n CustomSpecChartConfigSchema,\n]);\n\nexport type VgPlotChartConfig = z.infer<typeof VgPlotChartConfig>;\nexport type VgPlotChartSettings = VgPlotChartConfig['settings'];\n\n// Legacy compatibility exports\nexport const mosaicChartTypes = {\n histogram: histogramChartType,\n countPlot: countPlotChartType,\n lineChart: lineChartChartType,\n ecdf: ecdfChartType,\n heatmap: heatmapChartType,\n boxPlot: boxPlotChartType,\n bubbleChart: bubbleChartChartType,\n customSpec: customSpecChartType,\n} as const;\n\nexport function createDefaultChartTypes(options?: {\n includeCustomSpec?: boolean;\n}) {\n const includeCustomSpec = options?.includeCustomSpec ?? true;\n const chartTypes = [\n histogramChartType,\n countPlotChartType,\n lineChartChartType,\n ecdfChartType,\n heatmapChartType,\n boxPlotChartType,\n bubbleChartChartType,\n ];\n\n if (includeCustomSpec) {\n chartTypes.push(customSpecChartType);\n }\n\n return chartTypes;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chart-types/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,cAAc,cAAc,CAAC;AAK7B,gDAAgD;AAChD,cAAc,UAAU,CAAC;AAKzB,2EAA2E;AAC3E,uEAAuE;AACvE,qFAAqF;AACrF,6BAA6B;AAC7B,OAAO,EAAC,WAAW,EAAqC,MAAM,gBAAgB,CAAC;AAE/E,oBAAoB;AACpB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AAErC,gCAAgC;AAChC,OAAO,EAAC,0BAA0B,EAAC,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAE7E,wBAAwB;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAEzC,kEAAkE;AAClE,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,c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AAmB,EACnB,iBAAyB,mBAAmB;IAE5C,MAAM,KAAK,GAAyB,EAAE,CAAC;IAEvC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YACvE,KAAK,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Re-export base types\nexport * from './base-types';\n\n// Import Tool type for createChartTools function\nimport type {Tool} from 'ai';\n\n// Re-export error classes for chart definitions\nexport * from './errors';\n\n// Import specific types needed before re-exports\nimport type {ChartTypeDefinition} from './base-types';\n\n// CRITICAL: Export ChartConfig FIRST, before importing Settings components\n// Export ChartConfig from separate file to avoid circular dependencies\n// (chart-types/index imports Settings components, which import ChartSettingsContext,\n// which imports ChartConfig)\nexport {ChartConfig, type ChartSettings, type ChartType} from './chart-config';\n\n// Re-export schemas\nexport * from './histogram/schema';\nexport * from './line-chart/schema';\nexport * from './count-plot/schema';\nexport * from './heatmap/schema';\nexport * from './box-plot/schema';\nexport * from './bubble-chart/schema';\nexport * from './custom-spec/schema';\n\n// Re-export Settings components\nexport {HistogramSettingsComponent} from './histogram/HistogramSettings';\nexport {LineChartSettingsComponent} from './line-chart/LineChartSettings';\nexport {CountPlotSettingsComponent} from './count-plot/CountPlotSettings';\nexport {HeatmapSettingsComponent} from './heatmap/HeatmapSettings';\nexport {BoxPlotSettingsComponent} from './box-plot/BoxPlotSettings';\nexport {BubbleChartSettingsComponent} from './bubble-chart/BubbleChartSettings';\nexport {CustomSpecSettingsComponent} from './custom-spec/CustomSpecSettings';\n\n// Re-export definitions\nexport * from './histogram/definition';\nexport * from './line-chart/definition';\nexport * from './count-plot/definition';\nexport * from './heatmap/definition';\nexport * from './box-plot/definition';\nexport * from './bubble-chart/definition';\nexport * from './custom-spec/definition';\n\n// Re-export tool types, schemas, validation, and AI tool creators\nexport * from './tool-types';\nexport * from './tool-schemas';\nexport * from './tool-validation';\nexport * from './histogram/tool';\nexport * from './line-chart/tool';\nexport * from './count-plot/tool';\nexport * from './heatmap/tool';\nexport * from './bubble-chart/tool';\nexport * from './box-plot/tool';\n\n// Import chart type definitions for legacy exports\nimport {histogramChartType} from './histogram/definition';\nimport {lineChartChartType} from './line-chart/definition';\nimport {countPlotChartType} from './count-plot/definition';\nimport {heatmapChartType} from './heatmap/definition';\nimport {boxPlotChartType} from './box-plot/definition';\nimport {bubbleChartChartType} from './bubble-chart/definition';\nimport {customSpecChartType} from './custom-spec/definition';\nimport type {ChartToolDeps} from './base-types';\n\n// Legacy compatibility exports\nexport const mosaicChartTypes = {\n histogram: histogramChartType,\n countPlot: countPlotChartType,\n lineChart: lineChartChartType,\n heatmap: heatmapChartType,\n boxPlot: boxPlotChartType,\n bubbleChart: bubbleChartChartType,\n customSpec: customSpecChartType,\n} as const;\n\nexport function createDefaultChartTypes(options?: {\n includeCustomSpec?: boolean;\n}): ChartTypeDefinition<any>[] {\n const includeCustomSpec = options?.includeCustomSpec ?? true;\n const chartTypes: ChartTypeDefinition<any>[] = [\n histogramChartType,\n countPlotChartType,\n lineChartChartType,\n heatmapChartType,\n boxPlotChartType,\n bubbleChartChartType,\n ];\n\n if (includeCustomSpec) {\n chartTypes.push(customSpecChartType as ChartTypeDefinition<any>);\n }\n\n return chartTypes;\n}\n\n/**\n * Dynamically generate AI tools from chart type definitions.\n *\n * @param chartTypes Array of chart type definitions\n * @param deps Dependencies needed by tool creators (resolveResources, createChart)\n * @param toolNamePrefix Prefix for generated tool names (default: 'create_dashboard_')\n * @returns Record mapping tool names to tool instances\n *\n * @example\n * const chartTypes = createDefaultChartTypes({includeCustomSpec: false});\n * const tools = createChartTools(chartTypes, deps);\n * // Returns: { create_dashboard_histogram: ..., create_dashboard_line_chart: ..., ... }\n */\nexport function createChartTools(\n chartTypes: ChartTypeDefinition<any>[],\n deps: ChartToolDeps,\n toolNamePrefix: string = 'create_dashboard_',\n): Record<string, Tool> {\n const tools: Record<string, Tool> = {};\n\n for (const chartType of chartTypes) {\n if (chartType.createTool) {\n const toolName = `${toolNamePrefix}${chartType.id.replace(/-/g, '_')}`;\n tools[toolName] = chartType.createTool(deps);\n }\n }\n\n return tools;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { type FC } from 'react';
2
+ /**
3
+ * Explicit settings component for line chart.
4
+ * Composes primitive and compound components for full control over the UI.
5
+ */
6
+ export declare const LineChartSettingsComponent: FC;
7
+ //# sourceMappingURL=LineChartSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChartSettings.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AAS9B;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,EAyCxC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Field } from '../../chart-builders/Field';
3
+ import { ColumnSelector } from '../../chart-builders/ColumnSelector';
4
+ import { TemporalGranularitySelector } from '../../chart-builders/TemporalGranularitySelector';
5
+ import { useChartSettingsContext } from '../../chart/chart-settings/ChartSettingsContext';
6
+ import { MultiFieldSelector } from '../../chart-builders/MultiFieldSelector';
7
+ import { isTemporalType } from '../../chart-builders/constants';
8
+ /**
9
+ * Explicit settings component for line chart.
10
+ * Composes primitive and compound components for full control over the UI.
11
+ */
12
+ export const LineChartSettingsComponent = () => {
13
+ const { columns, onChangeConfig, config } = useChartSettingsContext('line-chart');
14
+ const xField = columns.find((c) => c.name === config.settings.x);
15
+ const isXFieldTemporal = xField && isTemporalType(xField.type);
16
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Field, { label: "X Axis", required: true, children: _jsxs("div", { className: "grid items-end gap-2", style: {
17
+ gridTemplateColumns: isXFieldTemporal
18
+ ? 'minmax(120px, 1fr) 100px'
19
+ : '1fr',
20
+ }, children: [_jsx(ColumnSelector.Quantitative, { value: config.settings.x, onChange: (x) => onChangeConfig('x', x) }), isXFieldTemporal && (_jsx(TemporalGranularitySelector, { value: config.settings.xInterval, onChange: (xInterval) => onChangeConfig('xInterval', xInterval), xFieldType: xField.type }))] }) }), _jsx(Field, { label: "Y Axis", required: true, children: _jsx(MultiFieldSelector.Numeric, { value: config.settings.yFields ?? [], onChange: (yFields) => onChangeConfig('yFields', yFields), showAggregation: Boolean(config.settings.xInterval) }) })] }));
21
+ };
22
+ //# sourceMappingURL=LineChartSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChartSettings.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAC,2BAA2B,EAAC,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAC,uBAAuB,EAAC,MAAM,iDAAiD,CAAC;AACxF,OAAO,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAO,GAAG,EAAE;IACjD,MAAM,EAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAC,GACrC,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/D,OAAO,CACL,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,KAAK,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC5B,eACE,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE;wBACL,mBAAmB,EAAE,gBAAgB;4BACnC,CAAC,CAAC,0BAA0B;4BAC5B,CAAC,CAAC,KAAK;qBACV,aAED,KAAC,cAAc,CAAC,YAAY,IAC1B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,GACvC,EACD,gBAAgB,IAAI,CACnB,KAAC,2BAA2B,IAC1B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAChC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,EAC/D,UAAU,EAAE,MAAM,CAAC,IAAI,GACvB,CACH,IACG,GACA,EAER,KAAC,KAAK,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC5B,KAAC,kBAAkB,CAAC,OAAO,IACzB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,EACpC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,EACzD,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GACnD,GACI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {type FC} from 'react';\nimport {Field} from '../../chart-builders/Field';\nimport {ColumnSelector} from '../../chart-builders/ColumnSelector';\n\nimport {TemporalGranularitySelector} from '../../chart-builders/TemporalGranularitySelector';\nimport {useChartSettingsContext} from '../../chart/chart-settings/ChartSettingsContext';\nimport {MultiFieldSelector} from '../../chart-builders/MultiFieldSelector';\nimport {isTemporalType} from '../../chart-builders/constants';\n\n/**\n * Explicit settings component for line chart.\n * Composes primitive and compound components for full control over the UI.\n */\nexport const LineChartSettingsComponent: FC = () => {\n const {columns, onChangeConfig, config} =\n useChartSettingsContext('line-chart');\n\n const xField = columns.find((c) => c.name === config.settings.x);\n const isXFieldTemporal = xField && isTemporalType(xField.type);\n\n return (\n <div className=\"space-y-4\">\n <Field label=\"X Axis\" required>\n <div\n className=\"grid items-end gap-2\"\n style={{\n gridTemplateColumns: isXFieldTemporal\n ? 'minmax(120px, 1fr) 100px'\n : '1fr',\n }}\n >\n <ColumnSelector.Quantitative\n value={config.settings.x}\n onChange={(x) => onChangeConfig('x', x)}\n />\n {isXFieldTemporal && (\n <TemporalGranularitySelector\n value={config.settings.xInterval}\n onChange={(xInterval) => onChangeConfig('xInterval', xInterval)}\n xFieldType={xField.type}\n />\n )}\n </div>\n </Field>\n\n <Field label=\"Y Axis\" required>\n <MultiFieldSelector.Numeric\n value={config.settings.yFields ?? []}\n onChange={(yFields) => onChangeConfig('yFields', yFields)}\n showAggregation={Boolean(config.settings.xInterval)}\n />\n </Field>\n </div>\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
- import type { ChartTypeDefinition } from '../base-types';
2
- import type { LineChartSettings } from './schema';
3
- export declare const lineChartChartType: ChartTypeDefinition<LineChartSettings>;
1
+ import type { SpecChartTypeDefinition } from '../base-types';
2
+ import { LineChartConfig } from './schema';
3
+ export declare const lineChartChartType: SpecChartTypeDefinition<LineChartConfig>;
4
4
  //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/definition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAUhD,eAAO,MAAM,kBAAkB,EAAE,mBAAmB,CAAC,iBAAiB,CA2CrE,CAAC"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAoB,MAAM,UAAU,CAAC;AAS5D,eAAO,MAAM,kBAAkB,EAAE,uBAAuB,CAAC,eAAe,CAUvE,CAAC"}
@@ -1,46 +1,19 @@
1
- import { QUANTITATIVE_COLUMN_TYPES, NUMERIC_COLUMN_TYPES, } from '../../chart-builders/constants';
1
+ import { LineChartSettings } from './schema';
2
2
  import { titleFromDescription } from '../../chart-builders/chartTypeUtils';
3
- const FG_COLOR = 'var(--color-chart-1)';
3
+ import { LineChartSettingsComponent } from './LineChartSettings';
4
+ import { createLineChartAiTool } from './tool';
5
+ import { LineChart } from 'lucide-react';
6
+ import { createLineChartSpec } from './spec';
4
7
  const DESCRIPTION = 'Create a line chart of two fields';
5
8
  export const lineChartChartType = {
6
9
  id: 'line-chart',
7
10
  label: 'Line Chart',
8
11
  description: DESCRIPTION,
9
- aiDescription: 'Use for trends over an ordered x-axis, typically time on x and a numeric measure on y.',
10
- fields: [
11
- {
12
- key: 'x',
13
- label: 'X Field',
14
- required: true,
15
- types: [...QUANTITATIVE_COLUMN_TYPES],
16
- description: 'Ordered x-axis column, usually time or a quantitative value.',
17
- },
18
- {
19
- key: 'y',
20
- label: 'Y Field',
21
- required: true,
22
- types: [...NUMERIC_COLUMN_TYPES],
23
- description: 'Numeric measure plotted on the y-axis.',
24
- },
25
- ],
12
+ icon: LineChart,
13
+ schema: LineChartSettings,
14
+ settingsComponent: LineChartSettingsComponent,
26
15
  buildTitle: titleFromDescription(DESCRIPTION),
27
- createSpec: (tableName, { x, y }) => ({
28
- plot: [
29
- {
30
- mark: 'lineY',
31
- data: { from: tableName, filterBy: '$brush' },
32
- x,
33
- y,
34
- stroke: FG_COLOR,
35
- },
36
- { select: 'intervalX', as: '$brush' },
37
- ],
38
- xLabel: x,
39
- yLabel: y,
40
- height: 250,
41
- width: 380,
42
- margins: { left: 50, right: 20, top: 20, bottom: 50 },
43
- params: { brush: { select: 'crossfilter' } },
44
- }),
16
+ createTool: createLineChartAiTool,
17
+ createSpec: createLineChartSpec,
45
18
  };
46
19
  //# sourceMappingURL=definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/definition.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AAEzE,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AACxC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAA2C;IACxE,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,WAAW;IACxB,aAAa,EACX,wFAAwF;IAC1F,MAAM,EAAE;QACN;YACE,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,CAAC,GAAG,yBAAyB,CAAC;YACrC,WAAW,EACT,8DAA8D;SACjE;QACD;YACE,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,CAAC,GAAG,oBAAoB,CAAC;YAChC,WAAW,EAAE,wCAAwC;SACtD;KACF;IACD,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,CAAC,SAAS,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,EAAQ,EAAE,CACtC,CAAC;QACC,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC;gBAC3C,CAAC;gBACD,CAAC;gBACD,MAAM,EAAE,QAAQ;aACjB;YACD,EAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAC;SACpC;QACD,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC;QACnD,MAAM,EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,aAAa,EAAC,EAAC;KACzC,CAAS;CACb,CAAC","sourcesContent":["import type {Spec} from '@uwdata/mosaic-spec';\nimport type {ChartTypeDefinition} from '../base-types';\nimport type {LineChartSettings} from './schema';\nimport {\n QUANTITATIVE_COLUMN_TYPES,\n NUMERIC_COLUMN_TYPES,\n} from '../../chart-builders/constants';\nimport {titleFromDescription} from '../../chart-builders/chartTypeUtils';\n\nconst FG_COLOR = 'var(--color-chart-1)';\nconst DESCRIPTION = 'Create a line chart of two fields';\n\nexport const lineChartChartType: ChartTypeDefinition<LineChartSettings> = {\n id: 'line-chart',\n label: 'Line Chart',\n description: DESCRIPTION,\n aiDescription:\n 'Use for trends over an ordered x-axis, typically time on x and a numeric measure on y.',\n fields: [\n {\n key: 'x',\n label: 'X Field',\n required: true,\n types: [...QUANTITATIVE_COLUMN_TYPES],\n description:\n 'Ordered x-axis column, usually time or a quantitative value.',\n },\n {\n key: 'y',\n label: 'Y Field',\n required: true,\n types: [...NUMERIC_COLUMN_TYPES],\n description: 'Numeric measure plotted on the y-axis.',\n },\n ],\n buildTitle: titleFromDescription(DESCRIPTION),\n createSpec: (tableName, {x, y}): Spec =>\n ({\n plot: [\n {\n mark: 'lineY',\n data: {from: tableName, filterBy: '$brush'},\n x,\n y,\n stroke: FG_COLOR,\n },\n {select: 'intervalX', as: '$brush'},\n ],\n xLabel: x,\n yLabel: y,\n height: 250,\n width: 380,\n margins: {left: 50, right: 20, top: 20, bottom: 50},\n params: {brush: {select: 'crossfilter'}},\n }) as Spec,\n};\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAA6C;IAC1E,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,iBAAiB;IACzB,iBAAiB,EAAE,0BAA0B;IAC7C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,mBAAmB;CAChC,CAAC","sourcesContent":["import type {SpecChartTypeDefinition} from '../base-types';\nimport {LineChartConfig, LineChartSettings} from './schema';\nimport {titleFromDescription} from '../../chart-builders/chartTypeUtils';\nimport {LineChartSettingsComponent} from './LineChartSettings';\nimport {createLineChartAiTool} from './tool';\nimport {LineChart} from 'lucide-react';\nimport {createLineChartSpec} from './spec';\n\nconst DESCRIPTION = 'Create a line chart of two fields';\n\nexport const lineChartChartType: SpecChartTypeDefinition<LineChartConfig> = {\n id: 'line-chart',\n label: 'Line Chart',\n description: DESCRIPTION,\n icon: LineChart,\n schema: LineChartSettings,\n settingsComponent: LineChartSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n createTool: createLineChartAiTool,\n createSpec: createLineChartSpec,\n};\n"]}
@@ -1,16 +1,82 @@
1
1
  import { z } from 'zod';
2
+ export declare const TemporalInterval: z.ZodEnum<{
3
+ second: "second";
4
+ minute: "minute";
5
+ hour: "hour";
6
+ day: "day";
7
+ week: "week";
8
+ month: "month";
9
+ quarter: "quarter";
10
+ year: "year";
11
+ }>;
12
+ export type TemporalInterval = z.infer<typeof TemporalInterval>;
13
+ export declare const AggregateFunction: z.ZodEnum<{
14
+ sum: "sum";
15
+ max: "max";
16
+ min: "min";
17
+ avg: "avg";
18
+ }>;
19
+ export type AggregateFunction = z.infer<typeof AggregateFunction>;
20
+ export declare const YFieldConfig: z.ZodObject<{
21
+ field: z.ZodString;
22
+ color: z.ZodOptional<z.ZodString>;
23
+ aggregate: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
24
+ sum: "sum";
25
+ max: "max";
26
+ min: "min";
27
+ avg: "avg";
28
+ }>>>;
29
+ }, z.core.$strip>;
30
+ export type YFieldConfig = z.infer<typeof YFieldConfig>;
2
31
  export declare const LineChartSettings: z.ZodObject<{
3
32
  x: z.ZodOptional<z.ZodString>;
4
- y: z.ZodOptional<z.ZodString>;
33
+ xInterval: z.ZodOptional<z.ZodEnum<{
34
+ second: "second";
35
+ minute: "minute";
36
+ hour: "hour";
37
+ day: "day";
38
+ week: "week";
39
+ month: "month";
40
+ quarter: "quarter";
41
+ year: "year";
42
+ }>>;
43
+ yFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ field: z.ZodString;
45
+ color: z.ZodOptional<z.ZodString>;
46
+ aggregate: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
47
+ sum: "sum";
48
+ max: "max";
49
+ min: "min";
50
+ avg: "avg";
51
+ }>>>;
52
+ }, z.core.$strip>>>;
5
53
  }, z.core.$strip>;
6
54
  export type LineChartSettings = z.infer<typeof LineChartSettings>;
7
55
  export declare const LineChartConfig: z.ZodObject<{
8
56
  chartType: z.ZodLiteral<"line-chart">;
9
57
  settings: z.ZodObject<{
10
58
  x: z.ZodOptional<z.ZodString>;
11
- y: z.ZodOptional<z.ZodString>;
59
+ xInterval: z.ZodOptional<z.ZodEnum<{
60
+ second: "second";
61
+ minute: "minute";
62
+ hour: "hour";
63
+ day: "day";
64
+ week: "week";
65
+ month: "month";
66
+ quarter: "quarter";
67
+ year: "year";
68
+ }>>;
69
+ yFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
+ field: z.ZodString;
71
+ color: z.ZodOptional<z.ZodString>;
72
+ aggregate: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
73
+ sum: "sum";
74
+ max: "max";
75
+ min: "min";
76
+ avg: "avg";
77
+ }>>>;
78
+ }, z.core.$strip>>>;
12
79
  }, z.core.$strip>;
13
- vgplot: z.ZodUnknown;
14
80
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
15
81
  }, z.core.$strip>;
16
82
  export type LineChartConfig = z.infer<typeof LineChartConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;iBAK1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,gBAAgB;;;;;;;;;EAS3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGhE,eAAO,MAAM,iBAAiB;;;;;EAAuC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAGlE,eAAO,MAAM,YAAY;;;;;;;;;iBAMvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;iBAY5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,12 +1,39 @@
1
1
  import { z } from 'zod';
2
+ // Temporal interval enum
3
+ export const TemporalInterval = z.enum([
4
+ 'year',
5
+ 'quarter',
6
+ 'month',
7
+ 'week',
8
+ 'day',
9
+ 'hour',
10
+ 'minute',
11
+ 'second',
12
+ ]);
13
+ // Aggregate function enum
14
+ export const AggregateFunction = z.enum(['sum', 'avg', 'min', 'max']);
15
+ // Y-field configuration
16
+ export const YFieldConfig = z.object({
17
+ field: z.string().describe('Numeric column name to plot on Y axis'),
18
+ color: z.string().optional().describe('Optional color for this line'),
19
+ aggregate: AggregateFunction.optional()
20
+ .default('sum')
21
+ .describe('Aggregation function: sum, avg, min, or max'),
22
+ });
2
23
  export const LineChartSettings = z.object({
3
- x: z.string().optional(),
4
- y: z.string().optional(),
24
+ x: z
25
+ .string()
26
+ .optional()
27
+ .describe('Column for X axis, typically temporal (date/time)'),
28
+ xInterval: TemporalInterval.optional().describe('Temporal binning interval: year, month, day, hour, etc.'),
29
+ yFields: z
30
+ .array(YFieldConfig)
31
+ .optional()
32
+ .describe('Array of Y fields to plot, supports multiple lines'),
5
33
  });
6
34
  export const LineChartConfig = z.object({
7
35
  chartType: z.literal('line-chart'),
8
36
  settings: LineChartSettings,
9
- vgplot: z.unknown(),
10
37
  settingsOpen: z.boolean().optional(),
11
38
  });
12
39
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACzB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAClC,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\nexport const LineChartSettings = z.object({\n x: z.string().optional(),\n y: z.string().optional(),\n});\n\nexport type LineChartSettings = z.infer<typeof LineChartSettings>;\n\nexport const LineChartConfig = z.object({\n chartType: z.literal('line-chart'),\n settings: LineChartSettings,\n vgplot: z.unknown(),\n settingsOpen: z.boolean().optional(),\n});\n\nexport type LineChartConfig = z.infer<typeof LineChartConfig>;\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/schema.ts"],"names":[],"mappings":"AA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,EAAE,iBAAiB;IAC3B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\n// Temporal interval enum\nexport const TemporalInterval = z.enum([\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n]);\nexport type TemporalInterval = z.infer<typeof TemporalInterval>;\n\n// Aggregate function enum\nexport const AggregateFunction = z.enum(['sum', 'avg', 'min', 'max']);\nexport type AggregateFunction = z.infer<typeof AggregateFunction>;\n\n// Y-field configuration\nexport const YFieldConfig = z.object({\n field: z.string().describe('Numeric column name to plot on Y axis'),\n color: z.string().optional().describe('Optional color for this line'),\n aggregate: AggregateFunction.optional()\n .default('sum')\n .describe('Aggregation function: sum, avg, min, or max'),\n});\nexport type YFieldConfig = z.infer<typeof YFieldConfig>;\n\nexport const LineChartSettings = z.object({\n x: z\n .string()\n .optional()\n .describe('Column for X axis, typically temporal (date/time)'),\n xInterval: TemporalInterval.optional().describe(\n 'Temporal binning interval: year, month, day, hour, etc.',\n ),\n yFields: z\n .array(YFieldConfig)\n .optional()\n .describe('Array of Y fields to plot, supports multiple lines'),\n});\n\nexport type LineChartSettings = z.infer<typeof LineChartSettings>;\n\nexport const LineChartConfig = z.object({\n chartType: z.literal('line-chart'),\n settings: LineChartSettings,\n settingsOpen: z.boolean().optional(),\n});\n\nexport type LineChartConfig = z.infer<typeof LineChartConfig>;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { Spec } from '@uwdata/mosaic-spec';
2
+ import { LineChartSettings } from './schema';
3
+ export declare function createLineChartSpec(tableName: string, { x, yFields, xInterval }: LineChartSettings): Spec;
4
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/chart-types/line-chart/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAuB3C,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,EAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,iBAAiB,GACzC,IAAI,CAkFN"}
@@ -0,0 +1,91 @@
1
+ import { SpecGenerationError } from '../errors';
2
+ // Chart color palette matching theme colors from tailwind-preset.css
3
+ const CHART_COLORS = [
4
+ '#ea7c5c', // chart-1: hsl(12, 76%, 61%)
5
+ '#2a9d8f', // chart-2: hsl(173, 58%, 39%)
6
+ '#264653', // chart-3: hsl(197, 37%, 24%)
7
+ '#e9c46a', // chart-4: hsl(43, 74%, 66%)
8
+ '#f4a261', // chart-5: hsl(27, 87%, 67%)
9
+ ];
10
+ function getLineColor(fieldConfig, index) {
11
+ if (fieldConfig.color) {
12
+ return fieldConfig.color;
13
+ }
14
+ // CHART_COLORS is non-empty, so this is always defined
15
+ return CHART_COLORS[index % CHART_COLORS.length];
16
+ }
17
+ export function createLineChartSpec(tableName, { x, yFields, xInterval }) {
18
+ if (!x) {
19
+ throw new SpecGenerationError('X field is required for line chart');
20
+ }
21
+ if (!yFields || yFields.length === 0) {
22
+ throw new SpecGenerationError('At least one Y field is required for line chart');
23
+ }
24
+ const plotMarks = [];
25
+ // When temporal aggregation is active, use SQL binning
26
+ const dataSource = xInterval
27
+ ? {
28
+ from: tableName,
29
+ filterBy: '$brush',
30
+ }
31
+ : { from: tableName, filterBy: '$brush' };
32
+ // Generate lineY and text marks for each Y field
33
+ yFields.forEach((fieldConfig, index) => {
34
+ const color = getLineColor(fieldConfig, index);
35
+ const aggregate = fieldConfig.aggregate || 'sum';
36
+ // When temporal aggregation is active, use bin for X and aggregation for Y
37
+ if (xInterval) {
38
+ // Use bin syntax for temporal aggregation
39
+ plotMarks.push({
40
+ mark: 'lineY',
41
+ data: dataSource,
42
+ x: { bin: x, interval: xInterval },
43
+ y: { [aggregate]: fieldConfig.field },
44
+ stroke: color,
45
+ });
46
+ // Text label with aggregation info
47
+ plotMarks.push({
48
+ mark: 'text',
49
+ data: dataSource,
50
+ x: { bin: x, interval: xInterval },
51
+ y: { [aggregate]: fieldConfig.field },
52
+ text: [`${fieldConfig.field} (${aggregate})`],
53
+ fill: color,
54
+ dx: 5,
55
+ dy: -5,
56
+ });
57
+ }
58
+ else {
59
+ // No aggregation - direct field references
60
+ plotMarks.push({
61
+ mark: 'lineY',
62
+ data: dataSource,
63
+ x,
64
+ y: fieldConfig.field,
65
+ stroke: color,
66
+ });
67
+ plotMarks.push({
68
+ mark: 'text',
69
+ data: dataSource,
70
+ x,
71
+ y: fieldConfig.field,
72
+ text: [fieldConfig.field],
73
+ fill: color,
74
+ dx: 5,
75
+ dy: -5,
76
+ });
77
+ }
78
+ });
79
+ // Add brush
80
+ plotMarks.push({ select: 'intervalX', as: '$brush' });
81
+ return {
82
+ plot: plotMarks,
83
+ xLabel: x,
84
+ yLabel: undefined,
85
+ height: 250,
86
+ width: 380,
87
+ margins: { left: 50, right: 20, top: 20, bottom: 50 },
88
+ params: { brush: { select: 'crossfilter' } },
89
+ };
90
+ }
91
+ //# sourceMappingURL=spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../src/chart-types/line-chart/spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAE9C,qEAAqE;AACrE,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,6BAA6B;IACxC,SAAS,EAAE,8BAA8B;IACzC,SAAS,EAAE,8BAA8B;IACzC,SAAS,EAAE,6BAA6B;IACxC,SAAS,EAAE,6BAA6B;CACzC,CAAC;AAEF,SAAS,YAAY,CACnB,WAA4C,EAC5C,KAAa;IAEb,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,WAAW,CAAC,KAAK,CAAC;IAC3B,CAAC;IACD,uDAAuD;IACvD,OAA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EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,aAAa,EAAC,EAAC;KACjC,CAAC;AACZ,CAAC","sourcesContent":["import type {Spec} from '@uwdata/mosaic-spec';\nimport {LineChartSettings} from './schema';\nimport {SpecGenerationError} from '../errors';\n\n// Chart color palette matching theme colors from tailwind-preset.css\nconst CHART_COLORS = [\n '#ea7c5c', // chart-1: hsl(12, 76%, 61%)\n '#2a9d8f', // chart-2: hsl(173, 58%, 39%)\n '#264653', // chart-3: hsl(197, 37%, 24%)\n '#e9c46a', // chart-4: hsl(43, 74%, 66%)\n '#f4a261', // chart-5: hsl(27, 87%, 67%)\n];\n\nfunction getLineColor(\n fieldConfig: {field: string; color?: string},\n index: number,\n): string {\n if (fieldConfig.color) {\n return fieldConfig.color;\n }\n // CHART_COLORS is non-empty, so this is always defined\n return CHART_COLORS[index % CHART_COLORS.length]!;\n}\n\nexport function createLineChartSpec(\n tableName: string,\n {x, yFields, xInterval}: LineChartSettings,\n): Spec {\n if (!x) {\n throw new SpecGenerationError('X field is required for line chart');\n }\n if (!yFields || yFields.length === 0) {\n throw new SpecGenerationError(\n 'At least one Y field is required for line chart',\n );\n }\n\n const plotMarks: any[] = [];\n\n // When temporal aggregation is active, use SQL binning\n const dataSource = xInterval\n ? {\n from: tableName,\n filterBy: '$brush',\n }\n : {from: tableName, filterBy: '$brush'};\n\n // Generate lineY and text marks for each Y field\n yFields.forEach((fieldConfig, index) => {\n const color = getLineColor(fieldConfig, index);\n const aggregate = fieldConfig.aggregate || 'sum';\n\n // When temporal aggregation is active, use bin for X and aggregation for Y\n if (xInterval) {\n // Use bin syntax for temporal aggregation\n plotMarks.push({\n mark: 'lineY',\n data: dataSource,\n x: {bin: x, interval: xInterval},\n y: {[aggregate]: fieldConfig.field},\n stroke: color,\n });\n\n // Text label with aggregation info\n plotMarks.push({\n mark: 'text',\n data: dataSource,\n x: {bin: x, interval: xInterval},\n y: {[aggregate]: fieldConfig.field},\n text: [`${fieldConfig.field} (${aggregate})`],\n fill: color,\n dx: 5,\n dy: -5,\n });\n } else {\n // No aggregation - direct field references\n plotMarks.push({\n mark: 'lineY',\n data: dataSource,\n x,\n y: fieldConfig.field,\n stroke: color,\n });\n\n plotMarks.push({\n mark: 'text',\n data: dataSource,\n x,\n y: fieldConfig.field,\n text: [fieldConfig.field],\n fill: color,\n dx: 5,\n dy: -5,\n });\n }\n });\n\n // Add brush\n plotMarks.push({select: 'intervalX', as: '$brush'});\n\n return {\n plot: plotMarks,\n xLabel: x,\n yLabel: undefined,\n height: 250,\n width: 380,\n margins: {left: 50, right: 20, top: 20, bottom: 50},\n params: {brush: {select: 'crossfilter'}},\n } as Spec;\n}\n"]}