@mks2508/mks-ui 0.3.1 → 0.4.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 (325) hide show
  1. package/dist/react-ui/blocks/Terminal/ResttyAdapter.d.ts +146 -0
  2. package/dist/react-ui/blocks/Terminal/ResttyAdapter.d.ts.map +1 -0
  3. package/dist/react-ui/blocks/Terminal/ResttyAdapter.js +213 -0
  4. package/dist/react-ui/blocks/Terminal/Terminal.adapter.d.ts +55 -0
  5. package/dist/react-ui/blocks/Terminal/Terminal.adapter.d.ts.map +1 -0
  6. package/dist/react-ui/blocks/Terminal/Terminal.adapter.js +68 -0
  7. package/dist/react-ui/blocks/Terminal/Terminal.theme.d.ts +43 -0
  8. package/dist/react-ui/blocks/Terminal/Terminal.theme.d.ts.map +1 -0
  9. package/dist/react-ui/blocks/Terminal/Terminal.theme.js +59 -0
  10. package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.d.ts +63 -0
  11. package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.d.ts.map +1 -0
  12. package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.js +109 -0
  13. package/dist/react-ui/blocks/Terminal/Terminal.types.d.ts +351 -0
  14. package/dist/react-ui/blocks/Terminal/Terminal.types.d.ts.map +1 -0
  15. package/dist/react-ui/blocks/Terminal/TerminalPanel.d.ts +60 -0
  16. package/dist/react-ui/blocks/Terminal/TerminalPanel.d.ts.map +1 -0
  17. package/dist/react-ui/blocks/Terminal/TerminalPanel.js +183 -0
  18. package/dist/react-ui/blocks/Terminal/TerminalRestty.d.ts +111 -0
  19. package/dist/react-ui/blocks/Terminal/TerminalRestty.d.ts.map +1 -0
  20. package/dist/react-ui/blocks/Terminal/TerminalRestty.js +185 -0
  21. package/dist/react-ui/blocks/Terminal/TerminalXterm.d.ts +58 -0
  22. package/dist/react-ui/blocks/Terminal/TerminalXterm.d.ts.map +1 -0
  23. package/dist/react-ui/blocks/Terminal/TerminalXterm.js +143 -0
  24. package/dist/react-ui/blocks/Terminal/XTermAdapter.d.ts +87 -0
  25. package/dist/react-ui/blocks/Terminal/XTermAdapter.d.ts.map +1 -0
  26. package/dist/react-ui/blocks/Terminal/XTermAdapter.js +135 -0
  27. package/dist/react-ui/blocks/Terminal/components/LogLineBadges.d.ts +160 -0
  28. package/dist/react-ui/blocks/Terminal/components/LogLineBadges.d.ts.map +1 -0
  29. package/dist/react-ui/blocks/Terminal/components/LogLineBadges.js +185 -0
  30. package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.d.ts +48 -0
  31. package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.d.ts.map +1 -0
  32. package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.js +139 -0
  33. package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.d.ts +60 -0
  34. package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.d.ts.map +1 -0
  35. package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.js +352 -0
  36. package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.d.ts +36 -0
  37. package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.d.ts.map +1 -0
  38. package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.js +52 -0
  39. package/dist/react-ui/blocks/Terminal/components/index.d.ts +10 -0
  40. package/dist/react-ui/blocks/Terminal/components/index.d.ts.map +1 -0
  41. package/dist/react-ui/blocks/Terminal/components/index.js +4 -0
  42. package/dist/react-ui/blocks/Terminal/hooks/index.d.ts +11 -0
  43. package/dist/react-ui/blocks/Terminal/hooks/index.d.ts.map +1 -0
  44. package/dist/react-ui/blocks/Terminal/hooks/index.js +2 -0
  45. package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.d.ts +69 -0
  46. package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.d.ts.map +1 -0
  47. package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.js +162 -0
  48. package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.d.ts +104 -0
  49. package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.d.ts.map +1 -0
  50. package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.js +180 -0
  51. package/dist/react-ui/blocks/Terminal/index.d.ts +39 -0
  52. package/dist/react-ui/blocks/Terminal/index.d.ts.map +1 -0
  53. package/dist/react-ui/blocks/Terminal/index.js +38 -0
  54. package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.d.ts +58 -0
  55. package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.d.ts.map +1 -0
  56. package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.js +222 -0
  57. package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.d.ts +74 -0
  58. package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.d.ts.map +1 -0
  59. package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.js +168 -0
  60. package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.d.ts +42 -0
  61. package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.d.ts.map +1 -0
  62. package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.js +175 -0
  63. package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs.d.ts +43 -0
  64. package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs.d.ts.map +1 -0
  65. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.d.ts +38 -0
  66. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.d.ts.map +1 -0
  67. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.js +62 -0
  68. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.d.ts +67 -0
  69. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.d.ts.map +1 -0
  70. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.d.ts +32 -0
  71. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.d.ts.map +1 -0
  72. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.js +326 -0
  73. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.d.ts +36 -0
  74. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.d.ts.map +1 -0
  75. package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.js +371 -0
  76. package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.d.ts +67 -0
  77. package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.d.ts.map +1 -0
  78. package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.js +417 -0
  79. package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.d.ts +197 -0
  80. package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.d.ts.map +1 -0
  81. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.d.ts +54 -0
  82. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.d.ts.map +1 -0
  83. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.js +193 -0
  84. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts +57 -0
  85. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts.map +1 -0
  86. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.d.ts +30 -0
  87. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.d.ts.map +1 -0
  88. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.js +126 -0
  89. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.d.ts +31 -0
  90. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.d.ts.map +1 -0
  91. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.js +149 -0
  92. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.d.ts +35 -0
  93. package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.d.ts.map +1 -0
  94. package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl.d.ts +58 -0
  95. package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl.d.ts.map +1 -0
  96. package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.d.ts +63 -0
  97. package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.d.ts.map +1 -0
  98. package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.js +245 -0
  99. package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.d.ts +24 -0
  100. package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.d.ts.map +1 -0
  101. package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.js +225 -0
  102. package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.d.ts +35 -0
  103. package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.d.ts.map +1 -0
  104. package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.js +187 -0
  105. package/dist/react-ui/blocks/Terminal/panel/index.d.ts +30 -0
  106. package/dist/react-ui/blocks/Terminal/panel/index.d.ts.map +1 -0
  107. package/dist/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module-Bovc57nm.css +60 -0
  108. package/dist/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.js +5 -0
  109. package/dist/react-ui/blocks/Terminal/panel/terminal-session-tabs.module-QyxHO7cN.css +60 -0
  110. package/dist/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.js +5 -0
  111. package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.d.ts +73 -0
  112. package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.d.ts.map +1 -0
  113. package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.js +136 -0
  114. package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.d.ts +117 -0
  115. package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.d.ts.map +1 -0
  116. package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.js +174 -0
  117. package/dist/react-ui/blocks/Terminal/parsing/LogParser.types.d.ts +221 -0
  118. package/dist/react-ui/blocks/Terminal/parsing/LogParser.types.d.ts.map +1 -0
  119. package/dist/react-ui/blocks/Terminal/parsing/LogParserService.d.ts +184 -0
  120. package/dist/react-ui/blocks/Terminal/parsing/LogParserService.d.ts.map +1 -0
  121. package/dist/react-ui/blocks/Terminal/parsing/LogParserService.js +478 -0
  122. package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.d.ts +173 -0
  123. package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.d.ts.map +1 -0
  124. package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.js +313 -0
  125. package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.d.ts +181 -0
  126. package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.d.ts.map +1 -0
  127. package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.js +221 -0
  128. package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.d.ts +69 -0
  129. package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.d.ts.map +1 -0
  130. package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.js +142 -0
  131. package/dist/react-ui/blocks/Terminal/parsing/TableParser.d.ts +125 -0
  132. package/dist/react-ui/blocks/Terminal/parsing/TableParser.d.ts.map +1 -0
  133. package/dist/react-ui/blocks/Terminal/parsing/TableParser.js +245 -0
  134. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.d.ts +165 -0
  135. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.d.ts.map +1 -0
  136. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.js +225 -0
  137. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.d.ts +164 -0
  138. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.d.ts.map +1 -0
  139. package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.js +285 -0
  140. package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.d.ts +188 -0
  141. package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.d.ts.map +1 -0
  142. package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.js +178 -0
  143. package/dist/react-ui/blocks/Terminal/parsing/ansi/index.d.ts +12 -0
  144. package/dist/react-ui/blocks/Terminal/parsing/ansi/index.d.ts.map +1 -0
  145. package/dist/react-ui/blocks/Terminal/parsing/index.d.ts +24 -0
  146. package/dist/react-ui/blocks/Terminal/parsing/index.d.ts.map +1 -0
  147. package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.d.ts +56 -0
  148. package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.d.ts.map +1 -0
  149. package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.d.ts +140 -0
  150. package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.d.ts.map +1 -0
  151. package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.js +325 -0
  152. package/dist/react-ui/blocks/Terminal/parsing/levels/index.d.ts +10 -0
  153. package/dist/react-ui/blocks/Terminal/parsing/levels/index.d.ts.map +1 -0
  154. package/dist/react-ui/blocks/index.d.ts +11 -0
  155. package/dist/react-ui/blocks/index.d.ts.map +1 -0
  156. package/dist/react-ui/icons/lucide-animated/activity.js +1 -1
  157. package/dist/react-ui/icons/lucide-animated/bell-electric.js +1 -1
  158. package/dist/react-ui/icons/lucide-animated/bell.js +1 -1
  159. package/dist/react-ui/icons/lucide-animated/bot.js +1 -1
  160. package/dist/react-ui/icons/lucide-animated/box.js +1 -1
  161. package/dist/react-ui/icons/lucide-animated/circle-check.js +1 -1
  162. package/dist/react-ui/icons/lucide-animated/delete.js +1 -1
  163. package/dist/react-ui/icons/lucide-animated/download.js +1 -1
  164. package/dist/react-ui/icons/lucide-animated/home.js +1 -1
  165. package/dist/react-ui/icons/lucide-animated/layout-panel-top.js +1 -1
  166. package/dist/react-ui/icons/lucide-animated/plus.js +1 -1
  167. package/dist/react-ui/icons/lucide-animated/search.js +1 -1
  168. package/dist/react-ui/icons/lucide-animated/settings.js +1 -1
  169. package/dist/react-ui/icons/lucide-animated/trending-down.js +1 -1
  170. package/dist/react-ui/icons/lucide-animated/trending-up.js +1 -1
  171. package/dist/react-ui/icons/lucide-animated/x.js +1 -1
  172. package/dist/react-ui/index.js +4 -1
  173. package/dist/react-ui/lib/icon-wrapper.d.ts +37 -0
  174. package/dist/react-ui/lib/icon-wrapper.d.ts.map +1 -0
  175. package/dist/react-ui/lib/icon-wrapper.js +55 -0
  176. package/dist/react-ui/lib/index.d.ts +1 -0
  177. package/dist/react-ui/lib/index.d.ts.map +1 -1
  178. package/dist/react-ui/lib/index.js +1 -0
  179. package/dist/react-ui/primitives/AutoHeight/index.d.ts +1 -1
  180. package/dist/react-ui/primitives/CountingNumber/index.d.ts +1 -1
  181. package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +1 -1
  182. package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +1 -1
  183. package/dist/react-ui/ui/Accordion/Accordion.styles.d.ts +1 -1
  184. package/dist/react-ui/ui/Accordion/Accordion.types.d.ts +1 -1
  185. package/dist/react-ui/ui/AlertDialog/AlertDialog.styles.d.ts +1 -1
  186. package/dist/react-ui/ui/AlertDialog/AlertDialog.types.d.ts +1 -1
  187. package/dist/react-ui/ui/Badge/Badge.styles.d.ts +1 -1
  188. package/dist/react-ui/ui/Badge/Badge.types.d.ts +1 -1
  189. package/dist/react-ui/ui/Button/Button.styles.d.ts +2 -2
  190. package/dist/react-ui/ui/Button/Button.types.d.ts +1 -1
  191. package/dist/react-ui/ui/Card/Card.styles.d.ts +1 -1
  192. package/dist/react-ui/ui/Card/Card.types.d.ts +1 -1
  193. package/dist/react-ui/ui/Checkbox/Checkbox.styles.d.ts +1 -1
  194. package/dist/react-ui/ui/Checkbox/Checkbox.types.d.ts +1 -1
  195. package/dist/react-ui/ui/Combobox/Combobox.styles.d.ts +1 -1
  196. package/dist/react-ui/ui/Combobox/Combobox.types.d.ts +1 -1
  197. package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.d.ts +2 -2
  198. package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.js +1 -1
  199. package/dist/react-ui/ui/CornerBracket/CornerBracket.types.d.ts +1 -1
  200. package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +1 -1
  201. package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +1 -1
  202. package/dist/react-ui/ui/DataCard/index.d.ts +1 -1
  203. package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts +1 -1
  204. package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +1 -1
  205. package/dist/react-ui/ui/DropdownMenu/DropdownMenu.styles.d.ts +1 -1
  206. package/dist/react-ui/ui/DropdownMenu/DropdownMenu.types.d.ts +1 -1
  207. package/dist/react-ui/ui/Field/Field.styles.d.ts +1 -1
  208. package/dist/react-ui/ui/Field/Field.types.d.ts +1 -1
  209. package/dist/react-ui/ui/Input/Input.styles.d.ts +1 -1
  210. package/dist/react-ui/ui/Input/Input.types.d.ts +1 -1
  211. package/dist/react-ui/ui/InputGroup/InputGroup.styles.d.ts +1 -1
  212. package/dist/react-ui/ui/InputGroup/InputGroup.types.d.ts +1 -1
  213. package/dist/react-ui/ui/Label/Label.styles.d.ts +1 -1
  214. package/dist/react-ui/ui/Label/Label.types.d.ts +1 -1
  215. package/dist/react-ui/ui/Menu/Menu.styles.d.ts +1 -1
  216. package/dist/react-ui/ui/Menu/Menu.types.d.ts +2 -2
  217. package/dist/react-ui/ui/Popover/Popover.styles.d.ts +1 -1
  218. package/dist/react-ui/ui/Popover/Popover.types.d.ts +1 -1
  219. package/dist/react-ui/ui/Progress/Progress.styles.d.ts +1 -1
  220. package/dist/react-ui/ui/Progress/Progress.types.d.ts +2 -2
  221. package/dist/react-ui/ui/Select/Select.styles.d.ts +1 -1
  222. package/dist/react-ui/ui/Select/Select.types.d.ts +1 -1
  223. package/dist/react-ui/ui/Separator/Separator.styles.d.ts +1 -1
  224. package/dist/react-ui/ui/Separator/Separator.types.d.ts +1 -1
  225. package/dist/react-ui/ui/Switch/Switch.styles.d.ts +1 -1
  226. package/dist/react-ui/ui/Switch/Switch.types.d.ts +1 -1
  227. package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts +43 -25
  228. package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts.map +1 -1
  229. package/dist/react-ui/ui/Tabs/Tabs.styles.js +105 -13
  230. package/dist/react-ui/ui/Tabs/Tabs.types.d.ts +9 -6
  231. package/dist/react-ui/ui/Tabs/Tabs.types.d.ts.map +1 -1
  232. package/dist/react-ui/ui/Tabs/index.d.ts +18 -9
  233. package/dist/react-ui/ui/Tabs/index.d.ts.map +1 -1
  234. package/dist/react-ui/ui/Tabs/index.js +99 -27
  235. package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +1 -1
  236. package/dist/react-ui/ui/Textarea/Textarea.styles.d.ts +1 -1
  237. package/dist/react-ui/ui/Textarea/Textarea.types.d.ts +1 -1
  238. package/dist/react-ui/ui/Tooltip/Tooltip.styles.d.ts +1 -1
  239. package/dist/react-ui/ui/Tooltip/Tooltip.types.d.ts +1 -1
  240. package/dist/react-ui/ui/index.d.ts +1 -0
  241. package/dist/react-ui/ui/index.d.ts.map +1 -1
  242. package/dist/react-ui/ui/index.js +2 -0
  243. package/package.json +54 -6
  244. package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +278 -0
  245. package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +97 -0
  246. package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +155 -0
  247. package/src/react-ui/blocks/Terminal/Terminal.theme.ts +80 -0
  248. package/src/react-ui/blocks/Terminal/Terminal.types.ts +438 -0
  249. package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +269 -0
  250. package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +326 -0
  251. package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +230 -0
  252. package/src/react-ui/blocks/Terminal/XTermAdapter.ts +163 -0
  253. package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +316 -0
  254. package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +218 -0
  255. package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +386 -0
  256. package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +67 -0
  257. package/src/react-ui/blocks/Terminal/components/index.ts +10 -0
  258. package/src/react-ui/blocks/Terminal/hooks/index.ts +22 -0
  259. package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +229 -0
  260. package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +292 -0
  261. package/src/react-ui/blocks/Terminal/index.ts +103 -0
  262. package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +330 -0
  263. package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +242 -0
  264. package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +202 -0
  265. package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +140 -0
  266. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +68 -0
  267. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +85 -0
  268. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +383 -0
  269. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +439 -0
  270. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +550 -0
  271. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +259 -0
  272. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +237 -0
  273. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +76 -0
  274. package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +112 -0
  275. package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +178 -0
  276. package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +203 -0
  277. package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +252 -0
  278. package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +334 -0
  279. package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +261 -0
  280. package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +248 -0
  281. package/src/react-ui/blocks/Terminal/panel/index.ts +72 -0
  282. package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +59 -0
  283. package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +59 -0
  284. package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +180 -0
  285. package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +248 -0
  286. package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +283 -0
  287. package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +686 -0
  288. package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +466 -0
  289. package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +343 -0
  290. package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +167 -0
  291. package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +348 -0
  292. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +251 -0
  293. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +390 -0
  294. package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +320 -0
  295. package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +20 -0
  296. package/src/react-ui/blocks/Terminal/parsing/index.ts +69 -0
  297. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +68 -0
  298. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +436 -0
  299. package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +14 -0
  300. package/src/react-ui/blocks/index.ts +11 -0
  301. package/src/react-ui/icons/lucide-animated/activity.tsx +2 -2
  302. package/src/react-ui/icons/lucide-animated/bell-electric.tsx +1 -1
  303. package/src/react-ui/icons/lucide-animated/bell.tsx +2 -2
  304. package/src/react-ui/icons/lucide-animated/bot.tsx +1 -1
  305. package/src/react-ui/icons/lucide-animated/box.tsx +2 -2
  306. package/src/react-ui/icons/lucide-animated/circle-check.tsx +2 -2
  307. package/src/react-ui/icons/lucide-animated/delete.tsx +2 -2
  308. package/src/react-ui/icons/lucide-animated/download.tsx +2 -2
  309. package/src/react-ui/icons/lucide-animated/home.tsx +2 -2
  310. package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +1 -1
  311. package/src/react-ui/icons/lucide-animated/plus.tsx +1 -1
  312. package/src/react-ui/icons/lucide-animated/search.tsx +1 -1
  313. package/src/react-ui/icons/lucide-animated/settings.tsx +1 -1
  314. package/src/react-ui/icons/lucide-animated/trending-down.tsx +2 -2
  315. package/src/react-ui/icons/lucide-animated/trending-up.tsx +2 -2
  316. package/src/react-ui/icons/lucide-animated/x.tsx +2 -2
  317. package/src/react-ui/lib/icon-wrapper.tsx +70 -0
  318. package/src/react-ui/lib/index.ts +1 -0
  319. package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +1 -1
  320. package/src/react-ui/ui/Tabs/Tabs.css +39 -0
  321. package/src/react-ui/ui/Tabs/Tabs.styles.ts +119 -31
  322. package/src/react-ui/ui/Tabs/Tabs.types.ts +8 -3
  323. package/src/react-ui/ui/Tabs/index.tsx +135 -27
  324. package/src/react-ui/ui/index.ts +1 -0
  325. package/dist/index.css +0 -129
@@ -0,0 +1,183 @@
1
+ 'use client';
2
+
3
+ import { TerminalIcon } from "../../icons/lucide-animated/terminal.js";
4
+ import "../../icons/lucide-animated/index.js";
5
+ import { XTermWrapper } from "./TerminalXterm.js";
6
+ import { getTerminalTheme } from "./Terminal.theme.js";
7
+ import { useCallback, useEffect, useRef, useState } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/react-ui/blocks/Terminal/TerminalPanel.tsx
11
+ /**
12
+ * Terminal Panel Component.
13
+ *
14
+ * Main UI component with toolbar, terminal display, and status indicator.
15
+ * Configurable backend adapter (xterm.js, WebContainer, Monaco) with
16
+ * Synthwave Industrial Dark theme matching the design system.
17
+ *
18
+ * @module components/devenv/terminal
19
+ */
20
+ /**
21
+ * Terminal Panel Component.
22
+ *
23
+ * Full-featured terminal UI with toolbar, status indicator, search,
24
+ * and xterm.js integration. Supports both interactive (WebSocket)
25
+ * and readonly (SSE) modes with proper cleanup and error handling.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * // Interactive mode with WebSocket
30
+ * <TerminalPanel
31
+ * mode="interactive"
32
+ * wsUrl="ws://localhost:3100/api/terminal/session-123"
33
+ * onData={(data) => sendMessage({ type: 'input', data })}
34
+ * />
35
+ *
36
+ * // Readonly mode with SSE
37
+ * <TerminalPanel
38
+ * mode="readonly"
39
+ * sseUrl="http://localhost:3100/api/logs/containers/devenv/stream"
40
+ * />
41
+ * ```
42
+ */
43
+ function TerminalPanel({ backend = "xterm", mode = "interactive", wsUrl, sseUrl, className, title = "Terminal", showToolbar = true, onStatusChange, onData }) {
44
+ const [status, setStatus] = useState("disconnected");
45
+ const terminalRef = useRef(null);
46
+ const wsRef = useRef(null);
47
+ const eventSourceRef = useRef(null);
48
+ /**
49
+ * Update connection status and notify parent.
50
+ */
51
+ const updateStatus = useCallback((newStatus) => {
52
+ setStatus(newStatus);
53
+ onStatusChange?.(newStatus);
54
+ }, [onStatusChange]);
55
+ /**
56
+ * Handle terminal data input from user.
57
+ */
58
+ const handleData = useCallback((data) => {
59
+ onData?.(data);
60
+ if (mode === "interactive" && wsRef.current?.readyState === WebSocket.OPEN) wsRef.current.send(data);
61
+ }, [mode, onData]);
62
+ /**
63
+ * Handle terminal ready state.
64
+ */
65
+ const handleReady = useCallback((terminal) => {
66
+ terminalRef.current = terminal;
67
+ updateStatus("connected");
68
+ if (mode === "interactive" && wsUrl) connectWebSocket(wsUrl);
69
+ else if (mode === "readonly" && sseUrl) connectSSE(sseUrl);
70
+ }, [
71
+ mode,
72
+ wsUrl,
73
+ sseUrl,
74
+ updateStatus
75
+ ]);
76
+ /**
77
+ * Establish WebSocket connection for interactive mode.
78
+ */
79
+ const connectWebSocket = useCallback((url) => {
80
+ updateStatus("connecting");
81
+ const ws = new WebSocket(url);
82
+ wsRef.current = ws;
83
+ ws.onopen = () => {
84
+ updateStatus("connected");
85
+ };
86
+ ws.onmessage = (event) => {
87
+ terminalRef.current?.write(event.data);
88
+ };
89
+ ws.onerror = () => {
90
+ updateStatus("error");
91
+ };
92
+ ws.onclose = () => {
93
+ updateStatus("disconnected");
94
+ };
95
+ }, [updateStatus]);
96
+ /**
97
+ * Establish SSE connection for readonly mode.
98
+ */
99
+ const connectSSE = useCallback((url) => {
100
+ updateStatus("connecting");
101
+ const eventSource = new EventSource(url);
102
+ eventSourceRef.current = eventSource;
103
+ eventSource.onopen = () => {
104
+ updateStatus("connected");
105
+ };
106
+ eventSource.onmessage = (event) => {
107
+ terminalRef.current?.writeln(event.data);
108
+ };
109
+ eventSource.onerror = () => {
110
+ updateStatus("error");
111
+ eventSource.close();
112
+ };
113
+ }, [updateStatus]);
114
+ /**
115
+ * Cleanup connections on unmount.
116
+ */
117
+ useEffect(() => {
118
+ return () => {
119
+ wsRef.current?.close();
120
+ eventSourceRef.current?.close();
121
+ };
122
+ }, []);
123
+ /**
124
+ * Get status color class.
125
+ */
126
+ const getStatusColor = () => {
127
+ switch (status) {
128
+ case "connected": return "text-success";
129
+ case "error": return "text-destructive";
130
+ case "connecting": return "text-warning";
131
+ default: return "text-muted-foreground";
132
+ }
133
+ };
134
+ return /* @__PURE__ */ jsxs("section", {
135
+ className,
136
+ children: [
137
+ showToolbar && /* @__PURE__ */ jsxs("div", {
138
+ className: "flex items-center justify-between mb-2 px-2",
139
+ children: [/* @__PURE__ */ jsxs("div", {
140
+ className: "flex items-center gap-2",
141
+ children: [
142
+ /* @__PURE__ */ jsx(TerminalIcon, { className: "w-4 h-4 text-primary" }),
143
+ /* @__PURE__ */ jsx("h2", {
144
+ className: "text-sm font-semibold font-mono text-foreground",
145
+ children: title
146
+ }),
147
+ /* @__PURE__ */ jsx("span", {
148
+ className: `text-xs font-mono font-medium ${getStatusColor()}`,
149
+ "data-terminal-status": true,
150
+ children: status.toUpperCase()
151
+ })
152
+ ]
153
+ }), /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1" })]
154
+ }),
155
+ /* @__PURE__ */ jsx(XTermWrapper, {
156
+ options: {
157
+ backend,
158
+ mode,
159
+ wsUrl,
160
+ sseUrl,
161
+ onData: handleData,
162
+ onError: (error) => {
163
+ console.error("[TerminalPanel] Error:", error);
164
+ updateStatus("error");
165
+ }
166
+ },
167
+ theme: getTerminalTheme(),
168
+ onReady: handleReady
169
+ }),
170
+ mode === "interactive" && status === "connected" && /* @__PURE__ */ jsxs("div", {
171
+ className: "mt-2 px-2 flex items-center justify-between text-xs text-muted-foreground font-mono",
172
+ children: [/* @__PURE__ */ jsx("span", { children: "Ctrl+C to interrupt • Ctrl+D to exit" }), /* @__PURE__ */ jsxs("span", { children: [
173
+ terminalRef.current?.cols ?? 0,
174
+ "x",
175
+ terminalRef.current?.rows ?? 0
176
+ ] })]
177
+ })
178
+ ]
179
+ });
180
+ }
181
+
182
+ //#endregion
183
+ export { TerminalPanel };
@@ -0,0 +1,111 @@
1
+ /**
2
+ * TerminalRestty - React wrapper for restty GPU terminal renderer.
3
+ *
4
+ * Manages the restty lifecycle within React's component model,
5
+ * handling mount/unmount, dynamic import (SSR-safe), font loading,
6
+ * theme application, and PTY connection via custom DevenvPtyTransport.
7
+ *
8
+ * @module components/devenv/terminal/TerminalRestty
9
+ */
10
+ import type { Restty } from 'restty';
11
+ import type { ITerminalTheme, IPtyTransportFactory } from './Terminal.types';
12
+ /**
13
+ * Props for the TerminalRestty React wrapper.
14
+ */
15
+ export interface ITerminalResttyProps {
16
+ /**
17
+ * Factory to create a custom PTY transport.
18
+ * If not provided, restty manages its own PTY connection internally.
19
+ * Use this to inject custom WebSocket protocol bridging (e.g., mks-devenv).
20
+ */
21
+ createPtyTransport?: IPtyTransportFactory;
22
+ /** PTY WebSocket URL to connect to */
23
+ wsUrl?: string;
24
+ /** Font size in CSS pixels (default: 14) */
25
+ fontSize?: number;
26
+ /** Terminal theme in xterm.js format (auto-converted to Ghostty format) */
27
+ theme?: ITerminalTheme;
28
+ /**
29
+ * Restty built-in theme name from the 458-theme catalog.
30
+ * Takes precedence over the `theme` prop when set.
31
+ */
32
+ resttyThemeName?: string;
33
+ /**
34
+ * GPU renderer preference.
35
+ * - `auto`: WebGPU with WebGL2 fallback (default, recommended)
36
+ * - `webgpu`: Force WebGPU only
37
+ * - `webgl2`: Force WebGL2 only
38
+ */
39
+ gpuRenderer?: 'auto' | 'webgpu' | 'webgl2';
40
+ /** Callback when restty instance is initialized and ready */
41
+ onReady?: (restty: Restty) => void;
42
+ /** Callback when terminal dimensions change */
43
+ onResize?: (cols: number, rows: number) => void;
44
+ /** Callback when PTY connection status changes */
45
+ onPtyStatus?: (status: string) => void;
46
+ /** Callback when PTY connection opens */
47
+ onConnect?: () => void;
48
+ /** Callback when PTY connection closes */
49
+ onDisconnect?: () => void;
50
+ /** Callback when PTY reports an error */
51
+ onError?: (message: string) => void;
52
+ /**
53
+ * Callback when the terminal receives a desktop notification (OSC 9/777).
54
+ * Available in restty v0.1.24+.
55
+ *
56
+ * @param notification - Notification data with title, body, and paneId
57
+ */
58
+ onDesktopNotification?: (notification: {
59
+ title?: string;
60
+ body?: string;
61
+ paneId: number;
62
+ }) => void;
63
+ /** Custom class name for the container div */
64
+ className?: string;
65
+ }
66
+ /**
67
+ * Imperative handle for TerminalRestty component.
68
+ */
69
+ export interface ITerminalResttyRef {
70
+ /** Get the underlying Restty instance */
71
+ getRestty: () => Restty | null;
72
+ /** Send raw input to the terminal PTY */
73
+ sendInput: (data: string) => void;
74
+ /** Clear the terminal screen */
75
+ clear: () => void;
76
+ /** Focus the terminal for keyboard input */
77
+ focus: () => void;
78
+ /** Remove focus from the terminal */
79
+ blur: () => void;
80
+ /** Update font size */
81
+ setFontSize: (size: number) => void;
82
+ /** Resize terminal to explicit dimensions (v0.1.21+) */
83
+ resize: (cols: number, rows: number) => void;
84
+ /** Check if PTY is connected */
85
+ isPtyConnected: () => boolean;
86
+ /** Connect to a PTY URL */
87
+ connectPty: (url: string) => void;
88
+ /** Disconnect from PTY */
89
+ disconnectPty: () => void;
90
+ }
91
+ /**
92
+ * TerminalRestty - React component wrapping restty's GPU terminal.
93
+ *
94
+ * Handles the full lifecycle: dynamic WASM/WebGPU import, font loading,
95
+ * theme application, PTY connection via custom transport, and cleanup.
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * const resttyRef = useRef<ITerminalResttyRef>(null);
100
+ *
101
+ * <TerminalRestty
102
+ * ref={resttyRef}
103
+ * wsUrl="ws://localhost:3100/terminal/session-1"
104
+ * fontSize={14}
105
+ * onResize={(cols, rows) => console.log(`${cols}x${rows}`)}
106
+ * onConnect={() => console.log('PTY connected')}
107
+ * />
108
+ * ```
109
+ */
110
+ export declare const TerminalRestty: import("react").ForwardRefExoticComponent<ITerminalResttyProps & import("react").RefAttributes<ITerminalResttyRef>>;
111
+ //# sourceMappingURL=TerminalRestty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalRestty.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalRestty.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAiB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5F;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAE1C,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE3C,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,kDAAkD;IAClD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAE1B,yCAAyC;IACzC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAElG,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,SAAS,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAE/B,yCAAyC;IACzC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,gCAAgC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,qCAAqC;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB,uBAAuB;IACvB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC,wDAAwD;IACxD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAE7C,gCAAgC;IAChC,cAAc,EAAE,MAAM,OAAO,CAAC;IAE9B,2BAA2B;IAC3B,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,0BAA0B;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,qHAqL1B,CAAC"}
@@ -0,0 +1,185 @@
1
+ 'use client';
2
+
3
+ import { getSynthwaveGhosttyTheme, xtermThemeToGhostty } from "./Terminal.theme.restty.js";
4
+ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/react-ui/blocks/Terminal/TerminalRestty.tsx
8
+ /**
9
+ * TerminalRestty - React wrapper for restty GPU terminal renderer.
10
+ *
11
+ * Manages the restty lifecycle within React's component model,
12
+ * handling mount/unmount, dynamic import (SSR-safe), font loading,
13
+ * theme application, and PTY connection via custom DevenvPtyTransport.
14
+ *
15
+ * @module components/devenv/terminal/TerminalRestty
16
+ */
17
+ /**
18
+ * TerminalRestty - React component wrapping restty's GPU terminal.
19
+ *
20
+ * Handles the full lifecycle: dynamic WASM/WebGPU import, font loading,
21
+ * theme application, PTY connection via custom transport, and cleanup.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * const resttyRef = useRef<ITerminalResttyRef>(null);
26
+ *
27
+ * <TerminalRestty
28
+ * ref={resttyRef}
29
+ * wsUrl="ws://localhost:3100/terminal/session-1"
30
+ * fontSize={14}
31
+ * onResize={(cols, rows) => console.log(`${cols}x${rows}`)}
32
+ * onConnect={() => console.log('PTY connected')}
33
+ * />
34
+ * ```
35
+ */
36
+ const TerminalRestty = forwardRef(({ createPtyTransport, wsUrl, fontSize = 14, theme, resttyThemeName, gpuRenderer = "auto", onReady, onResize, onPtyStatus, onConnect, onDisconnect, onError, onDesktopNotification, className }, ref) => {
37
+ const containerRef = useRef(null);
38
+ const resttyRef = useRef(null);
39
+ const transportRef = useRef(null);
40
+ const [isInitialized, setIsInitialized] = useState(false);
41
+ const callbacksRef = useRef({
42
+ onReady,
43
+ onResize,
44
+ onPtyStatus,
45
+ onConnect,
46
+ onDisconnect,
47
+ onError,
48
+ onDesktopNotification
49
+ });
50
+ callbacksRef.current = {
51
+ onReady,
52
+ onResize,
53
+ onPtyStatus,
54
+ onConnect,
55
+ onDisconnect,
56
+ onError,
57
+ onDesktopNotification
58
+ };
59
+ /**
60
+ * Initialize restty on mount.
61
+ * Dynamic import ensures SSR safety (WASM + WebGPU require browser).
62
+ */
63
+ useEffect(() => {
64
+ if (!containerRef.current) return;
65
+ let destroyed = false;
66
+ const initRestty = async () => {
67
+ const { Restty, getBuiltinTheme } = await import("restty");
68
+ if (destroyed || !containerRef.current) return;
69
+ const transport = createPtyTransport?.() ?? null;
70
+ transportRef.current = transport;
71
+ const restty = new Restty({
72
+ root: containerRef.current,
73
+ appOptions: {
74
+ renderer: gpuRenderer,
75
+ fontSize,
76
+ autoResize: true,
77
+ ...transport ? { ptyTransport: transport } : {},
78
+ callbacks: {
79
+ onTermSize: (cols, rows) => {
80
+ callbacksRef.current.onResize?.(cols, rows);
81
+ },
82
+ onPtyStatus: (status) => {
83
+ callbacksRef.current.onPtyStatus?.(status);
84
+ }
85
+ }
86
+ },
87
+ fontSources: [{
88
+ type: "local",
89
+ matchers: [
90
+ "jetbrains mono",
91
+ "fira code",
92
+ "sf mono",
93
+ "cascadia code",
94
+ "meslo"
95
+ ]
96
+ }],
97
+ onDesktopNotification: (notification) => {
98
+ callbacksRef.current.onDesktopNotification?.(notification);
99
+ },
100
+ createInitialPane: true,
101
+ shortcuts: false,
102
+ defaultContextMenu: true
103
+ });
104
+ resttyRef.current = restty;
105
+ if (resttyThemeName) {
106
+ const builtinTheme = getBuiltinTheme(resttyThemeName);
107
+ if (builtinTheme) restty.applyTheme(builtinTheme);
108
+ } else if (theme) restty.applyTheme(xtermThemeToGhostty(theme));
109
+ else restty.applyTheme(getSynthwaveGhosttyTheme());
110
+ if (wsUrl) restty.connectPty(wsUrl);
111
+ setIsInitialized(true);
112
+ callbacksRef.current.onReady?.(restty);
113
+ };
114
+ initRestty().catch((err) => {
115
+ if (!destroyed) callbacksRef.current.onError?.(`Failed to initialize restty: ${err instanceof Error ? err.message : String(err)}`);
116
+ });
117
+ return () => {
118
+ destroyed = true;
119
+ resttyRef.current?.destroy();
120
+ resttyRef.current = null;
121
+ transportRef.current = null;
122
+ setIsInitialized(false);
123
+ };
124
+ }, []);
125
+ /**
126
+ * Handle wsUrl changes after initialization.
127
+ */
128
+ useEffect(() => {
129
+ if (!isInitialized || !resttyRef.current) return;
130
+ if (wsUrl) {
131
+ resttyRef.current.disconnectPty();
132
+ resttyRef.current.connectPty(wsUrl);
133
+ } else resttyRef.current.disconnectPty();
134
+ }, [wsUrl, isInitialized]);
135
+ /**
136
+ * Handle fontSize changes after initialization.
137
+ */
138
+ useEffect(() => {
139
+ if (!isInitialized || !resttyRef.current) return;
140
+ resttyRef.current.setFontSize(fontSize);
141
+ }, [fontSize, isInitialized]);
142
+ /**
143
+ * Handle theme changes after initialization.
144
+ */
145
+ useEffect(() => {
146
+ if (!isInitialized || !resttyRef.current) return;
147
+ if (resttyThemeName) import("restty").then(({ getBuiltinTheme }) => {
148
+ const builtinTheme = getBuiltinTheme(resttyThemeName);
149
+ if (builtinTheme) resttyRef.current?.applyTheme(builtinTheme);
150
+ });
151
+ else if (theme) resttyRef.current.applyTheme(xtermThemeToGhostty(theme));
152
+ }, [
153
+ theme,
154
+ resttyThemeName,
155
+ isInitialized
156
+ ]);
157
+ /**
158
+ * Expose imperative handle for parent component control.
159
+ */
160
+ useImperativeHandle(ref, () => ({
161
+ getRestty: () => resttyRef.current,
162
+ sendInput: (data) => resttyRef.current?.sendInput(data),
163
+ clear: () => resttyRef.current?.clearScreen(),
164
+ focus: () => resttyRef.current?.focus(),
165
+ blur: () => resttyRef.current?.blur(),
166
+ setFontSize: (size) => resttyRef.current?.setFontSize(size),
167
+ resize: (cols, rows) => resttyRef.current?.resize(cols, rows),
168
+ isPtyConnected: () => resttyRef.current?.isPtyConnected() ?? false,
169
+ connectPty: (url) => resttyRef.current?.connectPty(url),
170
+ disconnectPty: () => resttyRef.current?.disconnectPty()
171
+ }));
172
+ return /* @__PURE__ */ jsx("div", {
173
+ ref: containerRef,
174
+ className,
175
+ style: {
176
+ width: "100%",
177
+ height: "100%",
178
+ minHeight: "400px"
179
+ }
180
+ });
181
+ });
182
+ TerminalRestty.displayName = "TerminalRestty";
183
+
184
+ //#endregion
185
+ export { TerminalRestty };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * xterm.js wrapper component.
3
+ *
4
+ * Encapsulates xterm.js initialization, addon loading,
5
+ * and cleanup following React best practices with proper
6
+ * ref management and effect hooks.
7
+ *
8
+ * @module components/devenv/terminal/xterm
9
+ */
10
+ import { Terminal } from '@xterm/xterm';
11
+ import type { ITerminalOptions, ITerminalTheme } from './Terminal.types';
12
+ import '@xterm/xterm/css/xterm.css';
13
+ /**
14
+ * Props for the XTermWrapper component.
15
+ */
16
+ export interface IXTermWrapperProps {
17
+ /** Terminal initialization options */
18
+ options: ITerminalOptions;
19
+ /** Terminal theme (defaults to Synthwave if not provided) */
20
+ theme?: ITerminalTheme;
21
+ /** Callback when user types data in interactive mode */
22
+ onData?: (data: string) => void;
23
+ /** Callback when terminal is ready for interaction */
24
+ onReady?: (terminal: Terminal) => void;
25
+ /** Callback when terminal resizes */
26
+ onResize?: (cols: number, rows: number) => void;
27
+ /** Custom class name for the container */
28
+ className?: string;
29
+ }
30
+ /**
31
+ * xterm.js wrapper component.
32
+ *
33
+ * Manages xterm.js lifecycle including initialization, addon loading,
34
+ * WebSocket/SSE connections, and cleanup. Provides auto-resize via
35
+ * FitAddon and clickable URLs via WebLinksAddon.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <XTermWrapper
40
+ * options={{ mode: 'interactive', wsUrl: 'ws://localhost:3100/terminal' }}
41
+ * onData={(data) => console.log('User input:', data)}
42
+ * onReady={(terminal) => console.log('Terminal ready')}
43
+ * />
44
+ * ```
45
+ */
46
+ export declare function XTermWrapper({ options, theme, onData, onReady, onResize, className, }: IXTermWrapperProps): import("react/jsx-runtime").JSX.Element;
47
+ /**
48
+ * Export search addon reference for external access.
49
+ *
50
+ * Allows parent components to trigger search in the terminal buffer.
51
+ */
52
+ export declare function useTerminalSearch(terminalRef: React.RefObject<Terminal | null>): {
53
+ search: (_term: string, _options?: {
54
+ caseSensitive?: boolean;
55
+ regex?: boolean;
56
+ }) => false;
57
+ };
58
+ //# sourceMappingURL=TerminalXterm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalXterm.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalXterm.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,4BAA4B,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,OAAO,EAAE,gBAAgB,CAAC;IAE1B,6DAA6D;IAC7D,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC,sDAAsD;IACtD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAEvC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,2CAmJpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;oBAC1C,MAAM,aAAa;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;EAOnG"}
@@ -0,0 +1,143 @@
1
+ 'use client';
2
+
3
+ import { useCallback, useEffect, useRef } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Terminal } from "@xterm/xterm";
6
+ import { FitAddon } from "@xterm/addon-fit";
7
+ import { WebLinksAddon } from "@xterm/addon-web-links";
8
+ import { SearchAddon } from "@xterm/addon-search";
9
+ import { Unicode11Addon } from "@xterm/addon-unicode11";
10
+ import "@xterm/xterm/css/xterm.css";
11
+
12
+ //#region src/react-ui/blocks/Terminal/TerminalXterm.tsx
13
+ /**
14
+ * xterm.js wrapper component.
15
+ *
16
+ * Encapsulates xterm.js initialization, addon loading,
17
+ * and cleanup following React best practices with proper
18
+ * ref management and effect hooks.
19
+ *
20
+ * @module components/devenv/terminal/xterm
21
+ */
22
+ /**
23
+ * xterm.js wrapper component.
24
+ *
25
+ * Manages xterm.js lifecycle including initialization, addon loading,
26
+ * WebSocket/SSE connections, and cleanup. Provides auto-resize via
27
+ * FitAddon and clickable URLs via WebLinksAddon.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <XTermWrapper
32
+ * options={{ mode: 'interactive', wsUrl: 'ws://localhost:3100/terminal' }}
33
+ * onData={(data) => console.log('User input:', data)}
34
+ * onReady={(terminal) => console.log('Terminal ready')}
35
+ * />
36
+ * ```
37
+ */
38
+ function XTermWrapper({ options, theme, onData, onReady, onResize, className }) {
39
+ const containerRef = useRef(null);
40
+ const terminalRef = useRef(null);
41
+ const fitAddonRef = useRef(null);
42
+ const searchAddonRef = useRef(null);
43
+ /**
44
+ * Handle terminal data input from user.
45
+ */
46
+ const handleData = useCallback((data) => {
47
+ if (options.mode === "interactive" && onData) onData(data);
48
+ }, [options.mode, onData]);
49
+ /**
50
+ * Initialize xterm.js instance and load addons.
51
+ *
52
+ * Note: LigaturesAddon uses `fs` (Node.js module) internally,
53
+ * so it must be loaded via dynamic import to avoid SSR/bundler
54
+ * errors. All other addons are browser-safe static imports.
55
+ */
56
+ useEffect(() => {
57
+ if (!containerRef.current) return;
58
+ let disposed = false;
59
+ const terminal = new Terminal({
60
+ cursorBlink: options.cursorBlink ?? true,
61
+ scrollback: options.scrollback ?? 1e3,
62
+ fontSize: options.fontSize ?? 14,
63
+ fontFamily: options.fontFamily ?? "'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', monospace",
64
+ theme: theme ?? {},
65
+ convertEol: true,
66
+ allowProposedApi: true
67
+ });
68
+ const fitAddon = new FitAddon();
69
+ const webLinksAddon = new WebLinksAddon();
70
+ const searchAddon = new SearchAddon();
71
+ const unicode11Addon = new Unicode11Addon();
72
+ terminal.loadAddon(fitAddon);
73
+ terminal.loadAddon(webLinksAddon);
74
+ terminal.loadAddon(searchAddon);
75
+ terminal.loadAddon(unicode11Addon);
76
+ terminal.unicode.activeVersion = "11";
77
+ terminal.open(containerRef.current);
78
+ fitAddon.fit();
79
+ terminalRef.current = terminal;
80
+ fitAddonRef.current = fitAddon;
81
+ searchAddonRef.current = searchAddon;
82
+ import("@xterm/addon-ligatures").then(({ LigaturesAddon }) => {
83
+ if (disposed) return;
84
+ terminal.loadAddon(new LigaturesAddon());
85
+ }).catch(() => {});
86
+ if (options.mode === "interactive") terminal.onData(handleData);
87
+ onReady?.(terminal);
88
+ return () => {
89
+ disposed = true;
90
+ terminal.dispose();
91
+ };
92
+ }, []);
93
+ /**
94
+ * Handle window resize with auto-fit.
95
+ */
96
+ useEffect(() => {
97
+ const handleResize = () => {
98
+ if (!fitAddonRef.current || !terminalRef.current) return;
99
+ const previousDims = {
100
+ cols: terminalRef.current.cols,
101
+ rows: terminalRef.current.rows
102
+ };
103
+ fitAddonRef.current.fit();
104
+ if (onResize && (terminalRef.current.cols !== previousDims.cols || terminalRef.current.rows !== previousDims.rows)) onResize(terminalRef.current.cols, terminalRef.current.rows);
105
+ };
106
+ window.addEventListener("resize", handleResize);
107
+ return () => window.removeEventListener("resize", handleResize);
108
+ }, [onResize]);
109
+ /**
110
+ * Handle theme updates.
111
+ */
112
+ useEffect(() => {
113
+ if (!terminalRef.current || !theme) return;
114
+ terminalRef.current.options.theme = theme;
115
+ }, [theme]);
116
+ /**
117
+ * Handle data callback updates.
118
+ */
119
+ useEffect(() => {
120
+ if (!terminalRef.current) return;
121
+ terminalRef.current.onData(void 0);
122
+ if (options.mode === "interactive" && onData) terminalRef.current.onData(onData);
123
+ }, [options.mode, onData]);
124
+ return /* @__PURE__ */ jsx("div", {
125
+ ref: containerRef,
126
+ className: className ?? "xterm-container w-full h-full",
127
+ style: { minHeight: "400px" },
128
+ "data-terminal-mode": options.mode ?? "interactive"
129
+ });
130
+ }
131
+ /**
132
+ * Export search addon reference for external access.
133
+ *
134
+ * Allows parent components to trigger search in the terminal buffer.
135
+ */
136
+ function useTerminalSearch(terminalRef) {
137
+ return { search: useCallback((_term, _options) => {
138
+ return false;
139
+ }, [terminalRef]) };
140
+ }
141
+
142
+ //#endregion
143
+ export { XTermWrapper, useTerminalSearch };