@mks2508/mks-ui 0.5.7 → 0.6.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 (271) hide show
  1. package/dist/react-ui/index.js +2 -2
  2. package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +2 -0
  3. package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
  4. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +1 -1
  5. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
  6. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +173 -43
  7. package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts.map +1 -1
  8. package/dist/react-ui/ui/Dialog/Dialog.styles.js +1 -0
  9. package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +20 -1
  10. package/dist/react-ui/ui/Dialog/Dialog.types.d.ts.map +1 -1
  11. package/dist/react-ui/ui/Dialog/index.d.ts +28 -7
  12. package/dist/react-ui/ui/Dialog/index.d.ts.map +1 -1
  13. package/dist/react-ui/ui/Dialog/index.js +32 -5
  14. package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-DOR3Ld-k.css → DynamicToggle-DJLwEkHr.css} +12 -19
  15. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +12 -20
  16. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -0
  17. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
  18. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +7 -1
  19. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +55 -31
  20. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
  21. package/dist/react-ui/ui/DynamicToggle/index.d.ts +9 -3
  22. package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
  23. package/dist/react-ui/ui/DynamicToggle/index.js +47 -34
  24. package/dist/react-ui/ui/index.js +1 -1
  25. package/package.json +52 -13
  26. package/src/assets/react.svg +0 -1
  27. package/src/core/index.ts +0 -7
  28. package/src/core/types.ts +0 -82
  29. package/src/css.d.ts +0 -7
  30. package/src/index.css +0 -129
  31. package/src/index.ts +0 -29
  32. package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +0 -278
  33. package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +0 -97
  34. package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +0 -155
  35. package/src/react-ui/blocks/Terminal/Terminal.theme.ts +0 -80
  36. package/src/react-ui/blocks/Terminal/Terminal.types.ts +0 -438
  37. package/src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts +0 -38
  38. package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +0 -254
  39. package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +0 -73
  40. package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +0 -269
  41. package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +0 -326
  42. package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +0 -230
  43. package/src/react-ui/blocks/Terminal/XTermAdapter.ts +0 -163
  44. package/src/react-ui/blocks/Terminal/chrome.ts +0 -25
  45. package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +0 -316
  46. package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +0 -218
  47. package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +0 -386
  48. package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +0 -67
  49. package/src/react-ui/blocks/Terminal/components/index.ts +0 -10
  50. package/src/react-ui/blocks/Terminal/display.ts +0 -46
  51. package/src/react-ui/blocks/Terminal/hooks/index.ts +0 -22
  52. package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +0 -229
  53. package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +0 -292
  54. package/src/react-ui/blocks/Terminal/index.ts +0 -111
  55. package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +0 -330
  56. package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +0 -242
  57. package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +0 -202
  58. package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +0 -140
  59. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +0 -68
  60. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +0 -85
  61. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +0 -383
  62. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +0 -439
  63. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +0 -550
  64. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +0 -259
  65. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.ts +0 -75
  66. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +0 -266
  67. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +0 -82
  68. package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +0 -112
  69. package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +0 -178
  70. package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +0 -203
  71. package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +0 -252
  72. package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +0 -334
  73. package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +0 -261
  74. package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +0 -248
  75. package/src/react-ui/blocks/Terminal/panel/index.ts +0 -72
  76. package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +0 -59
  77. package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +0 -59
  78. package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +0 -180
  79. package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +0 -248
  80. package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +0 -283
  81. package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +0 -686
  82. package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +0 -466
  83. package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +0 -343
  84. package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +0 -167
  85. package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +0 -348
  86. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +0 -251
  87. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +0 -390
  88. package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +0 -320
  89. package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +0 -20
  90. package/src/react-ui/blocks/Terminal/parsing/index.ts +0 -69
  91. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +0 -68
  92. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +0 -436
  93. package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +0 -14
  94. package/src/react-ui/blocks/index.ts +0 -11
  95. package/src/react-ui/components/MorphingPopover/MorphingPopover.types.ts +0 -49
  96. package/src/react-ui/components/MorphingPopover/index.tsx +0 -186
  97. package/src/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -153
  98. package/src/react-ui/components/index.ts +0 -9
  99. package/src/react-ui/hooks/Animation/UseAutoHeight.tsx +0 -123
  100. package/src/react-ui/hooks/DOM/UseIsInView.tsx +0 -44
  101. package/src/react-ui/hooks/Formatting/UseListFormat.ts +0 -134
  102. package/src/react-ui/hooks/State/UseControlledState.tsx +0 -57
  103. package/src/react-ui/hooks/State/UseDataState.tsx +0 -76
  104. package/src/react-ui/hooks/index.ts +0 -20
  105. package/src/react-ui/icons/index.ts +0 -12
  106. package/src/react-ui/icons/lucide-animated/activity.tsx +0 -109
  107. package/src/react-ui/icons/lucide-animated/arrow-down-to-line.tsx +0 -51
  108. package/src/react-ui/icons/lucide-animated/arrow-up.tsx +0 -50
  109. package/src/react-ui/icons/lucide-animated/bell-electric.tsx +0 -124
  110. package/src/react-ui/icons/lucide-animated/bell.tsx +0 -93
  111. package/src/react-ui/icons/lucide-animated/bot.tsx +0 -122
  112. package/src/react-ui/icons/lucide-animated/box.tsx +0 -117
  113. package/src/react-ui/icons/lucide-animated/check.tsx +0 -21
  114. package/src/react-ui/icons/lucide-animated/circle-check.tsx +0 -107
  115. package/src/react-ui/icons/lucide-animated/delete.tsx +0 -133
  116. package/src/react-ui/icons/lucide-animated/download.tsx +0 -99
  117. package/src/react-ui/icons/lucide-animated/edit-2.tsx +0 -21
  118. package/src/react-ui/icons/lucide-animated/globe.tsx +0 -23
  119. package/src/react-ui/icons/lucide-animated/home.tsx +0 -103
  120. package/src/react-ui/icons/lucide-animated/index.ts +0 -38
  121. package/src/react-ui/icons/lucide-animated/layers.tsx +0 -23
  122. package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +0 -143
  123. package/src/react-ui/icons/lucide-animated/list.tsx +0 -54
  124. package/src/react-ui/icons/lucide-animated/package.tsx +0 -24
  125. package/src/react-ui/icons/lucide-animated/palette.tsx +0 -25
  126. package/src/react-ui/icons/lucide-animated/plus.tsx +0 -92
  127. package/src/react-ui/icons/lucide-animated/refresh-cw.tsx +0 -24
  128. package/src/react-ui/icons/lucide-animated/rocket.tsx +0 -24
  129. package/src/react-ui/icons/lucide-animated/save.tsx +0 -23
  130. package/src/react-ui/icons/lucide-animated/search.tsx +0 -94
  131. package/src/react-ui/icons/lucide-animated/settings.tsx +0 -92
  132. package/src/react-ui/icons/lucide-animated/terminal.tsx +0 -46
  133. package/src/react-ui/icons/lucide-animated/trash-2.tsx +0 -25
  134. package/src/react-ui/icons/lucide-animated/trending-down.tsx +0 -151
  135. package/src/react-ui/icons/lucide-animated/trending-up.tsx +0 -150
  136. package/src/react-ui/icons/lucide-animated/type.tsx +0 -23
  137. package/src/react-ui/icons/lucide-animated/upload.tsx +0 -23
  138. package/src/react-ui/icons/lucide-animated/x.tsx +0 -102
  139. package/src/react-ui/index.ts +0 -30
  140. package/src/react-ui/lib/get-strict-context.tsx +0 -56
  141. package/src/react-ui/lib/icon-wrapper.tsx +0 -70
  142. package/src/react-ui/lib/index.ts +0 -9
  143. package/src/react-ui/lib/utils.ts +0 -24
  144. package/src/react-ui/primitives/AutoHeight/index.tsx +0 -74
  145. package/src/react-ui/primitives/CountingNumber/index.tsx +0 -147
  146. package/src/react-ui/primitives/Highlight/Highlight.types.ts +0 -136
  147. package/src/react-ui/primitives/Highlight/index.tsx +0 -577
  148. package/src/react-ui/primitives/Slot/index.tsx +0 -128
  149. package/src/react-ui/primitives/index.ts +0 -16
  150. package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +0 -141
  151. package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -217
  152. package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +0 -77
  153. package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +0 -58
  154. package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +0 -253
  155. package/src/react-ui/primitives/waapi/Gooey/index.ts +0 -50
  156. package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +0 -48
  157. package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +0 -106
  158. package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +0 -21
  159. package/src/react-ui/primitives/waapi/Morph/index.tsx +0 -56
  160. package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +0 -12
  161. package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +0 -89
  162. package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +0 -176
  163. package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +0 -87
  164. package/src/react-ui/primitives/waapi/Morph/useMorph.ts +0 -101
  165. package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +0 -177
  166. package/src/react-ui/primitives/waapi/Reorder/index.tsx +0 -260
  167. package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +0 -47
  168. package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +0 -209
  169. package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +0 -104
  170. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +0 -14
  171. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +0 -84
  172. package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +0 -474
  173. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +0 -32
  174. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +0 -69
  175. package/src/react-ui/primitives/waapi/SlidingText/index.tsx +0 -140
  176. package/src/react-ui/primitives/waapi/core/animationConstants.ts +0 -215
  177. package/src/react-ui/primitives/waapi/core/index.ts +0 -53
  178. package/src/react-ui/primitives/waapi/core/types.ts +0 -200
  179. package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +0 -430
  180. package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +0 -81
  181. package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +0 -138
  182. package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +0 -106
  183. package/src/react-ui/primitives/waapi/index.ts +0 -139
  184. package/src/react-ui/styles/animations.css +0 -369
  185. package/src/react-ui/ui/Accordion/Accordion.styles.ts +0 -72
  186. package/src/react-ui/ui/Accordion/Accordion.types.ts +0 -199
  187. package/src/react-ui/ui/Accordion/index.tsx +0 -362
  188. package/src/react-ui/ui/AlertDialog/AlertDialog.styles.ts +0 -38
  189. package/src/react-ui/ui/AlertDialog/AlertDialog.types.ts +0 -296
  190. package/src/react-ui/ui/AlertDialog/index.tsx +0 -540
  191. package/src/react-ui/ui/Badge/Badge.styles.ts +0 -43
  192. package/src/react-ui/ui/Badge/Badge.types.ts +0 -26
  193. package/src/react-ui/ui/Badge/index.tsx +0 -34
  194. package/src/react-ui/ui/Button/Button.styles.ts +0 -57
  195. package/src/react-ui/ui/Button/Button.types.ts +0 -63
  196. package/src/react-ui/ui/Button/index.tsx +0 -155
  197. package/src/react-ui/ui/Card/Card.styles.ts +0 -32
  198. package/src/react-ui/ui/Card/Card.types.ts +0 -39
  199. package/src/react-ui/ui/Card/index.tsx +0 -130
  200. package/src/react-ui/ui/Checkbox/Checkbox.styles.ts +0 -40
  201. package/src/react-ui/ui/Checkbox/Checkbox.types.ts +0 -98
  202. package/src/react-ui/ui/Checkbox/index.tsx +0 -233
  203. package/src/react-ui/ui/Combobox/Combobox.styles.ts +0 -34
  204. package/src/react-ui/ui/Combobox/Combobox.types.ts +0 -89
  205. package/src/react-ui/ui/Combobox/index.tsx +0 -331
  206. package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +0 -38
  207. package/src/react-ui/ui/CornerBracket/CornerBracket.types.ts +0 -15
  208. package/src/react-ui/ui/CornerBracket/index.tsx +0 -49
  209. package/src/react-ui/ui/DataCard/DataCard.styles.ts +0 -94
  210. package/src/react-ui/ui/DataCard/DataCard.types.ts +0 -125
  211. package/src/react-ui/ui/DataCard/index.tsx +0 -340
  212. package/src/react-ui/ui/Dialog/Dialog.styles.ts +0 -59
  213. package/src/react-ui/ui/Dialog/Dialog.types.ts +0 -284
  214. package/src/react-ui/ui/Dialog/index.tsx +0 -452
  215. package/src/react-ui/ui/DropdownMenu/DropdownMenu.styles.ts +0 -35
  216. package/src/react-ui/ui/DropdownMenu/DropdownMenu.types.ts +0 -81
  217. package/src/react-ui/ui/DropdownMenu/index.tsx +0 -300
  218. package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -376
  219. package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
  220. package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -180
  221. package/src/react-ui/ui/DynamicToggle/index.tsx +0 -316
  222. package/src/react-ui/ui/DynamicToggle/prototype-v7-ios.html +0 -413
  223. package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
  224. package/src/react-ui/ui/DynamicToggle/prototype-v8-gooey-safari.html +0 -560
  225. package/src/react-ui/ui/DynamicToggle/prototype-v8b-react-structure.html +0 -227
  226. package/src/react-ui/ui/DynamicToggle/prototype.html +0 -419
  227. package/src/react-ui/ui/Field/Field.styles.ts +0 -47
  228. package/src/react-ui/ui/Field/Field.types.ts +0 -60
  229. package/src/react-ui/ui/Field/index.tsx +0 -254
  230. package/src/react-ui/ui/Input/Input.styles.ts +0 -11
  231. package/src/react-ui/ui/Input/Input.types.ts +0 -10
  232. package/src/react-ui/ui/Input/index.tsx +0 -32
  233. package/src/react-ui/ui/InputGroup/InputGroup.styles.ts +0 -53
  234. package/src/react-ui/ui/InputGroup/InputGroup.types.ts +0 -44
  235. package/src/react-ui/ui/InputGroup/index.tsx +0 -149
  236. package/src/react-ui/ui/Label/Label.styles.ts +0 -10
  237. package/src/react-ui/ui/Label/Label.types.ts +0 -9
  238. package/src/react-ui/ui/Label/index.tsx +0 -27
  239. package/src/react-ui/ui/Menu/Menu.styles.ts +0 -71
  240. package/src/react-ui/ui/Menu/Menu.types.ts +0 -425
  241. package/src/react-ui/ui/Menu/index.tsx +0 -900
  242. package/src/react-ui/ui/Popover/Popover.styles.ts +0 -55
  243. package/src/react-ui/ui/Popover/Popover.types.ts +0 -261
  244. package/src/react-ui/ui/Popover/index.tsx +0 -422
  245. package/src/react-ui/ui/Progress/Progress.styles.ts +0 -36
  246. package/src/react-ui/ui/Progress/Progress.types.ts +0 -162
  247. package/src/react-ui/ui/Progress/index.tsx +0 -254
  248. package/src/react-ui/ui/Select/Select.styles.ts +0 -30
  249. package/src/react-ui/ui/Select/Select.types.ts +0 -51
  250. package/src/react-ui/ui/Select/index.tsx +0 -225
  251. package/src/react-ui/ui/Separator/Separator.styles.ts +0 -10
  252. package/src/react-ui/ui/Separator/Separator.types.ts +0 -10
  253. package/src/react-ui/ui/Separator/index.tsx +0 -37
  254. package/src/react-ui/ui/Switch/Switch.styles.ts +0 -50
  255. package/src/react-ui/ui/Switch/Switch.types.ts +0 -155
  256. package/src/react-ui/ui/Switch/index.tsx +0 -253
  257. package/src/react-ui/ui/Tabs/Tabs.css +0 -39
  258. package/src/react-ui/ui/Tabs/Tabs.styles.ts +0 -148
  259. package/src/react-ui/ui/Tabs/Tabs.types.ts +0 -255
  260. package/src/react-ui/ui/Tabs/index.tsx +0 -529
  261. package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +0 -36
  262. package/src/react-ui/ui/TextFlow/TextFlow.types.ts +0 -118
  263. package/src/react-ui/ui/TextFlow/index.tsx +0 -276
  264. package/src/react-ui/ui/Textarea/Textarea.styles.ts +0 -10
  265. package/src/react-ui/ui/Textarea/Textarea.types.ts +0 -9
  266. package/src/react-ui/ui/Textarea/index.tsx +0 -27
  267. package/src/react-ui/ui/Tooltip/Tooltip.styles.ts +0 -43
  268. package/src/react-ui/ui/Tooltip/Tooltip.types.ts +0 -253
  269. package/src/react-ui/ui/Tooltip/index.tsx +0 -394
  270. package/src/react-ui/ui/index.ts +0 -41
  271. package/src/types/css-modules.d.ts +0 -18
@@ -1,390 +0,0 @@
1
- /**
2
- * ANSI escape code parser for terminal colorization.
3
- *
4
- * Handles standard ANSI/VT100 escape sequences including:
5
- * - CSI (Control Sequence Introducer): \x1b[...
6
- * - SGR (Select Graphic Rendition): colors, styles
7
- * - OSC (Operating System Command): window title, etc.
8
- *
9
- * Converts ANSI codes to xterm.js compatible format with proper
10
- * Synthwave theme color mapping.
11
- *
12
- * @module components/devenv/terminal/parsing/ansi/parser
13
- */
14
-
15
- import { ANSI_PATTERNS, SGR_CODES } from './ansi.constants';
16
- import { AnsiColorMapper } from './AnsiColorMapper';
17
- import type { IAnsiParseResult, IAnsiStyle } from '../LogParser.types';
18
-
19
- /**
20
- * ANSI escape code parser state.
21
- *
22
- * Maintains current styling state during incremental parsing.
23
- */
24
- interface IAnsiParserState {
25
- /** Current foreground color code */
26
- fg_color?: number;
27
-
28
- /** Current background color code */
29
- bg_color?: number;
30
-
31
- /** Active text modifiers */
32
- modifiers: Set<string>;
33
- }
34
-
35
- /**
36
- * ANSI escape code parser class.
37
- *
38
- * Parses ANSI escape sequences from text and converts them to
39
- * xterm.js compatible format with proper Synthwave theme colors.
40
- *
41
- * @example
42
- * ```ts
43
- * const parser = new AnsiParser();
44
- * const result = parser.parse('\x1b[31mError\x1b[0m message');
45
- * // result.text: '\\x1b]4;197;#ff4466\\x07Error\\x1b[0m message'
46
- * // result.styles: [{ fg_color: 31, modifiers: [] }]
47
- * ```
48
- */
49
- export class AnsiParser {
50
- /** Current parser state */
51
- private state: IAnsiParserState;
52
-
53
- /**
54
- * Create a new ANSI parser.
55
- *
56
- * Initializes with default state (no colors, no modifiers).
57
- */
58
- constructor() {
59
- this.state = {
60
- modifiers: new Set<string>(),
61
- };
62
- }
63
-
64
- /**
65
- * Check if a string contains ANSI escape codes.
66
- *
67
- * @param text - Text to check
68
- * @returns true if text contains ANSI escape sequences
69
- *
70
- * @example
71
- * ```ts
72
- * AnsiParser.hasAnsi('\x1b[31mError'); // true
73
- * AnsiParser.hasAnsi('Plain text'); // false
74
- * ```
75
- */
76
- static hasAnsi(text: string): boolean {
77
- return ANSI_PATTERNS.CSI_SEQUENCE.test(text);
78
- }
79
-
80
- /**
81
- * Strip all ANSI escape codes from text.
82
- *
83
- * Removes ANSI sequences while preserving the actual text content.
84
- * Useful for plain text display or searching.
85
- *
86
- * @param text - Text with ANSI codes
87
- * @returns Plain text without ANSI codes
88
- *
89
- * @example
90
- * ```ts
91
- * const plain = AnsiParser.stripAnsi('\x1b[31mError\x1b[0m');
92
- * // 'Error'
93
- * ```
94
- */
95
- static stripAnsi(text: string): string {
96
- return text.replace(ANSI_PATTERNS.CSI_SEQUENCE, '').replace(ANSI_PATTERNS.OSC_SEQUENCE, '');
97
- }
98
-
99
- /**
100
- * Parse ANSI codes and convert to xterm.js format.
101
- *
102
- * Converts ANSI CSI sequences to xterm.js OSC sequences for
103
- * true-color support and applies Synthwave theme colors.
104
- *
105
- * @param text - Text with ANSI escape codes
106
- * @returns Parse result with converted text and extracted styles
107
- *
108
- * @example
109
- * ```ts
110
- * const result = parser.parse('\x1b[31;1mError\x1b[0m');
111
- * // result.text: xterm.js formatted string
112
- * // result.styles: [{ fg_color: 31, modifiers: ['bold'] }]
113
- * ```
114
- */
115
- parse(text: string): IAnsiParseResult {
116
- const styles: IAnsiStyle[] = [];
117
- let converted = text;
118
- let styleIndex = 0;
119
-
120
- // Reset state
121
- this.reset();
122
-
123
- // Find all CSI sequences
124
- const matches = text.matchAll(ANSI_PATTERNS.CSI_SEQUENCE);
125
-
126
- for (const match of matches) {
127
- const sequence = match[0];
128
-
129
- // Parse the SGR parameters
130
- const params = this.parseSgrParams(sequence);
131
-
132
- // Update state and create style
133
- const style = this.applySgrParams(params);
134
-
135
- if (style) {
136
- styles.push({ ...style, index: styleIndex++ });
137
- }
138
-
139
- // Convert to xterm.js format
140
- const xtermSequence = this.convertToXterm(sequence, params);
141
- converted = converted.replace(sequence, xtermSequence);
142
- }
143
-
144
- return {
145
- text: converted,
146
- styles,
147
- };
148
- }
149
-
150
- /**
151
- * Get ANSI color code as hex from theme.
152
- *
153
- * Converts an ANSI color code to its hex color value in the
154
- * Synthwave theme.
155
- *
156
- * @param code - ANSI color code (e.g., 31 for red)
157
- * @returns Hex color string (e.g., '#ff4466') or undefined
158
- */
159
- colorFromAnsi(code: number): string | undefined {
160
- if (code >= 40 && code <= 47) {
161
- return AnsiColorMapper.bgColor(code);
162
- } else if (code >= 100 && code <= 107) {
163
- return AnsiColorMapper.bgColor(code);
164
- } else {
165
- return AnsiColorMapper.fgColor(code);
166
- }
167
- }
168
-
169
- /**
170
- * Reset parser state to defaults.
171
- */
172
- reset(): void {
173
- this.state = {
174
- modifiers: new Set<string>(),
175
- };
176
- }
177
-
178
- /**
179
- * Parse SGR (Select Graphic Rendition) parameters from CSI sequence.
180
- *
181
- * @param sequence - CSI sequence (e.g., '\x1b[31;1m')
182
- * @returns Array of parameter numbers
183
- * @private
184
- */
185
- private parseSgrParams(sequence: string): number[] {
186
- // Extract parameters between '[' and final character
187
- const paramMatch = sequence.match(/\[([0-9;]*)[mM]/);
188
- if (!paramMatch) return [];
189
-
190
- const paramString = paramMatch[1];
191
- if (!paramString) return [0]; // Default to reset
192
-
193
- return paramString.split(';').map((p) => parseInt(p, 10));
194
- }
195
-
196
- /**
197
- * Apply SGR parameters to parser state.
198
- *
199
- * Updates internal state based on SGR parameters and returns
200
- * the current style after applying changes.
201
- *
202
- * @param params - Array of SGR parameter numbers
203
- * @returns Current style after applying parameters
204
- * @private
205
- */
206
- private applySgrParams(params: number[]): IAnsiStyle | null {
207
- if (params.length === 0 || (params.length === 1 && params[0] === 0)) {
208
- // Reset
209
- this.reset();
210
- return null;
211
- }
212
-
213
- for (const param of params) {
214
- switch (param) {
215
- // Reset
216
- case SGR_CODES.RESET:
217
- case SGR_CODES.BOLD_OFF:
218
- case SGR_CODES.DIM_OFF:
219
- case SGR_CODES.ITALIC_OFF:
220
- case SGR_CODES.UNDERLINE_OFF:
221
- case SGR_CODES.BLINK_OFF:
222
- case SGR_CODES.INVERSE_OFF:
223
- case SGR_CODES.STRIKETHROUGH_OFF:
224
- this.reset();
225
- break;
226
-
227
- // Modifiers
228
- case SGR_CODES.BOLD:
229
- this.state.modifiers.add('bold');
230
- break;
231
- case SGR_CODES.DIM:
232
- this.state.modifiers.add('dim');
233
- break;
234
- case SGR_CODES.ITALIC:
235
- this.state.modifiers.add('italic');
236
- break;
237
- case SGR_CODES.UNDERLINE:
238
- this.state.modifiers.add('underline');
239
- break;
240
- case SGR_CODES.BLINK_SLOW:
241
- case SGR_CODES.BLINK_FAST:
242
- this.state.modifiers.add('blink');
243
- break;
244
- case SGR_CODES.INVERSE:
245
- this.state.modifiers.add('inverse');
246
- break;
247
- case SGR_CODES.HIDDEN:
248
- this.state.modifiers.add('hidden');
249
- break;
250
- case SGR_CODES.STRIKETHROUGH:
251
- this.state.modifiers.add('strikethrough');
252
- break;
253
-
254
- // Default colors
255
- case SGR_CODES.FG_DEFAULT:
256
- this.state.fg_color = undefined;
257
- break;
258
- case SGR_CODES.BG_DEFAULT:
259
- this.state.bg_color = undefined;
260
- break;
261
-
262
- default:
263
- // Color codes (30-37, 40-47, 90-97, 100-107)
264
- if (
265
- (param >= 30 && param <= 37) ||
266
- (param >= 40 && param <= 47) ||
267
- (param >= 90 && param <= 97) ||
268
- (param >= 100 && param <= 107)
269
- ) {
270
- if (param >= 40) {
271
- // Background color
272
- this.state.bg_color = param;
273
- } else {
274
- // Foreground color
275
- this.state.fg_color = param;
276
- }
277
- }
278
- break;
279
- }
280
- }
281
-
282
- return {
283
- fg_color: this.state.fg_color,
284
- bg_color: this.state.bg_color,
285
- modifiers: Array.from(this.state.modifiers),
286
- };
287
- }
288
-
289
- /**
290
- * Convert ANSI CSI sequence to xterm.js OSC format.
291
- *
292
- * xterm.js supports OSC sequences for true-color (24-bit) colors.
293
- * This converts ANSI 4-bit/8-bit colors to OSC 4/10/11 sequences.
294
- *
295
- * @param sequence - Original ANSI CSI sequence
296
- * @param params - Parsed SGR parameters
297
- * @returns xterm.js compatible escape sequence
298
- * @private
299
- */
300
- private convertToXterm(sequence: string, params: number[]): string {
301
- // For simple resets and modifiers, keep original
302
- if (!params.some((p) => p >= 30 && p <= 47) && !params.some((p) => p >= 90 && p <= 107)) {
303
- return sequence;
304
- }
305
-
306
- // For color codes, use OSC 4 or 10/11 sequences
307
- let result = '';
308
-
309
- for (const param of params) {
310
- if ((param >= 30 && param <= 37) || (param >= 90 && param <= 97)) {
311
- // Foreground color - use OSC 10
312
- const hex = AnsiColorMapper.fgColor(param);
313
- if (hex) {
314
- result += `\x1b]10;#${hex.slice(1)}\x07`;
315
- }
316
- } else if ((param >= 40 && param <= 47) || (param >= 100 && param <= 107)) {
317
- // Background color - use OSC 11
318
- const fgCode = param >= 100 ? param - 10 : param - 10;
319
- const hex = AnsiColorMapper.fgColor(fgCode);
320
- if (hex) {
321
- result += `\x1b]11;#${hex.slice(1)}\x07`;
322
- }
323
- }
324
- }
325
-
326
- // Keep modifiers (bold, underline, etc.)
327
- const modifiers = params.filter(
328
- (p) =>
329
- p === SGR_CODES.BOLD ||
330
- p === SGR_CODES.DIM ||
331
- p === SGR_CODES.ITALIC ||
332
- p === SGR_CODES.UNDERLINE ||
333
- p === SGR_CODES.BLINK_SLOW ||
334
- p === SGR_CODES.BLINK_FAST ||
335
- p === SGR_CODES.INVERSE ||
336
- p === SGR_CODES.HIDDEN ||
337
- p === SGR_CODES.STRIKETHROUGH
338
- );
339
-
340
- if (modifiers.length > 0) {
341
- result += `\x1b[${modifiers.join(';')}m`;
342
- }
343
-
344
- return result || sequence;
345
- }
346
-
347
- /**
348
- * Extract all ANSI escape codes from text.
349
- *
350
- * Returns an array of all ANSI sequences found in the text.
351
- *
352
- * @param text - Text to extract from
353
- * @returns Array of ANSI escape sequences
354
- *
355
- * @example
356
- * ```ts
357
- * const codes = AnsiParser.extractCodes('\x1b[31mError\x1b[0m');
358
- * // ['\x1b[31m', '\x1b[0m']
359
- * ```
360
- */
361
- static extractCodes(text: string): string[] {
362
- const found = text.match(ANSI_PATTERNS.CSI_SEQUENCE);
363
- return found ?? [];
364
- }
365
-
366
- /**
367
- * Count ANSI escape codes in text.
368
- *
369
- * @param text - Text to count codes in
370
- * @returns Number of ANSI escape sequences
371
- */
372
- static countCodes(text: string): number {
373
- return (text.match(ANSI_PATTERNS.CSI_SEQUENCE) ?? []).length;
374
- }
375
-
376
- /**
377
- * Get visible text length (excluding ANSI codes).
378
- *
379
- * @param text - Text with potential ANSI codes
380
- * @returns Length of visible text only
381
- *
382
- * @example
383
- * ```ts
384
- * AnsiParser.visibleLength('\x1b[31mError\x1b[0m'); // 5
385
- * ```
386
- */
387
- static visibleLength(text: string): number {
388
- return this.stripAnsi(text).length;
389
- }
390
- }
@@ -1,320 +0,0 @@
1
- /**
2
- * ANSI escape code constants for terminal parsing.
3
- *
4
- * Contains standard ANSI/VT100 escape sequences for color, styling,
5
- * and cursor control. Used by AnsiParser to detect and convert
6
- * ANSI codes to xterm.js compatible format.
7
- *
8
- * References:
9
- * - ANSI/VT100 Control Sequences: https://vt100.net/docs/vt100-ug/chapter3.html
10
- * - SGR (Select Graphic Rendition): https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
11
- *
12
- * @module components/devenv/terminal/parsing/ansi/constants
13
- */
14
-
15
- /**
16
- * ANSI escape sequence introducers.
17
- *
18
- * Control sequences that introduce ANSI escape codes.
19
- */
20
- export const ANSI_INTRODUCERS = {
21
- /** CSI (Control Sequence Introducer) - \x1b[ */
22
- CSI: '\x1b[',
23
-
24
- /** OSC (Operating System Command) - \x1b] */
25
- OSC: '\x1b]',
26
-
27
- /** DCS (Device Control String) - \x1bP */
28
- DCS: '\x1bP',
29
-
30
- /** ST (String Terminator) - \x1b\\ */
31
- ST: '\x1b\\',
32
-
33
- /** ESC prefix */
34
- ESC: '\x1b',
35
- } as const;
36
-
37
- /**
38
- * ANSI SGR (Select Graphic Rendition) parameter codes.
39
- *
40
- * Text styling and color codes following CSI.
41
- */
42
- export const SGR_CODES = {
43
- /** Reset all attributes */
44
- RESET: 0,
45
-
46
- /** Bold/intense */
47
- BOLD: 1,
48
-
49
- /** Faint/dim */
50
- DIM: 2,
51
-
52
- /** Italic */
53
- ITALIC: 3,
54
-
55
- /** Underline */
56
- UNDERLINE: 4,
57
-
58
- /** Blink slowly */
59
- BLINK_SLOW: 5,
60
-
61
- /** Blink rapidly */
62
- BLINK_FAST: 6,
63
-
64
- /** Inverse/reverse video */
65
- INVERSE: 7,
66
-
67
- /** Hide/conceal */
68
- HIDDEN: 8,
69
-
70
- /** Strikethrough */
71
- STRIKETHROUGH: 9,
72
-
73
- /** Default font */
74
- FONT_DEFAULT: 10,
75
-
76
- /** Bold off (not widely supported) */
77
- BOLD_OFF: 21,
78
-
79
- /** Dim off (not widely supported) */
80
- DIM_OFF: 22,
81
-
82
- /** Italic off */
83
- ITALIC_OFF: 23,
84
-
85
- /** Underline off */
86
- UNDERLINE_OFF: 24,
87
-
88
- /** Blink off */
89
- BLINK_OFF: 25,
90
-
91
- /** Inverse off */
92
- INVERSE_OFF: 27,
93
-
94
- /** Reveal */
95
- REVEAL: 28,
96
-
97
- /** Strikethrough off */
98
- STRIKETHROUGH_OFF: 29,
99
-
100
- // Foreground colors (30-37)
101
-
102
- /** Black foreground */
103
- FG_BLACK: 30,
104
-
105
- /** Red foreground */
106
- FG_RED: 31,
107
-
108
- /** Green foreground */
109
- FG_GREEN: 32,
110
-
111
- /** Yellow foreground */
112
- FG_YELLOW: 33,
113
-
114
- /** Blue foreground */
115
- FG_BLUE: 34,
116
-
117
- /** Magenta foreground */
118
- FG_MAGENTA: 35,
119
-
120
- /** Cyan foreground */
121
- FG_CYAN: 36,
122
-
123
- /** White foreground */
124
- FG_WHITE: 37,
125
-
126
- /** Default foreground color */
127
- FG_DEFAULT: 39,
128
-
129
- // Background colors (40-47)
130
-
131
- /** Black background */
132
- BG_BLACK: 40,
133
-
134
- /** Red background */
135
- BG_RED: 41,
136
-
137
- /** Green background */
138
- BG_GREEN: 42,
139
-
140
- /** Yellow background */
141
- BG_YELLOW: 43,
142
-
143
- /** Blue background */
144
- BG_BLUE: 44,
145
-
146
- /** Magenta background */
147
- BG_MAGENTA: 45,
148
-
149
- /** Cyan background */
150
- BG_CYAN: 46,
151
-
152
- /** White background */
153
- BG_WHITE: 47,
154
-
155
- /** Default background color */
156
- BG_DEFAULT: 49,
157
-
158
- // Bright foreground colors (90-97)
159
-
160
- /** Bright black (gray) foreground */
161
- FG_BRIGHT_BLACK: 90,
162
-
163
- /** Bright red foreground */
164
- FG_BRIGHT_RED: 91,
165
-
166
- /** Bright green foreground */
167
- FG_BRIGHT_GREEN: 92,
168
-
169
- /** Bright yellow foreground */
170
- FG_BRIGHT_YELLOW: 93,
171
-
172
- /** Bright blue foreground */
173
- FG_BRIGHT_BLUE: 94,
174
-
175
- /** Bright magenta foreground */
176
- FG_BRIGHT_MAGENTA: 95,
177
-
178
- /** Bright cyan foreground */
179
- FG_BRIGHT_CYAN: 96,
180
-
181
- /** Bright white foreground */
182
- FG_BRIGHT_WHITE: 97,
183
-
184
- // Bright background colors (100-107)
185
-
186
- /** Bright black (gray) background */
187
- BG_BRIGHT_BLACK: 100,
188
-
189
- /** Bright red background */
190
- BG_BRIGHT_RED: 101,
191
-
192
- /** Bright green background */
193
- BG_BRIGHT_GREEN: 102,
194
-
195
- /** Bright yellow background */
196
- BG_BRIGHT_YELLOW: 103,
197
-
198
- /** Bright blue background */
199
- BG_BRIGHT_BLUE: 104,
200
-
201
- /** Bright magenta background */
202
- BG_BRIGHT_MAGENTA: 105,
203
-
204
- /** Bright cyan background */
205
- BG_BRIGHT_CYAN: 106,
206
-
207
- /** Bright white background */
208
- BG_BRIGHT_WHITE: 107,
209
- } as const;
210
-
211
- /**
212
- * ANSI regex patterns for detection and parsing.
213
- */
214
- export const ANSI_PATTERNS = {
215
- /** CSI sequence: \x1b[ followed by parameters and final character */
216
- CSI_SEQUENCE: /\x1b\[[0-9;]*[a-zA-Z]/g,
217
-
218
- /** OSC sequence: \x1b] followed by content and ST */
219
- OSC_SEQUENCE: /\x1b\][^\x07\x1b\\]*(?:\x07|\x1b\\)/g,
220
-
221
- /** SGR parameters (numeric codes within CSI) */
222
- SGR_PARAMS: /[0-9]+/g,
223
-
224
- /** Complete ANSI escape sequence */
225
- ANSI_ESCAPE: /\x1b\[[0-9;]*[mGaKHF]/g,
226
-
227
- /** Text attributes (bold, dim, italic, underline) */
228
- TEXT_ATTRIBUTES: /[0-9]/,
229
-
230
- /** Color codes (30-37, 40-47, 90-97, 100-107) */
231
- COLOR_CODES: /[34][0-7]|10[0-7]|[34][0-7]/g,
232
- } as const;
233
-
234
- /**
235
- * ANSI to xterm.js color mapping.
236
- *
237
- * Maps standard ANSI color codes (0-15) to xterm.js color indices.
238
- */
239
- export const ANSI_COLOR_MAP: Record<number, number> = {
240
- // Standard colors (0-7)
241
- 0: 0, // Black
242
- 1: 1, // Red
243
- 2: 2, // Green
244
- 3: 3, // Yellow
245
- 4: 4, // Blue
246
- 5: 5, // Magenta
247
- 6: 6, // Cyan
248
- 7: 7, // White
249
-
250
- // Bright colors (8-15)
251
- 8: 8, // Bright Black
252
- 9: 9, // Bright Red
253
- 10: 10, // Bright Green
254
- 11: 11, // Bright Yellow
255
- 12: 12, // Bright Blue
256
- 13: 13, // Bright Magenta
257
- 14: 14, // Bright Cyan
258
- 15: 15, // Bright White
259
- } as const;
260
-
261
- /**
262
- * ANSI text modifier names.
263
- *
264
- * Maps SGR modifier codes to human-readable names.
265
- */
266
- export const ANSI_MODIFIERS: Record<number, string> = {
267
- 1: 'bold',
268
- 2: 'dim',
269
- 3: 'italic',
270
- 4: 'underline',
271
- 5: 'blink',
272
- 7: 'inverse',
273
- 8: 'hidden',
274
- 9: 'strikethrough',
275
- } as const;
276
-
277
- /**
278
- * Synthwave theme ANSI to hex color mapping.
279
- *
280
- * Maps ANSI color codes to Synthwave Industrial Dark theme colors
281
- * from Terminal.theme.ts. Used for colorizing logs with proper
282
- * design system colors.
283
- */
284
- export const SYNTHWAVE_ANSI_COLORS: Record<number, string> = {
285
- // Standard colors
286
- 30: '#1a1a2e', // Black (FG_BLACK)
287
- 31: '#ff4466', // Red (FG_RED)
288
- 32: '#44ffaa', // Green (FG_GREEN)
289
- 33: '#ffcc00', // Yellow (FG_YELLOW)
290
- 34: '#00d9ff', // Blue (FG_BLUE)
291
- 35: '#D40C67', // Magenta (FG_MAGENTA)
292
- 36: '#00d9ff', // Cyan (FG_CYAN)
293
- 37: '#e8e8ec', // White (FG_WHITE)
294
-
295
- // Bright colors
296
- 90: '#2d2d44', // Bright Black
297
- 91: '#ff6b6b', // Bright Red
298
- 92: '#66ffcc', // Bright Green
299
- 93: '#ffdd33', // Bright Yellow
300
- 94: '#33e0ff', // Bright Blue
301
- 95: '#ff3399', // Bright Magenta
302
- 96: '#33e0ff', // Bright Cyan
303
- 97: '#ffffff', // Bright White
304
- } as const;
305
-
306
- /**
307
- * Log level to ANSI color mapping.
308
- *
309
- * Maps log levels to their corresponding ANSI color codes for
310
- * terminal display with proper colorization.
311
- */
312
- export const LOG_LEVEL_ANSI_COLORS: Record<string, number> = {
313
- trace: 90, // Gray (bright black)
314
- debug: 36, // Cyan
315
- info: 34, // Blue
316
- warn: 33, // Yellow
317
- error: 31, // Red
318
- fatal: 35, // Magenta
319
- unknown: 37, // White
320
- } as const;