@mks2508/mks-ui 0.3.2 → 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.
- package/dist/react-ui/blocks/Terminal/ResttyAdapter.d.ts +146 -0
- package/dist/react-ui/blocks/Terminal/ResttyAdapter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/ResttyAdapter.js +213 -0
- package/dist/react-ui/blocks/Terminal/Terminal.adapter.d.ts +55 -0
- package/dist/react-ui/blocks/Terminal/Terminal.adapter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/Terminal.adapter.js +68 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.d.ts +43 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.js +59 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.d.ts +63 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/Terminal.theme.restty.js +109 -0
- package/dist/react-ui/blocks/Terminal/Terminal.types.d.ts +351 -0
- package/dist/react-ui/blocks/Terminal/Terminal.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalPanel.d.ts +60 -0
- package/dist/react-ui/blocks/Terminal/TerminalPanel.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalPanel.js +183 -0
- package/dist/react-ui/blocks/Terminal/TerminalRestty.d.ts +111 -0
- package/dist/react-ui/blocks/Terminal/TerminalRestty.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalRestty.js +185 -0
- package/dist/react-ui/blocks/Terminal/TerminalXterm.d.ts +58 -0
- package/dist/react-ui/blocks/Terminal/TerminalXterm.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalXterm.js +143 -0
- package/dist/react-ui/blocks/Terminal/XTermAdapter.d.ts +87 -0
- package/dist/react-ui/blocks/Terminal/XTermAdapter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/XTermAdapter.js +135 -0
- package/dist/react-ui/blocks/Terminal/components/LogLineBadges.d.ts +160 -0
- package/dist/react-ui/blocks/Terminal/components/LogLineBadges.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/components/LogLineBadges.js +185 -0
- package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.d.ts +48 -0
- package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.js +139 -0
- package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.d.ts +60 -0
- package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/components/SyntaxHighlight.js +352 -0
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.d.ts +36 -0
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge.js +52 -0
- package/dist/react-ui/blocks/Terminal/components/index.d.ts +10 -0
- package/dist/react-ui/blocks/Terminal/components/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/components/index.js +4 -0
- package/dist/react-ui/blocks/Terminal/hooks/index.d.ts +11 -0
- package/dist/react-ui/blocks/Terminal/hooks/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/hooks/index.js +2 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.d.ts +69 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalSettings.js +162 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.d.ts +104 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.js +180 -0
- package/dist/react-ui/blocks/Terminal/index.d.ts +39 -0
- package/dist/react-ui/blocks/Terminal/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/index.js +38 -0
- package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.d.ts +58 -0
- package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/LogLinesViewer.js +222 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.d.ts +74 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel.js +168 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.d.ts +42 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.js +175 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs.d.ts +43 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.d.ts +38 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.js +62 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.d.ts +67 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.d.ts +32 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.js +326 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.d.ts +36 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.js +371 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.d.ts +67 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.js +417 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.d.ts +197 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.d.ts +54 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.js +193 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts +57 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.d.ts +30 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter.js +126 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.d.ts +31 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader.js +149 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.d.ts +35 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl.d.ts +58 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.d.ts +63 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs.js +245 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.d.ts +24 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.js +225 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.d.ts +35 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector.js +187 -0
- package/dist/react-ui/blocks/Terminal/panel/index.d.ts +30 -0
- package/dist/react-ui/blocks/Terminal/panel/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module-Bovc57nm.css +60 -0
- package/dist/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.js +5 -0
- package/dist/react-ui/blocks/Terminal/panel/terminal-session-tabs.module-QyxHO7cN.css +60 -0
- package/dist/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.js +5 -0
- package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.d.ts +73 -0
- package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/BadgeFormatter.js +136 -0
- package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.d.ts +117 -0
- package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/HttpLogParser.js +174 -0
- package/dist/react-ui/blocks/Terminal/parsing/LogParser.types.d.ts +221 -0
- package/dist/react-ui/blocks/Terminal/parsing/LogParser.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/LogParserService.d.ts +184 -0
- package/dist/react-ui/blocks/Terminal/parsing/LogParserService.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/LogParserService.js +478 -0
- package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.d.ts +173 -0
- package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/MultilineAggregator.js +313 -0
- package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.d.ts +181 -0
- package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.js +221 -0
- package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.d.ts +69 -0
- package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.js +142 -0
- package/dist/react-ui/blocks/Terminal/parsing/TableParser.d.ts +125 -0
- package/dist/react-ui/blocks/Terminal/parsing/TableParser.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/TableParser.js +245 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.d.ts +165 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.js +225 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.d.ts +164 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.js +285 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.d.ts +188 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.js +178 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/index.d.ts +12 -0
- package/dist/react-ui/blocks/Terminal/parsing/ansi/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/index.d.ts +24 -0
- package/dist/react-ui/blocks/Terminal/parsing/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.d.ts +56 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.d.ts +140 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.js +325 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/index.d.ts +10 -0
- package/dist/react-ui/blocks/Terminal/parsing/levels/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/index.d.ts +11 -0
- package/dist/react-ui/blocks/index.d.ts.map +1 -0
- package/dist/react-ui/icons/lucide-animated/activity.js +1 -1
- package/dist/react-ui/icons/lucide-animated/bell-electric.js +1 -1
- package/dist/react-ui/icons/lucide-animated/bell.js +1 -1
- package/dist/react-ui/icons/lucide-animated/bot.js +1 -1
- package/dist/react-ui/icons/lucide-animated/box.js +1 -1
- package/dist/react-ui/icons/lucide-animated/circle-check.js +1 -1
- package/dist/react-ui/icons/lucide-animated/delete.js +1 -1
- package/dist/react-ui/icons/lucide-animated/download.js +1 -1
- package/dist/react-ui/icons/lucide-animated/home.js +1 -1
- package/dist/react-ui/icons/lucide-animated/layout-panel-top.js +1 -1
- package/dist/react-ui/icons/lucide-animated/plus.js +1 -1
- package/dist/react-ui/icons/lucide-animated/search.js +1 -1
- package/dist/react-ui/icons/lucide-animated/settings.js +1 -1
- package/dist/react-ui/icons/lucide-animated/trending-down.js +1 -1
- package/dist/react-ui/icons/lucide-animated/trending-up.js +1 -1
- package/dist/react-ui/icons/lucide-animated/x.js +1 -1
- package/dist/react-ui/index.js +3 -1
- package/dist/react-ui/lib/icon-wrapper.d.ts +37 -0
- package/dist/react-ui/lib/icon-wrapper.d.ts.map +1 -0
- package/dist/react-ui/lib/icon-wrapper.js +55 -0
- package/dist/react-ui/lib/index.d.ts +1 -0
- package/dist/react-ui/lib/index.d.ts.map +1 -1
- package/dist/react-ui/lib/index.js +1 -0
- package/dist/react-ui/primitives/AutoHeight/index.d.ts +1 -1
- package/dist/react-ui/primitives/CountingNumber/index.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.types.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.types.d.ts +1 -1
- package/dist/react-ui/ui/Badge/Badge.styles.d.ts +1 -1
- package/dist/react-ui/ui/Badge/Badge.types.d.ts +1 -1
- package/dist/react-ui/ui/Button/Button.styles.d.ts +2 -2
- package/dist/react-ui/ui/Button/Button.types.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.styles.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.types.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.types.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.d.ts +2 -2
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.js +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/index.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.styles.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.styles.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.types.d.ts +1 -1
- package/dist/react-ui/ui/Input/Input.styles.d.ts +1 -1
- package/dist/react-ui/ui/Input/Input.types.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.styles.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.types.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.styles.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.types.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.styles.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.types.d.ts +2 -2
- package/dist/react-ui/ui/Popover/Popover.styles.d.ts +1 -1
- package/dist/react-ui/ui/Popover/Popover.types.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.styles.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.types.d.ts +2 -2
- package/dist/react-ui/ui/Select/Select.styles.d.ts +1 -1
- package/dist/react-ui/ui/Select/Select.types.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.styles.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.types.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.styles.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.types.d.ts +1 -1
- package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts +43 -25
- package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/Tabs/Tabs.styles.js +105 -13
- package/dist/react-ui/ui/Tabs/Tabs.types.d.ts +9 -6
- package/dist/react-ui/ui/Tabs/Tabs.types.d.ts.map +1 -1
- package/dist/react-ui/ui/Tabs/index.d.ts +18 -9
- package/dist/react-ui/ui/Tabs/index.d.ts.map +1 -1
- package/dist/react-ui/ui/Tabs/index.js +99 -27
- package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.types.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/react-ui/ui/index.js +1 -0
- package/package.json +54 -6
- package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +278 -0
- package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +97 -0
- package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +155 -0
- package/src/react-ui/blocks/Terminal/Terminal.theme.ts +80 -0
- package/src/react-ui/blocks/Terminal/Terminal.types.ts +438 -0
- package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +269 -0
- package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +326 -0
- package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +230 -0
- package/src/react-ui/blocks/Terminal/XTermAdapter.ts +163 -0
- package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +316 -0
- package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +218 -0
- package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +386 -0
- package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +67 -0
- package/src/react-ui/blocks/Terminal/components/index.ts +10 -0
- package/src/react-ui/blocks/Terminal/hooks/index.ts +22 -0
- package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +229 -0
- package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +292 -0
- package/src/react-ui/blocks/Terminal/index.ts +103 -0
- package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +330 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +242 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +202 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +140 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +68 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +85 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +383 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +439 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +550 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +259 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +237 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +76 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +112 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +178 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +203 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +252 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +334 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +261 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +248 -0
- package/src/react-ui/blocks/Terminal/panel/index.ts +72 -0
- package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +59 -0
- package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +59 -0
- package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +180 -0
- package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +248 -0
- package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +283 -0
- package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +686 -0
- package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +466 -0
- package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +343 -0
- package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +167 -0
- package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +348 -0
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +251 -0
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +390 -0
- package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +320 -0
- package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +20 -0
- package/src/react-ui/blocks/Terminal/parsing/index.ts +69 -0
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +68 -0
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +436 -0
- package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +14 -0
- package/src/react-ui/blocks/index.ts +11 -0
- package/src/react-ui/icons/lucide-animated/activity.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/bell-electric.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/bell.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/bot.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/box.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/circle-check.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/delete.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/download.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/home.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/plus.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/search.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/settings.tsx +1 -1
- package/src/react-ui/icons/lucide-animated/trending-down.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/trending-up.tsx +2 -2
- package/src/react-ui/icons/lucide-animated/x.tsx +2 -2
- package/src/react-ui/lib/icon-wrapper.tsx +70 -0
- package/src/react-ui/lib/index.ts +1 -0
- package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +1 -1
- package/src/react-ui/ui/Tabs/Tabs.css +39 -0
- package/src/react-ui/ui/Tabs/Tabs.styles.ts +119 -31
- package/src/react-ui/ui/Tabs/Tabs.types.ts +8 -3
- package/src/react-ui/ui/Tabs/index.tsx +135 -27
- package/dist/index.css +0 -129
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent circular buffer for log entries with periodic cleanup.
|
|
3
|
+
*
|
|
4
|
+
* Maintains a large history of logs without memory leaks by using
|
|
5
|
+
* a circular buffer with periodic cleanup. Supports pagination,
|
|
6
|
+
* search, and efficient querying.
|
|
7
|
+
*
|
|
8
|
+
* @module components/devenv/terminal/parsing/PersistentLogBuffer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { IParsedLogEntry } from './LogParser.types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for the persistent log buffer.
|
|
15
|
+
*/
|
|
16
|
+
export interface IPersistentLogBufferConfig {
|
|
17
|
+
/** Maximum number of entries to store (default: 50,000) */
|
|
18
|
+
maxSize: number;
|
|
19
|
+
|
|
20
|
+
/** Soft limit that triggers cleanup (default: 40,000) */
|
|
21
|
+
softLimit: number;
|
|
22
|
+
|
|
23
|
+
/** Number of entries to remove per cleanup batch (default: 5,000) */
|
|
24
|
+
cleanupBatch: number;
|
|
25
|
+
|
|
26
|
+
/** Cleanup interval in milliseconds (default: 30,000 ms = 30s) */
|
|
27
|
+
cleanupInterval: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Buffer statistics for monitoring.
|
|
32
|
+
*/
|
|
33
|
+
export interface IBufferStats {
|
|
34
|
+
/** Current number of entries */
|
|
35
|
+
size: number;
|
|
36
|
+
|
|
37
|
+
/** Maximum configured size */
|
|
38
|
+
maxSize: number;
|
|
39
|
+
|
|
40
|
+
/** Usage ratio (0-1) */
|
|
41
|
+
usage: number;
|
|
42
|
+
|
|
43
|
+
/** First line number in buffer */
|
|
44
|
+
firstLine: number | undefined;
|
|
45
|
+
|
|
46
|
+
/** Last line number in buffer */
|
|
47
|
+
lastLine: number | undefined;
|
|
48
|
+
|
|
49
|
+
/** Memory usage estimate (bytes) */
|
|
50
|
+
memoryUsage: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Search options for querying the buffer.
|
|
55
|
+
*/
|
|
56
|
+
export interface ISearchOptions {
|
|
57
|
+
/** Start from line number */
|
|
58
|
+
fromLine?: number;
|
|
59
|
+
|
|
60
|
+
/** Maximum results to return */
|
|
61
|
+
limit?: number;
|
|
62
|
+
|
|
63
|
+
/** Case insensitive search */
|
|
64
|
+
caseInsensitive?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Persistent circular buffer for log entries.
|
|
69
|
+
*
|
|
70
|
+
* Features:
|
|
71
|
+
* - Circular buffer with automatic cleanup
|
|
72
|
+
* - Pagination support for large datasets
|
|
73
|
+
* - Search by pattern
|
|
74
|
+
* - Memory-efficient storage
|
|
75
|
+
* - Periodic cleanup to prevent memory leaks
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const buffer = new PersistentLogBuffer({ maxSize: 50000 });
|
|
80
|
+
* buffer.append(entries);
|
|
81
|
+
* const page1 = buffer.getEntries({ offset: 0, limit: 100 });
|
|
82
|
+
* const results = buffer.search(/error/i);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export class PersistentLogBuffer {
|
|
86
|
+
/** Internal storage for entries */
|
|
87
|
+
private buffer: IParsedLogEntry[] = [];
|
|
88
|
+
|
|
89
|
+
/** Buffer configuration */
|
|
90
|
+
private config: IPersistentLogBufferConfig;
|
|
91
|
+
|
|
92
|
+
/** Cleanup timer reference */
|
|
93
|
+
private cleanupTimer?: ReturnType<typeof setTimeout>;
|
|
94
|
+
|
|
95
|
+
/** Cleanup scheduled flag */
|
|
96
|
+
private cleanupScheduled = false;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Create a new persistent log buffer.
|
|
100
|
+
*
|
|
101
|
+
* @param config - Buffer configuration
|
|
102
|
+
*/
|
|
103
|
+
constructor(config: Partial<IPersistentLogBufferConfig> = {}) {
|
|
104
|
+
this.config = {
|
|
105
|
+
maxSize: 50000,
|
|
106
|
+
softLimit: 40000,
|
|
107
|
+
cleanupBatch: 5000,
|
|
108
|
+
cleanupInterval: 30000,
|
|
109
|
+
...config,
|
|
110
|
+
};
|
|
111
|
+
this.startCleanupTimer();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Append entries to the buffer.
|
|
116
|
+
*
|
|
117
|
+
* If the buffer exceeds the soft limit, schedules a cleanup.
|
|
118
|
+
*
|
|
119
|
+
* @param entries - Entries to append
|
|
120
|
+
*/
|
|
121
|
+
append(entries: IParsedLogEntry[]): void {
|
|
122
|
+
if (entries.length === 0) return;
|
|
123
|
+
|
|
124
|
+
this.buffer.push(...entries);
|
|
125
|
+
|
|
126
|
+
if (this.buffer.length > this.config.softLimit && !this.cleanupScheduled) {
|
|
127
|
+
this.scheduleCleanup();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Prepend entries to the buffer (for loading historical logs).
|
|
133
|
+
*
|
|
134
|
+
* @param entries - Entries to prepend
|
|
135
|
+
*/
|
|
136
|
+
prepend(entries: IParsedLogEntry[]): void {
|
|
137
|
+
if (entries.length === 0) return;
|
|
138
|
+
|
|
139
|
+
this.buffer = [...entries, ...this.buffer];
|
|
140
|
+
|
|
141
|
+
if (this.buffer.length > this.config.maxSize) {
|
|
142
|
+
// Trim from the end to stay within max size
|
|
143
|
+
this.buffer = this.buffer.slice(0, this.config.maxSize);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get entries from the buffer with pagination.
|
|
149
|
+
*
|
|
150
|
+
* @param options - Query options
|
|
151
|
+
* @returns Array of entries
|
|
152
|
+
*/
|
|
153
|
+
getEntries(options: {
|
|
154
|
+
offset?: number;
|
|
155
|
+
limit?: number;
|
|
156
|
+
fromLine?: number;
|
|
157
|
+
toLine?: number;
|
|
158
|
+
} = {}): IParsedLogEntry[] {
|
|
159
|
+
let { offset = 0, limit, fromLine, toLine } = options;
|
|
160
|
+
|
|
161
|
+
let start = offset;
|
|
162
|
+
let end: number | undefined;
|
|
163
|
+
|
|
164
|
+
if (fromLine !== undefined) {
|
|
165
|
+
start = this.buffer.findIndex((e) => e.line_number >= fromLine);
|
|
166
|
+
if (start === -1) start = this.buffer.length;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (toLine !== undefined) {
|
|
170
|
+
end = this.buffer.findIndex((e) => e.line_number > toLine);
|
|
171
|
+
if (end === -1) end = this.buffer.length;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (limit !== undefined && end === undefined) {
|
|
175
|
+
end = start + limit;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return this.buffer.slice(start, end);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get all entries in the buffer.
|
|
183
|
+
*
|
|
184
|
+
* @returns All entries
|
|
185
|
+
*/
|
|
186
|
+
getAllEntries(): IParsedLogEntry[] {
|
|
187
|
+
return this.buffer;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get the total number of entries.
|
|
192
|
+
*
|
|
193
|
+
* @returns Entry count
|
|
194
|
+
*/
|
|
195
|
+
getSize(): number {
|
|
196
|
+
return this.buffer.length;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Search entries by pattern.
|
|
201
|
+
*
|
|
202
|
+
* @param pattern - RegExp pattern or string to search
|
|
203
|
+
* @param options - Search options
|
|
204
|
+
* @returns Matching entries
|
|
205
|
+
*/
|
|
206
|
+
search(pattern: RegExp | string, options: ISearchOptions = {}): IParsedLogEntry[] {
|
|
207
|
+
const { fromLine, limit = 100, caseInsensitive = true } = options;
|
|
208
|
+
|
|
209
|
+
const regex = typeof pattern === 'string'
|
|
210
|
+
? new RegExp(pattern, caseInsensitive ? 'i' : undefined)
|
|
211
|
+
: pattern;
|
|
212
|
+
|
|
213
|
+
const results: IParsedLogEntry[] = [];
|
|
214
|
+
const start = fromLine !== undefined
|
|
215
|
+
? this.buffer.findIndex((e) => e.line_number >= fromLine)
|
|
216
|
+
: 0;
|
|
217
|
+
|
|
218
|
+
for (let i = start; i < this.buffer.length && results.length < limit; i++) {
|
|
219
|
+
const entry = this.buffer[i];
|
|
220
|
+
if (regex.test(entry.raw) || regex.test(entry.message ?? '')) {
|
|
221
|
+
results.push(entry);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return results;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Find entries by line number.
|
|
230
|
+
*
|
|
231
|
+
* @param lineNumbers - Array of line numbers to find
|
|
232
|
+
* @returns Matching entries
|
|
233
|
+
*/
|
|
234
|
+
findByLineNumbers(lineNumbers: number[]): IParsedLogEntry[] {
|
|
235
|
+
const lineSet = new Set(lineNumbers);
|
|
236
|
+
return this.buffer.filter((e) => lineSet.has(e.line_number));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Get entries filtered by log level.
|
|
241
|
+
*
|
|
242
|
+
* @param level - Log level to filter by
|
|
243
|
+
* @returns Filtered entries
|
|
244
|
+
*/
|
|
245
|
+
getByLevel(level: string): IParsedLogEntry[] {
|
|
246
|
+
return this.buffer.filter((e) => e.level === level);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Clear all entries from the buffer.
|
|
251
|
+
*/
|
|
252
|
+
clear(): void {
|
|
253
|
+
this.buffer = [];
|
|
254
|
+
this.cleanupScheduled = false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Get buffer statistics.
|
|
259
|
+
*
|
|
260
|
+
* @returns Buffer statistics
|
|
261
|
+
*/
|
|
262
|
+
getStats(): IBufferStats {
|
|
263
|
+
const size = this.buffer.length;
|
|
264
|
+
let memoryUsage = 0;
|
|
265
|
+
|
|
266
|
+
for (const entry of this.buffer) {
|
|
267
|
+
memoryUsage += entry.raw.length * 2; // UTF-16 = 2 bytes per char
|
|
268
|
+
if (entry.message) memoryUsage += entry.message.length * 2;
|
|
269
|
+
if (entry.formatted) memoryUsage += entry.formatted.length * 2;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
size,
|
|
274
|
+
maxSize: this.config.maxSize,
|
|
275
|
+
usage: size / this.config.maxSize,
|
|
276
|
+
firstLine: this.buffer[0]?.line_number,
|
|
277
|
+
lastLine: this.buffer[size - 1]?.line_number,
|
|
278
|
+
memoryUsage,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Schedule a cleanup operation.
|
|
284
|
+
*/
|
|
285
|
+
private scheduleCleanup(): void {
|
|
286
|
+
if (this.cleanupScheduled) return;
|
|
287
|
+
|
|
288
|
+
this.cleanupScheduled = true;
|
|
289
|
+
// Use setTimeout to defer cleanup
|
|
290
|
+
setTimeout(() => this.cleanup(), 0);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Perform cleanup of old entries.
|
|
295
|
+
*
|
|
296
|
+
* Removes the oldest entries to keep the buffer within limits.
|
|
297
|
+
*/
|
|
298
|
+
private cleanup(): void {
|
|
299
|
+
if (this.buffer.length <= this.config.softLimit) {
|
|
300
|
+
this.cleanupScheduled = false;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Remove oldest entries
|
|
305
|
+
const toRemove = Math.min(
|
|
306
|
+
this.buffer.length - this.config.softLimit,
|
|
307
|
+
this.config.cleanupBatch
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
this.buffer = this.buffer.slice(toRemove);
|
|
311
|
+
this.cleanupScheduled = false;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Start the periodic cleanup timer.
|
|
316
|
+
*/
|
|
317
|
+
private startCleanupTimer(): void {
|
|
318
|
+
this.cleanupTimer = setInterval(() => {
|
|
319
|
+
this.cleanup();
|
|
320
|
+
}, this.config.cleanupInterval);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Stop the cleanup timer and clear resources.
|
|
325
|
+
*/
|
|
326
|
+
destroy(): void {
|
|
327
|
+
if (this.cleanupTimer) {
|
|
328
|
+
clearInterval(this.cleanupTimer);
|
|
329
|
+
this.cleanupTimer = undefined;
|
|
330
|
+
}
|
|
331
|
+
this.clear();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Create a new persistent log buffer with default configuration.
|
|
337
|
+
*
|
|
338
|
+
* @param config - Optional configuration overrides
|
|
339
|
+
* @returns New buffer instance
|
|
340
|
+
*/
|
|
341
|
+
export function createPersistentLogBuffer(config?: Partial<IPersistentLogBufferConfig>): PersistentLogBuffer {
|
|
342
|
+
return new PersistentLogBuffer(config);
|
|
343
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax highlighter for log messages.
|
|
3
|
+
*
|
|
4
|
+
* Applies color highlighting to specific elements within log messages.
|
|
5
|
+
* Uses standard ANSI SGR codes compatible with xterm.js.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: Only highlights plain text - skips lines with existing ANSI codes
|
|
8
|
+
* to prevent mixing codes and creating visual artifacts.
|
|
9
|
+
*
|
|
10
|
+
* @module components/devenv/terminal/parsing/syntax
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* ANSI color codes for syntax highlighting.
|
|
15
|
+
*
|
|
16
|
+
* Uses standard SGR (Select Graphic Rendition) codes for compatibility.
|
|
17
|
+
*/
|
|
18
|
+
const SYNTAX_COLORS = {
|
|
19
|
+
/** HTTP methods (GET, POST, PUT, DELETE) - Magenta */
|
|
20
|
+
httpMethod: '\x1b[35m',
|
|
21
|
+
/** Paths/URLs (/api/workspaces) - Cyan */
|
|
22
|
+
path: '\x1b[36m',
|
|
23
|
+
/** Braces and brackets ({ } [ ]) - Yellow */
|
|
24
|
+
brace: '\x1b[33m',
|
|
25
|
+
/** Property keys (filter:, name:) - Green */
|
|
26
|
+
key: '\x1b[32m',
|
|
27
|
+
/** String values - Bright green */
|
|
28
|
+
string: '\x1b[92m',
|
|
29
|
+
/** Numeric values - Bright yellow */
|
|
30
|
+
number: '\x1b[93m',
|
|
31
|
+
/** Boolean values - Blue */
|
|
32
|
+
boolean: '\x1b[34m',
|
|
33
|
+
/** Null/undefined - Gray */
|
|
34
|
+
nullish: '\x1b[90m',
|
|
35
|
+
/** Reset code */
|
|
36
|
+
reset: '\x1b[0m',
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* HTTP method patterns.
|
|
41
|
+
*/
|
|
42
|
+
const HTTP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE'] as const;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Pattern to detect existing ANSI escape codes.
|
|
46
|
+
*/
|
|
47
|
+
const ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Check if text contains ANSI escape codes.
|
|
51
|
+
*/
|
|
52
|
+
function hasAnsiCodes(text: string): boolean {
|
|
53
|
+
return ANSI_PATTERN.test(text);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Syntax highlighter class.
|
|
58
|
+
*
|
|
59
|
+
* Applies syntax highlighting to plain text messages.
|
|
60
|
+
* Skips messages that already contain ANSI codes to prevent
|
|
61
|
+
* visual artifacts from mixed escape sequences.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const highlighter = new SyntaxHighlighter();
|
|
66
|
+
* const highlighted = highlighter.highlight('GET /api/workspaces { filter: {} }');
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export class SyntaxHighlighter {
|
|
70
|
+
/**
|
|
71
|
+
* Apply syntax highlighting to a message.
|
|
72
|
+
*
|
|
73
|
+
* Only processes plain text - messages with existing ANSI codes
|
|
74
|
+
* are returned unchanged to prevent visual artifacts.
|
|
75
|
+
*
|
|
76
|
+
* @param message - Message to highlight
|
|
77
|
+
* @returns Message with ANSI color codes applied, or original if already colored
|
|
78
|
+
*/
|
|
79
|
+
highlight(message: string): string {
|
|
80
|
+
if (!message || message.length === 0) {
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Skip if already has ANSI codes - prevents mixing codes
|
|
85
|
+
if (hasAnsiCodes(message)) {
|
|
86
|
+
return message;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let result = message;
|
|
90
|
+
|
|
91
|
+
// Apply highlighting in order (most specific first)
|
|
92
|
+
result = this.highlightStrings(result);
|
|
93
|
+
result = this.highlightNumbers(result);
|
|
94
|
+
result = this.highlightBooleans(result);
|
|
95
|
+
result = this.highlightNullish(result);
|
|
96
|
+
result = this.highlightKeys(result);
|
|
97
|
+
result = this.highlightPaths(result);
|
|
98
|
+
result = this.highlightHttpMethods(result);
|
|
99
|
+
result = this.highlightBraces(result);
|
|
100
|
+
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Highlight HTTP methods.
|
|
106
|
+
*/
|
|
107
|
+
private highlightHttpMethods(text: string): string {
|
|
108
|
+
const methodPattern = new RegExp(`\\b(${HTTP_METHODS.join('|')})\\b`, 'g');
|
|
109
|
+
return text.replace(methodPattern, `${SYNTAX_COLORS.httpMethod}$1${SYNTAX_COLORS.reset}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Highlight URL paths.
|
|
114
|
+
*/
|
|
115
|
+
private highlightPaths(text: string): string {
|
|
116
|
+
const pathPattern = /(^|[\s(])\/[a-zA-Z0-9_/-]+/g;
|
|
117
|
+
return text.replace(pathPattern, `$1${SYNTAX_COLORS.path}$2${SYNTAX_COLORS.reset}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Highlight braces and brackets.
|
|
122
|
+
*/
|
|
123
|
+
private highlightBraces(text: string): string {
|
|
124
|
+
return text.replace(/([{}[\]])/g, `${SYNTAX_COLORS.brace}$1${SYNTAX_COLORS.reset}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Highlight property keys.
|
|
129
|
+
*/
|
|
130
|
+
private highlightKeys(text: string): string {
|
|
131
|
+
// Match keys before colons, but not within URLs like https://
|
|
132
|
+
const keyPattern = /(^|[\s])([a-zA-Z_][a-zA-Z0-9_]*)(\s*:)/g;
|
|
133
|
+
return text.replace(keyPattern, `$1${SYNTAX_COLORS.key}$2${SYNTAX_COLORS.reset}$3`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Highlight string values.
|
|
138
|
+
*/
|
|
139
|
+
private highlightStrings(text: string): string {
|
|
140
|
+
const stringPattern = /([:=,]\s*)(['"])(.*?)\2/g;
|
|
141
|
+
return text.replace(stringPattern, `$1${SYNTAX_COLORS.string}$2$3$2${SYNTAX_COLORS.reset}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Highlight numeric values.
|
|
146
|
+
*/
|
|
147
|
+
private highlightNumbers(text: string): string {
|
|
148
|
+
const numberPattern = /(?<!\w)(-?\d+(?:\.\d+)?)(?!\w)/g;
|
|
149
|
+
return text.replace(numberPattern, `${SYNTAX_COLORS.number}$1${SYNTAX_COLORS.reset}`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Highlight boolean values.
|
|
154
|
+
*/
|
|
155
|
+
private highlightBooleans(text: string): string {
|
|
156
|
+
const boolPattern = /\b(true|false)\b/g;
|
|
157
|
+
return text.replace(boolPattern, `${SYNTAX_COLORS.boolean}$1${SYNTAX_COLORS.reset}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Highlight null and undefined.
|
|
162
|
+
*/
|
|
163
|
+
private highlightNullish(text: string): string {
|
|
164
|
+
const nullishPattern = /\b(null|undefined)\b/g;
|
|
165
|
+
return text.replace(nullishPattern, `${SYNTAX_COLORS.nullish}$1${SYNTAX_COLORS.reset}`);
|
|
166
|
+
}
|
|
167
|
+
}
|