@cloudflare/kumo 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/CHANGELOG.md +510 -0
  2. package/LICENSE +21 -0
  3. package/README.md +521 -0
  4. package/ai/component-registry.json +3754 -0
  5. package/ai/component-registry.md +4022 -0
  6. package/ai/schemas.ts +594 -0
  7. package/dist/badge-Dc99vsfo.js +51 -0
  8. package/dist/badge-Dc99vsfo.js.map +1 -0
  9. package/dist/banner-4fkH6Sbt.js +51 -0
  10. package/dist/banner-4fkH6Sbt.js.map +1 -0
  11. package/dist/breadcrumbs-B5SY2CWj.js +132 -0
  12. package/dist/breadcrumbs-B5SY2CWj.js.map +1 -0
  13. package/dist/button-E2-hZMZE.js +191 -0
  14. package/dist/button-E2-hZMZE.js.map +1 -0
  15. package/dist/catalog.js +229 -0
  16. package/dist/catalog.js.map +1 -0
  17. package/dist/checkbox-BexIU_lZ.js +224 -0
  18. package/dist/checkbox-BexIU_lZ.js.map +1 -0
  19. package/dist/clipboard-text-BFHWMjmr.js +108 -0
  20. package/dist/clipboard-text-BFHWMjmr.js.map +1 -0
  21. package/dist/cn-Bhsu1vx2.js +26 -0
  22. package/dist/cn-Bhsu1vx2.js.map +1 -0
  23. package/dist/code-T2wPDiM0.js +60 -0
  24. package/dist/code-T2wPDiM0.js.map +1 -0
  25. package/dist/collapsible-OBNkTO48.js +56 -0
  26. package/dist/collapsible-OBNkTO48.js.map +1 -0
  27. package/dist/combobox-Dld0kS0U.js +228 -0
  28. package/dist/combobox-Dld0kS0U.js.map +1 -0
  29. package/dist/command-line/cli.js +764 -0
  30. package/dist/command-line/commands/add.js +220 -0
  31. package/dist/command-line/commands/blocks.js +61 -0
  32. package/dist/command-line/commands/doc.js +167 -0
  33. package/dist/command-line/commands/init.js +95 -0
  34. package/dist/command-line/commands/ls.js +53 -0
  35. package/dist/command-palette-BgQ680BG.js +393 -0
  36. package/dist/command-palette-BgQ680BG.js.map +1 -0
  37. package/dist/components/badge.js +7 -0
  38. package/dist/components/badge.js.map +1 -0
  39. package/dist/components/banner.js +7 -0
  40. package/dist/components/banner.js.map +1 -0
  41. package/dist/components/breadcrumbs.js +9 -0
  42. package/dist/components/breadcrumbs.js.map +1 -0
  43. package/dist/components/button.js +9 -0
  44. package/dist/components/button.js.map +1 -0
  45. package/dist/components/checkbox.js +8 -0
  46. package/dist/components/checkbox.js.map +1 -0
  47. package/dist/components/clipboard-text.js +6 -0
  48. package/dist/components/clipboard-text.js.map +1 -0
  49. package/dist/components/code.js +7 -0
  50. package/dist/components/code.js.map +1 -0
  51. package/dist/components/collapsible.js +6 -0
  52. package/dist/components/collapsible.js.map +1 -0
  53. package/dist/components/combobox.js +6 -0
  54. package/dist/components/combobox.js.map +1 -0
  55. package/dist/components/command-palette.js +8 -0
  56. package/dist/components/command-palette.js.map +1 -0
  57. package/dist/components/date-range-picker.js +6 -0
  58. package/dist/components/date-range-picker.js.map +1 -0
  59. package/dist/components/dialog.js +11 -0
  60. package/dist/components/dialog.js.map +1 -0
  61. package/dist/components/dropdown.js +6 -0
  62. package/dist/components/dropdown.js.map +1 -0
  63. package/dist/components/empty.js +9 -0
  64. package/dist/components/empty.js.map +1 -0
  65. package/dist/components/field.js +9 -0
  66. package/dist/components/field.js.map +1 -0
  67. package/dist/components/grid.js +11 -0
  68. package/dist/components/grid.js.map +1 -0
  69. package/dist/components/input.js +11 -0
  70. package/dist/components/input.js.map +1 -0
  71. package/dist/components/label.js +10 -0
  72. package/dist/components/label.js.map +1 -0
  73. package/dist/components/layer-card.js +6 -0
  74. package/dist/components/layer-card.js.map +1 -0
  75. package/dist/components/link.js +9 -0
  76. package/dist/components/link.js.map +1 -0
  77. package/dist/components/loader.js +8 -0
  78. package/dist/components/loader.js.map +1 -0
  79. package/dist/components/menubar.js +7 -0
  80. package/dist/components/menubar.js.map +1 -0
  81. package/dist/components/meter.js +6 -0
  82. package/dist/components/meter.js.map +1 -0
  83. package/dist/components/pagination.js +6 -0
  84. package/dist/components/pagination.js.map +1 -0
  85. package/dist/components/popover.js +14 -0
  86. package/dist/components/popover.js.map +1 -0
  87. package/dist/components/radio.js +10 -0
  88. package/dist/components/radio.js.map +1 -0
  89. package/dist/components/select.js +6 -0
  90. package/dist/components/select.js.map +1 -0
  91. package/dist/components/sensitive-input.js +8 -0
  92. package/dist/components/sensitive-input.js.map +1 -0
  93. package/dist/components/surface.js +6 -0
  94. package/dist/components/surface.js.map +1 -0
  95. package/dist/components/switch.js +8 -0
  96. package/dist/components/switch.js.map +1 -0
  97. package/dist/components/table.js +8 -0
  98. package/dist/components/table.js.map +1 -0
  99. package/dist/components/tabs.js +6 -0
  100. package/dist/components/tabs.js.map +1 -0
  101. package/dist/components/text.js +6 -0
  102. package/dist/components/text.js.map +1 -0
  103. package/dist/components/toast.js +8 -0
  104. package/dist/components/toast.js.map +1 -0
  105. package/dist/components/tooltip.js +7 -0
  106. package/dist/components/tooltip.js.map +1 -0
  107. package/dist/date-range-picker-CbKEQ9pi.js +408 -0
  108. package/dist/date-range-picker-CbKEQ9pi.js.map +1 -0
  109. package/dist/dialog-B1TaN0oR.js +77 -0
  110. package/dist/dialog-B1TaN0oR.js.map +1 -0
  111. package/dist/dropdown-D0rhYKeG.js +263 -0
  112. package/dist/dropdown-D0rhYKeG.js.map +1 -0
  113. package/dist/empty-DzCqjea-.js +93 -0
  114. package/dist/empty-DzCqjea-.js.map +1 -0
  115. package/dist/field-V3J0Ql_V.js +71 -0
  116. package/dist/field-V3J0Ql_V.js.map +1 -0
  117. package/dist/grid-DKajRHh8.js +127 -0
  118. package/dist/grid-DKajRHh8.js.map +1 -0
  119. package/dist/index.js +125 -0
  120. package/dist/index.js.map +1 -0
  121. package/dist/input-Dqvc2AB_.js +109 -0
  122. package/dist/input-Dqvc2AB_.js.map +1 -0
  123. package/dist/input-area-B9qajxvZ.js +57 -0
  124. package/dist/input-area-B9qajxvZ.js.map +1 -0
  125. package/dist/input-group-Bl6tgD5-.js +111 -0
  126. package/dist/input-group-Bl6tgD5-.js.map +1 -0
  127. package/dist/label-87HQArUG.js +50 -0
  128. package/dist/label-87HQArUG.js.map +1 -0
  129. package/dist/layer-card-C8j5Hkkj.js +44 -0
  130. package/dist/layer-card-C8j5Hkkj.js.map +1 -0
  131. package/dist/link-6TIZ4JIw.js +73 -0
  132. package/dist/link-6TIZ4JIw.js.map +1 -0
  133. package/dist/link-provider-DPBGo-0n.js +22 -0
  134. package/dist/link-provider-DPBGo-0n.js.map +1 -0
  135. package/dist/loader-DHGMYlC6.js +105 -0
  136. package/dist/loader-DHGMYlC6.js.map +1 -0
  137. package/dist/menubar-DLwLRFB1.js +92 -0
  138. package/dist/menubar-DLwLRFB1.js.map +1 -0
  139. package/dist/meter-DKUuvXxS.js +51 -0
  140. package/dist/meter-DKUuvXxS.js.map +1 -0
  141. package/dist/pagination-C4HQqodz.js +99 -0
  142. package/dist/pagination-C4HQqodz.js.map +1 -0
  143. package/dist/popover-DhdIqrP7.js +178 -0
  144. package/dist/popover-DhdIqrP7.js.map +1 -0
  145. package/dist/primitives/accordion.js +6 -0
  146. package/dist/primitives/accordion.js.map +1 -0
  147. package/dist/primitives/alert-dialog.js +6 -0
  148. package/dist/primitives/alert-dialog.js.map +1 -0
  149. package/dist/primitives/autocomplete.js +6 -0
  150. package/dist/primitives/autocomplete.js.map +1 -0
  151. package/dist/primitives/avatar.js +6 -0
  152. package/dist/primitives/avatar.js.map +1 -0
  153. package/dist/primitives/button.js +6 -0
  154. package/dist/primitives/button.js.map +1 -0
  155. package/dist/primitives/checkbox-group.js +6 -0
  156. package/dist/primitives/checkbox-group.js.map +1 -0
  157. package/dist/primitives/checkbox.js +6 -0
  158. package/dist/primitives/checkbox.js.map +1 -0
  159. package/dist/primitives/collapsible.js +6 -0
  160. package/dist/primitives/collapsible.js.map +1 -0
  161. package/dist/primitives/combobox.js +6 -0
  162. package/dist/primitives/combobox.js.map +1 -0
  163. package/dist/primitives/context-menu.js +6 -0
  164. package/dist/primitives/context-menu.js.map +1 -0
  165. package/dist/primitives/dialog.js +6 -0
  166. package/dist/primitives/dialog.js.map +1 -0
  167. package/dist/primitives/direction-provider.js +7 -0
  168. package/dist/primitives/direction-provider.js.map +1 -0
  169. package/dist/primitives/field.js +6 -0
  170. package/dist/primitives/field.js.map +1 -0
  171. package/dist/primitives/fieldset.js +6 -0
  172. package/dist/primitives/fieldset.js.map +1 -0
  173. package/dist/primitives/form.js +6 -0
  174. package/dist/primitives/form.js.map +1 -0
  175. package/dist/primitives/input.js +6 -0
  176. package/dist/primitives/input.js.map +1 -0
  177. package/dist/primitives/menu.js +6 -0
  178. package/dist/primitives/menu.js.map +1 -0
  179. package/dist/primitives/menubar.js +6 -0
  180. package/dist/primitives/menubar.js.map +1 -0
  181. package/dist/primitives/meter.js +6 -0
  182. package/dist/primitives/meter.js.map +1 -0
  183. package/dist/primitives/navigation-menu.js +6 -0
  184. package/dist/primitives/navigation-menu.js.map +1 -0
  185. package/dist/primitives/number-field.js +6 -0
  186. package/dist/primitives/number-field.js.map +1 -0
  187. package/dist/primitives/popover.js +6 -0
  188. package/dist/primitives/popover.js.map +1 -0
  189. package/dist/primitives/preview-card.js +6 -0
  190. package/dist/primitives/preview-card.js.map +1 -0
  191. package/dist/primitives/progress.js +6 -0
  192. package/dist/primitives/progress.js.map +1 -0
  193. package/dist/primitives/radio-group.js +6 -0
  194. package/dist/primitives/radio-group.js.map +1 -0
  195. package/dist/primitives/radio.js +6 -0
  196. package/dist/primitives/radio.js.map +1 -0
  197. package/dist/primitives/scroll-area.js +6 -0
  198. package/dist/primitives/scroll-area.js.map +1 -0
  199. package/dist/primitives/select.js +6 -0
  200. package/dist/primitives/select.js.map +1 -0
  201. package/dist/primitives/separator.js +6 -0
  202. package/dist/primitives/separator.js.map +1 -0
  203. package/dist/primitives/slider.js +6 -0
  204. package/dist/primitives/slider.js.map +1 -0
  205. package/dist/primitives/switch.js +6 -0
  206. package/dist/primitives/switch.js.map +1 -0
  207. package/dist/primitives/tabs.js +6 -0
  208. package/dist/primitives/tabs.js.map +1 -0
  209. package/dist/primitives/toast.js +6 -0
  210. package/dist/primitives/toast.js.map +1 -0
  211. package/dist/primitives/toggle-group.js +6 -0
  212. package/dist/primitives/toggle-group.js.map +1 -0
  213. package/dist/primitives/toggle.js +6 -0
  214. package/dist/primitives/toggle.js.map +1 -0
  215. package/dist/primitives/toolbar.js +6 -0
  216. package/dist/primitives/toolbar.js.map +1 -0
  217. package/dist/primitives/tooltip.js +6 -0
  218. package/dist/primitives/tooltip.js.map +1 -0
  219. package/dist/primitives.js +43 -0
  220. package/dist/primitives.js.map +1 -0
  221. package/dist/radio-BVAG7hNp.js +125 -0
  222. package/dist/radio-BVAG7hNp.js.map +1 -0
  223. package/dist/registry.js +2 -0
  224. package/dist/registry.js.map +1 -0
  225. package/dist/schemas-BSdA0fz-.js +3210 -0
  226. package/dist/schemas-BSdA0fz-.js.map +1 -0
  227. package/dist/select-B5Vb3zou.js +122 -0
  228. package/dist/select-B5Vb3zou.js.map +1 -0
  229. package/dist/sensitive-input-D5HCV04N.js +258 -0
  230. package/dist/sensitive-input-D5HCV04N.js.map +1 -0
  231. package/dist/skeleton-line-CtpS1u1J.js +28 -0
  232. package/dist/skeleton-line-CtpS1u1J.js.map +1 -0
  233. package/dist/src/blocks/page-header/index.d.ts +2 -0
  234. package/dist/src/blocks/page-header/index.d.ts.map +1 -0
  235. package/dist/src/blocks/page-header/page-header.d.ts +38 -0
  236. package/dist/src/blocks/page-header/page-header.d.ts.map +1 -0
  237. package/dist/src/blocks/resource-list/index.d.ts +2 -0
  238. package/dist/src/blocks/resource-list/index.d.ts.map +1 -0
  239. package/dist/src/blocks/resource-list/resource-list.d.ts +18 -0
  240. package/dist/src/blocks/resource-list/resource-list.d.ts.map +1 -0
  241. package/dist/src/catalog/catalog.d.ts +75 -0
  242. package/dist/src/catalog/catalog.d.ts.map +1 -0
  243. package/dist/src/catalog/data.d.ts +44 -0
  244. package/dist/src/catalog/data.d.ts.map +1 -0
  245. package/dist/src/catalog/index.d.ts +39 -0
  246. package/dist/src/catalog/index.d.ts.map +1 -0
  247. package/dist/src/catalog/types.d.ts +226 -0
  248. package/dist/src/catalog/types.d.ts.map +1 -0
  249. package/dist/src/catalog/visibility.d.ts +37 -0
  250. package/dist/src/catalog/visibility.d.ts.map +1 -0
  251. package/dist/src/command-line/build-cli.d.ts +7 -0
  252. package/dist/src/command-line/build-cli.d.ts.map +1 -0
  253. package/dist/src/command-line/cli.d.ts +13 -0
  254. package/dist/src/command-line/cli.d.ts.map +1 -0
  255. package/dist/src/command-line/commands/add.d.ts +10 -0
  256. package/dist/src/command-line/commands/add.d.ts.map +1 -0
  257. package/dist/src/command-line/commands/blocks.d.ts +10 -0
  258. package/dist/src/command-line/commands/blocks.d.ts.map +1 -0
  259. package/dist/src/command-line/commands/doc.d.ts +14 -0
  260. package/dist/src/command-line/commands/doc.d.ts.map +1 -0
  261. package/dist/src/command-line/commands/init.d.ts +18 -0
  262. package/dist/src/command-line/commands/init.d.ts.map +1 -0
  263. package/dist/src/command-line/commands/ls.d.ts +10 -0
  264. package/dist/src/command-line/commands/ls.d.ts.map +1 -0
  265. package/dist/src/command-line/commands/migrate.d.ts +10 -0
  266. package/dist/src/command-line/commands/migrate.d.ts.map +1 -0
  267. package/dist/src/command-line/utils/config.d.ts +42 -0
  268. package/dist/src/command-line/utils/config.d.ts.map +1 -0
  269. package/dist/src/command-line/utils/transformer.d.ts +17 -0
  270. package/dist/src/command-line/utils/transformer.d.ts.map +1 -0
  271. package/dist/src/components/badge/badge.d.ts +46 -0
  272. package/dist/src/components/badge/badge.d.ts.map +1 -0
  273. package/dist/src/components/badge/index.d.ts +2 -0
  274. package/dist/src/components/badge/index.d.ts.map +1 -0
  275. package/dist/src/components/banner/banner.d.ts +45 -0
  276. package/dist/src/components/banner/banner.d.ts.map +1 -0
  277. package/dist/src/components/banner/index.d.ts +2 -0
  278. package/dist/src/components/banner/index.d.ts.map +1 -0
  279. package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +43 -0
  280. package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
  281. package/dist/src/components/breadcrumbs/index.d.ts +2 -0
  282. package/dist/src/components/breadcrumbs/index.d.ts.map +1 -0
  283. package/dist/src/components/button/button.d.ts +118 -0
  284. package/dist/src/components/button/button.d.ts.map +1 -0
  285. package/dist/src/components/button/index.d.ts +2 -0
  286. package/dist/src/components/button/index.d.ts.map +1 -0
  287. package/dist/src/components/checkbox/checkbox.d.ts +167 -0
  288. package/dist/src/components/checkbox/checkbox.d.ts.map +1 -0
  289. package/dist/src/components/checkbox/index.d.ts +2 -0
  290. package/dist/src/components/checkbox/index.d.ts.map +1 -0
  291. package/dist/src/components/clipboard-text/clipboard-text.d.ts +38 -0
  292. package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -0
  293. package/dist/src/components/clipboard-text/index.d.ts +2 -0
  294. package/dist/src/components/clipboard-text/index.d.ts.map +1 -0
  295. package/dist/src/components/code/code.d.ts +138 -0
  296. package/dist/src/components/code/code.d.ts.map +1 -0
  297. package/dist/src/components/code/index.d.ts +4 -0
  298. package/dist/src/components/code/index.d.ts.map +1 -0
  299. package/dist/src/components/collapsible/collapsible.d.ts +62 -0
  300. package/dist/src/components/collapsible/collapsible.d.ts.map +1 -0
  301. package/dist/src/components/collapsible/index.d.ts +2 -0
  302. package/dist/src/components/collapsible/index.d.ts.map +1 -0
  303. package/dist/src/components/combobox/combobox.d.ts +124 -0
  304. package/dist/src/components/combobox/combobox.d.ts.map +1 -0
  305. package/dist/src/components/combobox/index.d.ts +2 -0
  306. package/dist/src/components/combobox/index.d.ts.map +1 -0
  307. package/dist/src/components/command-palette/command-palette.d.ts +225 -0
  308. package/dist/src/components/command-palette/command-palette.d.ts.map +1 -0
  309. package/dist/src/components/command-palette/index.d.ts +3 -0
  310. package/dist/src/components/command-palette/index.d.ts.map +1 -0
  311. package/dist/src/components/command-palette/types.d.ts +149 -0
  312. package/dist/src/components/command-palette/types.d.ts.map +1 -0
  313. package/dist/src/components/date-range-picker/date-range-picker.d.ts +65 -0
  314. package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +1 -0
  315. package/dist/src/components/date-range-picker/index.d.ts +2 -0
  316. package/dist/src/components/date-range-picker/index.d.ts.map +1 -0
  317. package/dist/src/components/dialog/dialog.d.ts +121 -0
  318. package/dist/src/components/dialog/dialog.d.ts.map +1 -0
  319. package/dist/src/components/dialog/index.d.ts +2 -0
  320. package/dist/src/components/dialog/index.d.ts.map +1 -0
  321. package/dist/src/components/dropdown/dropdown.d.ts +58 -0
  322. package/dist/src/components/dropdown/dropdown.d.ts.map +1 -0
  323. package/dist/src/components/dropdown/index.d.ts +2 -0
  324. package/dist/src/components/dropdown/index.d.ts.map +1 -0
  325. package/dist/src/components/empty/empty.d.ts +34 -0
  326. package/dist/src/components/empty/empty.d.ts.map +1 -0
  327. package/dist/src/components/empty/index.d.ts +2 -0
  328. package/dist/src/components/empty/index.d.ts.map +1 -0
  329. package/dist/src/components/field/field.d.ts +38 -0
  330. package/dist/src/components/field/field.d.ts.map +1 -0
  331. package/dist/src/components/field/index.d.ts +2 -0
  332. package/dist/src/components/field/index.d.ts.map +1 -0
  333. package/dist/src/components/grid/grid.d.ts +107 -0
  334. package/dist/src/components/grid/grid.d.ts.map +1 -0
  335. package/dist/src/components/grid/index.d.ts +2 -0
  336. package/dist/src/components/grid/index.d.ts.map +1 -0
  337. package/dist/src/components/input/index.d.ts +4 -0
  338. package/dist/src/components/input/index.d.ts.map +1 -0
  339. package/dist/src/components/input/input-area.d.ts +46 -0
  340. package/dist/src/components/input/input-area.d.ts.map +1 -0
  341. package/dist/src/components/input/input-group.d.ts +39 -0
  342. package/dist/src/components/input/input-group.d.ts.map +1 -0
  343. package/dist/src/components/input/input.d.ts +157 -0
  344. package/dist/src/components/input/input.d.ts.map +1 -0
  345. package/dist/src/components/label/index.d.ts +2 -0
  346. package/dist/src/components/label/index.d.ts.map +1 -0
  347. package/dist/src/components/label/label.d.ts +54 -0
  348. package/dist/src/components/label/label.d.ts.map +1 -0
  349. package/dist/src/components/layer-card/index.d.ts +2 -0
  350. package/dist/src/components/layer-card/index.d.ts.map +1 -0
  351. package/dist/src/components/layer-card/layer-card.d.ts +16 -0
  352. package/dist/src/components/layer-card/layer-card.d.ts.map +1 -0
  353. package/dist/src/components/link/index.d.ts +2 -0
  354. package/dist/src/components/link/index.d.ts.map +1 -0
  355. package/dist/src/components/link/link.d.ts +35 -0
  356. package/dist/src/components/link/link.d.ts.map +1 -0
  357. package/dist/src/components/loader/index.d.ts +3 -0
  358. package/dist/src/components/loader/index.d.ts.map +1 -0
  359. package/dist/src/components/loader/loader.d.ts +30 -0
  360. package/dist/src/components/loader/loader.d.ts.map +1 -0
  361. package/dist/src/components/loader/skeleton-line.d.ts +10 -0
  362. package/dist/src/components/loader/skeleton-line.d.ts.map +1 -0
  363. package/dist/src/components/menubar/index.d.ts +3 -0
  364. package/dist/src/components/menubar/index.d.ts.map +1 -0
  365. package/dist/src/components/menubar/menubar.d.ts +22 -0
  366. package/dist/src/components/menubar/menubar.d.ts.map +1 -0
  367. package/dist/src/components/menubar/use-menu-navigation.d.ts +8 -0
  368. package/dist/src/components/menubar/use-menu-navigation.d.ts.map +1 -0
  369. package/dist/src/components/meter/index.d.ts +2 -0
  370. package/dist/src/components/meter/index.d.ts.map +1 -0
  371. package/dist/src/components/meter/meter.d.ts +18 -0
  372. package/dist/src/components/meter/meter.d.ts.map +1 -0
  373. package/dist/src/components/pagination/index.d.ts +2 -0
  374. package/dist/src/components/pagination/index.d.ts.map +1 -0
  375. package/dist/src/components/pagination/pagination.d.ts +28 -0
  376. package/dist/src/components/pagination/pagination.d.ts.map +1 -0
  377. package/dist/src/components/popover/index.d.ts +3 -0
  378. package/dist/src/components/popover/index.d.ts.map +1 -0
  379. package/dist/src/components/popover/popover.d.ts +110 -0
  380. package/dist/src/components/popover/popover.d.ts.map +1 -0
  381. package/dist/src/components/radio/index.d.ts +2 -0
  382. package/dist/src/components/radio/index.d.ts.map +1 -0
  383. package/dist/src/components/radio/radio.d.ts +141 -0
  384. package/dist/src/components/radio/radio.d.ts.map +1 -0
  385. package/dist/src/components/select/index.d.ts +2 -0
  386. package/dist/src/components/select/index.d.ts.map +1 -0
  387. package/dist/src/components/select/select.d.ts +128 -0
  388. package/dist/src/components/select/select.d.ts.map +1 -0
  389. package/dist/src/components/sensitive-input/index.d.ts +2 -0
  390. package/dist/src/components/sensitive-input/index.d.ts.map +1 -0
  391. package/dist/src/components/sensitive-input/sensitive-input.d.ts +70 -0
  392. package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +1 -0
  393. package/dist/src/components/surface/index.d.ts +2 -0
  394. package/dist/src/components/surface/index.d.ts.map +1 -0
  395. package/dist/src/components/surface/surface.d.ts +48 -0
  396. package/dist/src/components/surface/surface.d.ts.map +1 -0
  397. package/dist/src/components/switch/index.d.ts +2 -0
  398. package/dist/src/components/switch/index.d.ts.map +1 -0
  399. package/dist/src/components/switch/switch.d.ts +155 -0
  400. package/dist/src/components/switch/switch.d.ts.map +1 -0
  401. package/dist/src/components/table/index.d.ts +2 -0
  402. package/dist/src/components/table/index.d.ts.map +1 -0
  403. package/dist/src/components/table/table.d.ts +54 -0
  404. package/dist/src/components/table/table.d.ts.map +1 -0
  405. package/dist/src/components/tabs/index.d.ts +3 -0
  406. package/dist/src/components/tabs/index.d.ts.map +1 -0
  407. package/dist/src/components/tabs/tabs.d.ts +64 -0
  408. package/dist/src/components/tabs/tabs.d.ts.map +1 -0
  409. package/dist/src/components/text/index.d.ts +2 -0
  410. package/dist/src/components/text/index.d.ts.map +1 -0
  411. package/dist/src/components/text/text.d.ts +153 -0
  412. package/dist/src/components/text/text.d.ts.map +1 -0
  413. package/dist/src/components/toast/index.d.ts +3 -0
  414. package/dist/src/components/toast/index.d.ts.map +1 -0
  415. package/dist/src/components/toast/toast.d.ts +66 -0
  416. package/dist/src/components/toast/toast.d.ts.map +1 -0
  417. package/dist/src/components/tooltip/index.d.ts +2 -0
  418. package/dist/src/components/tooltip/index.d.ts.map +1 -0
  419. package/dist/src/components/tooltip/tooltip.d.ts +43 -0
  420. package/dist/src/components/tooltip/tooltip.d.ts.map +1 -0
  421. package/dist/src/index.d.ts +39 -0
  422. package/dist/src/index.d.ts.map +1 -0
  423. package/dist/src/primitives/accordion.d.ts +13 -0
  424. package/dist/src/primitives/accordion.d.ts.map +1 -0
  425. package/dist/src/primitives/alert-dialog.d.ts +13 -0
  426. package/dist/src/primitives/alert-dialog.d.ts.map +1 -0
  427. package/dist/src/primitives/autocomplete.d.ts +13 -0
  428. package/dist/src/primitives/autocomplete.d.ts.map +1 -0
  429. package/dist/src/primitives/avatar.d.ts +13 -0
  430. package/dist/src/primitives/avatar.d.ts.map +1 -0
  431. package/dist/src/primitives/button.d.ts +13 -0
  432. package/dist/src/primitives/button.d.ts.map +1 -0
  433. package/dist/src/primitives/checkbox-group.d.ts +13 -0
  434. package/dist/src/primitives/checkbox-group.d.ts.map +1 -0
  435. package/dist/src/primitives/checkbox.d.ts +13 -0
  436. package/dist/src/primitives/checkbox.d.ts.map +1 -0
  437. package/dist/src/primitives/collapsible.d.ts +13 -0
  438. package/dist/src/primitives/collapsible.d.ts.map +1 -0
  439. package/dist/src/primitives/combobox.d.ts +13 -0
  440. package/dist/src/primitives/combobox.d.ts.map +1 -0
  441. package/dist/src/primitives/context-menu.d.ts +13 -0
  442. package/dist/src/primitives/context-menu.d.ts.map +1 -0
  443. package/dist/src/primitives/dialog.d.ts +13 -0
  444. package/dist/src/primitives/dialog.d.ts.map +1 -0
  445. package/dist/src/primitives/direction-provider.d.ts +13 -0
  446. package/dist/src/primitives/direction-provider.d.ts.map +1 -0
  447. package/dist/src/primitives/field.d.ts +13 -0
  448. package/dist/src/primitives/field.d.ts.map +1 -0
  449. package/dist/src/primitives/fieldset.d.ts +13 -0
  450. package/dist/src/primitives/fieldset.d.ts.map +1 -0
  451. package/dist/src/primitives/form.d.ts +13 -0
  452. package/dist/src/primitives/form.d.ts.map +1 -0
  453. package/dist/src/primitives/index.d.ts +52 -0
  454. package/dist/src/primitives/index.d.ts.map +1 -0
  455. package/dist/src/primitives/input.d.ts +13 -0
  456. package/dist/src/primitives/input.d.ts.map +1 -0
  457. package/dist/src/primitives/menu.d.ts +13 -0
  458. package/dist/src/primitives/menu.d.ts.map +1 -0
  459. package/dist/src/primitives/menubar.d.ts +13 -0
  460. package/dist/src/primitives/menubar.d.ts.map +1 -0
  461. package/dist/src/primitives/meter.d.ts +13 -0
  462. package/dist/src/primitives/meter.d.ts.map +1 -0
  463. package/dist/src/primitives/navigation-menu.d.ts +13 -0
  464. package/dist/src/primitives/navigation-menu.d.ts.map +1 -0
  465. package/dist/src/primitives/number-field.d.ts +13 -0
  466. package/dist/src/primitives/number-field.d.ts.map +1 -0
  467. package/dist/src/primitives/popover.d.ts +13 -0
  468. package/dist/src/primitives/popover.d.ts.map +1 -0
  469. package/dist/src/primitives/preview-card.d.ts +13 -0
  470. package/dist/src/primitives/preview-card.d.ts.map +1 -0
  471. package/dist/src/primitives/progress.d.ts +13 -0
  472. package/dist/src/primitives/progress.d.ts.map +1 -0
  473. package/dist/src/primitives/radio-group.d.ts +13 -0
  474. package/dist/src/primitives/radio-group.d.ts.map +1 -0
  475. package/dist/src/primitives/radio.d.ts +13 -0
  476. package/dist/src/primitives/radio.d.ts.map +1 -0
  477. package/dist/src/primitives/scroll-area.d.ts +13 -0
  478. package/dist/src/primitives/scroll-area.d.ts.map +1 -0
  479. package/dist/src/primitives/select.d.ts +13 -0
  480. package/dist/src/primitives/select.d.ts.map +1 -0
  481. package/dist/src/primitives/separator.d.ts +13 -0
  482. package/dist/src/primitives/separator.d.ts.map +1 -0
  483. package/dist/src/primitives/slider.d.ts +13 -0
  484. package/dist/src/primitives/slider.d.ts.map +1 -0
  485. package/dist/src/primitives/switch.d.ts +13 -0
  486. package/dist/src/primitives/switch.d.ts.map +1 -0
  487. package/dist/src/primitives/tabs.d.ts +13 -0
  488. package/dist/src/primitives/tabs.d.ts.map +1 -0
  489. package/dist/src/primitives/toast.d.ts +13 -0
  490. package/dist/src/primitives/toast.d.ts.map +1 -0
  491. package/dist/src/primitives/toggle-group.d.ts +13 -0
  492. package/dist/src/primitives/toggle-group.d.ts.map +1 -0
  493. package/dist/src/primitives/toggle.d.ts +13 -0
  494. package/dist/src/primitives/toggle.d.ts.map +1 -0
  495. package/dist/src/primitives/toolbar.d.ts +13 -0
  496. package/dist/src/primitives/toolbar.d.ts.map +1 -0
  497. package/dist/src/primitives/tooltip.d.ts +13 -0
  498. package/dist/src/primitives/tooltip.d.ts.map +1 -0
  499. package/dist/src/registry/index.d.ts +8 -0
  500. package/dist/src/registry/index.d.ts.map +1 -0
  501. package/dist/src/registry/types.d.ts +191 -0
  502. package/dist/src/registry/types.d.ts.map +1 -0
  503. package/dist/src/utils/cn.d.ts +4 -0
  504. package/dist/src/utils/cn.d.ts.map +1 -0
  505. package/dist/src/utils/index.d.ts +3 -0
  506. package/dist/src/utils/index.d.ts.map +1 -0
  507. package/dist/src/utils/link-provider.d.ts +12 -0
  508. package/dist/src/utils/link-provider.d.ts.map +1 -0
  509. package/dist/src/utils/prop-examples.d.ts +36 -0
  510. package/dist/src/utils/prop-examples.d.ts.map +1 -0
  511. package/dist/styles/kumo-binding.css +190 -0
  512. package/dist/styles/kumo-standalone.css +2 -0
  513. package/dist/styles/kumo.css +55 -0
  514. package/dist/styles/theme-fedramp.css +20 -0
  515. package/dist/styles/theme-kumo.css +186 -0
  516. package/dist/surface-BIC6CXiz.js +21 -0
  517. package/dist/surface-BIC6CXiz.js.map +1 -0
  518. package/dist/switch-D4duMhJ0.js +257 -0
  519. package/dist/switch-D4duMhJ0.js.map +1 -0
  520. package/dist/table-KuvHGpL8.js +153 -0
  521. package/dist/table-KuvHGpL8.js.map +1 -0
  522. package/dist/tabs-lQup-IbT.js +85 -0
  523. package/dist/tabs-lQup-IbT.js.map +1 -0
  524. package/dist/text-BEhqwMfe.js +97 -0
  525. package/dist/text-BEhqwMfe.js.map +1 -0
  526. package/dist/toast-8YyyQuqZ.js +69 -0
  527. package/dist/toast-8YyyQuqZ.js.map +1 -0
  528. package/dist/tooltip-DJWsDTWJ.js +85 -0
  529. package/dist/tooltip-DJWsDTWJ.js.map +1 -0
  530. package/dist/utils.js +10 -0
  531. package/dist/utils.js.map +1 -0
  532. package/dist/vendor-base-ui-DWIDNgE1.js +20446 -0
  533. package/dist/vendor-base-ui-DWIDNgE1.js.map +1 -0
  534. package/dist/vendor-floating-ui-BgbEw62H.js +1286 -0
  535. package/dist/vendor-floating-ui-BgbEw62H.js.map +1 -0
  536. package/dist/vendor-styling-BQbxAbdS.js +2775 -0
  537. package/dist/vendor-styling-BQbxAbdS.js.map +1 -0
  538. package/dist/vendor-utils-DD8jNJwD.js +741 -0
  539. package/dist/vendor-utils-DD8jNJwD.js.map +1 -0
  540. package/package.json +444 -0
  541. package/scripts/component-registry/cache.ts +123 -0
  542. package/scripts/component-registry/discovery.ts +469 -0
  543. package/scripts/component-registry/example-cleanup.ts +168 -0
  544. package/scripts/component-registry/index.test.ts +680 -0
  545. package/scripts/component-registry/index.ts +874 -0
  546. package/scripts/component-registry/markdown-generator.ts +222 -0
  547. package/scripts/component-registry/metadata.ts +643 -0
  548. package/scripts/component-registry/props-filter.ts +310 -0
  549. package/scripts/component-registry/schema-generator.ts +326 -0
  550. package/scripts/component-registry/sub-components.ts +349 -0
  551. package/scripts/component-registry/types.ts +156 -0
  552. package/scripts/component-registry/utils.ts +280 -0
  553. package/scripts/component-registry/variant-parser.ts +261 -0
  554. package/scripts/css-build.ts +55 -0
  555. package/scripts/generate-primitives.ts +178 -0
  556. package/scripts/theme-generator/config.ts +392 -0
  557. package/scripts/theme-generator/generate-css.ts +250 -0
  558. package/scripts/theme-generator/index.ts +159 -0
  559. package/scripts/theme-generator/migrate.ts +560 -0
  560. package/scripts/theme-generator/types.ts +86 -0
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Props filtering for component registry generation.
3
+ *
4
+ * Filters out inherited DOM/React props to keep documentation focused
5
+ * on component-specific props.
6
+ */
7
+
8
+ import * as ts from "typescript";
9
+ import { join, dirname } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ import type { CLIFlags } from "./types.js";
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const rootDir = join(__dirname, "../..");
15
+
16
+ // =============================================================================
17
+ // Props Filter Constants
18
+ // =============================================================================
19
+
20
+ /**
21
+ * Props to always skip - these are internal React props or rarely useful for LLMs
22
+ */
23
+ export const ALWAYS_SKIP_PROPS = new Set([
24
+ "key",
25
+ "ref",
26
+ "style",
27
+ "dangerouslySetInnerHTML",
28
+ ]);
29
+
30
+ /**
31
+ * Prefixes for props that should be skipped (DOM event handlers, ARIA, data attributes)
32
+ */
33
+ export const SKIP_PROP_PREFIXES = [
34
+ "aria-",
35
+ "data-",
36
+ "on", // Event handlers: onClick, onMouseDown, onKeyUp, etc.
37
+ ];
38
+
39
+ /**
40
+ * Props that should be kept even if they appear in inherited HTML types.
41
+ * These are commonly used and meaningful for component APIs.
42
+ */
43
+ export const KEEP_PROPS = new Set([
44
+ "children",
45
+ "className",
46
+ "disabled",
47
+ "name",
48
+ "value",
49
+ "checked",
50
+ "required",
51
+ "placeholder",
52
+ "readOnly",
53
+ "type",
54
+ "label", // Common form field prop
55
+ "href", // Common link prop for navigation components
56
+ "lang", // Code component uses lang for syntax highlighting
57
+ ]);
58
+
59
+ /**
60
+ * React interface names that define inherited HTML props.
61
+ * Props from these interfaces are filtered out to keep docs focused on component-specific props.
62
+ */
63
+ export const REACT_HTML_INTERFACES = [
64
+ "HTMLAttributes",
65
+ "InputHTMLAttributes",
66
+ "ButtonHTMLAttributes",
67
+ "AnchorHTMLAttributes",
68
+ "FormHTMLAttributes",
69
+ "TextareaHTMLAttributes",
70
+ "SelectHTMLAttributes",
71
+ ];
72
+
73
+ /**
74
+ * Minimal static list of common HTML props to skip (when --inherited-props is not set).
75
+ * This replaces the expensive deriveInheritedHtmlProps() by default.
76
+ */
77
+ export const MINIMAL_SKIP_PROPS = new Set([
78
+ // Common HTML attributes we don't want to document
79
+ "accessKey",
80
+ "autoCapitalize",
81
+ "autoFocus",
82
+ "contentEditable",
83
+ "dir",
84
+ "draggable",
85
+ "hidden",
86
+ "spellCheck",
87
+ "tabIndex",
88
+ "translate",
89
+ // Form-specific attributes
90
+ "autocomplete",
91
+ "autofocus",
92
+ "form",
93
+ "formAction",
94
+ "formEncType",
95
+ "formMethod",
96
+ "formNoValidate",
97
+ "formTarget",
98
+ "max",
99
+ "maxLength",
100
+ "min",
101
+ "minLength",
102
+ "multiple",
103
+ "pattern",
104
+ "step",
105
+ // Media attributes
106
+ "accept",
107
+ "capture",
108
+ "crossOrigin",
109
+ "loop",
110
+ "muted",
111
+ "preload",
112
+ "poster",
113
+ "src",
114
+ "srcSet",
115
+ // React internal props
116
+ "suppressContentEditableWarning",
117
+ "suppressHydrationWarning",
118
+ "defaultChecked",
119
+ "defaultValue",
120
+ // RDFa attributes (semantic web metadata - not useful for component docs)
121
+ "about",
122
+ "content",
123
+ "datatype",
124
+ "inlist",
125
+ "prefix",
126
+ "property",
127
+ "rel",
128
+ "resource",
129
+ "rev",
130
+ "typeof",
131
+ "vocab",
132
+ // Microdata attributes (HTML5 semantic markup - not useful for component docs)
133
+ "itemID",
134
+ "itemProp",
135
+ "itemRef",
136
+ "itemScope",
137
+ "itemType",
138
+ // Deprecated/obscure HTML attributes
139
+ "autoCorrect",
140
+ "autoSave",
141
+ "color",
142
+ "results",
143
+ "security",
144
+ "unselectable",
145
+ // Popover API attributes (rarely used directly)
146
+ "popover",
147
+ "popoverTarget",
148
+ "popoverTargetAction",
149
+ // Web Components attributes
150
+ "is",
151
+ "slot",
152
+ "part",
153
+ "exportparts",
154
+ // Other rarely-used HTML attributes
155
+ "contextMenu",
156
+ "enterKeyHint",
157
+ "inputMode",
158
+ "inert",
159
+ "nonce",
160
+ "radioGroup",
161
+ "role",
162
+ ]);
163
+
164
+ // =============================================================================
165
+ // Inherited Props Derivation (expensive, only used with --inherited-props)
166
+ // =============================================================================
167
+
168
+ // Lazily computed inherited HTML props (derived from React types at runtime)
169
+ let _inheritedHtmlProps: Set<string> | null = null;
170
+
171
+ /**
172
+ * OPTIMIZATION: Derive inherited HTML props from React's type definitions.
173
+ * This is EXPENSIVE (~15s / 47% of total time) and NOT NEEDED for most use cases.
174
+ * Only enabled with --inherited-props CLI flag.
175
+ *
176
+ * Extracts property names from HTMLAttributes, InputHTMLAttributes, ButtonHTMLAttributes, etc.
177
+ * These are filtered out to keep component docs focused on component-specific props.
178
+ */
179
+ export function deriveInheritedHtmlProps(): Set<string> {
180
+ const inheritedProps = new Set<string>();
181
+
182
+ try {
183
+ // Read tsconfig to get compiler options
184
+ const configPath = join(rootDir, "tsconfig.json");
185
+ const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
186
+ const parsedConfig = ts.parseJsonConfigFileContent(
187
+ configFile.config,
188
+ ts.sys,
189
+ rootDir,
190
+ );
191
+
192
+ // Create a program to access React's type definitions
193
+ const program = ts.createProgram({
194
+ rootNames: parsedConfig.fileNames,
195
+ options: parsedConfig.options,
196
+ });
197
+
198
+ // Find React's type definition file
199
+ const reactDts = program
200
+ .getSourceFiles()
201
+ .find((sf) =>
202
+ sf.fileName.includes("node_modules/@types/react/index.d.ts"),
203
+ );
204
+
205
+ if (!reactDts) {
206
+ throw new Error("Could not find React type definitions");
207
+ }
208
+
209
+ // Walk the AST to find the HTML attribute interfaces
210
+ ts.forEachChild(reactDts, function visit(node) {
211
+ if (ts.isInterfaceDeclaration(node)) {
212
+ const name = node.name.text;
213
+ if (REACT_HTML_INTERFACES.includes(name)) {
214
+ // Extract property names from this interface
215
+ for (const member of node.members) {
216
+ if (ts.isPropertySignature(member) && member.name) {
217
+ const propName = member.name.getText(reactDts);
218
+ inheritedProps.add(propName);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ts.forEachChild(node, visit);
224
+ });
225
+
226
+ console.log(
227
+ `Derived ${inheritedProps.size} inherited HTML props from React types`,
228
+ );
229
+ } catch (error) {
230
+ console.warn(
231
+ "Warning: Could not derive HTML props from React types, using fallback list",
232
+ );
233
+ console.warn(error instanceof Error ? error.message : error);
234
+
235
+ // Fallback to a minimal set if derivation fails
236
+ const fallbackProps = [
237
+ "accessKey",
238
+ "autoCapitalize",
239
+ "autoFocus",
240
+ "contentEditable",
241
+ "dir",
242
+ "draggable",
243
+ "hidden",
244
+ "lang",
245
+ "spellCheck",
246
+ "tabIndex",
247
+ "title",
248
+ "translate",
249
+ "className",
250
+ "id",
251
+ "style",
252
+ "children",
253
+ ];
254
+ for (const prop of fallbackProps) {
255
+ inheritedProps.add(prop);
256
+ }
257
+ }
258
+
259
+ return inheritedProps;
260
+ }
261
+
262
+ /**
263
+ * Get the set of inherited HTML props to skip.
264
+ * Uses minimal static list by default, or derives from React types with --inherited-props flag.
265
+ */
266
+ export function getInheritedHtmlProps(cliFlags: CLIFlags): Set<string> {
267
+ if (!cliFlags.includeInheritedProps) {
268
+ // Use minimal static list instead of expensive derivation
269
+ return MINIMAL_SKIP_PROPS;
270
+ }
271
+
272
+ if (!_inheritedHtmlProps) {
273
+ _inheritedHtmlProps = deriveInheritedHtmlProps();
274
+ }
275
+ return _inheritedHtmlProps;
276
+ }
277
+
278
+ // =============================================================================
279
+ // Main Filter Function
280
+ // =============================================================================
281
+
282
+ /**
283
+ * Determine if a prop should be skipped from the generated documentation.
284
+ * Filters out inherited DOM props, event handlers, and internal React props.
285
+ */
286
+ export function shouldSkipProp(propName: string, cliFlags: CLIFlags): boolean {
287
+ // Never skip props in the keep list
288
+ if (KEEP_PROPS.has(propName)) {
289
+ return false;
290
+ }
291
+
292
+ // Always skip certain props
293
+ if (ALWAYS_SKIP_PROPS.has(propName)) {
294
+ return true;
295
+ }
296
+
297
+ // Skip props with certain prefixes
298
+ for (const prefix of SKIP_PROP_PREFIXES) {
299
+ if (propName.startsWith(prefix)) {
300
+ return true;
301
+ }
302
+ }
303
+
304
+ // Skip inherited HTML attributes (derived from React types)
305
+ if (getInheritedHtmlProps(cliFlags).has(propName)) {
306
+ return true;
307
+ }
308
+
309
+ return false;
310
+ }
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Zod Schema Generator for Kumo Component Registry
3
+ *
4
+ * Generates TypeScript file with Zod schemas from component-registry.json.
5
+ * This enables runtime validation of AI-generated UI trees.
6
+ *
7
+ * Output: catalog/schemas.ts
8
+ */
9
+
10
+ import type {
11
+ ComponentRegistry,
12
+ ComponentSchema,
13
+ PropSchema,
14
+ } from "./types.js";
15
+
16
+ /**
17
+ * Convert a PropSchema type to its Zod equivalent
18
+ */
19
+ function propTypeToZod(prop: PropSchema): string {
20
+ const { type, values, required, optional } = prop;
21
+
22
+ let zodType: string;
23
+
24
+ // Handle enum types with explicit values
25
+ if (type === "enum" && values && values.length > 0) {
26
+ const enumValues = values.map((v) => `"${v}"`).join(", ");
27
+ zodType = `z.enum([${enumValues}])`;
28
+ }
29
+ // Handle common types
30
+ else if (type === "string") {
31
+ zodType = "z.string()";
32
+ } else if (type === "number") {
33
+ zodType = "z.number()";
34
+ } else if (type === "boolean") {
35
+ zodType = "z.boolean()";
36
+ } else if (type === "ReactNode") {
37
+ // ReactNode can be string, number, boolean, null, or a dynamic path reference
38
+ zodType =
39
+ "z.union([z.string(), z.number(), z.boolean(), z.null(), DynamicValueSchema])";
40
+ } else if (type.endsWith("[]")) {
41
+ // Array types
42
+ const itemType = type.slice(0, -2);
43
+ const itemZod = itemType === "string" ? "z.string()" : "z.unknown()";
44
+ zodType = `z.array(${itemZod})`;
45
+ } else if (type.includes("|")) {
46
+ // Union types - simplified handling
47
+ zodType = "z.unknown()";
48
+ } else {
49
+ // Fallback for complex types
50
+ zodType = "z.unknown()";
51
+ }
52
+
53
+ // Make optional if not required
54
+ if (optional || !required) {
55
+ zodType = `${zodType}.optional()`;
56
+ }
57
+
58
+ return zodType;
59
+ }
60
+
61
+ /**
62
+ * Generate Zod schema for a single component's props
63
+ */
64
+ function generateComponentPropsSchema(
65
+ componentName: string,
66
+ schema: ComponentSchema,
67
+ ): string {
68
+ const propsEntries = Object.entries(schema.props);
69
+
70
+ if (propsEntries.length === 0) {
71
+ return `export const ${componentName}PropsSchema = z.object({});`;
72
+ }
73
+
74
+ const propsLines = propsEntries.map(([propName, propSchema]) => {
75
+ const zodType = propTypeToZod(propSchema);
76
+ // Replace newlines with spaces to keep comments on a single line
77
+ const sanitizedDescription = propSchema.description
78
+ ?.replace(/\n+/g, " ")
79
+ .trim();
80
+ const comment = sanitizedDescription ? ` // ${sanitizedDescription}` : "";
81
+ return ` ${propName}: ${zodType},${comment}`;
82
+ });
83
+
84
+ return `export const ${componentName}PropsSchema = z.object({
85
+ ${propsLines.join("\n")}
86
+ });`;
87
+ }
88
+
89
+ /**
90
+ * Generate the complete schemas.ts file content
91
+ */
92
+ export function generateSchemasFile(registry: ComponentRegistry): string {
93
+ const componentNames = Object.keys(registry.components).sort();
94
+
95
+ const lines: string[] = [
96
+ "/**",
97
+ " * Auto-generated Zod schemas for Kumo components",
98
+ " * DO NOT EDIT - Generated by scripts/component-registry/index.ts",
99
+ " *",
100
+ " * These schemas enable runtime validation of AI-generated UI trees.",
101
+ " */",
102
+ "",
103
+ 'import { z } from "zod";',
104
+ "",
105
+ "// =============================================================================",
106
+ "// Dynamic Value Schema (for data binding)",
107
+ "// =============================================================================",
108
+ "",
109
+ "/**",
110
+ " * A value that can either be a literal or a reference to the data model.",
111
+ ' * Example: "Hello" or { path: "/user/name" }',
112
+ " */",
113
+ "export const DynamicValueSchema = z.union([",
114
+ " z.string(),",
115
+ " z.number(),",
116
+ " z.boolean(),",
117
+ " z.null(),",
118
+ " z.object({ path: z.string() }),",
119
+ "]);",
120
+ "",
121
+ "export type DynamicValue<T = unknown> = T | { path: string };",
122
+ "",
123
+ "// =============================================================================",
124
+ "// Visibility Condition Schemas",
125
+ "// =============================================================================",
126
+ "",
127
+ "/**",
128
+ " * Visibility conditions for conditional rendering.",
129
+ " * Components can be shown/hidden based on data, auth, or logic expressions.",
130
+ " */",
131
+ "",
132
+ "// Forward declaration for recursive types",
133
+ "// Note: Numeric comparisons use DynamicValue (not DynamicValue<number>) for Zod compatibility",
134
+ "export type LogicExpression =",
135
+ " | { and: LogicExpression[] }",
136
+ " | { or: LogicExpression[] }",
137
+ " | { not: LogicExpression }",
138
+ " | { path: string }",
139
+ " | { eq: [DynamicValue, DynamicValue] }",
140
+ " | { neq: [DynamicValue, DynamicValue] }",
141
+ " | { gt: [DynamicValue, DynamicValue] }",
142
+ " | { gte: [DynamicValue, DynamicValue] }",
143
+ " | { lt: [DynamicValue, DynamicValue] }",
144
+ " | { lte: [DynamicValue, DynamicValue] };",
145
+ "",
146
+ "// Lazy schema for recursive logic expressions",
147
+ "const LogicExpressionSchema: z.ZodType<LogicExpression> = z.lazy(() =>",
148
+ " z.union([",
149
+ " z.object({ and: z.array(LogicExpressionSchema) }),",
150
+ " z.object({ or: z.array(LogicExpressionSchema) }),",
151
+ " z.object({ not: LogicExpressionSchema }),",
152
+ " z.object({ path: z.string() }),",
153
+ " z.object({ eq: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
154
+ " z.object({ neq: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
155
+ " z.object({ gt: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
156
+ " z.object({ gte: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
157
+ " z.object({ lt: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
158
+ " z.object({ lte: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
159
+ " ])",
160
+ ");",
161
+ "",
162
+ "export const VisibilityConditionSchema = z.union([",
163
+ " z.boolean(),",
164
+ " z.object({ path: z.string() }),",
165
+ ' z.object({ auth: z.enum(["signedIn", "signedOut"]) }),',
166
+ " LogicExpressionSchema,",
167
+ "]);",
168
+ "",
169
+ "export type VisibilityCondition = z.infer<typeof VisibilityConditionSchema>;",
170
+ "",
171
+ "// =============================================================================",
172
+ "// Action Schemas",
173
+ "// =============================================================================",
174
+ "",
175
+ "/**",
176
+ " * Action confirmation dialog configuration",
177
+ " */",
178
+ "export const ActionConfirmSchema = z.object({",
179
+ " title: z.string(),",
180
+ " message: z.string(),",
181
+ ' variant: z.enum(["default", "danger"]).optional(),',
182
+ " confirmLabel: z.string().optional(),",
183
+ " cancelLabel: z.string().optional(),",
184
+ "});",
185
+ "",
186
+ "/**",
187
+ " * Action definition that AI can declare",
188
+ " */",
189
+ "export const ActionSchema = z.object({",
190
+ " name: z.string(),",
191
+ " params: z.record(z.string(), DynamicValueSchema).optional(),",
192
+ " confirm: ActionConfirmSchema.optional(),",
193
+ " onSuccess: z.object({ set: z.record(z.string(), DynamicValueSchema) }).optional(),",
194
+ " onError: z.object({ set: z.record(z.string(), DynamicValueSchema) }).optional(),",
195
+ "});",
196
+ "",
197
+ "export type Action = z.infer<typeof ActionSchema>;",
198
+ "",
199
+ "// =============================================================================",
200
+ "// Component Props Schemas",
201
+ "// =============================================================================",
202
+ "",
203
+ ];
204
+
205
+ // Generate schema for each component
206
+ for (const name of componentNames) {
207
+ const schema = registry.components[name];
208
+ lines.push(generateComponentPropsSchema(name, schema));
209
+ lines.push("");
210
+ }
211
+
212
+ // Generate the component type union
213
+ lines.push(
214
+ "// =============================================================================",
215
+ );
216
+ lines.push("// Component Type Union");
217
+ lines.push(
218
+ "// =============================================================================",
219
+ );
220
+ lines.push("");
221
+ lines.push("/**");
222
+ lines.push(" * All valid component type names");
223
+ lines.push(" */");
224
+ const typeUnion = componentNames.map((n) => `"${n}"`).join(" | ");
225
+ lines.push(`export type KumoComponentType = ${typeUnion};`);
226
+ lines.push("");
227
+ lines.push("export const KumoComponentTypeSchema = z.enum([");
228
+ for (const name of componentNames) {
229
+ lines.push(` "${name}",`);
230
+ }
231
+ lines.push("]);");
232
+ lines.push("");
233
+
234
+ // Generate props schema map
235
+ lines.push("/**");
236
+ lines.push(" * Map of component type to its props schema");
237
+ lines.push(" */");
238
+ lines.push("export const ComponentPropsSchemas = {");
239
+ for (const name of componentNames) {
240
+ lines.push(` ${name}: ${name}PropsSchema,`);
241
+ }
242
+ lines.push("} as const;");
243
+ lines.push("");
244
+
245
+ // Generate UIElement schema
246
+ lines.push(
247
+ "// =============================================================================",
248
+ );
249
+ lines.push("// UI Element & Tree Schemas");
250
+ lines.push(
251
+ "// =============================================================================",
252
+ );
253
+ lines.push("");
254
+ lines.push("/**");
255
+ lines.push(" * Base UI element structure");
256
+ lines.push(" */");
257
+ lines.push("export const UIElementBaseSchema = z.object({");
258
+ lines.push(" key: z.string(),");
259
+ lines.push(" type: KumoComponentTypeSchema,");
260
+ lines.push(" props: z.record(z.string(), z.unknown()),");
261
+ lines.push(" children: z.array(z.string()).optional(),");
262
+ lines.push(" parentKey: z.string().nullable().optional(),");
263
+ lines.push(" visible: VisibilityConditionSchema.optional(),");
264
+ lines.push(" action: ActionSchema.optional(),");
265
+ lines.push("});");
266
+ lines.push("");
267
+ lines.push("export type UIElement = z.infer<typeof UIElementBaseSchema>;");
268
+ lines.push("");
269
+ lines.push("/**");
270
+ lines.push(" * Flat UI tree structure (optimized for LLM generation)");
271
+ lines.push(" */");
272
+ lines.push("export const UITreeSchema = z.object({");
273
+ lines.push(" root: z.string(),");
274
+ lines.push(" elements: z.record(z.string(), UIElementBaseSchema),");
275
+ lines.push("});");
276
+ lines.push("");
277
+ lines.push("export type UITree = z.infer<typeof UITreeSchema>;");
278
+ lines.push("");
279
+
280
+ // Generate validation helpers
281
+ lines.push(
282
+ "// =============================================================================",
283
+ );
284
+ lines.push("// Validation Helpers");
285
+ lines.push(
286
+ "// =============================================================================",
287
+ );
288
+ lines.push("");
289
+ lines.push("/**");
290
+ lines.push(" * Validate an element's props against its component schema");
291
+ lines.push(" */");
292
+ lines.push(
293
+ "export function validateElementProps(element: UIElement): z.SafeParseReturnType<unknown, unknown> {",
294
+ );
295
+ lines.push(
296
+ " const schema = ComponentPropsSchemas[element.type as keyof typeof ComponentPropsSchemas];",
297
+ );
298
+ lines.push(" if (!schema) {");
299
+ lines.push(
300
+ " return { success: false, error: new z.ZodError([{ code: 'custom', message: `Unknown component type: ${element.type}`, path: ['type'] }]) };",
301
+ );
302
+ lines.push(" }");
303
+ lines.push(" return schema.safeParse(element.props);");
304
+ lines.push("}");
305
+ lines.push("");
306
+ lines.push("/**");
307
+ lines.push(" * Validate a complete UI tree");
308
+ lines.push(" */");
309
+ lines.push(
310
+ "export function validateUITree(tree: unknown): z.SafeParseReturnType<unknown, UITree> {",
311
+ );
312
+ lines.push(" return UITreeSchema.safeParse(tree);");
313
+ lines.push("}");
314
+ lines.push("");
315
+
316
+ // Export component names for catalog generation
317
+ lines.push("/**");
318
+ lines.push(" * List of all component names (for catalog generation)");
319
+ lines.push(" */");
320
+ lines.push(
321
+ `export const KUMO_COMPONENT_NAMES = [${componentNames.map((n) => `"${n}"`).join(", ")}] as const;`,
322
+ );
323
+ lines.push("");
324
+
325
+ return lines.join("\n");
326
+ }