semiotic 2.0.2 → 3.0.0-beta.1

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 (359) hide show
  1. package/CLAUDE.md +530 -0
  2. package/README.md +190 -37
  3. package/ai/cli.js +48 -0
  4. package/ai/dist/ai/componentRegistry.js +45 -0
  5. package/ai/dist/ai/mcp-server.js +99 -0
  6. package/ai/dist/ai/renderHOCToSVG.js +77 -0
  7. package/ai/dist/src/components/Annotation.js +358 -0
  8. package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
  9. package/ai/dist/src/components/Axis/Axis.js +373 -0
  10. package/ai/dist/src/components/Axis/axisTitle.js +14 -0
  11. package/ai/dist/src/components/Axis/index.js +7 -0
  12. package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
  13. package/ai/dist/src/components/Brush.js +84 -0
  14. package/ai/dist/src/components/DividedLine.js +65 -0
  15. package/ai/dist/src/components/FacetController.js +259 -0
  16. package/ai/dist/src/components/Frame.js +139 -0
  17. package/ai/dist/src/components/InteractionLayer.js +328 -0
  18. package/ai/dist/src/components/Legend.js +140 -0
  19. package/ai/dist/src/components/MiniMap.js +75 -0
  20. package/ai/dist/src/components/MinimapXYFrame.js +99 -0
  21. package/ai/dist/src/components/NetworkFrame.js +335 -0
  22. package/ai/dist/src/components/OrdinalFrame.js +437 -0
  23. package/ai/dist/src/components/ResponsiveFrame.js +68 -0
  24. package/ai/dist/src/components/ResponsiveMinimapXYFrame.js +11 -0
  25. package/ai/dist/src/components/ResponsiveNetworkFrame.js +11 -0
  26. package/ai/dist/src/components/ResponsiveOrdinalFrame.js +11 -0
  27. package/ai/dist/src/components/ResponsiveXYFrame.js +10 -0
  28. package/ai/dist/src/components/SparkFrame.js +113 -0
  29. package/ai/dist/src/components/SparkNetworkFrame.js +11 -0
  30. package/ai/dist/src/components/SparkOrdinalFrame.js +11 -0
  31. package/ai/dist/src/components/SparkXYFrame.js +11 -0
  32. package/ai/dist/src/components/Tooltip/Tooltip.js +304 -0
  33. package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
  34. package/ai/dist/src/components/VisualizationLayer.js +395 -0
  35. package/ai/dist/src/components/XYFrame.js +524 -0
  36. package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
  37. package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
  38. package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
  39. package/ai/dist/src/components/annotationRules/networkframeRules.js +198 -0
  40. package/ai/dist/src/components/annotationRules/orframeRules.js +695 -0
  41. package/ai/dist/src/components/annotationRules/xyframeRules.js +299 -0
  42. package/ai/dist/src/components/batchWork.js +35 -0
  43. package/ai/dist/src/components/charts/index.js +96 -0
  44. package/ai/dist/src/components/charts/network/ChordDiagram.js +245 -0
  45. package/ai/dist/src/components/charts/network/CirclePack.js +177 -0
  46. package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +248 -0
  47. package/ai/dist/src/components/charts/network/SankeyDiagram.js +305 -0
  48. package/ai/dist/src/components/charts/network/TreeDiagram.js +268 -0
  49. package/ai/dist/src/components/charts/network/Treemap.js +177 -0
  50. package/ai/dist/src/components/charts/ordinal/BarChart.js +191 -0
  51. package/ai/dist/src/components/charts/ordinal/BoxPlot.js +235 -0
  52. package/ai/dist/src/components/charts/ordinal/DonutChart.js +178 -0
  53. package/ai/dist/src/components/charts/ordinal/DotPlot.js +194 -0
  54. package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +194 -0
  55. package/ai/dist/src/components/charts/ordinal/PieChart.js +155 -0
  56. package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +213 -0
  57. package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +219 -0
  58. package/ai/dist/src/components/charts/realtime/RealtimeBarChart.js +91 -0
  59. package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +73 -0
  60. package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +85 -0
  61. package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +86 -0
  62. package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
  63. package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
  64. package/ai/dist/src/components/charts/shared/formatUtils.js +176 -0
  65. package/ai/dist/src/components/charts/shared/hooks.js +49 -0
  66. package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
  67. package/ai/dist/src/components/charts/shared/types.js +2 -0
  68. package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
  69. package/ai/dist/src/components/charts/shared/validateProps.js +640 -0
  70. package/ai/dist/src/components/charts/xy/AreaChart.js +220 -0
  71. package/ai/dist/src/components/charts/xy/BubbleChart.js +222 -0
  72. package/ai/dist/src/components/charts/xy/Heatmap.js +230 -0
  73. package/ai/dist/src/components/charts/xy/LineChart.js +302 -0
  74. package/ai/dist/src/components/charts/xy/Scatterplot.js +136 -0
  75. package/ai/dist/src/components/charts/xy/StackedAreaChart.js +220 -0
  76. package/ai/dist/src/components/constants/coordinateNames.js +11 -0
  77. package/ai/dist/src/components/constants/frame_props.js +251 -0
  78. package/ai/dist/src/components/constants/jsx.js +71 -0
  79. package/ai/dist/src/components/data/dataFunctions.js +473 -0
  80. package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
  81. package/ai/dist/src/components/data/networkPipelineCache.js +43 -0
  82. package/ai/dist/src/components/data/ordinalPipelineCache.js +53 -0
  83. package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
  84. package/ai/dist/src/components/data/xyPipelineCache.js +49 -0
  85. package/ai/dist/src/components/generic_utilities/functions.js +5 -0
  86. package/ai/dist/src/components/index.js +145 -0
  87. package/ai/dist/src/components/interactionLayerBehavior/InteractionCanvas.js +128 -0
  88. package/ai/dist/src/components/processing/InteractionItems.js +223 -0
  89. package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
  90. package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
  91. package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
  92. package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
  93. package/ai/dist/src/components/processing/layouts/index.js +32 -0
  94. package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
  95. package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
  96. package/ai/dist/src/components/processing/layouts/types.js +2 -0
  97. package/ai/dist/src/components/processing/network.js +771 -0
  98. package/ai/dist/src/components/processing/networkDefaults.js +39 -0
  99. package/ai/dist/src/components/processing/networkLayoutHelpers.js +98 -0
  100. package/ai/dist/src/components/processing/ordinal.js +889 -0
  101. package/ai/dist/src/components/processing/ordinalConstants.js +23 -0
  102. package/ai/dist/src/components/processing/ordinalOverlays.js +88 -0
  103. package/ai/dist/src/components/processing/ordinalRenderPipeline.js +196 -0
  104. package/ai/dist/src/components/processing/xyDrawing.js +484 -0
  105. package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
  106. package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
  107. package/ai/dist/src/components/realtime/RealtimeFrame.js +710 -0
  108. package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
  109. package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
  110. package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
  111. package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
  112. package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
  113. package/ai/dist/src/components/realtime/renderers/types.js +2 -0
  114. package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
  115. package/ai/dist/src/components/realtime/types.js +2 -0
  116. package/ai/dist/src/components/semiotic-ai.js +66 -0
  117. package/ai/dist/src/components/semiotic-network.js +30 -0
  118. package/ai/dist/src/components/semiotic-ordinal.js +28 -0
  119. package/ai/dist/src/components/semiotic-realtime.js +37 -0
  120. package/ai/dist/src/components/semiotic-server.js +8 -0
  121. package/ai/dist/src/components/semiotic-xy.js +41 -0
  122. package/ai/dist/src/components/semiotic.js +101 -0
  123. package/ai/dist/src/components/server/renderToStaticSVG.js +392 -0
  124. package/ai/dist/src/components/store/TooltipStore.js +13 -0
  125. package/ai/dist/src/components/store/createStore.js +77 -0
  126. package/ai/dist/src/components/svg/SvgHelper.js +308 -0
  127. package/ai/dist/src/components/svg/areaDrawing.js +312 -0
  128. package/ai/dist/src/components/svg/boxplotRenderer.js +441 -0
  129. package/ai/dist/src/components/svg/bucketizedRenderer.js +677 -0
  130. package/ai/dist/src/components/svg/ckbinsRenderer.js +92 -0
  131. package/ai/dist/src/components/svg/ckmeans.js +238 -0
  132. package/ai/dist/src/components/svg/contourLayout.js +73 -0
  133. package/ai/dist/src/components/svg/contourRenderer.js +53 -0
  134. package/ai/dist/src/components/svg/edgeGenerators.js +181 -0
  135. package/ai/dist/src/components/svg/frameFunctions.js +579 -0
  136. package/ai/dist/src/components/svg/graphAlgorithms.js +138 -0
  137. package/ai/dist/src/components/svg/hexbinLayout.js +163 -0
  138. package/ai/dist/src/components/svg/lineDrawing.js +427 -0
  139. package/ai/dist/src/components/svg/networkDrawing.js +207 -0
  140. package/ai/dist/src/components/svg/nodeGenerators.js +131 -0
  141. package/ai/dist/src/components/svg/pieceDrawing.js +110 -0
  142. package/ai/dist/src/components/svg/pieceLayouts.js +588 -0
  143. package/ai/dist/src/components/svg/sankeyLinks.js +143 -0
  144. package/ai/dist/src/components/svg/summaryAxis.js +48 -0
  145. package/ai/dist/src/components/svg/summaryLayouts.js +202 -0
  146. package/ai/dist/src/components/svg/swarmLayout.js +128 -0
  147. package/ai/dist/src/components/types/annotationTypes.js +2 -0
  148. package/ai/dist/src/components/types/canvasTypes.js +2 -0
  149. package/ai/dist/src/components/types/generalTypes.js +2 -0
  150. package/ai/dist/src/components/types/interactionTypes.js +2 -0
  151. package/ai/dist/src/components/types/legendTypes.js +2 -0
  152. package/ai/dist/src/components/types/networkTypes.js +2 -0
  153. package/ai/dist/src/components/types/ordinalTypes.js +2 -0
  154. package/ai/dist/src/components/types/xyTypes.js +2 -0
  155. package/ai/dist/src/components/useBoundingRect.js +24 -0
  156. package/ai/dist/src/components/useDerivedStateFromProps.js +25 -0
  157. package/ai/dist/src/components/useLegacyUnmountCallback.js +21 -0
  158. package/ai/dist/src/components/visualizationLayerBehavior/axis.js +249 -0
  159. package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
  160. package/ai/dist/src/setupTests.js +4 -0
  161. package/ai/examples.md +394 -0
  162. package/ai/schema.json +1178 -0
  163. package/ai/system-prompt.md +38 -0
  164. package/dist/Annotation.d.ts +3 -0
  165. package/dist/AnnotationLayer/AnnotationLayer.d.ts +25 -0
  166. package/dist/Axis/Axis.d.ts +7 -0
  167. package/dist/Axis/axisTitle.d.ts +10 -0
  168. package/dist/Axis/index.d.ts +2 -0
  169. package/dist/Axis/summaryGraphic.d.ts +17 -0
  170. package/dist/Brush.d.ts +12 -0
  171. package/dist/DividedLine.d.ts +16 -0
  172. package/dist/FacetController.d.ts +12 -0
  173. package/dist/Frame.d.ts +2 -0
  174. package/dist/InteractionLayer.d.ts +3 -0
  175. package/dist/Legend.d.ts +3 -0
  176. package/dist/MiniMap.d.ts +14 -0
  177. package/dist/MinimapXYFrame.d.ts +10 -0
  178. package/dist/NetworkFrame.d.ts +8 -0
  179. package/dist/OrdinalFrame.d.ts +8 -0
  180. package/dist/ResponsiveFrame.d.ts +22 -0
  181. package/dist/ResponsiveMinimapXYFrame.d.ts +3 -0
  182. package/dist/ResponsiveNetworkFrame.d.ts +3 -0
  183. package/dist/ResponsiveOrdinalFrame.d.ts +3 -0
  184. package/dist/ResponsiveXYFrame.d.ts +3 -0
  185. package/dist/SparkFrame.d.ts +14 -0
  186. package/dist/SparkNetworkFrame.d.ts +5 -0
  187. package/dist/SparkOrdinalFrame.d.ts +5 -0
  188. package/dist/SparkXYFrame.d.ts +5 -0
  189. package/dist/Tooltip/Tooltip.d.ts +141 -0
  190. package/dist/TooltipPositioner/index.d.ts +7 -0
  191. package/dist/VisualizationLayer.d.ts +33 -0
  192. package/dist/XYFrame.d.ts +8 -0
  193. package/dist/annotationLayerBehavior/annotationHandling.d.ts +19 -0
  194. package/dist/annotationLayerBehavior/d3labeler.d.ts +9 -0
  195. package/dist/annotationRules/baseRules.d.ts +25 -0
  196. package/dist/annotationRules/networkframeRules.d.ts +48 -0
  197. package/dist/annotationRules/orframeRules.d.ts +103 -0
  198. package/dist/annotationRules/xyframeRules.d.ts +117 -0
  199. package/dist/batchWork.d.ts +6 -0
  200. package/dist/charts/index.d.ts +62 -0
  201. package/dist/charts/network/ChordDiagram.d.ts +181 -0
  202. package/dist/charts/network/CirclePack.d.ts +103 -0
  203. package/dist/charts/network/ForceDirectedGraph.d.ts +192 -0
  204. package/dist/charts/network/SankeyDiagram.d.ts +195 -0
  205. package/dist/charts/network/TreeDiagram.d.ts +200 -0
  206. package/dist/charts/network/Treemap.d.ts +98 -0
  207. package/dist/charts/ordinal/BarChart.d.ts +119 -0
  208. package/dist/charts/ordinal/BoxPlot.d.ts +125 -0
  209. package/dist/charts/ordinal/DonutChart.d.ts +95 -0
  210. package/dist/charts/ordinal/DotPlot.d.ts +128 -0
  211. package/dist/charts/ordinal/GroupedBarChart.d.ts +113 -0
  212. package/dist/charts/ordinal/PieChart.d.ts +83 -0
  213. package/dist/charts/ordinal/StackedBarChart.d.ts +119 -0
  214. package/dist/charts/ordinal/SwarmPlot.d.ts +137 -0
  215. package/dist/charts/realtime/RealtimeBarChart.d.ts +102 -0
  216. package/dist/charts/realtime/RealtimeLineChart.d.ts +78 -0
  217. package/dist/charts/realtime/RealtimeSwarmChart.d.ts +88 -0
  218. package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +85 -0
  219. package/dist/charts/shared/ChartError.d.ts +19 -0
  220. package/dist/charts/shared/colorUtils.d.ts +62 -0
  221. package/dist/charts/shared/formatUtils.d.ts +82 -0
  222. package/dist/charts/shared/hooks.d.ts +20 -0
  223. package/dist/charts/shared/legendUtils.d.ts +32 -0
  224. package/dist/charts/shared/types.d.ts +58 -0
  225. package/dist/charts/shared/validateChartData.d.ts +41 -0
  226. package/dist/charts/shared/validateProps.d.ts +18 -0
  227. package/dist/charts/xy/AreaChart.d.ts +127 -0
  228. package/dist/charts/xy/BubbleChart.d.ts +157 -0
  229. package/dist/charts/xy/Heatmap.d.ts +153 -0
  230. package/dist/charts/xy/LineChart.d.ts +193 -0
  231. package/dist/charts/xy/Scatterplot.d.ts +50 -0
  232. package/dist/charts/xy/StackedAreaChart.d.ts +131 -0
  233. package/dist/constants/coordinateNames.d.ts +8 -0
  234. package/dist/constants/frame_props.d.ts +13 -0
  235. package/dist/constants/jsx.d.ts +19 -0
  236. package/dist/data/dataFunctions.d.ts +45 -0
  237. package/dist/data/multiAccessorUtils.d.ts +1 -0
  238. package/dist/data/networkPipelineCache.d.ts +27 -0
  239. package/dist/data/ordinalPipelineCache.d.ts +33 -0
  240. package/dist/data/unflowedFunctions.d.ts +1 -0
  241. package/dist/data/xyPipelineCache.d.ts +35 -0
  242. package/dist/generic_utilities/functions.d.ts +1 -0
  243. package/dist/index.d.ts +133 -0
  244. package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +20 -0
  245. package/dist/network.js +8520 -0
  246. package/dist/network.js.map +1 -0
  247. package/dist/network.min.js +1 -0
  248. package/dist/network.module.js +8484 -0
  249. package/dist/network.module.js.map +1 -0
  250. package/dist/network.module.min.js +1 -0
  251. package/dist/ordinal.js +9276 -0
  252. package/dist/ordinal.js.map +1 -0
  253. package/dist/ordinal.min.js +1 -0
  254. package/dist/ordinal.module.js +9242 -0
  255. package/dist/ordinal.module.js.map +1 -0
  256. package/dist/ordinal.module.min.js +1 -0
  257. package/dist/processing/InteractionItems.d.ts +13 -0
  258. package/dist/processing/hierarchyUtils.d.ts +16 -0
  259. package/dist/processing/layouts/chordLayout.d.ts +2 -0
  260. package/dist/processing/layouts/forceLayout.d.ts +3 -0
  261. package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
  262. package/dist/processing/layouts/index.d.ts +8 -0
  263. package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
  264. package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
  265. package/dist/processing/layouts/types.d.ts +17 -0
  266. package/dist/processing/network.d.ts +111 -0
  267. package/dist/processing/networkDefaults.d.ts +36 -0
  268. package/dist/processing/networkLayoutHelpers.d.ts +54 -0
  269. package/dist/processing/ordinal.d.ts +102 -0
  270. package/dist/processing/ordinalConstants.d.ts +33 -0
  271. package/dist/processing/ordinalOverlays.d.ts +33 -0
  272. package/dist/processing/ordinalRenderPipeline.d.ts +148 -0
  273. package/dist/processing/xyDrawing.d.ts +140 -0
  274. package/dist/realtime/BinAccumulator.d.ts +8 -0
  275. package/dist/realtime/IncrementalExtent.d.ts +13 -0
  276. package/dist/realtime/RealtimeFrame.d.ts +4 -0
  277. package/dist/realtime/RingBuffer.d.ts +19 -0
  278. package/dist/realtime/renderers/barRenderer.d.ts +2 -0
  279. package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
  280. package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
  281. package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
  282. package/dist/realtime/renderers/types.d.ts +9 -0
  283. package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
  284. package/dist/realtime/types.d.ts +113 -0
  285. package/dist/realtime.js +1598 -0
  286. package/dist/realtime.js.map +1 -0
  287. package/dist/realtime.min.js +1 -0
  288. package/dist/realtime.module.js +1566 -0
  289. package/dist/realtime.module.js.map +1 -0
  290. package/dist/realtime.module.min.js +1 -0
  291. package/dist/semiotic-ai.d.ts +28 -0
  292. package/dist/semiotic-ai.js +18722 -0
  293. package/dist/semiotic-ai.js.map +1 -0
  294. package/dist/semiotic-ai.min.js +1 -0
  295. package/dist/semiotic-ai.module.js +18668 -0
  296. package/dist/semiotic-ai.module.js.map +1 -0
  297. package/dist/semiotic-ai.module.min.js +1 -0
  298. package/dist/semiotic-network.d.ts +19 -0
  299. package/dist/semiotic-ordinal.d.ts +18 -0
  300. package/dist/semiotic-realtime.d.ts +23 -0
  301. package/dist/semiotic-server.d.ts +1 -0
  302. package/dist/semiotic-xy.d.ts +24 -0
  303. package/dist/semiotic.d.ts +51 -0
  304. package/dist/semiotic.js +18723 -12996
  305. package/dist/semiotic.js.map +1 -0
  306. package/dist/semiotic.min.js +1 -0
  307. package/dist/semiotic.module.js +18666 -12965
  308. package/dist/semiotic.module.js.map +1 -0
  309. package/dist/semiotic.module.min.js +1 -0
  310. package/dist/server/renderToStaticSVG.d.ts +9 -0
  311. package/dist/server.js +8360 -0
  312. package/dist/server.js.map +1 -0
  313. package/dist/server.min.js +1 -0
  314. package/dist/server.module.js +8331 -0
  315. package/dist/server.module.js.map +1 -0
  316. package/dist/server.module.min.js +1 -0
  317. package/dist/store/TooltipStore.d.ts +2 -0
  318. package/dist/store/createStore.d.ts +1 -0
  319. package/dist/svg/SvgHelper.d.ts +33 -0
  320. package/dist/svg/areaDrawing.d.ts +21 -0
  321. package/dist/svg/boxplotRenderer.d.ts +15 -0
  322. package/dist/svg/bucketizedRenderer.d.ts +16 -0
  323. package/dist/svg/ckbinsRenderer.d.ts +20 -0
  324. package/dist/svg/ckmeans.d.ts +69 -0
  325. package/dist/svg/contourLayout.d.ts +6 -0
  326. package/dist/svg/contourRenderer.d.ts +12 -0
  327. package/dist/svg/edgeGenerators.d.ts +51 -0
  328. package/dist/svg/frameFunctions.d.ts +108 -0
  329. package/dist/svg/graphAlgorithms.d.ts +14 -0
  330. package/dist/svg/hexbinLayout.d.ts +7 -0
  331. package/dist/svg/lineDrawing.d.ts +99 -0
  332. package/dist/svg/networkDrawing.d.ts +16 -0
  333. package/dist/svg/nodeGenerators.d.ts +58 -0
  334. package/dist/svg/pieceDrawing.d.ts +12 -0
  335. package/dist/svg/pieceLayouts.d.ts +53 -0
  336. package/dist/svg/sankeyLinks.d.ts +3 -0
  337. package/dist/svg/summaryAxis.d.ts +6 -0
  338. package/dist/svg/summaryLayouts.d.ts +53 -0
  339. package/dist/svg/swarmLayout.d.ts +13 -0
  340. package/dist/types/annotationTypes.d.ts +135 -0
  341. package/dist/types/canvasTypes.d.ts +9 -0
  342. package/dist/types/generalTypes.d.ts +238 -0
  343. package/dist/types/interactionTypes.d.ts +72 -0
  344. package/dist/types/legendTypes.d.ts +20 -0
  345. package/dist/types/networkTypes.d.ts +175 -0
  346. package/dist/types/ordinalTypes.d.ts +112 -0
  347. package/dist/types/xyTypes.d.ts +115 -0
  348. package/dist/useBoundingRect.d.ts +2 -0
  349. package/dist/useDerivedStateFromProps.d.ts +1 -0
  350. package/dist/useLegacyUnmountCallback.d.ts +2 -0
  351. package/dist/visualizationLayerBehavior/axis.d.ts +36 -0
  352. package/dist/visualizationLayerBehavior/general.d.ts +80 -0
  353. package/dist/xy.js +7944 -0
  354. package/dist/xy.js.map +1 -0
  355. package/dist/xy.min.js +1 -0
  356. package/dist/xy.module.js +7903 -0
  357. package/dist/xy.module.js.map +1 -0
  358. package/dist/xy.module.min.js +1 -0
  359. package/package.json +116 -65
@@ -0,0 +1,640 @@
1
+ "use strict";
2
+ /**
3
+ * Static props validation for AI code-generation pipelines.
4
+ *
5
+ * Validates component name, required props, prop types, enum values,
6
+ * unknown props (typo detection), and data shape via the existing
7
+ * validateArrayData / validateObjectData / validateNetworkData helpers.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.validateProps = validateProps;
11
+ const validateChartData_1 = require("./validateChartData");
12
+ const validateChartData_2 = require("./validateChartData");
13
+ const validateChartData_3 = require("./validateChartData");
14
+ // ---------------------------------------------------------------------------
15
+ // Shared prop definitions (reused across many components)
16
+ // ---------------------------------------------------------------------------
17
+ const commonProps = {
18
+ width: { type: "number" },
19
+ height: { type: "number" },
20
+ margin: { type: "object" },
21
+ className: { type: "string" },
22
+ title: { type: "string" },
23
+ enableHover: { type: "boolean" },
24
+ showLegend: { type: "boolean" },
25
+ showGrid: { type: "boolean" },
26
+ colorBy: { type: ["string", "function"] },
27
+ colorScheme: { type: ["string", "array"] },
28
+ tooltip: { type: ["function", "object"] },
29
+ frameProps: { type: "object" },
30
+ };
31
+ const xyAxisProps = {
32
+ xLabel: { type: "string" },
33
+ yLabel: { type: "string" },
34
+ xFormat: { type: "function" },
35
+ yFormat: { type: "function" },
36
+ };
37
+ const ordinalAxisProps = {
38
+ categoryLabel: { type: "string" },
39
+ valueLabel: { type: "string" },
40
+ valueFormat: { type: "function" },
41
+ };
42
+ const curveEnum = [
43
+ "linear", "monotoneX", "monotoneY", "step",
44
+ "stepAfter", "stepBefore", "basis", "cardinal", "catmullRom",
45
+ ];
46
+ const orientationEnum = ["vertical", "horizontal"];
47
+ // ---------------------------------------------------------------------------
48
+ // Validation map — one entry per component
49
+ // ---------------------------------------------------------------------------
50
+ const VALIDATION_MAP = {
51
+ // -- XY Charts --
52
+ LineChart: {
53
+ required: ["data"],
54
+ dataShape: "array",
55
+ dataAccessors: ["xAccessor", "yAccessor"],
56
+ props: {
57
+ ...commonProps,
58
+ ...xyAxisProps,
59
+ data: { type: "array" },
60
+ xAccessor: { type: ["string", "function"] },
61
+ yAccessor: { type: ["string", "function"] },
62
+ lineBy: { type: ["string", "function"] },
63
+ lineDataAccessor: { type: "string" },
64
+ curve: { type: "string", enum: curveEnum },
65
+ lineWidth: { type: "number" },
66
+ showPoints: { type: "boolean" },
67
+ pointRadius: { type: "number" },
68
+ fillArea: { type: "boolean" },
69
+ areaOpacity: { type: "number" },
70
+ },
71
+ },
72
+ AreaChart: {
73
+ required: ["data"],
74
+ dataShape: "array",
75
+ dataAccessors: ["xAccessor", "yAccessor"],
76
+ props: {
77
+ ...commonProps,
78
+ ...xyAxisProps,
79
+ data: { type: "array" },
80
+ xAccessor: { type: ["string", "function"] },
81
+ yAccessor: { type: ["string", "function"] },
82
+ areaBy: { type: ["string", "function"] },
83
+ lineDataAccessor: { type: "string" },
84
+ curve: { type: "string", enum: curveEnum },
85
+ areaOpacity: { type: "number" },
86
+ showLine: { type: "boolean" },
87
+ lineWidth: { type: "number" },
88
+ },
89
+ },
90
+ StackedAreaChart: {
91
+ required: ["data"],
92
+ dataShape: "array",
93
+ dataAccessors: ["xAccessor", "yAccessor"],
94
+ props: {
95
+ ...commonProps,
96
+ ...xyAxisProps,
97
+ data: { type: "array" },
98
+ xAccessor: { type: ["string", "function"] },
99
+ yAccessor: { type: ["string", "function"] },
100
+ areaBy: { type: ["string", "function"] },
101
+ lineDataAccessor: { type: "string" },
102
+ curve: { type: "string", enum: curveEnum },
103
+ areaOpacity: { type: "number" },
104
+ showLine: { type: "boolean" },
105
+ lineWidth: { type: "number" },
106
+ normalize: { type: "boolean" },
107
+ },
108
+ },
109
+ Scatterplot: {
110
+ required: ["data"],
111
+ dataShape: "array",
112
+ dataAccessors: ["xAccessor", "yAccessor"],
113
+ props: {
114
+ ...commonProps,
115
+ ...xyAxisProps,
116
+ data: { type: "array" },
117
+ xAccessor: { type: ["string", "function"] },
118
+ yAccessor: { type: ["string", "function"] },
119
+ sizeBy: { type: ["string", "function"] },
120
+ sizeRange: { type: "array" },
121
+ pointRadius: { type: "number" },
122
+ pointOpacity: { type: "number" },
123
+ },
124
+ },
125
+ BubbleChart: {
126
+ required: ["data", "sizeBy"],
127
+ dataShape: "array",
128
+ dataAccessors: ["xAccessor", "yAccessor"],
129
+ props: {
130
+ ...commonProps,
131
+ ...xyAxisProps,
132
+ data: { type: "array" },
133
+ xAccessor: { type: ["string", "function"] },
134
+ yAccessor: { type: ["string", "function"] },
135
+ sizeBy: { type: ["string", "function"] },
136
+ sizeRange: { type: "array" },
137
+ bubbleOpacity: { type: "number" },
138
+ bubbleStrokeWidth: { type: "number" },
139
+ bubbleStrokeColor: { type: "string" },
140
+ },
141
+ },
142
+ Heatmap: {
143
+ required: ["data"],
144
+ dataShape: "array",
145
+ dataAccessors: ["xAccessor", "yAccessor", "valueAccessor"],
146
+ props: {
147
+ ...commonProps,
148
+ ...xyAxisProps,
149
+ data: { type: "array" },
150
+ xAccessor: { type: ["string", "function"] },
151
+ yAccessor: { type: ["string", "function"] },
152
+ valueAccessor: { type: ["string", "function"] },
153
+ colorScheme: { type: "string", enum: ["blues", "reds", "greens", "viridis", "custom"] },
154
+ customColorScale: { type: ["object", "function"] },
155
+ showValues: { type: "boolean" },
156
+ valueFormat: { type: "function" },
157
+ cellBorderColor: { type: "string" },
158
+ cellBorderWidth: { type: "number" },
159
+ },
160
+ },
161
+ // -- Ordinal Charts --
162
+ BarChart: {
163
+ required: ["data"],
164
+ dataShape: "array",
165
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
166
+ props: {
167
+ ...commonProps,
168
+ ...ordinalAxisProps,
169
+ data: { type: "array" },
170
+ categoryAccessor: { type: ["string", "function"] },
171
+ valueAccessor: { type: ["string", "function"] },
172
+ orientation: { type: "string", enum: orientationEnum },
173
+ sort: { type: ["boolean", "string", "function"] },
174
+ barPadding: { type: "number" },
175
+ },
176
+ },
177
+ StackedBarChart: {
178
+ required: ["data", "stackBy"],
179
+ dataShape: "array",
180
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
181
+ props: {
182
+ ...commonProps,
183
+ ...ordinalAxisProps,
184
+ data: { type: "array" },
185
+ categoryAccessor: { type: ["string", "function"] },
186
+ stackBy: { type: ["string", "function"] },
187
+ valueAccessor: { type: ["string", "function"] },
188
+ orientation: { type: "string", enum: orientationEnum },
189
+ normalize: { type: "boolean" },
190
+ barPadding: { type: "number" },
191
+ },
192
+ },
193
+ GroupedBarChart: {
194
+ required: ["data", "groupBy"],
195
+ dataShape: "array",
196
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
197
+ props: {
198
+ ...commonProps,
199
+ ...ordinalAxisProps,
200
+ data: { type: "array" },
201
+ categoryAccessor: { type: ["string", "function"] },
202
+ groupBy: { type: ["string", "function"] },
203
+ valueAccessor: { type: ["string", "function"] },
204
+ orientation: { type: "string", enum: orientationEnum },
205
+ barPadding: { type: "number" },
206
+ },
207
+ },
208
+ SwarmPlot: {
209
+ required: ["data"],
210
+ dataShape: "array",
211
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
212
+ props: {
213
+ ...commonProps,
214
+ ...ordinalAxisProps,
215
+ data: { type: "array" },
216
+ categoryAccessor: { type: ["string", "function"] },
217
+ valueAccessor: { type: ["string", "function"] },
218
+ orientation: { type: "string", enum: orientationEnum },
219
+ sizeBy: { type: ["string", "function"] },
220
+ sizeRange: { type: "array" },
221
+ pointRadius: { type: "number" },
222
+ pointOpacity: { type: "number" },
223
+ categoryPadding: { type: "number" },
224
+ },
225
+ },
226
+ BoxPlot: {
227
+ required: ["data"],
228
+ dataShape: "array",
229
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
230
+ props: {
231
+ ...commonProps,
232
+ ...ordinalAxisProps,
233
+ data: { type: "array" },
234
+ categoryAccessor: { type: ["string", "function"] },
235
+ valueAccessor: { type: ["string", "function"] },
236
+ orientation: { type: "string", enum: orientationEnum },
237
+ showOutliers: { type: "boolean" },
238
+ outlierRadius: { type: "number" },
239
+ categoryPadding: { type: "number" },
240
+ },
241
+ },
242
+ DotPlot: {
243
+ required: ["data"],
244
+ dataShape: "array",
245
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
246
+ props: {
247
+ ...commonProps,
248
+ ...ordinalAxisProps,
249
+ data: { type: "array" },
250
+ categoryAccessor: { type: ["string", "function"] },
251
+ valueAccessor: { type: ["string", "function"] },
252
+ orientation: { type: "string", enum: orientationEnum },
253
+ sort: { type: ["boolean", "string", "function"] },
254
+ dotRadius: { type: "number" },
255
+ categoryPadding: { type: "number" },
256
+ },
257
+ },
258
+ PieChart: {
259
+ required: ["data"],
260
+ dataShape: "array",
261
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
262
+ props: {
263
+ ...commonProps,
264
+ data: { type: "array" },
265
+ categoryAccessor: { type: ["string", "function"] },
266
+ valueAccessor: { type: ["string", "function"] },
267
+ startAngle: { type: "number" },
268
+ slicePadding: { type: "number" },
269
+ },
270
+ },
271
+ DonutChart: {
272
+ required: ["data"],
273
+ dataShape: "array",
274
+ dataAccessors: ["categoryAccessor", "valueAccessor"],
275
+ props: {
276
+ ...commonProps,
277
+ data: { type: "array" },
278
+ categoryAccessor: { type: ["string", "function"] },
279
+ valueAccessor: { type: ["string", "function"] },
280
+ innerRadius: { type: "number" },
281
+ centerContent: { type: ["object", "string", "number"] },
282
+ startAngle: { type: "number" },
283
+ slicePadding: { type: "number" },
284
+ },
285
+ },
286
+ // -- Network Charts --
287
+ ForceDirectedGraph: {
288
+ required: ["nodes", "edges"],
289
+ dataShape: "network",
290
+ dataAccessors: ["nodeIDAccessor", "sourceAccessor", "targetAccessor"],
291
+ props: {
292
+ ...commonProps,
293
+ nodes: { type: "array" },
294
+ edges: { type: "array" },
295
+ nodeIDAccessor: { type: ["string", "function"] },
296
+ sourceAccessor: { type: ["string", "function"] },
297
+ targetAccessor: { type: ["string", "function"] },
298
+ nodeLabel: { type: ["string", "function"] },
299
+ nodeSize: { type: ["number", "string", "function"] },
300
+ nodeSizeRange: { type: "array" },
301
+ edgeWidth: { type: ["number", "string", "function"] },
302
+ edgeColor: { type: "string" },
303
+ edgeOpacity: { type: "number" },
304
+ iterations: { type: "number" },
305
+ forceStrength: { type: "number" },
306
+ showLabels: { type: "boolean" },
307
+ },
308
+ },
309
+ SankeyDiagram: {
310
+ required: ["edges"],
311
+ dataShape: "network",
312
+ dataAccessors: ["sourceAccessor", "targetAccessor"],
313
+ props: {
314
+ ...commonProps,
315
+ nodes: { type: "array" },
316
+ edges: { type: "array" },
317
+ sourceAccessor: { type: ["string", "function"] },
318
+ targetAccessor: { type: ["string", "function"] },
319
+ valueAccessor: { type: ["string", "function"] },
320
+ nodeIdAccessor: { type: ["string", "function"] },
321
+ edgeColorBy: { type: ["string", "function"], enum: ["source", "target", "gradient"] },
322
+ orientation: { type: "string", enum: orientationEnum },
323
+ nodeAlign: { type: "string", enum: ["justify", "left", "right", "center"] },
324
+ nodePaddingRatio: { type: "number" },
325
+ nodeWidth: { type: "number" },
326
+ nodeLabel: { type: ["string", "function"] },
327
+ showLabels: { type: "boolean" },
328
+ edgeOpacity: { type: "number" },
329
+ edgeSort: { type: "function" },
330
+ },
331
+ },
332
+ ChordDiagram: {
333
+ required: ["edges"],
334
+ dataShape: "network",
335
+ dataAccessors: ["sourceAccessor", "targetAccessor"],
336
+ props: {
337
+ ...commonProps,
338
+ nodes: { type: "array" },
339
+ edges: { type: "array" },
340
+ sourceAccessor: { type: ["string", "function"] },
341
+ targetAccessor: { type: ["string", "function"] },
342
+ valueAccessor: { type: ["string", "function"] },
343
+ nodeIdAccessor: { type: ["string", "function"] },
344
+ edgeColorBy: { type: ["string", "function"], enum: ["source", "target"] },
345
+ padAngle: { type: "number" },
346
+ groupWidth: { type: "number" },
347
+ sortGroups: { type: "function" },
348
+ nodeLabel: { type: ["string", "function"] },
349
+ showLabels: { type: "boolean" },
350
+ edgeOpacity: { type: "number" },
351
+ },
352
+ },
353
+ TreeDiagram: {
354
+ required: ["data"],
355
+ dataShape: "object",
356
+ dataAccessors: [],
357
+ props: {
358
+ ...commonProps,
359
+ data: { type: "object" },
360
+ layout: { type: "string", enum: ["tree", "cluster", "partition", "treemap", "circlepack"] },
361
+ orientation: { type: "string", enum: ["vertical", "horizontal", "radial"] },
362
+ childrenAccessor: { type: ["string", "function"] },
363
+ valueAccessor: { type: ["string", "function"] },
364
+ nodeIdAccessor: { type: ["string", "function"] },
365
+ colorByDepth: { type: "boolean" },
366
+ edgeStyle: { type: "string", enum: ["line", "curve"] },
367
+ nodeLabel: { type: ["string", "function"] },
368
+ showLabels: { type: "boolean" },
369
+ nodeSize: { type: "number" },
370
+ },
371
+ },
372
+ Treemap: {
373
+ required: ["data"],
374
+ dataShape: "object",
375
+ dataAccessors: [],
376
+ props: {
377
+ ...commonProps,
378
+ data: { type: "object" },
379
+ childrenAccessor: { type: ["string", "function"] },
380
+ valueAccessor: { type: ["string", "function"] },
381
+ nodeIdAccessor: { type: ["string", "function"] },
382
+ colorByDepth: { type: "boolean" },
383
+ showLabels: { type: "boolean" },
384
+ nodeLabel: { type: ["string", "function"] },
385
+ },
386
+ },
387
+ CirclePack: {
388
+ required: ["data"],
389
+ dataShape: "object",
390
+ dataAccessors: [],
391
+ props: {
392
+ ...commonProps,
393
+ data: { type: "object" },
394
+ childrenAccessor: { type: ["string", "function"] },
395
+ valueAccessor: { type: ["string", "function"] },
396
+ nodeIdAccessor: { type: ["string", "function"] },
397
+ colorByDepth: { type: "boolean" },
398
+ showLabels: { type: "boolean" },
399
+ nodeLabel: { type: ["string", "function"] },
400
+ circleOpacity: { type: "number" },
401
+ },
402
+ },
403
+ // -- Realtime Charts --
404
+ RealtimeLineChart: {
405
+ required: [],
406
+ dataShape: "realtime",
407
+ dataAccessors: [],
408
+ props: {
409
+ size: { type: "array" },
410
+ margin: { type: "object" },
411
+ className: { type: "string" },
412
+ timeAccessor: { type: ["string", "function"] },
413
+ valueAccessor: { type: ["string", "function"] },
414
+ windowSize: { type: "number" },
415
+ windowMode: { type: "string", enum: ["sliding", "stepping"] },
416
+ arrowOfTime: { type: "string", enum: ["left", "right"] },
417
+ stroke: { type: "string" },
418
+ strokeWidth: { type: "number" },
419
+ strokeDasharray: { type: "string" },
420
+ timeExtent: { type: "array" },
421
+ valueExtent: { type: "array" },
422
+ extentPadding: { type: "number" },
423
+ showAxes: { type: "boolean" },
424
+ background: { type: "string" },
425
+ enableHover: { type: ["boolean", "object"] },
426
+ tooltipContent: { type: "function" },
427
+ onHover: { type: "function" },
428
+ annotations: { type: "array" },
429
+ svgAnnotationRules: { type: "function" },
430
+ tickFormatTime: { type: "function" },
431
+ tickFormatValue: { type: "function" },
432
+ },
433
+ },
434
+ RealtimeBarChart: {
435
+ required: ["binSize"],
436
+ dataShape: "realtime",
437
+ dataAccessors: [],
438
+ props: {
439
+ binSize: { type: "number" },
440
+ size: { type: "array" },
441
+ margin: { type: "object" },
442
+ className: { type: "string" },
443
+ timeAccessor: { type: ["string", "function"] },
444
+ valueAccessor: { type: ["string", "function"] },
445
+ categoryAccessor: { type: ["string", "function"] },
446
+ colors: { type: "object" },
447
+ windowSize: { type: "number" },
448
+ windowMode: { type: "string", enum: ["sliding", "stepping"] },
449
+ arrowOfTime: { type: "string", enum: ["left", "right"] },
450
+ fill: { type: "string" },
451
+ stroke: { type: "string" },
452
+ strokeWidth: { type: "number" },
453
+ gap: { type: "number" },
454
+ timeExtent: { type: "array" },
455
+ valueExtent: { type: "array" },
456
+ extentPadding: { type: "number" },
457
+ showAxes: { type: "boolean" },
458
+ background: { type: "string" },
459
+ enableHover: { type: ["boolean", "object"] },
460
+ tooltipContent: { type: "function" },
461
+ onHover: { type: "function" },
462
+ annotations: { type: "array" },
463
+ svgAnnotationRules: { type: "function" },
464
+ tickFormatTime: { type: "function" },
465
+ tickFormatValue: { type: "function" },
466
+ },
467
+ },
468
+ RealtimeSwarmChart: {
469
+ required: [],
470
+ dataShape: "realtime",
471
+ dataAccessors: [],
472
+ props: {
473
+ size: { type: "array" },
474
+ margin: { type: "object" },
475
+ className: { type: "string" },
476
+ timeAccessor: { type: ["string", "function"] },
477
+ valueAccessor: { type: ["string", "function"] },
478
+ categoryAccessor: { type: ["string", "function"] },
479
+ colors: { type: "object" },
480
+ windowSize: { type: "number" },
481
+ windowMode: { type: "string", enum: ["sliding", "stepping"] },
482
+ arrowOfTime: { type: "string", enum: ["left", "right"] },
483
+ radius: { type: "number" },
484
+ fill: { type: "string" },
485
+ opacity: { type: "number" },
486
+ stroke: { type: "string" },
487
+ strokeWidth: { type: "number" },
488
+ timeExtent: { type: "array" },
489
+ valueExtent: { type: "array" },
490
+ extentPadding: { type: "number" },
491
+ showAxes: { type: "boolean" },
492
+ background: { type: "string" },
493
+ enableHover: { type: ["boolean", "object"] },
494
+ tooltipContent: { type: "function" },
495
+ onHover: { type: "function" },
496
+ annotations: { type: "array" },
497
+ svgAnnotationRules: { type: "function" },
498
+ tickFormatTime: { type: "function" },
499
+ tickFormatValue: { type: "function" },
500
+ },
501
+ },
502
+ RealtimeWaterfallChart: {
503
+ required: [],
504
+ dataShape: "realtime",
505
+ dataAccessors: [],
506
+ props: {
507
+ size: { type: "array" },
508
+ margin: { type: "object" },
509
+ className: { type: "string" },
510
+ timeAccessor: { type: ["string", "function"] },
511
+ valueAccessor: { type: ["string", "function"] },
512
+ windowSize: { type: "number" },
513
+ windowMode: { type: "string", enum: ["sliding", "stepping"] },
514
+ arrowOfTime: { type: "string", enum: ["left", "right"] },
515
+ positiveColor: { type: "string" },
516
+ negativeColor: { type: "string" },
517
+ connectorStroke: { type: "string" },
518
+ connectorWidth: { type: "number" },
519
+ gap: { type: "number" },
520
+ stroke: { type: "string" },
521
+ strokeWidth: { type: "number" },
522
+ timeExtent: { type: "array" },
523
+ valueExtent: { type: "array" },
524
+ extentPadding: { type: "number" },
525
+ showAxes: { type: "boolean" },
526
+ background: { type: "string" },
527
+ enableHover: { type: ["boolean", "object"] },
528
+ tooltipContent: { type: "function" },
529
+ onHover: { type: "function" },
530
+ annotations: { type: "array" },
531
+ svgAnnotationRules: { type: "function" },
532
+ tickFormatTime: { type: "function" },
533
+ tickFormatValue: { type: "function" },
534
+ },
535
+ },
536
+ };
537
+ // ---------------------------------------------------------------------------
538
+ // Helpers
539
+ // ---------------------------------------------------------------------------
540
+ function checkType(value, expected) {
541
+ const types = Array.isArray(expected) ? expected : [expected];
542
+ const actual = Array.isArray(value) ? "array" : typeof value;
543
+ return types.includes(actual);
544
+ }
545
+ // ---------------------------------------------------------------------------
546
+ // Public API
547
+ // ---------------------------------------------------------------------------
548
+ /**
549
+ * Validate props for a Semiotic HOC chart component.
550
+ *
551
+ * Checks: component name, required props, prop types, enum values,
552
+ * unknown prop names (typo detection), and data shape + accessor validity.
553
+ */
554
+ function validateProps(componentName, props) {
555
+ const errors = [];
556
+ // 1. Component name check
557
+ const spec = VALIDATION_MAP[componentName];
558
+ if (!spec) {
559
+ return {
560
+ valid: false,
561
+ errors: [
562
+ `Unknown component "${componentName}". Valid components: ${Object.keys(VALIDATION_MAP).join(", ")}`,
563
+ ],
564
+ };
565
+ }
566
+ // 2. Required props
567
+ for (const req of spec.required) {
568
+ if (props[req] === undefined || props[req] === null) {
569
+ errors.push(`"${req}" is required for ${componentName}.`);
570
+ }
571
+ }
572
+ // 3. Prop types & enum values
573
+ for (const [key, value] of Object.entries(props)) {
574
+ if (value === undefined || value === null)
575
+ continue;
576
+ const def = spec.props[key];
577
+ if (!def)
578
+ continue; // unknown prop — checked in step 5
579
+ // Type check
580
+ if (!checkType(value, def.type)) {
581
+ const expectedStr = Array.isArray(def.type)
582
+ ? def.type.join(" | ")
583
+ : def.type;
584
+ errors.push(`"${key}" should be ${expectedStr}, got ${Array.isArray(value) ? "array" : typeof value}.`);
585
+ continue;
586
+ }
587
+ // Enum check
588
+ if (def.enum && typeof value === "string" && !def.enum.includes(value)) {
589
+ errors.push(`"${key}" value "${value}" is not valid. Expected one of: ${def.enum.join(", ")}.`);
590
+ }
591
+ }
592
+ // 4. Unknown props (warn on typos)
593
+ const knownProps = new Set(Object.keys(spec.props));
594
+ for (const key of Object.keys(props)) {
595
+ if (props[key] === undefined)
596
+ continue;
597
+ if (!knownProps.has(key)) {
598
+ errors.push(`Unknown prop "${key}" for ${componentName}. Check for typos.`);
599
+ }
600
+ }
601
+ // 5. Data shape + accessor validation (delegate to existing helpers)
602
+ if (spec.dataShape === "array") {
603
+ const data = props.data;
604
+ const accessors = {};
605
+ for (const acc of spec.dataAccessors) {
606
+ const val = props[acc];
607
+ if (typeof val === "string") {
608
+ accessors[acc] = val;
609
+ }
610
+ }
611
+ const dataError = (0, validateChartData_1.validateArrayData)({
612
+ componentName,
613
+ data,
614
+ accessors: Object.keys(accessors).length > 0 ? accessors : undefined,
615
+ });
616
+ if (dataError)
617
+ errors.push(dataError);
618
+ }
619
+ else if (spec.dataShape === "object") {
620
+ const dataError = (0, validateChartData_2.validateObjectData)({
621
+ componentName,
622
+ data: props.data,
623
+ });
624
+ if (dataError)
625
+ errors.push(dataError);
626
+ }
627
+ else if (spec.dataShape === "network") {
628
+ const dataError = (0, validateChartData_3.validateNetworkData)({
629
+ componentName,
630
+ nodes: props.nodes,
631
+ edges: props.edges,
632
+ nodesRequired: spec.required.includes("nodes"),
633
+ edgesRequired: spec.required.includes("edges"),
634
+ });
635
+ if (dataError)
636
+ errors.push(dataError);
637
+ }
638
+ // realtime charts: no data validation (ref-based push API)
639
+ return { valid: errors.length === 0, errors };
640
+ }