@luxfi/ui 8.0.0 → 8.1.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 (744) hide show
  1. package/dist/3d-button.cjs +298 -0
  2. package/dist/3d-button.d.ts +52 -0
  3. package/dist/3d-button.d.ts.map +1 -0
  4. package/dist/3d-button.js +273 -0
  5. package/dist/3d-card.cjs +236 -0
  6. package/dist/3d-card.d.ts +29 -0
  7. package/dist/3d-card.d.ts.map +1 -0
  8. package/dist/3d-card.js +209 -0
  9. package/dist/3d-carousel.cjs +375 -0
  10. package/dist/3d-carousel.d.ts +26 -0
  11. package/dist/3d-carousel.d.ts.map +1 -0
  12. package/dist/3d-carousel.js +348 -0
  13. package/dist/3d-grid.cjs +360 -0
  14. package/dist/3d-grid.d.ts +49 -0
  15. package/dist/3d-grid.d.ts.map +1 -0
  16. package/dist/3d-grid.js +335 -0
  17. package/dist/3d-marquee.cjs +8669 -0
  18. package/dist/3d-marquee.d.ts +65 -0
  19. package/dist/3d-marquee.d.ts.map +1 -0
  20. package/dist/3d-marquee.js +8645 -0
  21. package/dist/3d-model-viewer.cjs +909 -0
  22. package/dist/3d-model-viewer.d.ts +45 -0
  23. package/dist/3d-model-viewer.d.ts.map +1 -0
  24. package/dist/3d-model-viewer.js +886 -0
  25. package/dist/3d-pin.cjs +46 -0
  26. package/dist/3d-pin.d.ts +8 -0
  27. package/dist/3d-pin.d.ts.map +1 -0
  28. package/dist/3d-pin.js +24 -0
  29. package/dist/3d-scene.cjs +439 -0
  30. package/dist/3d-scene.d.ts +76 -0
  31. package/dist/3d-scene.d.ts.map +1 -0
  32. package/dist/3d-scene.js +407 -0
  33. package/dist/3d-text.cjs +367 -0
  34. package/dist/3d-text.d.ts +62 -0
  35. package/dist/3d-text.d.ts.map +1 -0
  36. package/dist/3d-text.js +341 -0
  37. package/dist/advanced-chart.cjs +53 -0
  38. package/dist/advanced-chart.d.ts +6 -0
  39. package/dist/advanced-chart.d.ts.map +1 -0
  40. package/dist/advanced-chart.js +51 -0
  41. package/dist/advanced-navigation-bar.cjs +459 -0
  42. package/dist/advanced-navigation-bar.d.ts +14 -0
  43. package/dist/advanced-navigation-bar.d.ts.map +1 -0
  44. package/dist/advanced-navigation-bar.js +437 -0
  45. package/dist/ai-actions.cjs +57 -0
  46. package/dist/ai-actions.d.ts +14 -0
  47. package/dist/ai-actions.d.ts.map +1 -0
  48. package/dist/ai-actions.js +35 -0
  49. package/dist/ai-agents.cjs +1764 -0
  50. package/dist/ai-agents.d.ts +56 -0
  51. package/dist/ai-agents.d.ts.map +1 -0
  52. package/dist/ai-agents.js +1740 -0
  53. package/dist/ai-assistant.cjs +907 -0
  54. package/dist/ai-assistant.d.ts +28 -0
  55. package/dist/ai-assistant.d.ts.map +1 -0
  56. package/dist/ai-assistant.js +886 -0
  57. package/dist/ai-chat.cjs +1165 -0
  58. package/dist/ai-chat.d.ts +56 -0
  59. package/dist/ai-chat.d.ts.map +1 -0
  60. package/dist/ai-chat.js +1141 -0
  61. package/dist/ai-code.cjs +1866 -0
  62. package/dist/ai-code.d.ts +58 -0
  63. package/dist/ai-code.d.ts.map +1 -0
  64. package/dist/ai-code.js +1841 -0
  65. package/dist/ai-model-selector-navigation-bar.cjs +59 -0
  66. package/dist/ai-model-selector-navigation-bar.d.ts +15 -0
  67. package/dist/ai-model-selector-navigation-bar.d.ts.map +1 -0
  68. package/dist/ai-model-selector-navigation-bar.js +37 -0
  69. package/dist/ai-models.cjs +41 -0
  70. package/dist/ai-models.d.ts +15 -0
  71. package/dist/ai-models.d.ts.map +1 -0
  72. package/dist/ai-models.js +19 -0
  73. package/dist/ai-playground.cjs +1110 -0
  74. package/dist/ai-playground.d.ts +66 -0
  75. package/dist/ai-playground.d.ts.map +1 -0
  76. package/dist/ai-playground.js +1088 -0
  77. package/dist/ai-tools.cjs +1043 -0
  78. package/dist/ai-tools.d.ts +23 -0
  79. package/dist/ai-tools.d.ts.map +1 -0
  80. package/dist/ai-tools.js +1022 -0
  81. package/dist/ai-vision.cjs +1831 -0
  82. package/dist/ai-vision.d.ts +74 -0
  83. package/dist/ai-vision.d.ts.map +1 -0
  84. package/dist/ai-vision.js +1810 -0
  85. package/dist/ai-voice-settings.cjs +1511 -0
  86. package/dist/ai-voice-settings.d.ts +100 -0
  87. package/dist/ai-voice-settings.d.ts.map +1 -0
  88. package/dist/ai-voice-settings.js +1478 -0
  89. package/dist/ai-voice.cjs +1522 -0
  90. package/dist/ai-voice.d.ts +72 -0
  91. package/dist/ai-voice.d.ts.map +1 -0
  92. package/dist/ai-voice.js +1501 -0
  93. package/dist/alert.cjs +13 -142
  94. package/dist/alert.js +14 -143
  95. package/dist/android.cjs +127 -0
  96. package/dist/android.d.ts +19 -0
  97. package/dist/android.d.ts.map +1 -0
  98. package/dist/android.js +104 -0
  99. package/dist/animated-background.cjs +8830 -0
  100. package/dist/animated-background.d.ts +103 -0
  101. package/dist/animated-background.d.ts.map +1 -0
  102. package/dist/animated-background.js +8824 -0
  103. package/dist/animated-beam.cjs +8438 -0
  104. package/dist/animated-beam.d.ts +15 -0
  105. package/dist/animated-beam.d.ts.map +1 -0
  106. package/dist/animated-beam.js +8417 -0
  107. package/dist/animated-cursor.cjs +269 -0
  108. package/dist/animated-cursor.d.ts +70 -0
  109. package/dist/animated-cursor.d.ts.map +1 -0
  110. package/dist/animated-cursor.js +264 -0
  111. package/dist/animated-icon.cjs +8927 -0
  112. package/dist/animated-icon.d.ts +119 -0
  113. package/dist/animated-icon.d.ts.map +1 -0
  114. package/dist/animated-icon.js +8902 -0
  115. package/dist/animated-list.cjs +9226 -0
  116. package/dist/animated-list.d.ts +126 -0
  117. package/dist/animated-list.d.ts.map +1 -0
  118. package/dist/animated-list.js +9201 -0
  119. package/dist/animated-number.cjs +8773 -0
  120. package/dist/animated-number.d.ts +127 -0
  121. package/dist/animated-number.d.ts.map +1 -0
  122. package/dist/animated-number.js +8767 -0
  123. package/dist/animated-testimonials.cjs +8653 -0
  124. package/dist/animated-testimonials.d.ts +17 -0
  125. package/dist/animated-testimonials.d.ts.map +1 -0
  126. package/dist/animated-testimonials.js +8632 -0
  127. package/dist/animated-text.cjs +8914 -0
  128. package/dist/animated-text.d.ts +65 -0
  129. package/dist/animated-text.d.ts.map +1 -0
  130. package/dist/animated-text.js +8890 -0
  131. package/dist/animated-tooltip.cjs +8624 -0
  132. package/dist/animated-tooltip.d.ts +9 -0
  133. package/dist/animated-tooltip.d.ts.map +1 -0
  134. package/dist/animated-tooltip.js +8603 -0
  135. package/dist/announcement.cjs +465 -0
  136. package/dist/announcement.d.ts +9 -0
  137. package/dist/announcement.d.ts.map +1 -0
  138. package/dist/announcement.js +443 -0
  139. package/dist/app-switcher-navigation-bar.cjs +470 -0
  140. package/dist/app-switcher-navigation-bar.d.ts +15 -0
  141. package/dist/app-switcher-navigation-bar.d.ts.map +1 -0
  142. package/dist/app-switcher-navigation-bar.js +448 -0
  143. package/dist/apple-cards-carousel.cjs +9356 -0
  144. package/dist/apple-cards-carousel.d.ts +36 -0
  145. package/dist/apple-cards-carousel.d.ts.map +1 -0
  146. package/dist/apple-cards-carousel.js +9334 -0
  147. package/dist/apple-hello-effect.cjs +8380 -0
  148. package/dist/apple-hello-effect.d.ts +8 -0
  149. package/dist/apple-hello-effect.d.ts.map +1 -0
  150. package/dist/apple-hello-effect.js +8359 -0
  151. package/dist/auth.cjs +6 -5
  152. package/dist/auth.d.ts.map +1 -1
  153. package/dist/auth.js +6 -5
  154. package/dist/badge.cjs +28 -164
  155. package/dist/badge.d.ts +2 -5
  156. package/dist/badge.d.ts.map +1 -1
  157. package/dist/badge.js +29 -165
  158. package/dist/bank.d.ts +6 -6
  159. package/dist/banner.cjs +78 -0
  160. package/dist/banner.d.ts +20 -0
  161. package/dist/banner.d.ts.map +1 -0
  162. package/dist/banner.js +55 -0
  163. package/dist/breadcrumb-and-filters-navigation-bar.cjs +51 -0
  164. package/dist/breadcrumb-and-filters-navigation-bar.d.ts +10 -0
  165. package/dist/breadcrumb-and-filters-navigation-bar.d.ts.map +1 -0
  166. package/dist/breadcrumb-and-filters-navigation-bar.js +29 -0
  167. package/dist/breadcrumb-navigation-bar.cjs +37 -0
  168. package/dist/breadcrumb-navigation-bar.d.ts +10 -0
  169. package/dist/breadcrumb-navigation-bar.d.ts.map +1 -0
  170. package/dist/breadcrumb-navigation-bar.js +15 -0
  171. package/dist/button.cjs +21 -150
  172. package/dist/button.d.ts +1 -1
  173. package/dist/button.d.ts.map +1 -1
  174. package/dist/button.js +21 -150
  175. package/dist/calendar.cjs +55 -0
  176. package/dist/calendar.d.ts +9 -0
  177. package/dist/calendar.d.ts.map +1 -0
  178. package/dist/calendar.js +53 -0
  179. package/dist/centered-logo-navigation-bar.cjs +37 -0
  180. package/dist/centered-logo-navigation-bar.d.ts +15 -0
  181. package/dist/centered-logo-navigation-bar.d.ts.map +1 -0
  182. package/dist/centered-logo-navigation-bar.js +15 -0
  183. package/dist/chart.cjs +266 -0
  184. package/dist/chart.d.ts +52 -0
  185. package/dist/chart.d.ts.map +1 -0
  186. package/dist/chart.js +238 -0
  187. package/dist/choicebox.cjs +77 -0
  188. package/dist/choicebox.d.ts +15 -0
  189. package/dist/choicebox.d.ts.map +1 -0
  190. package/dist/choicebox.js +55 -0
  191. package/dist/chrome.cjs +36 -30
  192. package/dist/chrome.d.ts.map +1 -1
  193. package/dist/chrome.js +37 -31
  194. package/dist/code-block.cjs +871 -0
  195. package/dist/code-block.d.ts +38 -0
  196. package/dist/code-block.d.ts.map +1 -0
  197. package/dist/code-block.js +849 -0
  198. package/dist/code-compare.cjs +1714 -0
  199. package/dist/code-compare.d.ts +46 -0
  200. package/dist/code-compare.d.ts.map +1 -0
  201. package/dist/code-compare.js +1692 -0
  202. package/dist/code-diff.cjs +1073 -0
  203. package/dist/code-diff.d.ts +42 -0
  204. package/dist/code-diff.d.ts.map +1 -0
  205. package/dist/code-diff.js +1051 -0
  206. package/dist/code-editor.cjs +641 -0
  207. package/dist/code-editor.d.ts +23 -0
  208. package/dist/code-editor.d.ts.map +1 -0
  209. package/dist/code-editor.js +616 -0
  210. package/dist/code-explorer.cjs +729 -0
  211. package/dist/code-explorer.d.ts +41 -0
  212. package/dist/code-explorer.d.ts.map +1 -0
  213. package/dist/code-explorer.js +707 -0
  214. package/dist/code-preview.cjs +1349 -0
  215. package/dist/code-preview.d.ts +38 -0
  216. package/dist/code-preview.d.ts.map +1 -0
  217. package/dist/code-preview.js +1327 -0
  218. package/dist/code-snippet.cjs +920 -0
  219. package/dist/code-snippet.d.ts +48 -0
  220. package/dist/code-snippet.d.ts.map +1 -0
  221. package/dist/code-snippet.js +897 -0
  222. package/dist/code-tabs.cjs +76 -0
  223. package/dist/code-tabs.d.ts +12 -0
  224. package/dist/code-tabs.d.ts.map +1 -0
  225. package/dist/code-tabs.js +54 -0
  226. package/dist/code-terminal.cjs +894 -0
  227. package/dist/code-terminal.d.ts +48 -0
  228. package/dist/code-terminal.d.ts.map +1 -0
  229. package/dist/code-terminal.js +872 -0
  230. package/dist/collaboration-navigation-bar.cjs +49 -0
  231. package/dist/collaboration-navigation-bar.d.ts +11 -0
  232. package/dist/collaboration-navigation-bar.d.ts.map +1 -0
  233. package/dist/collaboration-navigation-bar.js +27 -0
  234. package/dist/collapsible.cjs +34 -155
  235. package/dist/collapsible.d.ts.map +1 -1
  236. package/dist/collapsible.js +34 -155
  237. package/dist/color-picker.cjs +516 -0
  238. package/dist/color-picker.d.ts +10 -0
  239. package/dist/color-picker.d.ts.map +1 -0
  240. package/dist/color-picker.js +495 -0
  241. package/dist/combobox.cjs +488 -0
  242. package/dist/combobox.d.ts +13 -0
  243. package/dist/combobox.d.ts.map +1 -0
  244. package/dist/combobox.js +466 -0
  245. package/dist/communication-navigation-bar.cjs +438 -0
  246. package/dist/communication-navigation-bar.d.ts +7 -0
  247. package/dist/communication-navigation-bar.d.ts.map +1 -0
  248. package/dist/communication-navigation-bar.js +416 -0
  249. package/dist/company-profile.cjs +46 -0
  250. package/dist/company-profile.d.ts +10 -0
  251. package/dist/company-profile.d.ts.map +1 -0
  252. package/dist/company-profile.js +44 -0
  253. package/dist/comparison.cjs +60 -0
  254. package/dist/comparison.d.ts +16 -0
  255. package/dist/comparison.d.ts.map +1 -0
  256. package/dist/comparison.js +38 -0
  257. package/dist/context-switcher-navigation-bar.cjs +51 -0
  258. package/dist/context-switcher-navigation-bar.d.ts +10 -0
  259. package/dist/context-switcher-navigation-bar.d.ts.map +1 -0
  260. package/dist/context-switcher-navigation-bar.js +29 -0
  261. package/dist/credit-card.cjs +77 -0
  262. package/dist/credit-card.d.ts +11 -0
  263. package/dist/credit-card.d.ts.map +1 -0
  264. package/dist/credit-card.js +55 -0
  265. package/dist/crypto-screener.cjs +43 -0
  266. package/dist/crypto-screener.d.ts +4 -0
  267. package/dist/crypto-screener.d.ts.map +1 -0
  268. package/dist/crypto-screener.js +41 -0
  269. package/dist/cursor.cjs +71 -0
  270. package/dist/cursor.d.ts +9 -0
  271. package/dist/cursor.d.ts.map +1 -0
  272. package/dist/cursor.js +49 -0
  273. package/dist/dashboard-navigation-bar.cjs +441 -0
  274. package/dist/dashboard-navigation-bar.d.ts +11 -0
  275. package/dist/dashboard-navigation-bar.d.ts.map +1 -0
  276. package/dist/dashboard-navigation-bar.js +419 -0
  277. package/dist/dialog-stack.cjs +460 -0
  278. package/dist/dialog-stack.d.ts +13 -0
  279. package/dist/dialog-stack.d.ts.map +1 -0
  280. package/dist/dialog-stack.js +438 -0
  281. package/dist/dialog.cjs +12 -11
  282. package/dist/dialog.d.ts +1 -1
  283. package/dist/dialog.d.ts.map +1 -1
  284. package/dist/dialog.js +12 -11
  285. package/dist/direction.cjs +26 -0
  286. package/dist/direction.d.ts +20 -0
  287. package/dist/direction.d.ts.map +1 -0
  288. package/dist/direction.js +23 -0
  289. package/dist/dock.cjs +8675 -0
  290. package/dist/dock.d.ts +20 -0
  291. package/dist/dock.d.ts.map +1 -0
  292. package/dist/dock.js +8653 -0
  293. package/dist/dropzone.cjs +116 -0
  294. package/dist/dropzone.d.ts +11 -0
  295. package/dist/dropzone.d.ts.map +1 -0
  296. package/dist/dropzone.js +94 -0
  297. package/dist/e-commerce-navigation-bar.cjs +442 -0
  298. package/dist/e-commerce-navigation-bar.d.ts +12 -0
  299. package/dist/e-commerce-navigation-bar.d.ts.map +1 -0
  300. package/dist/e-commerce-navigation-bar.js +420 -0
  301. package/dist/editor.cjs +497 -0
  302. package/dist/editor.d.ts +9 -0
  303. package/dist/editor.d.ts.map +1 -0
  304. package/dist/editor.js +475 -0
  305. package/dist/empty.cjs +117 -0
  306. package/dist/empty.d.ts +18 -0
  307. package/dist/empty.d.ts.map +1 -0
  308. package/dist/empty.js +110 -0
  309. package/dist/engine.cjs +91 -0
  310. package/dist/engine.js +86 -0
  311. package/dist/field.cjs +2 -1
  312. package/dist/field.d.ts.map +1 -1
  313. package/dist/field.js +3 -2
  314. package/dist/financials.cjs +66 -0
  315. package/dist/financials.d.ts +12 -0
  316. package/dist/financials.d.ts.map +1 -0
  317. package/dist/financials.js +64 -0
  318. package/dist/forex-screener.cjs +44 -0
  319. package/dist/forex-screener.d.ts +4 -0
  320. package/dist/forex-screener.d.ts.map +1 -0
  321. package/dist/forex-screener.js +42 -0
  322. package/dist/gantt.cjs +65 -0
  323. package/dist/gantt.d.ts +13 -0
  324. package/dist/gantt.d.ts.map +1 -0
  325. package/dist/gantt.js +43 -0
  326. package/dist/grid-pattern.cjs +327 -0
  327. package/dist/grid-pattern.d.ts +111 -0
  328. package/dist/grid-pattern.d.ts.map +1 -0
  329. package/dist/grid-pattern.js +304 -0
  330. package/dist/hooks/use-mobile.d.ts +3 -0
  331. package/dist/hooks/use-mobile.d.ts.map +1 -0
  332. package/dist/icon-button.cjs +13 -142
  333. package/dist/icon-button.js +14 -143
  334. package/dist/icon-navigation-bar.cjs +48 -0
  335. package/dist/icon-navigation-bar.d.ts +11 -0
  336. package/dist/icon-navigation-bar.d.ts.map +1 -0
  337. package/dist/icon-navigation-bar.js +26 -0
  338. package/dist/image-crop.cjs +482 -0
  339. package/dist/image-crop.d.ts +9 -0
  340. package/dist/image-crop.d.ts.map +1 -0
  341. package/dist/image-crop.js +460 -0
  342. package/dist/image-zoom.cjs +77 -0
  343. package/dist/image-zoom.d.ts +7 -0
  344. package/dist/image-zoom.d.ts.map +1 -0
  345. package/dist/image-zoom.js +55 -0
  346. package/dist/image.cjs +15 -143
  347. package/dist/image.d.ts.map +1 -1
  348. package/dist/image.js +16 -144
  349. package/dist/index.cjs +30274 -1201
  350. package/dist/index.d.ts +121 -0
  351. package/dist/index.d.ts.map +1 -1
  352. package/dist/index.js +30006 -1220
  353. package/dist/ink.cjs +17 -0
  354. package/dist/ink.js +15 -0
  355. package/dist/input-otp.cjs +72 -0
  356. package/dist/input-otp.d.ts +35 -0
  357. package/dist/input-otp.d.ts.map +1 -0
  358. package/dist/input-otp.js +47 -0
  359. package/dist/iphone-15-pro.cjs +61 -0
  360. package/dist/iphone-15-pro.d.ts +9 -0
  361. package/dist/iphone-15-pro.d.ts.map +1 -0
  362. package/dist/iphone-15-pro.js +39 -0
  363. package/dist/item.cjs +215 -0
  364. package/dist/item.d.ts +41 -0
  365. package/dist/item.d.ts.map +1 -0
  366. package/dist/item.js +200 -0
  367. package/dist/kanban.cjs +1354 -0
  368. package/dist/kanban.d.ts +36 -0
  369. package/dist/kanban.d.ts.map +1 -0
  370. package/dist/kanban.js +1330 -0
  371. package/dist/kbd.cjs +40 -0
  372. package/dist/kbd.d.ts +4 -0
  373. package/dist/kbd.d.ts.map +1 -0
  374. package/dist/kbd.js +37 -0
  375. package/dist/limelight-nav-navigation-bar.cjs +51 -0
  376. package/dist/limelight-nav-navigation-bar.d.ts +10 -0
  377. package/dist/limelight-nav-navigation-bar.d.ts.map +1 -0
  378. package/dist/limelight-nav-navigation-bar.js +29 -0
  379. package/dist/limelight-nav.cjs +570 -0
  380. package/dist/limelight-nav.d.ts +10 -0
  381. package/dist/limelight-nav.d.ts.map +1 -0
  382. package/dist/limelight-nav.js +549 -0
  383. package/dist/link.cjs +29 -152
  384. package/dist/link.js +30 -153
  385. package/dist/list.cjs +35 -0
  386. package/dist/list.d.ts +5 -0
  387. package/dist/list.d.ts.map +1 -0
  388. package/dist/list.js +12 -0
  389. package/dist/magnetic.cjs +63 -0
  390. package/dist/magnetic.d.ts +8 -0
  391. package/dist/magnetic.d.ts.map +1 -0
  392. package/dist/magnetic.js +41 -0
  393. package/dist/market-overview.cjs +102 -0
  394. package/dist/market-overview.d.ts +4 -0
  395. package/dist/market-overview.d.ts.map +1 -0
  396. package/dist/market-overview.js +100 -0
  397. package/dist/marquee.cjs +67 -0
  398. package/dist/marquee.d.ts +10 -0
  399. package/dist/marquee.d.ts.map +1 -0
  400. package/dist/marquee.js +45 -0
  401. package/dist/menu-dock.cjs +64 -0
  402. package/dist/menu-dock.d.ts +14 -0
  403. package/dist/menu-dock.d.ts.map +1 -0
  404. package/dist/menu-dock.js +42 -0
  405. package/dist/menubar.cjs +116 -0
  406. package/dist/menubar.d.ts +30 -0
  407. package/dist/menubar.d.ts.map +1 -0
  408. package/dist/menubar.js +61 -0
  409. package/dist/message-dock.cjs +480 -0
  410. package/dist/message-dock.d.ts +15 -0
  411. package/dist/message-dock.d.ts.map +1 -0
  412. package/dist/message-dock.js +458 -0
  413. package/dist/mini-calendar.cjs +505 -0
  414. package/dist/mini-calendar.d.ts +10 -0
  415. package/dist/mini-calendar.d.ts.map +1 -0
  416. package/dist/mini-calendar.js +483 -0
  417. package/dist/minimal-tiptap.cjs +48 -0
  418. package/dist/minimal-tiptap.d.ts +8 -0
  419. package/dist/minimal-tiptap.d.ts.map +1 -0
  420. package/dist/minimal-tiptap.js +26 -0
  421. package/dist/motion-highlight.cjs +71 -0
  422. package/dist/motion-highlight.d.ts +7 -0
  423. package/dist/motion-highlight.d.ts.map +1 -0
  424. package/dist/motion-highlight.js +49 -0
  425. package/dist/music-player.cjs +810 -0
  426. package/dist/music-player.d.ts +18 -0
  427. package/dist/music-player.d.ts.map +1 -0
  428. package/dist/music-player.js +788 -0
  429. package/dist/native-select.cjs +82 -0
  430. package/dist/native-select.d.ts +9 -0
  431. package/dist/native-select.d.ts.map +1 -0
  432. package/dist/native-select.js +58 -0
  433. package/dist/news-timeline.cjs +42 -0
  434. package/dist/news-timeline.d.ts +4 -0
  435. package/dist/news-timeline.d.ts.map +1 -0
  436. package/dist/news-timeline.js +40 -0
  437. package/dist/order-entry.cjs +141 -0
  438. package/dist/order-entry.d.ts +15 -0
  439. package/dist/order-entry.d.ts.map +1 -0
  440. package/dist/order-entry.js +136 -0
  441. package/dist/orders-history.cjs +83 -0
  442. package/dist/orders-history.d.ts +18 -0
  443. package/dist/orders-history.d.ts.map +1 -0
  444. package/dist/orders-history.js +78 -0
  445. package/dist/pagination.cjs +132 -0
  446. package/dist/pagination.d.ts +29 -0
  447. package/dist/pagination.d.ts.map +1 -0
  448. package/dist/pagination.js +104 -0
  449. package/dist/particles-background.cjs +159 -0
  450. package/dist/particles-background.d.ts +18 -0
  451. package/dist/particles-background.d.ts.map +1 -0
  452. package/dist/particles-background.js +157 -0
  453. package/dist/pill.cjs +80 -0
  454. package/dist/pill.d.ts +21 -0
  455. package/dist/pill.d.ts.map +1 -0
  456. package/dist/pill.js +57 -0
  457. package/dist/pixel-image.cjs +71 -0
  458. package/dist/pixel-image.d.ts +8 -0
  459. package/dist/pixel-image.d.ts.map +1 -0
  460. package/dist/pixel-image.js +49 -0
  461. package/dist/popover.cjs +11 -9
  462. package/dist/popover.d.ts.map +1 -1
  463. package/dist/popover.js +11 -9
  464. package/dist/positions-list.cjs +98 -0
  465. package/dist/positions-list.d.ts +13 -0
  466. package/dist/positions-list.d.ts.map +1 -0
  467. package/dist/positions-list.js +93 -0
  468. package/dist/progress-circle.cjs +2 -1
  469. package/dist/progress-circle.d.ts.map +1 -1
  470. package/dist/progress-circle.js +2 -1
  471. package/dist/pulse-animation.cjs +8741 -0
  472. package/dist/pulse-animation.d.ts +155 -0
  473. package/dist/pulse-animation.d.ts.map +1 -0
  474. package/dist/pulse-animation.js +8732 -0
  475. package/dist/qr-code.cjs +65 -0
  476. package/dist/qr-code.d.ts +21 -0
  477. package/dist/qr-code.d.ts.map +1 -0
  478. package/dist/qr-code.js +43 -0
  479. package/dist/relative-time.cjs +88 -0
  480. package/dist/relative-time.d.ts +9 -0
  481. package/dist/relative-time.d.ts.map +1 -0
  482. package/dist/relative-time.js +66 -0
  483. package/dist/resizable.cjs +61 -0
  484. package/dist/resizable.d.ts +24 -0
  485. package/dist/resizable.d.ts.map +1 -0
  486. package/dist/resizable.js +37 -0
  487. package/dist/reveal-animation.cjs +8791 -0
  488. package/dist/reveal-animation.d.ts +134 -0
  489. package/dist/reveal-animation.d.ts.map +1 -0
  490. package/dist/reveal-animation.js +8779 -0
  491. package/dist/safari.cjs +90 -0
  492. package/dist/safari.d.ts +9 -0
  493. package/dist/safari.d.ts.map +1 -0
  494. package/dist/safari.js +68 -0
  495. package/dist/sandbox.cjs +94 -0
  496. package/dist/sandbox.d.ts +9 -0
  497. package/dist/sandbox.d.ts.map +1 -0
  498. package/dist/sandbox.js +72 -0
  499. package/dist/search-and-toggle-navigation-bar.cjs +51 -0
  500. package/dist/search-and-toggle-navigation-bar.d.ts +10 -0
  501. package/dist/search-and-toggle-navigation-bar.d.ts.map +1 -0
  502. package/dist/search-and-toggle-navigation-bar.js +29 -0
  503. package/dist/select.cjs +34 -160
  504. package/dist/select.d.ts.map +1 -1
  505. package/dist/select.js +34 -160
  506. package/dist/sidebar.cjs +1134 -0
  507. package/dist/sidebar.d.ts +80 -0
  508. package/dist/sidebar.d.ts.map +1 -0
  509. package/dist/sidebar.js +1090 -0
  510. package/dist/simple-navigation-bar.cjs +45 -0
  511. package/dist/simple-navigation-bar.d.ts +11 -0
  512. package/dist/simple-navigation-bar.d.ts.map +1 -0
  513. package/dist/simple-navigation-bar.js +23 -0
  514. package/dist/skeleton.cjs +14 -143
  515. package/dist/skeleton.d.ts +2 -41
  516. package/dist/skeleton.d.ts.map +1 -1
  517. package/dist/skeleton.js +15 -144
  518. package/dist/slider.d.ts +1 -0
  519. package/dist/slider.d.ts.map +1 -1
  520. package/dist/status-dashboard-navigation-bar.cjs +51 -0
  521. package/dist/status-dashboard-navigation-bar.d.ts +10 -0
  522. package/dist/status-dashboard-navigation-bar.d.ts.map +1 -0
  523. package/dist/status-dashboard-navigation-bar.js +29 -0
  524. package/dist/status.cjs +85 -0
  525. package/dist/status.d.ts +23 -0
  526. package/dist/status.d.ts.map +1 -0
  527. package/dist/status.js +62 -0
  528. package/dist/stock-screener.cjs +44 -0
  529. package/dist/stock-screener.d.ts +4 -0
  530. package/dist/stock-screener.d.ts.map +1 -0
  531. package/dist/stock-screener.js +42 -0
  532. package/dist/switch.cjs +1 -1
  533. package/dist/switch.d.ts +1 -3
  534. package/dist/switch.d.ts.map +1 -1
  535. package/dist/switch.js +1 -1
  536. package/dist/symbol-info.cjs +44 -0
  537. package/dist/symbol-info.d.ts +9 -0
  538. package/dist/symbol-info.d.ts.map +1 -0
  539. package/dist/symbol-info.js +42 -0
  540. package/dist/table.cjs +53 -167
  541. package/dist/table.d.ts.map +1 -1
  542. package/dist/table.js +53 -167
  543. package/dist/tag.cjs +13 -142
  544. package/dist/tag.js +14 -143
  545. package/dist/tags.cjs +385 -0
  546. package/dist/tags.d.ts +13 -0
  547. package/dist/tags.d.ts.map +1 -0
  548. package/dist/tags.js +364 -0
  549. package/dist/team-switcher-navigation-bar.cjs +51 -0
  550. package/dist/team-switcher-navigation-bar.d.ts +10 -0
  551. package/dist/team-switcher-navigation-bar.d.ts.map +1 -0
  552. package/dist/team-switcher-navigation-bar.js +29 -0
  553. package/dist/technical-analysis.cjs +69 -0
  554. package/dist/technical-analysis.d.ts +13 -0
  555. package/dist/technical-analysis.d.ts.map +1 -0
  556. package/dist/technical-analysis.js +67 -0
  557. package/dist/terminal.cjs +372 -0
  558. package/dist/terminal.d.ts +21 -0
  559. package/dist/terminal.d.ts.map +1 -0
  560. package/dist/terminal.js +350 -0
  561. package/dist/ticker-tape.cjs +54 -0
  562. package/dist/ticker-tape.d.ts +4 -0
  563. package/dist/ticker-tape.d.ts.map +1 -0
  564. package/dist/ticker-tape.js +52 -0
  565. package/dist/ticker.cjs +66 -0
  566. package/dist/ticker.d.ts +10 -0
  567. package/dist/ticker.d.ts.map +1 -0
  568. package/dist/ticker.js +44 -0
  569. package/dist/timeline.cjs +317 -0
  570. package/dist/timeline.d.ts +20 -0
  571. package/dist/timeline.d.ts.map +1 -0
  572. package/dist/timeline.js +295 -0
  573. package/dist/toggle.cjs +62 -0
  574. package/dist/toggle.d.ts +26 -0
  575. package/dist/toggle.d.ts.map +1 -0
  576. package/dist/toggle.js +57 -0
  577. package/dist/trading-panel.cjs +212 -0
  578. package/dist/trading-panel.d.ts +7 -0
  579. package/dist/trading-panel.d.ts.map +1 -0
  580. package/dist/trading-panel.js +207 -0
  581. package/dist/two-tier-navigation-bar.cjs +51 -0
  582. package/dist/two-tier-navigation-bar.d.ts +10 -0
  583. package/dist/two-tier-navigation-bar.d.ts.map +1 -0
  584. package/dist/two-tier-navigation-bar.js +29 -0
  585. package/dist/underline-navigation-bar.cjs +51 -0
  586. package/dist/underline-navigation-bar.d.ts +10 -0
  587. package/dist/underline-navigation-bar.d.ts.map +1 -0
  588. package/dist/underline-navigation-bar.js +29 -0
  589. package/dist/youtube-pip-player.cjs +489 -0
  590. package/dist/youtube-pip-player.d.ts +41 -0
  591. package/dist/youtube-pip-player.d.ts.map +1 -0
  592. package/dist/youtube-pip-player.js +466 -0
  593. package/package.json +755 -54
  594. package/src/3d-button.tsx +346 -0
  595. package/src/3d-card.tsx +271 -0
  596. package/src/3d-carousel.tsx +444 -0
  597. package/src/3d-grid.tsx +448 -0
  598. package/src/3d-marquee.tsx +422 -0
  599. package/src/3d-model-viewer.tsx +659 -0
  600. package/src/3d-pin.tsx +37 -0
  601. package/src/3d-scene.tsx +629 -0
  602. package/src/3d-text.tsx +442 -0
  603. package/src/advanced-chart.tsx +63 -0
  604. package/src/advanced-navigation-bar.tsx +83 -0
  605. package/src/ai-actions.tsx +60 -0
  606. package/src/ai-agents.tsx +1174 -0
  607. package/src/ai-assistant.tsx +227 -0
  608. package/src/ai-chat.tsx +554 -0
  609. package/src/ai-code.tsx +1331 -0
  610. package/src/ai-model-selector-navigation-bar.tsx +78 -0
  611. package/src/ai-models.tsx +58 -0
  612. package/src/ai-playground.tsx +429 -0
  613. package/src/ai-tools.tsx +383 -0
  614. package/src/ai-vision.tsx +1220 -0
  615. package/src/ai-voice-settings.tsx +726 -0
  616. package/src/ai-voice.tsx +735 -0
  617. package/src/android.tsx +92 -0
  618. package/src/animated-background.tsx +625 -0
  619. package/src/animated-beam.tsx +110 -0
  620. package/src/animated-cursor.tsx +406 -0
  621. package/src/animated-icon.tsx +520 -0
  622. package/src/animated-list.tsx +508 -0
  623. package/src/animated-number.tsx +485 -0
  624. package/src/animated-testimonials.tsx +119 -0
  625. package/src/animated-text.tsx +481 -0
  626. package/src/animated-tooltip.tsx +54 -0
  627. package/src/announcement.tsx +55 -0
  628. package/src/app-switcher-navigation-bar.tsx +76 -0
  629. package/src/apple-cards-carousel.tsx +349 -0
  630. package/src/apple-hello-effect.tsx +50 -0
  631. package/src/auth.tsx +9 -8
  632. package/src/avatar.tsx +1 -1
  633. package/src/badge.tsx +27 -30
  634. package/src/banner.tsx +62 -0
  635. package/src/breadcrumb-and-filters-navigation-bar.tsx +40 -0
  636. package/src/breadcrumb-navigation-bar.tsx +43 -0
  637. package/src/button.tsx +10 -9
  638. package/src/calendar.tsx +62 -0
  639. package/src/centered-logo-navigation-bar.tsx +43 -0
  640. package/src/chart.tsx +372 -0
  641. package/src/choicebox.tsx +89 -0
  642. package/src/chrome.tsx +41 -40
  643. package/src/code-block.tsx +278 -0
  644. package/src/code-compare.tsx +551 -0
  645. package/src/code-diff.tsx +573 -0
  646. package/src/code-editor.tsx +250 -0
  647. package/src/code-explorer.tsx +403 -0
  648. package/src/code-preview.tsx +488 -0
  649. package/src/code-snippet.tsx +336 -0
  650. package/src/code-tabs.tsx +78 -0
  651. package/src/code-terminal.tsx +530 -0
  652. package/src/collaboration-navigation-bar.tsx +50 -0
  653. package/src/collapsible.tsx +3 -2
  654. package/src/color-picker.tsx +68 -0
  655. package/src/combobox.tsx +87 -0
  656. package/src/communication-navigation-bar.tsx +42 -0
  657. package/src/company-profile.tsx +67 -0
  658. package/src/comparison.tsx +68 -0
  659. package/src/context-switcher-navigation-bar.tsx +39 -0
  660. package/src/credit-card.tsx +72 -0
  661. package/src/crypto-screener.tsx +57 -0
  662. package/src/cursor.tsx +61 -0
  663. package/src/dashboard-navigation-bar.tsx +49 -0
  664. package/src/dialog-stack.tsx +55 -0
  665. package/src/dialog.tsx +16 -15
  666. package/src/direction.tsx +40 -0
  667. package/src/dock.tsx +172 -0
  668. package/src/dropzone.tsx +106 -0
  669. package/src/e-commerce-navigation-bar.tsx +54 -0
  670. package/src/editor.tsx +85 -0
  671. package/src/empty.tsx +117 -0
  672. package/src/field.tsx +2 -1
  673. package/src/financials.tsx +85 -0
  674. package/src/forex-screener.tsx +58 -0
  675. package/src/gantt.tsx +68 -0
  676. package/src/grid-pattern.tsx +353 -0
  677. package/src/hooks/use-mobile.ts +29 -0
  678. package/src/icon-navigation-bar.tsx +36 -0
  679. package/src/image-crop.tsx +67 -0
  680. package/src/image-zoom.tsx +64 -0
  681. package/src/image.tsx +2 -1
  682. package/src/index.ts +123 -0
  683. package/src/input-otp.tsx +72 -0
  684. package/src/iphone-15-pro.tsx +69 -0
  685. package/src/item.tsx +193 -0
  686. package/src/kanban.tsx +772 -0
  687. package/src/kbd.tsx +32 -0
  688. package/src/limelight-nav-navigation-bar.tsx +39 -0
  689. package/src/limelight-nav.tsx +101 -0
  690. package/src/link.tsx +18 -18
  691. package/src/list.tsx +22 -0
  692. package/src/magnetic.tsx +54 -0
  693. package/src/market-overview.tsx +116 -0
  694. package/src/marquee.tsx +62 -0
  695. package/src/menu-dock.tsx +56 -0
  696. package/src/menubar.tsx +149 -0
  697. package/src/message-dock.tsx +89 -0
  698. package/src/mini-calendar.tsx +121 -0
  699. package/src/minimal-tiptap.tsx +32 -0
  700. package/src/motion-highlight.tsx +55 -0
  701. package/src/music-player.tsx +413 -0
  702. package/src/native-select.tsx +63 -0
  703. package/src/news-timeline.tsx +56 -0
  704. package/src/order-entry.tsx +162 -0
  705. package/src/orders-history.tsx +115 -0
  706. package/src/pagination.tsx +118 -0
  707. package/src/particles-background.tsx +225 -0
  708. package/src/pill.tsx +61 -0
  709. package/src/pixel-image.tsx +64 -0
  710. package/src/popover.tsx +10 -9
  711. package/src/positions-list.tsx +108 -0
  712. package/src/progress-circle.tsx +2 -1
  713. package/src/pulse-animation.tsx +606 -0
  714. package/src/qr-code.tsx +64 -0
  715. package/src/relative-time.tsx +84 -0
  716. package/src/resizable.tsx +46 -0
  717. package/src/reveal-animation.tsx +532 -0
  718. package/src/safari.tsx +115 -0
  719. package/src/sandbox.tsx +83 -0
  720. package/src/search-and-toggle-navigation-bar.tsx +39 -0
  721. package/src/select.tsx +31 -30
  722. package/src/sidebar.tsx +723 -0
  723. package/src/simple-navigation-bar.tsx +39 -0
  724. package/src/skeleton.tsx +20 -168
  725. package/src/slider.tsx +1 -0
  726. package/src/status-dashboard-navigation-bar.tsx +39 -0
  727. package/src/status.tsx +63 -0
  728. package/src/stock-screener.tsx +58 -0
  729. package/src/switch.tsx +2 -2
  730. package/src/symbol-info.tsx +64 -0
  731. package/src/table.tsx +26 -25
  732. package/src/tags.tsx +62 -0
  733. package/src/team-switcher-navigation-bar.tsx +39 -0
  734. package/src/technical-analysis.tsx +99 -0
  735. package/src/terminal.tsx +399 -0
  736. package/src/ticker-tape.tsx +68 -0
  737. package/src/ticker.tsx +52 -0
  738. package/src/timeline.tsx +412 -0
  739. package/src/toggle.tsx +84 -0
  740. package/src/trading-panel.tsx +262 -0
  741. package/src/two-tier-navigation-bar.tsx +39 -0
  742. package/src/underline-navigation-bar.tsx +39 -0
  743. package/src/youtube-pip-player.tsx +606 -0
  744. package/tokens.css +11 -0
@@ -0,0 +1,1331 @@
1
+ "use client"
2
+
3
+ import { type GuiElement, variants } from '@hanzo/ui'
4
+ import * as React from "react"
5
+ import Editor, { OnChange, OnMount } from "@monaco-editor/react"
6
+ import {
7
+ AlertTriangle,
8
+ Bot,
9
+ Bug,
10
+ Check,
11
+ ChevronDown,
12
+ ChevronRight,
13
+ Code,
14
+ Copy,
15
+ Download,
16
+ Eye,
17
+ EyeOff,
18
+ FileCode,
19
+ FileText,
20
+ GitCompare,
21
+ Loader2,
22
+ MessageSquare,
23
+ Play,
24
+ RotateCcw,
25
+ Send,
26
+ Settings,
27
+ Shield,
28
+ Split,
29
+ TestTube,
30
+ Upload,
31
+ User,
32
+ Wand2,
33
+ Zap,
34
+ } from "lucide-react"
35
+ import { useTheme } from "next-themes"
36
+ import { toast } from "sonner"
37
+
38
+ import { cn } from "./utils"
39
+ import {
40
+ Avatar,
41
+ AvatarFallback,
42
+ AvatarImage,
43
+ } from "@hanzo/ui"
44
+ import { Badge } from "./badge"
45
+ import { Button } from "./button"
46
+ import { Box, Card, CardContent, CardHeader, CardTitle, css, sx } from '@hanzo/ui'
47
+ import {
48
+ DropdownMenu,
49
+ DropdownMenuCheckboxItem,
50
+ DropdownMenuContent,
51
+ DropdownMenuItem,
52
+ DropdownMenuSeparator,
53
+ DropdownMenuTrigger,
54
+ } from "@hanzo/ui"
55
+ import { Progress } from "./progress"
56
+ import {
57
+ ResizableHandle,
58
+ ResizablePanel,
59
+ ResizablePanelGroup,
60
+ } from "./resizable"
61
+ import { ScrollArea, ScrollBar } from "@hanzo/ui"
62
+ import { Separator } from "./separator"
63
+ import {
64
+ Tabs,
65
+ TabsContent,
66
+ TabsList,
67
+ TabsTrigger,
68
+ } from "@hanzo/ui"
69
+ import { Textarea } from "./textarea"
70
+ import {
71
+ Tooltip,
72
+ TooltipContent,
73
+ TooltipProvider,
74
+ TooltipTrigger,
75
+ } from "@hanzo/ui"
76
+
77
+ // Types
78
+ export type CodeFeature =
79
+ | "generate"
80
+ | "explain"
81
+ | "refactor"
82
+ | "debug"
83
+ | "test"
84
+ | "document"
85
+ | "review"
86
+
87
+ export interface Explanation {
88
+ id: string
89
+ line: number
90
+ content: string
91
+ type: "explanation" | "suggestion" | "warning" | "error"
92
+ }
93
+
94
+ export interface CodeSuggestion {
95
+ id: string
96
+ type: CodeFeature
97
+ title: string
98
+ description: string
99
+ code?: string
100
+ startLine?: number
101
+ endLine?: number
102
+ severity?: "info" | "warning" | "error"
103
+ }
104
+
105
+ export interface SecurityIssue {
106
+ id: string
107
+ line: number
108
+ severity: "low" | "medium" | "high" | "critical"
109
+ message: string
110
+ fix?: string
111
+ }
112
+
113
+ export interface AICodeProps
114
+ extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
115
+ value?: string
116
+ defaultValue?: string
117
+ language?: string
118
+ theme?: "dark" | "light" | "auto"
119
+ height?: string | number
120
+ onGenerate?: (prompt: string) => Promise<string>
121
+ onExplain?: (code: string, line?: number) => Promise<Explanation[]>
122
+ onRefactor?: (code: string) => Promise<string>
123
+ onDebug?: (code: string) => Promise<CodeSuggestion[]>
124
+ onTest?: (code: string) => Promise<string>
125
+ onDocument?: (code: string) => Promise<string>
126
+ onReview?: (code: string) => Promise<CodeSuggestion[]>
127
+ onSecurityScan?: (code: string) => Promise<SecurityIssue[]>
128
+ onChange?: (value: string) => void
129
+ features?: CodeFeature[]
130
+ showMinimap?: boolean
131
+ showLineNumbers?: boolean
132
+ isGenerating?: boolean
133
+ multiFileSupport?: boolean
134
+ files?: { name: string; content: string; language?: string }[]
135
+ activeFile?: string
136
+ onFileChange?: (fileName: string) => void
137
+ onFileCreate?: (fileName: string, content: string) => void
138
+ placeholder?: string
139
+ }
140
+
141
+ // Component variants
142
+ const suggestionVariants = variants(
143
+ "relative rounded-lg border p-3 transition-colors",
144
+ {
145
+ variants: {
146
+ severity: {
147
+ info: "border-[var(--color-link-primary)] bg-[var(--color-link-primary)] dark:border-[var(--color-link-primary)] dark:bg-[var(--color-link-primary)]",
148
+ warning:
149
+ "border-[var(--lux-state-notice)] bg-[var(--lux-state-notice)] dark:border-[var(--lux-state-notice)] dark:bg-[var(--lux-state-notice)]",
150
+ error: "border-[var(--lux-state-error)] bg-[var(--lux-state-error)] dark:border-[var(--lux-state-error)] dark:bg-[var(--lux-state-error)]",
151
+ },
152
+ },
153
+ defaultVariants: {
154
+ severity: "info",
155
+ },
156
+ }
157
+ )
158
+
159
+ // AI Chat Message for prompts
160
+ interface AIMessage {
161
+ id: string
162
+ content: string
163
+ role: "user" | "assistant"
164
+ timestamp: Date
165
+ type?: "prompt" | "code" | "explanation"
166
+ }
167
+
168
+ // Feature icons mapping
169
+ const featureIcons = {
170
+ generate: Wand2,
171
+ explain: Eye,
172
+ refactor: Code,
173
+ debug: Bug,
174
+ test: TestTube,
175
+ document: FileText,
176
+ review: GitCompare,
177
+ }
178
+
179
+ // Language detection patterns
180
+ const languagePatterns = {
181
+ typescript: /\.(tsx?|ts)$/,
182
+ javascript: /\.(jsx?|js|mjs)$/,
183
+ python: /\.py$/,
184
+ java: /\.java$/,
185
+ csharp: /\.cs$/,
186
+ cpp: /\.(cpp|cc|cxx)$/,
187
+ c: /\.c$/,
188
+ go: /\.go$/,
189
+ rust: /\.rs$/,
190
+ php: /\.php$/,
191
+ ruby: /\.rb$/,
192
+ swift: /\.swift$/,
193
+ }
194
+
195
+ // Security scanner component
196
+ const SecurityPanel = React.forwardRef<
197
+ HTMLDivElement,
198
+ {
199
+ issues: SecurityIssue[]
200
+ onFixIssue?: (issue: SecurityIssue) => void
201
+ } & React.HTMLAttributes<HTMLDivElement>
202
+ >(({ issues, onFixIssue, className, ...props }, ref) => (
203
+ <Box ref={ref as never} className={cn("space-y-2", className)} {...props}>
204
+ <Box className="flex items-center gap-2">
205
+ <Shield style={css('h-4 w-4')} />
206
+ <Box tag="span" className="font-medium">Security Analysis</Box>
207
+ {issues.length > 0 && (
208
+ <Badge
209
+ colorPalette={
210
+ issues.some((i) => i.severity === "critical")
211
+ ? "red"
212
+ : "gray"
213
+ }
214
+ >
215
+ {issues.length} issue{issues.length !== 1 ? "s" : ""}
216
+ </Badge>
217
+ )}
218
+ </Box>
219
+ {issues.length === 0 ? (
220
+ <Box tag="p" className="text-sm text-muted-foreground">
221
+ No security issues detected
222
+ </Box>
223
+ ) : (
224
+ <Box className="space-y-2">
225
+ {issues.map((issue) => (
226
+ <Box
227
+ key={issue.id}
228
+ className={cn(
229
+ "rounded-lg border p-3 text-sm",
230
+ issue.severity === "critical" &&
231
+ "border-[var(--lux-state-error)] bg-[var(--lux-state-error)] dark:bg-[var(--lux-state-error)]",
232
+ issue.severity === "high" &&
233
+ "border-[var(--lux-state-notice)] bg-[var(--lux-state-notice)] dark:bg-[var(--lux-state-notice)]",
234
+ issue.severity === "medium" &&
235
+ "border-[var(--lux-state-notice)] bg-[var(--lux-state-notice)] dark:bg-[var(--lux-state-notice)]",
236
+ issue.severity === "low" &&
237
+ "border-[var(--color-link-primary)] bg-[var(--color-link-primary)] dark:bg-[var(--color-link-primary)]"
238
+ )}
239
+ >
240
+ <Box className="flex items-start justify-between gap-2">
241
+ <Box className="space-y-1">
242
+ <Box className="flex items-center gap-2">
243
+ <Badge
244
+ colorPalette={
245
+ issue.severity === "critical" || issue.severity === "high"
246
+ ? "red"
247
+ : "gray"
248
+ }
249
+ {...sx('text-xs')}
250
+ >
251
+ {issue.severity.toUpperCase()}
252
+ </Badge>
253
+ <Box tag="span" className="text-xs text-muted-foreground">
254
+ Line {issue.line}
255
+ </Box>
256
+ </Box>
257
+ <p>{issue.message}</p>
258
+ {issue.fix && (
259
+ <Box tag="p" className="text-xs text-muted-foreground">
260
+ Fix: {issue.fix}
261
+ </Box>
262
+ )}
263
+ </Box>
264
+ {onFixIssue && issue.fix && (
265
+ <Button
266
+ size="sm"
267
+ variant="outline"
268
+ onClick={() => onFixIssue(issue)}
269
+ >
270
+ Fix
271
+ </Button>
272
+ )}
273
+ </Box>
274
+ </Box>
275
+ ))}
276
+ </Box>
277
+ )}
278
+ </Box>
279
+ ))
280
+ SecurityPanel.displayName = "SecurityPanel"
281
+
282
+ // Suggestions panel component
283
+ const SuggestionsPanel = React.forwardRef<
284
+ HTMLDivElement,
285
+ {
286
+ suggestions: CodeSuggestion[]
287
+ onApplySuggestion?: (suggestion: CodeSuggestion) => void
288
+ } & React.HTMLAttributes<HTMLDivElement>
289
+ >(({ suggestions, onApplySuggestion, className, ...props }, ref) => (
290
+ <Box ref={ref as never} className={cn("space-y-2", className)} {...props}>
291
+ <Box className="flex items-center gap-2">
292
+ <Zap style={css('h-4 w-4')} />
293
+ <Box tag="span" className="font-medium">AI Suggestions</Box>
294
+ </Box>
295
+ {suggestions.length === 0 ? (
296
+ <Box tag="p" className="text-sm text-muted-foreground">No suggestions available</Box>
297
+ ) : (
298
+ <Box className="space-y-2">
299
+ {suggestions.map((suggestion) => {
300
+ const Icon = featureIcons[suggestion.type] || Code
301
+ return (
302
+ <Box
303
+ key={suggestion.id}
304
+ className={cn(
305
+ suggestionVariants({ severity: suggestion.severity || "info" }),
306
+ "space-y-2"
307
+ )}
308
+ >
309
+ <Box className="flex items-start justify-between gap-2">
310
+ <Box className="space-y-1">
311
+ <Box className="flex items-center gap-2">
312
+ <Icon style={css('h-4 w-4')} />
313
+ <Box tag="span" className="font-medium text-sm">
314
+ {suggestion.title}
315
+ </Box>
316
+ </Box>
317
+ <Box tag="p" className="text-sm text-muted-foreground">
318
+ {suggestion.description}
319
+ </Box>
320
+ {suggestion.startLine && suggestion.endLine && (
321
+ <Box tag="span" className="text-xs text-muted-foreground">
322
+ Lines {suggestion.startLine}-{suggestion.endLine}
323
+ </Box>
324
+ )}
325
+ </Box>
326
+ {onApplySuggestion && (
327
+ <Button
328
+ size="sm"
329
+ variant="outline"
330
+ onClick={() => onApplySuggestion(suggestion)}
331
+ >
332
+ Apply
333
+ </Button>
334
+ )}
335
+ </Box>
336
+ {suggestion.code && (
337
+ <Box className="mt-2 rounded bg-background/50 p-2">
338
+ <Box tag="pre" className="text-xs overflow-x-auto">
339
+ <code>{suggestion.code}</code>
340
+ </Box>
341
+ </Box>
342
+ )}
343
+ </Box>
344
+ )
345
+ })}
346
+ </Box>
347
+ )}
348
+ </Box>
349
+ ))
350
+ SuggestionsPanel.displayName = "SuggestionsPanel"
351
+
352
+ // Chat panel for AI interaction
353
+ const ChatPanel = React.forwardRef<
354
+ HTMLDivElement,
355
+ {
356
+ messages: AIMessage[]
357
+ onSendMessage: (message: string) => void
358
+ isGenerating?: boolean
359
+ placeholder?: string
360
+ } & React.HTMLAttributes<HTMLDivElement>
361
+ >(
362
+ (
363
+ {
364
+ messages,
365
+ onSendMessage,
366
+ isGenerating,
367
+ placeholder = "Ask AI about your code...",
368
+ className,
369
+ ...props
370
+ },
371
+ ref
372
+ ) => {
373
+ const [input, setInput] = React.useState("")
374
+ const scrollRef = React.useRef<HTMLDivElement | null>(null)
375
+
376
+ React.useEffect(() => {
377
+ if (scrollRef.current) {
378
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight
379
+ }
380
+ }, [messages])
381
+
382
+ const handleSend = () => {
383
+ if (!input.trim() || isGenerating) return
384
+ onSendMessage(input)
385
+ setInput("")
386
+ }
387
+
388
+ const handleKeyPress = (e: React.KeyboardEvent) => {
389
+ if (e.key === "Enter" && !e.shiftKey) {
390
+ e.preventDefault()
391
+ handleSend()
392
+ }
393
+ }
394
+
395
+ return (
396
+ <Box
397
+ ref={ref as never}
398
+ className={cn("flex h-full flex-col", className)}
399
+ {...props}
400
+ >
401
+ <Box className="flex items-center gap-2 p-3 border-b">
402
+ <MessageSquare style={css('h-4 w-4')} />
403
+ <Box tag="span" className="font-medium">AI Assistant</Box>
404
+ </Box>
405
+
406
+ <ScrollArea ref={scrollRef as never} {...sx('flex-1 p-3')}>
407
+ <Box className="space-y-3">
408
+ {messages.map((message) => (
409
+ <Box
410
+ key={message.id}
411
+ className={cn(
412
+ "flex gap-2",
413
+ message.role === "user" ? "justify-end" : "justify-start"
414
+ )}
415
+ >
416
+ {message.role === "assistant" && (
417
+ <Avatar {...sx('h-6 w-6 shrink-0')}>
418
+ <AvatarFallback>
419
+ <Bot style={css('h-3 w-3')} />
420
+ </AvatarFallback>
421
+ </Avatar>
422
+ )}
423
+ <Box
424
+ className={cn(
425
+ "max-w-[80%] rounded-lg px-3 py-2 text-sm",
426
+ message.role === "user"
427
+ ? "bg-primary text-primary-foreground"
428
+ : "bg-muted"
429
+ )}
430
+ >
431
+ {message.type === "code" ? (
432
+ <Box tag="pre" className="overflow-x-auto">
433
+ <code>{message.content}</code>
434
+ </Box>
435
+ ) : (
436
+ <p>{message.content}</p>
437
+ )}
438
+ </Box>
439
+ {message.role === "user" && (
440
+ <Avatar {...sx('h-6 w-6 shrink-0')}>
441
+ <AvatarFallback>
442
+ <User style={css('h-3 w-3')} />
443
+ </AvatarFallback>
444
+ </Avatar>
445
+ )}
446
+ </Box>
447
+ ))}
448
+ {isGenerating && (
449
+ <Box className="flex gap-2 justify-start">
450
+ <Avatar {...sx('h-6 w-6 shrink-0')}>
451
+ <AvatarFallback>
452
+ <Bot style={css('h-3 w-3')} />
453
+ </AvatarFallback>
454
+ </Avatar>
455
+ <Box className="bg-muted rounded-lg px-3 py-2 text-sm">
456
+ <Box className="flex items-center gap-2">
457
+ <Loader2 style={css('h-3 w-3 animate-spin')} />
458
+ <span>AI is thinking...</span>
459
+ </Box>
460
+ </Box>
461
+ </Box>
462
+ )}
463
+ </Box>
464
+ </ScrollArea>
465
+
466
+ <Box className="border-t p-3">
467
+ <Box className="flex gap-2">
468
+ <Textarea
469
+ value={input}
470
+ onChange={(e) => setInput(e.target.value)}
471
+ onKeyPress={handleKeyPress}
472
+ placeholder={placeholder}
473
+ disabled={isGenerating}
474
+ {...sx('min-h-[60px] resize-none')}
475
+ rows={2}
476
+ />
477
+ <Button
478
+ size="icon"
479
+ onClick={handleSend}
480
+ disabled={!input.trim() || isGenerating}
481
+ >
482
+ <Send style={css('h-4 w-4')} />
483
+ </Button>
484
+ </Box>
485
+ </Box>
486
+ </Box>
487
+ )
488
+ }
489
+ )
490
+ ChatPanel.displayName = "ChatPanel"
491
+
492
+ // File tabs component for multi-file support
493
+ const FileTabs = React.forwardRef<
494
+ HTMLDivElement,
495
+ {
496
+ files: { name: string; content: string; language?: string }[]
497
+ activeFile?: string
498
+ onFileChange?: (fileName: string) => void
499
+ onFileCreate?: (fileName: string) => void
500
+ onFileDelete?: (fileName: string) => void
501
+ } & React.HTMLAttributes<HTMLDivElement>
502
+ >(
503
+ (
504
+ {
505
+ files,
506
+ activeFile,
507
+ onFileChange,
508
+ onFileCreate,
509
+ onFileDelete,
510
+ className,
511
+ ...props
512
+ },
513
+ ref
514
+ ) => {
515
+ const [newFileName, setNewFileName] = React.useState("")
516
+ const [isCreating, setIsCreating] = React.useState(false)
517
+
518
+ const handleCreateFile = () => {
519
+ if (newFileName.trim() && onFileCreate) {
520
+ onFileCreate(newFileName.trim())
521
+ setNewFileName("")
522
+ setIsCreating(false)
523
+ }
524
+ }
525
+
526
+ const getLanguageFromFile = (fileName: string) => {
527
+ for (const [lang, pattern] of Object.entries(languagePatterns)) {
528
+ if (pattern.test(fileName)) {
529
+ return lang
530
+ }
531
+ }
532
+ return "plaintext"
533
+ }
534
+
535
+ return (
536
+ <Box
537
+ ref={ref as never}
538
+ className={cn(
539
+ "flex items-center gap-1 border-b bg-muted/30 px-2",
540
+ className
541
+ )}
542
+ {...props}
543
+ >
544
+ <ScrollArea {...sx('flex-1')}>
545
+ <Box className="flex items-center gap-1 py-1">
546
+ {files.map((file) => (
547
+ <Button
548
+ key={file.name}
549
+ variant={activeFile === file.name ? "secondary" : "ghost"}
550
+ size="sm"
551
+ {...sx('h-8 gap-2 rounded-t-md rounded-b-none')}
552
+ onClick={() => onFileChange?.(file.name)}
553
+ >
554
+ <FileCode style={css('h-3 w-3')} />
555
+ <Box tag="span" className="text-xs">{file.name}</Box>
556
+ {onFileDelete && files.length > 1 && (
557
+ <Button
558
+ variant="ghost"
559
+ size="icon"
560
+ {...sx('h-4 w-4 hover:bg-destructive hover:text-destructive-foreground')}
561
+ onClick={(e) => {
562
+ e.stopPropagation()
563
+ onFileDelete(file.name)
564
+ }}
565
+ >
566
+ ×
567
+ </Button>
568
+ )}
569
+ </Button>
570
+ ))}
571
+ </Box>
572
+ <ScrollBar orientation="horizontal" />
573
+ </ScrollArea>
574
+
575
+ {onFileCreate && (
576
+ <Box className="flex items-center gap-1">
577
+ {isCreating ? (
578
+ <Box className="flex items-center gap-1">
579
+ <Box tag="input"
580
+ type="text"
581
+ value={newFileName}
582
+ onChange={(e) => setNewFileName(e.target.value)}
583
+ placeholder="filename.ext"
584
+ className="h-6 w-24 rounded border px-2 text-xs"
585
+ onKeyPress={(e) => {
586
+ if (e.key === "Enter") handleCreateFile()
587
+ if (e.key === "Escape") setIsCreating(false)
588
+ }}
589
+ autoFocus
590
+ />
591
+ <Button
592
+ size="icon"
593
+ {...sx('h-6 w-6')}
594
+ onClick={handleCreateFile}
595
+ >
596
+ <Check style={css('h-3 w-3')} />
597
+ </Button>
598
+ </Box>
599
+ ) : (
600
+ <Button
601
+ variant="ghost"
602
+ size="icon"
603
+ {...sx('h-6 w-6')}
604
+ onClick={() => setIsCreating(true)}
605
+ >
606
+ +
607
+ </Button>
608
+ )}
609
+ </Box>
610
+ )}
611
+ </Box>
612
+ )
613
+ }
614
+ )
615
+ FileTabs.displayName = "FileTabs"
616
+
617
+ // Main AI Code component
618
+ const AICode = React.forwardRef<HTMLDivElement, AICodeProps>(
619
+ (
620
+ {
621
+ value,
622
+ defaultValue = "",
623
+ language = "typescript",
624
+ theme: themeProp = "auto",
625
+ height = "500px",
626
+ onGenerate,
627
+ onExplain,
628
+ onRefactor,
629
+ onDebug,
630
+ onTest,
631
+ onDocument,
632
+ onReview,
633
+ onSecurityScan,
634
+ onChange,
635
+ features = [
636
+ "generate",
637
+ "explain",
638
+ "refactor",
639
+ "debug",
640
+ "test",
641
+ "document",
642
+ "review",
643
+ ],
644
+ showMinimap = false,
645
+ showLineNumbers = true,
646
+ isGenerating = false,
647
+ multiFileSupport = false,
648
+ files = [{ name: "main.ts", content: defaultValue, language }],
649
+ activeFile,
650
+ onFileChange,
651
+ onFileCreate,
652
+ placeholder = "Ask AI to generate code or explain existing code...",
653
+ className,
654
+ ...props
655
+ },
656
+ ref
657
+ ) => {
658
+ const { theme: systemTheme } = useTheme()
659
+ const [editorValue, setEditorValue] = React.useState(value || defaultValue)
660
+ const [currentLanguage, setCurrentLanguage] = React.useState(language)
661
+ const [explanations, setExplanations] = React.useState<Explanation[]>([])
662
+ const [suggestions, setSuggestions] = React.useState<CodeSuggestion[]>([])
663
+ const [securityIssues, setSecurityIssues] = React.useState<SecurityIssue[]>(
664
+ []
665
+ )
666
+ const [messages, setMessages] = React.useState<AIMessage[]>([])
667
+ const [currentFiles, setCurrentFiles] = React.useState(files)
668
+ const [currentActiveFile, setCurrentActiveFile] = React.useState(
669
+ activeFile || files[0]?.name
670
+ )
671
+ const [showSidePanel, setShowSidePanel] = React.useState(true)
672
+ const [sidePanelTab, setSidePanelTab] = React.useState<
673
+ "chat" | "suggestions" | "security"
674
+ >("chat")
675
+ const [isProcessing, setIsProcessing] = React.useState(false)
676
+ const [progress, setProgress] = React.useState(0)
677
+
678
+ const editorRef = React.useRef<any>(null)
679
+
680
+ // Get current file content
681
+ const currentFile = React.useMemo(() => {
682
+ return (
683
+ currentFiles.find((f) => f.name === currentActiveFile) ||
684
+ currentFiles[0]
685
+ )
686
+ }, [currentFiles, currentActiveFile])
687
+
688
+ // Update editor value when file changes
689
+ React.useEffect(() => {
690
+ if (currentFile) {
691
+ setEditorValue(currentFile.content)
692
+ setCurrentLanguage(
693
+ currentFile.language || getLanguageFromFile(currentFile.name)
694
+ )
695
+ }
696
+ }, [currentFile])
697
+
698
+ // External value changes
699
+ React.useEffect(() => {
700
+ if (value !== undefined) {
701
+ setEditorValue(value)
702
+ }
703
+ }, [value])
704
+
705
+ const resolveTheme = React.useMemo(() => {
706
+ if (themeProp === "auto") {
707
+ return systemTheme === "dark" ? "vs-dark" : "light"
708
+ }
709
+ return themeProp === "dark" ? "vs-dark" : "light"
710
+ }, [themeProp, systemTheme])
711
+
712
+ const getLanguageFromFile = React.useCallback((fileName: string) => {
713
+ for (const [lang, pattern] of Object.entries(languagePatterns)) {
714
+ if (pattern.test(fileName)) {
715
+ return lang
716
+ }
717
+ }
718
+ return "plaintext"
719
+ }, [])
720
+
721
+ // Handle editor changes
722
+ const handleEditorChange: OnChange = React.useCallback(
723
+ (newValue) => {
724
+ const content = newValue || ""
725
+ setEditorValue(content)
726
+ onChange?.(content)
727
+
728
+ // Update current file content
729
+ if (multiFileSupport && currentActiveFile) {
730
+ setCurrentFiles((prev) =>
731
+ prev.map((f) =>
732
+ f.name === currentActiveFile ? { ...f, content } : f
733
+ )
734
+ )
735
+ }
736
+ },
737
+ [onChange, multiFileSupport, currentActiveFile]
738
+ )
739
+
740
+ // Handle editor mount
741
+ const handleEditorMount: OnMount = React.useCallback(
742
+ (editor, monaco) => {
743
+ editorRef.current = editor
744
+
745
+ // Setup hover providers for explanations
746
+ monaco.languages.registerHoverProvider(currentLanguage, {
747
+ provideHover: (model: any, position: any) => {
748
+ const line = position.lineNumber
749
+ const explanation = explanations.find((e) => e.line === line)
750
+
751
+ if (explanation) {
752
+ return {
753
+ range: new monaco.Range(line, 1, line, 1),
754
+ contents: [
755
+ { value: `**${explanation.type.toUpperCase()}**` },
756
+ { value: explanation.content },
757
+ ],
758
+ }
759
+ }
760
+ return null
761
+ },
762
+ })
763
+
764
+ // Setup code actions for suggestions
765
+ monaco.languages.registerCodeActionProvider(currentLanguage, {
766
+ provideCodeActions: (model: any, range: any, context: any, token: any) => {
767
+ const actions = suggestions
768
+ .filter(
769
+ (s) =>
770
+ s.startLine &&
771
+ s.endLine &&
772
+ range.startLineNumber >= s.startLine &&
773
+ range.endLineNumber <= s.endLine
774
+ )
775
+ .map((suggestion) => ({
776
+ title: suggestion.title,
777
+ kind: "quickfix",
778
+ edit: suggestion.code
779
+ ? {
780
+ edits: [
781
+ {
782
+ resource: model.uri,
783
+ edit: {
784
+ range: new monaco.Range(
785
+ suggestion.startLine!,
786
+ 1,
787
+ suggestion.endLine!,
788
+ model.getLineMaxColumn(suggestion.endLine!)
789
+ ),
790
+ text: suggestion.code,
791
+ },
792
+ },
793
+ ],
794
+ }
795
+ : undefined,
796
+ }))
797
+
798
+ return { actions, dispose: () => {} } as any
799
+ },
800
+ })
801
+ },
802
+ [currentLanguage, explanations, suggestions]
803
+ )
804
+
805
+ // AI feature handlers
806
+ const handleGenerate = React.useCallback(
807
+ async (prompt: string) => {
808
+ if (!onGenerate) return
809
+
810
+ setIsProcessing(true)
811
+ setProgress(0)
812
+
813
+ try {
814
+ // Simulate progress
815
+ const progressInterval = setInterval(() => {
816
+ setProgress((prev) => Math.min(prev + 10, 90))
817
+ }, 200)
818
+
819
+ const newMessage: AIMessage = {
820
+ id: Date.now().toString(),
821
+ content: prompt,
822
+ role: "user",
823
+ timestamp: new Date(),
824
+ type: "prompt",
825
+ }
826
+ setMessages((prev) => [...prev, newMessage])
827
+
828
+ const generatedCode = await onGenerate(prompt)
829
+
830
+ clearInterval(progressInterval)
831
+ setProgress(100)
832
+
833
+ setEditorValue(generatedCode)
834
+ onChange?.(generatedCode)
835
+
836
+ const responseMessage: AIMessage = {
837
+ id: (Date.now() + 1).toString(),
838
+ content: generatedCode,
839
+ role: "assistant",
840
+ timestamp: new Date(),
841
+ type: "code",
842
+ }
843
+ setMessages((prev) => [...prev, responseMessage])
844
+
845
+ // Update current file
846
+ if (multiFileSupport && currentActiveFile) {
847
+ setCurrentFiles((prev) =>
848
+ prev.map((f) =>
849
+ f.name === currentActiveFile
850
+ ? { ...f, content: generatedCode }
851
+ : f
852
+ )
853
+ )
854
+ }
855
+ } catch (error) {
856
+ console.error("Failed to generate code:", error)
857
+ toast.error("Failed to generate code", {
858
+ description: "Please try again",
859
+ action: {
860
+ label: "Retry",
861
+ onClick: () => handleGenerate(prompt),
862
+ },
863
+ })
864
+ } finally {
865
+ setIsProcessing(false)
866
+ setProgress(0)
867
+ }
868
+ },
869
+ [onGenerate, onChange, multiFileSupport, currentActiveFile]
870
+ )
871
+
872
+ const handleExplain = React.useCallback(
873
+ async (selectedLine?: number) => {
874
+ if (!onExplain) return
875
+
876
+ setIsProcessing(true)
877
+ try {
878
+ const explanationsResult = await onExplain(editorValue, selectedLine)
879
+ setExplanations(explanationsResult)
880
+ setSidePanelTab("suggestions")
881
+ } catch (error) {
882
+ console.error("Failed to explain code:", error)
883
+ toast.error("Failed to explain code", {
884
+ description: "Please try again",
885
+ })
886
+ } finally {
887
+ setIsProcessing(false)
888
+ }
889
+ },
890
+ [onExplain, editorValue]
891
+ )
892
+
893
+ const handleFeatureAction = React.useCallback(
894
+ async (feature: CodeFeature) => {
895
+ if (isProcessing) return
896
+
897
+ setIsProcessing(true)
898
+ try {
899
+ switch (feature) {
900
+ case "refactor":
901
+ if (onRefactor) {
902
+ const refactoredCode = await onRefactor(editorValue)
903
+ setEditorValue(refactoredCode)
904
+ onChange?.(refactoredCode)
905
+ }
906
+ break
907
+
908
+ case "debug":
909
+ if (onDebug) {
910
+ const debugSuggestions = await onDebug(editorValue)
911
+ setSuggestions(debugSuggestions)
912
+ setSidePanelTab("suggestions")
913
+ }
914
+ break
915
+
916
+ case "test":
917
+ if (onTest) {
918
+ const testCode = await onTest(editorValue)
919
+ // Handle test generation result
920
+ const testMessage: AIMessage = {
921
+ id: Date.now().toString(),
922
+ content: testCode,
923
+ role: "assistant",
924
+ timestamp: new Date(),
925
+ type: "code",
926
+ }
927
+ setMessages((prev) => [...prev, testMessage])
928
+ setSidePanelTab("chat")
929
+ }
930
+ break
931
+
932
+ case "document":
933
+ if (onDocument) {
934
+ const documentation = await onDocument(editorValue)
935
+ const docMessage: AIMessage = {
936
+ id: Date.now().toString(),
937
+ content: documentation,
938
+ role: "assistant",
939
+ timestamp: new Date(),
940
+ type: "explanation",
941
+ }
942
+ setMessages((prev) => [...prev, docMessage])
943
+ setSidePanelTab("chat")
944
+ }
945
+ break
946
+
947
+ case "review":
948
+ if (onReview) {
949
+ const reviewSuggestions = await onReview(editorValue)
950
+ setSuggestions(reviewSuggestions)
951
+ setSidePanelTab("suggestions")
952
+ }
953
+ break
954
+ }
955
+ } catch (error) {
956
+ console.error(`Failed to ${feature}:`, error)
957
+ } finally {
958
+ setIsProcessing(false)
959
+ }
960
+ },
961
+ [
962
+ isProcessing,
963
+ editorValue,
964
+ onRefactor,
965
+ onDebug,
966
+ onTest,
967
+ onDocument,
968
+ onReview,
969
+ onChange,
970
+ ]
971
+ )
972
+
973
+ const handleSecurityScan = React.useCallback(async () => {
974
+ if (!onSecurityScan) return
975
+
976
+ setIsProcessing(true)
977
+ try {
978
+ const issues = await onSecurityScan(editorValue)
979
+ setSecurityIssues(issues)
980
+ setSidePanelTab("security")
981
+ } catch (error) {
982
+ console.error("Failed to scan for security issues:", error)
983
+ toast.error("Security scan failed", {
984
+ description: "Please try again",
985
+ })
986
+ } finally {
987
+ setIsProcessing(false)
988
+ }
989
+ }, [onSecurityScan, editorValue])
990
+
991
+ // File management
992
+ const handleFileChange = React.useCallback(
993
+ (fileName: string) => {
994
+ setCurrentActiveFile(fileName)
995
+ onFileChange?.(fileName)
996
+ },
997
+ [onFileChange]
998
+ )
999
+
1000
+ const handleFileCreate = React.useCallback(
1001
+ (fileName: string) => {
1002
+ const newFile = {
1003
+ name: fileName,
1004
+ content: "",
1005
+ language: getLanguageFromFile(fileName),
1006
+ }
1007
+ setCurrentFiles((prev) => [...prev, newFile])
1008
+ setCurrentActiveFile(fileName)
1009
+ onFileCreate?.(fileName, "")
1010
+ },
1011
+ [getLanguageFromFile, onFileCreate]
1012
+ )
1013
+
1014
+ const handleFileDelete = React.useCallback(
1015
+ (fileName: string) => {
1016
+ if (currentFiles.length <= 1) return
1017
+
1018
+ setCurrentFiles((prev) => prev.filter((f) => f.name !== fileName))
1019
+
1020
+ if (currentActiveFile === fileName) {
1021
+ const remainingFiles = currentFiles.filter((f) => f.name !== fileName)
1022
+ setCurrentActiveFile(remainingFiles[0]?.name)
1023
+ }
1024
+ },
1025
+ [currentFiles, currentActiveFile]
1026
+ )
1027
+
1028
+ return (
1029
+ <TooltipProvider delay={0}>
1030
+ <Box
1031
+ ref={ref as never}
1032
+ className={cn(
1033
+ "flex h-full w-full flex-col overflow-hidden rounded-lg border bg-background",
1034
+ className
1035
+ )}
1036
+ {...props}
1037
+ >
1038
+ {/* Header with feature buttons */}
1039
+ <Box className="flex items-center justify-between border-b bg-muted/50 p-2">
1040
+ <Box className="flex items-center gap-1">
1041
+ {features.map((feature) => {
1042
+ const Icon = featureIcons[feature]
1043
+ const isActive =
1044
+ feature === "explain" && explanations.length > 0
1045
+
1046
+ return (
1047
+ <Tooltip key={feature}>
1048
+ <TooltipTrigger asChild>
1049
+ <Button
1050
+ variant={isActive ? "secondary" : "ghost"}
1051
+ size="sm"
1052
+ {...sx('h-8 gap-1.5 px-2')}
1053
+ onClick={() => {
1054
+ if (feature === "explain") {
1055
+ handleExplain()
1056
+ } else {
1057
+ handleFeatureAction(feature)
1058
+ }
1059
+ }}
1060
+ disabled={isProcessing}
1061
+ >
1062
+ <Icon style={css('h-3 w-3')} />
1063
+ <Box tag="span" className="text-xs capitalize">{feature}</Box>
1064
+ </Button>
1065
+ </TooltipTrigger>
1066
+ <TooltipContent>
1067
+ <p>AI {feature} assistance</p>
1068
+ </TooltipContent>
1069
+ </Tooltip>
1070
+ )
1071
+ })}
1072
+
1073
+ <Separator orientation="vertical" {...sx('h-4')} />
1074
+
1075
+ <Tooltip>
1076
+ <TooltipTrigger asChild>
1077
+ <Button
1078
+ variant="ghost"
1079
+ size="sm"
1080
+ {...sx('h-8 gap-1.5 px-2')}
1081
+ onClick={handleSecurityScan}
1082
+ disabled={isProcessing}
1083
+ >
1084
+ <Shield style={css('h-3 w-3')} />
1085
+ <Box tag="span" className="text-xs">Security</Box>
1086
+ </Button>
1087
+ </TooltipTrigger>
1088
+ <TooltipContent>
1089
+ <p>Scan for security vulnerabilities</p>
1090
+ </TooltipContent>
1091
+ </Tooltip>
1092
+ </Box>
1093
+
1094
+ <Box className="flex items-center gap-2">
1095
+ {isProcessing && (
1096
+ <Box className="flex items-center gap-2">
1097
+ <Loader2 style={css('h-3 w-3 animate-spin')} />
1098
+ <Box tag="span" className="text-xs text-muted-foreground">
1099
+ Processing...
1100
+ </Box>
1101
+ {progress > 0 && (
1102
+ <Progress value={progress} {...sx('w-16 h-1')} />
1103
+ )}
1104
+ </Box>
1105
+ )}
1106
+
1107
+ <Button
1108
+ variant="ghost"
1109
+ size="sm"
1110
+ {...sx('h-8')}
1111
+ onClick={() => setShowSidePanel(!showSidePanel)}
1112
+ >
1113
+ {showSidePanel ? (
1114
+ <EyeOff style={css('h-3 w-3')} />
1115
+ ) : (
1116
+ <Eye style={css('h-3 w-3')} />
1117
+ )}
1118
+ </Button>
1119
+
1120
+ <DropdownMenu>
1121
+ <DropdownMenuTrigger asChild>
1122
+ <Button variant="ghost" size="sm" {...sx('h-8 gap-1')}>
1123
+ <Settings style={css('h-3 w-3')} />
1124
+ <ChevronDown style={css('h-3 w-3')} />
1125
+ </Button>
1126
+ </DropdownMenuTrigger>
1127
+ <DropdownMenuContent align="end">
1128
+ <DropdownMenuCheckboxItem
1129
+ checked={showMinimap}
1130
+ onCheckedChange={(checked) => {
1131
+ // Handle minimap toggle - would need to be passed as prop
1132
+ }}
1133
+ >
1134
+ Show Minimap
1135
+ </DropdownMenuCheckboxItem>
1136
+ <DropdownMenuCheckboxItem
1137
+ checked={showLineNumbers}
1138
+ onCheckedChange={(checked) => {
1139
+ // Handle line numbers toggle - would need to be passed as prop
1140
+ }}
1141
+ >
1142
+ Show Line Numbers
1143
+ </DropdownMenuCheckboxItem>
1144
+ <DropdownMenuSeparator />
1145
+ <DropdownMenuItem>
1146
+ <Download style={css('mr-2 h-3 w-3')} />
1147
+ Export Code
1148
+ </DropdownMenuItem>
1149
+ <DropdownMenuItem>
1150
+ <Upload style={css('mr-2 h-3 w-3')} />
1151
+ Import Code
1152
+ </DropdownMenuItem>
1153
+ </DropdownMenuContent>
1154
+ </DropdownMenu>
1155
+ </Box>
1156
+ </Box>
1157
+
1158
+ {/* File tabs for multi-file support */}
1159
+ {multiFileSupport && (
1160
+ <FileTabs
1161
+ files={currentFiles}
1162
+ activeFile={currentActiveFile}
1163
+ onFileChange={handleFileChange}
1164
+ onFileCreate={onFileCreate ? handleFileCreate : undefined}
1165
+ onFileDelete={
1166
+ currentFiles.length > 1 ? handleFileDelete : undefined
1167
+ }
1168
+ />
1169
+ )}
1170
+
1171
+ {/* Main content area */}
1172
+ <ResizablePanelGroup direction="horizontal" className="flex-1">
1173
+ {/* Code editor panel */}
1174
+ <ResizablePanel defaultSize={showSidePanel ? 70 : 100} minSize={30}>
1175
+ <Box className="h-full">
1176
+ <Editor
1177
+ height={height}
1178
+ language={currentLanguage}
1179
+ value={editorValue}
1180
+ theme={resolveTheme}
1181
+ onChange={handleEditorChange}
1182
+ onMount={handleEditorMount}
1183
+ options={{
1184
+ readOnly: isGenerating || isProcessing,
1185
+ lineNumbers: showLineNumbers ? "on" : "off",
1186
+ minimap: { enabled: showMinimap },
1187
+ wordWrap: "on",
1188
+ fontSize: 14,
1189
+ scrollBeyondLastLine: false,
1190
+ automaticLayout: true,
1191
+ tabSize: 2,
1192
+ insertSpaces: true,
1193
+ formatOnPaste: true,
1194
+ formatOnType: true,
1195
+ quickSuggestions: true,
1196
+ parameterHints: { enabled: true },
1197
+ suggestOnTriggerCharacters: true,
1198
+ acceptSuggestionOnEnter: "on",
1199
+ accessibilitySupport: "auto",
1200
+ scrollbar: {
1201
+ vertical: "auto",
1202
+ horizontal: "auto",
1203
+ verticalScrollbarSize: 10,
1204
+ horizontalScrollbarSize: 10,
1205
+ },
1206
+ padding: {
1207
+ top: 16,
1208
+ bottom: 16,
1209
+ },
1210
+ }}
1211
+ />
1212
+ </Box>
1213
+ </ResizablePanel>
1214
+
1215
+ {/* Side panel */}
1216
+ {showSidePanel && (
1217
+ <>
1218
+ <ResizableHandle />
1219
+ <ResizablePanel defaultSize={30} minSize={20} maxSize={50}>
1220
+ <Tabs
1221
+ value={sidePanelTab}
1222
+ onValueChange={(value) => setSidePanelTab(value as any)}
1223
+ >
1224
+ <TabsList {...sx('grid w-full grid-cols-3')}>
1225
+ <TabsTrigger value="chat" {...sx('text-xs')}>
1226
+ <MessageSquare style={css('h-3 w-3 mr-1')} />
1227
+ Chat
1228
+ </TabsTrigger>
1229
+ <TabsTrigger value="suggestions" {...sx('text-xs')}>
1230
+ <Zap style={css('h-3 w-3 mr-1')} />
1231
+ AI
1232
+ {suggestions.length > 0 && (
1233
+ <Badge
1234
+ colorPalette="gray"
1235
+ {...sx('ml-1 h-4 text-xs')}
1236
+ >
1237
+ {suggestions.length}
1238
+ </Badge>
1239
+ )}
1240
+ </TabsTrigger>
1241
+ <TabsTrigger value="security" {...sx('text-xs')}>
1242
+ <Shield style={css('h-3 w-3 mr-1')} />
1243
+ Security
1244
+ {securityIssues.length > 0 && (
1245
+ <Badge
1246
+ colorPalette={
1247
+ securityIssues.some(
1248
+ (i) => i.severity === "critical"
1249
+ )
1250
+ ? "red"
1251
+ : "gray"
1252
+ }
1253
+ {...sx('ml-1 h-4 text-xs')}
1254
+ >
1255
+ {securityIssues.length}
1256
+ </Badge>
1257
+ )}
1258
+ </TabsTrigger>
1259
+ </TabsList>
1260
+
1261
+ <TabsContent value="chat" {...sx('h-[calc(100%-40px)]')}>
1262
+ <ChatPanel
1263
+ messages={messages}
1264
+ onSendMessage={handleGenerate}
1265
+ isGenerating={isGenerating || isProcessing}
1266
+ placeholder={placeholder}
1267
+ />
1268
+ </TabsContent>
1269
+
1270
+ <TabsContent
1271
+ value="suggestions"
1272
+ {...sx('h-[calc(100%-40px)] overflow-hidden')}
1273
+ >
1274
+ <ScrollArea {...sx('h-full p-3')}>
1275
+ <SuggestionsPanel
1276
+ suggestions={suggestions}
1277
+ onApplySuggestion={(suggestion) => {
1278
+ if (suggestion.code) {
1279
+ setEditorValue(suggestion.code)
1280
+ onChange?.(suggestion.code)
1281
+ }
1282
+ }}
1283
+ />
1284
+ </ScrollArea>
1285
+ </TabsContent>
1286
+
1287
+ <TabsContent
1288
+ value="security"
1289
+ {...sx('h-[calc(100%-40px)] overflow-hidden')}
1290
+ >
1291
+ <ScrollArea {...sx('h-full p-3')}>
1292
+ <SecurityPanel
1293
+ issues={securityIssues}
1294
+ onFixIssue={(issue) => {
1295
+ if (issue.fix && editorRef.current) {
1296
+ // Apply security fix to editor
1297
+ const model = editorRef.current.getModel()
1298
+ if (model) {
1299
+ const line = model.getLineContent(issue.line)
1300
+ const newLine = issue.fix
1301
+ editorRef.current.executeEdits("security-fix", [
1302
+ {
1303
+ range: {
1304
+ startLineNumber: issue.line,
1305
+ startColumn: 1,
1306
+ endLineNumber: issue.line,
1307
+ endColumn: line.length + 1,
1308
+ },
1309
+ text: newLine,
1310
+ },
1311
+ ])
1312
+ }
1313
+ }
1314
+ }}
1315
+ />
1316
+ </ScrollArea>
1317
+ </TabsContent>
1318
+ </Tabs>
1319
+ </ResizablePanel>
1320
+ </>
1321
+ )}
1322
+ </ResizablePanelGroup>
1323
+ </Box>
1324
+ </TooltipProvider>
1325
+ )
1326
+ }
1327
+ )
1328
+
1329
+ AICode.displayName = "AICode"
1330
+
1331
+ export { AICode }