@mks2508/mks-ui 0.3.2 → 0.5.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/TerminalDisplay.d.ts +46 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.js +168 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.styles.d.ts +21 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.styles.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.styles.js +31 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.types.d.ts +56 -0
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.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/chrome.d.ts +14 -0
- package/dist/react-ui/blocks/Terminal/chrome.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/chrome.js +6 -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/display.d.ts +20 -0
- package/dist/react-ui/blocks/Terminal/display.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/display.js +9 -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 +43 -0
- package/dist/react-ui/blocks/Terminal/index.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/index.js +41 -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 +55 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.js +214 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.d.ts +35 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.d.ts.map +1 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.js +57 -0
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts +62 -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-CNVWCefU.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-cmyJ11jP.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/waapi/Morph/techniques/useCSSGridMorph.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.js +2 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.js +2 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.js +2 -0
- package/dist/react-ui/primitives/waapi/Morph/useMorph.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Morph/useMorph.js +2 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorder.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Reorder/useReorder.js +2 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.js +2 -0
- package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.js +2 -0
- package/dist/react-ui/primitives/waapi/core/useElementRegistry.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/core/useElementRegistry.js +2 -0
- package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.js +2 -0
- package/dist/react-ui/primitives/waapi/core/usePositionCapture.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/core/usePositionCapture.js +2 -0
- package/dist/react-ui/ui/Button/Button.styles.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.js +1 -1
- package/dist/react-ui/ui/InputGroup/index.d.ts.map +1 -1
- package/dist/react-ui/ui/InputGroup/index.js +2 -0
- 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 +6 -3
- 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/index.js +1 -0
- package/package.json +84 -29
- package/src/css.d.ts +6 -0
- 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/TerminalDisplay.styles.ts +38 -0
- package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +243 -0
- package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +73 -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/chrome.ts +25 -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/display.ts +46 -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 +111 -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.styles.ts +75 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +266 -0
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +82 -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/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +1 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +1 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +1 -0
- package/src/react-ui/primitives/waapi/Morph/useMorph.ts +1 -0
- package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +1 -0
- package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +1 -0
- package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +1 -0
- package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +1 -0
- package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +1 -0
- package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +1 -0
- package/src/react-ui/ui/Accordion/index.tsx +3 -3
- package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +1 -1
- package/src/react-ui/ui/InputGroup/index.tsx +2 -0
- 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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TerminalDisplay style definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module components/devenv/terminal/TerminalDisplay.styles
|
|
5
|
+
*/
|
|
6
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
7
|
+
import type { StyleSlots } from '../../../core/types';
|
|
8
|
+
import type { TerminalDisplaySlot } from './TerminalDisplay.types';
|
|
9
|
+
/**
|
|
10
|
+
* Default style slots for TerminalDisplay regions.
|
|
11
|
+
*/
|
|
12
|
+
export declare const terminalDisplayStyles: StyleSlots<TerminalDisplaySlot>;
|
|
13
|
+
/**
|
|
14
|
+
* CVA variants for the display root.
|
|
15
|
+
*/
|
|
16
|
+
export declare const terminalDisplayVariants: (props?: ({
|
|
17
|
+
variant?: "default" | "compact" | "error" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
+
/** Extracted variant props type */
|
|
20
|
+
export type TerminalDisplayVariantProps = VariantProps<typeof terminalDisplayVariants>;
|
|
21
|
+
//# sourceMappingURL=TerminalDisplay.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalDisplay.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,UAAU,CAAC,mBAAmB,CAKjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;8EAWlC,CAAC;AAEH,mCAAmC;AACnC,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
//#region src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* TerminalDisplay style definitions.
|
|
6
|
+
*
|
|
7
|
+
* @module components/devenv/terminal/TerminalDisplay.styles
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default style slots for TerminalDisplay regions.
|
|
11
|
+
*/
|
|
12
|
+
const terminalDisplayStyles = {
|
|
13
|
+
root: "relative overflow-hidden",
|
|
14
|
+
chrome: "",
|
|
15
|
+
terminal: "w-full h-full pointer-events-none",
|
|
16
|
+
emptyState: "flex items-center justify-center text-sm text-muted-foreground/50 font-mono"
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* CVA variants for the display root.
|
|
20
|
+
*/
|
|
21
|
+
const terminalDisplayVariants = cva(terminalDisplayStyles.root, {
|
|
22
|
+
variants: { variant: {
|
|
23
|
+
default: "",
|
|
24
|
+
compact: "",
|
|
25
|
+
error: ""
|
|
26
|
+
} },
|
|
27
|
+
defaultVariants: { variant: "default" }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { terminalDisplayStyles, terminalDisplayVariants };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TerminalDisplay component types.
|
|
3
|
+
*
|
|
4
|
+
* Readonly GPU-rendered terminal for displaying ANSI-formatted text
|
|
5
|
+
* without PTY connection, using restty.
|
|
6
|
+
*
|
|
7
|
+
* @module components/devenv/terminal/TerminalDisplay.types
|
|
8
|
+
*/
|
|
9
|
+
import type { SlotOverrides } from '../../../core/types';
|
|
10
|
+
import type { Restty } from 'restty';
|
|
11
|
+
import type { ITerminalTheme } from './Terminal.types';
|
|
12
|
+
/** Slot names for TerminalDisplay sub-regions */
|
|
13
|
+
export type TerminalDisplaySlot = 'root' | 'chrome' | 'terminal' | 'emptyState';
|
|
14
|
+
/**
|
|
15
|
+
* Props for TerminalDisplay component.
|
|
16
|
+
*/
|
|
17
|
+
export interface ITerminalDisplayProps {
|
|
18
|
+
/** ANSI-formatted string content to display */
|
|
19
|
+
content: string;
|
|
20
|
+
/** Title shown in the chrome header */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Visual variant — 'error' uses red accent line */
|
|
23
|
+
variant?: 'default' | 'compact' | 'error';
|
|
24
|
+
/** Whether to show the glassmorphism chrome shell (default: true) */
|
|
25
|
+
chrome?: boolean;
|
|
26
|
+
/** Font size in CSS pixels (default: 13) */
|
|
27
|
+
fontSize?: number;
|
|
28
|
+
/** Minimum height in CSS pixels (default: 200) */
|
|
29
|
+
minHeight?: number;
|
|
30
|
+
/** Terminal theme in xterm.js format (auto-converted to Ghostty) */
|
|
31
|
+
theme?: ITerminalTheme;
|
|
32
|
+
/** Restty built-in theme name from the 458-theme catalog */
|
|
33
|
+
resttyThemeName?: string;
|
|
34
|
+
/** GPU renderer preference (default: 'auto') */
|
|
35
|
+
gpuRenderer?: 'auto' | 'webgpu' | 'webgl2';
|
|
36
|
+
/** Slot class overrides for each visual region */
|
|
37
|
+
slots?: SlotOverrides<TerminalDisplaySlot>;
|
|
38
|
+
/** Custom class name on root element */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Placeholder text when content is empty */
|
|
41
|
+
emptyText?: string;
|
|
42
|
+
/** Callback when restty instance is ready */
|
|
43
|
+
onReady?: (restty: Restty) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Imperative handle for TerminalDisplay.
|
|
47
|
+
*/
|
|
48
|
+
export interface ITerminalDisplayRef {
|
|
49
|
+
/** Get the underlying Restty instance */
|
|
50
|
+
getRestty: () => Restty | null;
|
|
51
|
+
/** Clear the terminal display */
|
|
52
|
+
clear: () => void;
|
|
53
|
+
/** Write additional ANSI content (appends) */
|
|
54
|
+
write: (data: string) => void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=TerminalDisplay.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalDisplay.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalDisplay.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,iDAAiD;AACjD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAEhB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAE1C,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oEAAoE;IACpE,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE3C,kDAAkD;IAClD,KAAK,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAE3C,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,SAAS,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAE/B,iCAAiC;IACjC,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,8CAA8C;IAC9C,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal Panel Component.
|
|
3
|
+
*
|
|
4
|
+
* Main UI component with toolbar, terminal display, and status indicator.
|
|
5
|
+
* Configurable backend adapter (xterm.js, WebContainer, Monaco) with
|
|
6
|
+
* Synthwave Industrial Dark theme matching the design system.
|
|
7
|
+
*
|
|
8
|
+
* @module components/devenv/terminal
|
|
9
|
+
*/
|
|
10
|
+
import type { ITerminalBackendType, ITerminalMode } from './Terminal.types';
|
|
11
|
+
/**
|
|
12
|
+
* Props for the TerminalPanel component.
|
|
13
|
+
*/
|
|
14
|
+
export interface ITerminalPanelProps {
|
|
15
|
+
/** Backend type to use (default: 'xterm') */
|
|
16
|
+
backend?: ITerminalBackendType;
|
|
17
|
+
/** Terminal mode (default: 'interactive') */
|
|
18
|
+
mode?: ITerminalMode;
|
|
19
|
+
/** WebSocket URL for interactive mode */
|
|
20
|
+
wsUrl?: string;
|
|
21
|
+
/** SSE URL for readonly mode */
|
|
22
|
+
sseUrl?: string;
|
|
23
|
+
/** Custom class name for styling */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Display title (default: 'Terminal') */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Show/hide toolbar (default: true) */
|
|
28
|
+
showToolbar?: boolean;
|
|
29
|
+
/** Enable search functionality (default: true) */
|
|
30
|
+
enableSearch?: boolean;
|
|
31
|
+
/** Callback when connection status changes */
|
|
32
|
+
onStatusChange?: (status: 'connected' | 'disconnected' | 'error' | 'connecting') => void;
|
|
33
|
+
/** Callback when user types data */
|
|
34
|
+
onData?: (data: string) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Terminal Panel Component.
|
|
38
|
+
*
|
|
39
|
+
* Full-featured terminal UI with toolbar, status indicator, search,
|
|
40
|
+
* and xterm.js integration. Supports both interactive (WebSocket)
|
|
41
|
+
* and readonly (SSE) modes with proper cleanup and error handling.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // Interactive mode with WebSocket
|
|
46
|
+
* <TerminalPanel
|
|
47
|
+
* mode="interactive"
|
|
48
|
+
* wsUrl="ws://localhost:3100/api/terminal/session-123"
|
|
49
|
+
* onData={(data) => sendMessage({ type: 'input', data })}
|
|
50
|
+
* />
|
|
51
|
+
*
|
|
52
|
+
* // Readonly mode with SSE
|
|
53
|
+
* <TerminalPanel
|
|
54
|
+
* mode="readonly"
|
|
55
|
+
* sseUrl="http://localhost:3100/api/logs/containers/devenv/stream"
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function TerminalPanel({ backend, mode, wsUrl, sseUrl, className, title, showToolbar, onStatusChange, onData, }: ITerminalPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
//# sourceMappingURL=TerminalPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalPanel.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,OAAO,GAAG,YAAY,KAAK,IAAI,CAAC;IAEzF,oCAAoC;IACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAiB,EACjB,IAAoB,EACpB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAkB,EAClB,WAAkB,EAClB,cAAc,EACd,MAAM,GACP,EAAE,mBAAmB,2CAgLrB"}
|
|
@@ -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 };
|