@mks2508/mks-ui 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-ui/index.js +2 -2
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +2 -0
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +173 -43
- package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.styles.js +1 -0
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +20 -1
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/index.d.ts +28 -7
- package/dist/react-ui/ui/Dialog/index.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/index.js +32 -5
- package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-DOR3Ld-k.css → DynamicToggle-DJLwEkHr.css} +12 -19
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +12 -20
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +7 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +55 -31
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.d.ts +9 -3
- package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.js +47 -34
- package/dist/react-ui/ui/index.js +1 -1
- package/package.json +52 -13
- package/src/assets/react.svg +0 -1
- package/src/core/index.ts +0 -7
- package/src/core/types.ts +0 -82
- package/src/css.d.ts +0 -7
- package/src/index.css +0 -129
- package/src/index.ts +0 -29
- package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +0 -278
- package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +0 -97
- package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +0 -155
- package/src/react-ui/blocks/Terminal/Terminal.theme.ts +0 -80
- package/src/react-ui/blocks/Terminal/Terminal.types.ts +0 -438
- package/src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts +0 -38
- package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +0 -254
- package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +0 -73
- package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +0 -269
- package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +0 -326
- package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +0 -230
- package/src/react-ui/blocks/Terminal/XTermAdapter.ts +0 -163
- package/src/react-ui/blocks/Terminal/chrome.ts +0 -25
- package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +0 -316
- package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +0 -218
- package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +0 -386
- package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +0 -67
- package/src/react-ui/blocks/Terminal/components/index.ts +0 -10
- package/src/react-ui/blocks/Terminal/display.ts +0 -46
- package/src/react-ui/blocks/Terminal/hooks/index.ts +0 -22
- package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +0 -229
- package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +0 -292
- package/src/react-ui/blocks/Terminal/index.ts +0 -111
- package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +0 -330
- package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +0 -242
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +0 -202
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +0 -140
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +0 -68
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +0 -85
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +0 -383
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +0 -439
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +0 -550
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +0 -259
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.ts +0 -75
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +0 -266
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +0 -82
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +0 -112
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +0 -178
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +0 -203
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +0 -252
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +0 -334
- package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +0 -261
- package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +0 -248
- package/src/react-ui/blocks/Terminal/panel/index.ts +0 -72
- package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +0 -59
- package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +0 -59
- package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +0 -180
- package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +0 -248
- package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +0 -283
- package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +0 -686
- package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +0 -466
- package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +0 -343
- package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +0 -167
- package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +0 -348
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +0 -251
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +0 -390
- package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +0 -320
- package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +0 -20
- package/src/react-ui/blocks/Terminal/parsing/index.ts +0 -69
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +0 -68
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +0 -436
- package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +0 -14
- package/src/react-ui/blocks/index.ts +0 -11
- package/src/react-ui/components/MorphingPopover/MorphingPopover.types.ts +0 -49
- package/src/react-ui/components/MorphingPopover/index.tsx +0 -186
- package/src/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -153
- package/src/react-ui/components/index.ts +0 -9
- package/src/react-ui/hooks/Animation/UseAutoHeight.tsx +0 -123
- package/src/react-ui/hooks/DOM/UseIsInView.tsx +0 -44
- package/src/react-ui/hooks/Formatting/UseListFormat.ts +0 -134
- package/src/react-ui/hooks/State/UseControlledState.tsx +0 -57
- package/src/react-ui/hooks/State/UseDataState.tsx +0 -76
- package/src/react-ui/hooks/index.ts +0 -20
- package/src/react-ui/icons/index.ts +0 -12
- package/src/react-ui/icons/lucide-animated/activity.tsx +0 -109
- package/src/react-ui/icons/lucide-animated/arrow-down-to-line.tsx +0 -51
- package/src/react-ui/icons/lucide-animated/arrow-up.tsx +0 -50
- package/src/react-ui/icons/lucide-animated/bell-electric.tsx +0 -124
- package/src/react-ui/icons/lucide-animated/bell.tsx +0 -93
- package/src/react-ui/icons/lucide-animated/bot.tsx +0 -122
- package/src/react-ui/icons/lucide-animated/box.tsx +0 -117
- package/src/react-ui/icons/lucide-animated/check.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/circle-check.tsx +0 -107
- package/src/react-ui/icons/lucide-animated/delete.tsx +0 -133
- package/src/react-ui/icons/lucide-animated/download.tsx +0 -99
- package/src/react-ui/icons/lucide-animated/edit-2.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/globe.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/home.tsx +0 -103
- package/src/react-ui/icons/lucide-animated/index.ts +0 -38
- package/src/react-ui/icons/lucide-animated/layers.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +0 -143
- package/src/react-ui/icons/lucide-animated/list.tsx +0 -54
- package/src/react-ui/icons/lucide-animated/package.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/palette.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/plus.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/refresh-cw.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/rocket.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/save.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/search.tsx +0 -94
- package/src/react-ui/icons/lucide-animated/settings.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/terminal.tsx +0 -46
- package/src/react-ui/icons/lucide-animated/trash-2.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/trending-down.tsx +0 -151
- package/src/react-ui/icons/lucide-animated/trending-up.tsx +0 -150
- package/src/react-ui/icons/lucide-animated/type.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/upload.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/x.tsx +0 -102
- package/src/react-ui/index.ts +0 -30
- package/src/react-ui/lib/get-strict-context.tsx +0 -56
- package/src/react-ui/lib/icon-wrapper.tsx +0 -70
- package/src/react-ui/lib/index.ts +0 -9
- package/src/react-ui/lib/utils.ts +0 -24
- package/src/react-ui/primitives/AutoHeight/index.tsx +0 -74
- package/src/react-ui/primitives/CountingNumber/index.tsx +0 -147
- package/src/react-ui/primitives/Highlight/Highlight.types.ts +0 -136
- package/src/react-ui/primitives/Highlight/index.tsx +0 -577
- package/src/react-ui/primitives/Slot/index.tsx +0 -128
- package/src/react-ui/primitives/index.ts +0 -16
- package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +0 -141
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -217
- package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +0 -77
- package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +0 -58
- package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +0 -253
- package/src/react-ui/primitives/waapi/Gooey/index.ts +0 -50
- package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +0 -48
- package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +0 -106
- package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +0 -21
- package/src/react-ui/primitives/waapi/Morph/index.tsx +0 -56
- package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +0 -12
- package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +0 -89
- package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +0 -176
- package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +0 -87
- package/src/react-ui/primitives/waapi/Morph/useMorph.ts +0 -101
- package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +0 -177
- package/src/react-ui/primitives/waapi/Reorder/index.tsx +0 -260
- package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +0 -47
- package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +0 -209
- package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +0 -104
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +0 -14
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +0 -84
- package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +0 -474
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +0 -32
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +0 -69
- package/src/react-ui/primitives/waapi/SlidingText/index.tsx +0 -140
- package/src/react-ui/primitives/waapi/core/animationConstants.ts +0 -215
- package/src/react-ui/primitives/waapi/core/index.ts +0 -53
- package/src/react-ui/primitives/waapi/core/types.ts +0 -200
- package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +0 -430
- package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +0 -81
- package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +0 -138
- package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +0 -106
- package/src/react-ui/primitives/waapi/index.ts +0 -139
- package/src/react-ui/styles/animations.css +0 -369
- package/src/react-ui/ui/Accordion/Accordion.styles.ts +0 -72
- package/src/react-ui/ui/Accordion/Accordion.types.ts +0 -199
- package/src/react-ui/ui/Accordion/index.tsx +0 -362
- package/src/react-ui/ui/AlertDialog/AlertDialog.styles.ts +0 -38
- package/src/react-ui/ui/AlertDialog/AlertDialog.types.ts +0 -296
- package/src/react-ui/ui/AlertDialog/index.tsx +0 -540
- package/src/react-ui/ui/Badge/Badge.styles.ts +0 -43
- package/src/react-ui/ui/Badge/Badge.types.ts +0 -26
- package/src/react-ui/ui/Badge/index.tsx +0 -34
- package/src/react-ui/ui/Button/Button.styles.ts +0 -57
- package/src/react-ui/ui/Button/Button.types.ts +0 -63
- package/src/react-ui/ui/Button/index.tsx +0 -155
- package/src/react-ui/ui/Card/Card.styles.ts +0 -32
- package/src/react-ui/ui/Card/Card.types.ts +0 -39
- package/src/react-ui/ui/Card/index.tsx +0 -130
- package/src/react-ui/ui/Checkbox/Checkbox.styles.ts +0 -40
- package/src/react-ui/ui/Checkbox/Checkbox.types.ts +0 -98
- package/src/react-ui/ui/Checkbox/index.tsx +0 -233
- package/src/react-ui/ui/Combobox/Combobox.styles.ts +0 -34
- package/src/react-ui/ui/Combobox/Combobox.types.ts +0 -89
- package/src/react-ui/ui/Combobox/index.tsx +0 -331
- package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +0 -38
- package/src/react-ui/ui/CornerBracket/CornerBracket.types.ts +0 -15
- package/src/react-ui/ui/CornerBracket/index.tsx +0 -49
- package/src/react-ui/ui/DataCard/DataCard.styles.ts +0 -94
- package/src/react-ui/ui/DataCard/DataCard.types.ts +0 -125
- package/src/react-ui/ui/DataCard/index.tsx +0 -340
- package/src/react-ui/ui/Dialog/Dialog.styles.ts +0 -59
- package/src/react-ui/ui/Dialog/Dialog.types.ts +0 -284
- package/src/react-ui/ui/Dialog/index.tsx +0 -452
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.styles.ts +0 -35
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.types.ts +0 -81
- package/src/react-ui/ui/DropdownMenu/index.tsx +0 -300
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -376
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -180
- package/src/react-ui/ui/DynamicToggle/index.tsx +0 -316
- package/src/react-ui/ui/DynamicToggle/prototype-v7-ios.html +0 -413
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
- package/src/react-ui/ui/DynamicToggle/prototype-v8-gooey-safari.html +0 -560
- package/src/react-ui/ui/DynamicToggle/prototype-v8b-react-structure.html +0 -227
- package/src/react-ui/ui/DynamicToggle/prototype.html +0 -419
- package/src/react-ui/ui/Field/Field.styles.ts +0 -47
- package/src/react-ui/ui/Field/Field.types.ts +0 -60
- package/src/react-ui/ui/Field/index.tsx +0 -254
- package/src/react-ui/ui/Input/Input.styles.ts +0 -11
- package/src/react-ui/ui/Input/Input.types.ts +0 -10
- package/src/react-ui/ui/Input/index.tsx +0 -32
- package/src/react-ui/ui/InputGroup/InputGroup.styles.ts +0 -53
- package/src/react-ui/ui/InputGroup/InputGroup.types.ts +0 -44
- package/src/react-ui/ui/InputGroup/index.tsx +0 -149
- package/src/react-ui/ui/Label/Label.styles.ts +0 -10
- package/src/react-ui/ui/Label/Label.types.ts +0 -9
- package/src/react-ui/ui/Label/index.tsx +0 -27
- package/src/react-ui/ui/Menu/Menu.styles.ts +0 -71
- package/src/react-ui/ui/Menu/Menu.types.ts +0 -425
- package/src/react-ui/ui/Menu/index.tsx +0 -900
- package/src/react-ui/ui/Popover/Popover.styles.ts +0 -55
- package/src/react-ui/ui/Popover/Popover.types.ts +0 -261
- package/src/react-ui/ui/Popover/index.tsx +0 -422
- package/src/react-ui/ui/Progress/Progress.styles.ts +0 -36
- package/src/react-ui/ui/Progress/Progress.types.ts +0 -162
- package/src/react-ui/ui/Progress/index.tsx +0 -254
- package/src/react-ui/ui/Select/Select.styles.ts +0 -30
- package/src/react-ui/ui/Select/Select.types.ts +0 -51
- package/src/react-ui/ui/Select/index.tsx +0 -225
- package/src/react-ui/ui/Separator/Separator.styles.ts +0 -10
- package/src/react-ui/ui/Separator/Separator.types.ts +0 -10
- package/src/react-ui/ui/Separator/index.tsx +0 -37
- package/src/react-ui/ui/Switch/Switch.styles.ts +0 -50
- package/src/react-ui/ui/Switch/Switch.types.ts +0 -155
- package/src/react-ui/ui/Switch/index.tsx +0 -253
- package/src/react-ui/ui/Tabs/Tabs.css +0 -39
- package/src/react-ui/ui/Tabs/Tabs.styles.ts +0 -148
- package/src/react-ui/ui/Tabs/Tabs.types.ts +0 -255
- package/src/react-ui/ui/Tabs/index.tsx +0 -529
- package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +0 -36
- package/src/react-ui/ui/TextFlow/TextFlow.types.ts +0 -118
- package/src/react-ui/ui/TextFlow/index.tsx +0 -276
- package/src/react-ui/ui/Textarea/Textarea.styles.ts +0 -10
- package/src/react-ui/ui/Textarea/Textarea.types.ts +0 -9
- package/src/react-ui/ui/Textarea/index.tsx +0 -27
- package/src/react-ui/ui/Tooltip/Tooltip.styles.ts +0 -43
- package/src/react-ui/ui/Tooltip/Tooltip.types.ts +0 -253
- package/src/react-ui/ui/Tooltip/index.tsx +0 -394
- package/src/react-ui/ui/index.ts +0 -41
- package/src/types/css-modules.d.ts +0 -18
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal Chrome — lightweight barrel export.
|
|
3
|
-
*
|
|
4
|
-
* Exports only the glassmorphism shell components (no restty, no xterm).
|
|
5
|
-
* Use `@mks2508/mks-ui/react/blocks/Terminal/chrome` for zero terminal deps.
|
|
6
|
-
*
|
|
7
|
-
* @module @mks2508/mks-ui/react/blocks/Terminal/chrome
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Chrome shell
|
|
11
|
-
export { TerminalPanelChrome, NOISE_TEXTURE_SVG, terminalScrollStyles } from './panel/TerminalPanelChrome';
|
|
12
|
-
export { TerminalPanelHeader } from './panel/TerminalPanelHeader';
|
|
13
|
-
export { TerminalPanelFooter } from './panel/TerminalPanelFooter';
|
|
14
|
-
|
|
15
|
-
// Chrome styles + variants
|
|
16
|
-
export {
|
|
17
|
-
terminalChromeStyles,
|
|
18
|
-
terminalChromeVariants,
|
|
19
|
-
ACCENT_GRADIENTS,
|
|
20
|
-
type TerminalChromeSlot,
|
|
21
|
-
type TerminalChromeVariantProps,
|
|
22
|
-
} from './panel/TerminalPanelChrome.styles';
|
|
23
|
-
|
|
24
|
-
// Chrome types
|
|
25
|
-
export type { ITerminalPanelChromeProps } from './panel/TerminalPanelChrome.types';
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React badge components for log lines.
|
|
3
|
-
*
|
|
4
|
-
* Styled badge components using Tailwind CSS for the React log viewer.
|
|
5
|
-
* Provides level badges, timestamp badges, and tag badges with consistent
|
|
6
|
-
* Synthwave Dark theme styling.
|
|
7
|
-
*
|
|
8
|
-
* All badge components are memoized for optimal performance.
|
|
9
|
-
*
|
|
10
|
-
* @module components/devenv/terminal/LogLineBadges
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use client';
|
|
14
|
-
|
|
15
|
-
import { memo } from 'react';
|
|
16
|
-
import type { TLogLevel, TContentType } from '../parsing';
|
|
17
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Level badge color mapping.
|
|
21
|
-
*
|
|
22
|
-
* Maps each log level to its corresponding Tailwind color classes.
|
|
23
|
-
*/
|
|
24
|
-
const LEVEL_COLORS: Record<TLogLevel, string> = {
|
|
25
|
-
info: 'bg-blue-500/15 text-blue-400 border-blue-500/25 shadow-[0_0_6px_rgba(59,130,246,0.15)]',
|
|
26
|
-
warn: 'bg-yellow-500/15 text-yellow-400 border-yellow-500/25 shadow-[0_0_6px_rgba(234,179,8,0.15)]',
|
|
27
|
-
error: 'bg-red-500/20 text-red-400 border-red-500/30 shadow-[0_0_8px_rgba(239,68,68,0.2)]',
|
|
28
|
-
fatal: 'bg-pink-500/20 text-pink-400 border-pink-500/30 shadow-[0_0_8px_rgba(236,72,153,0.2)]',
|
|
29
|
-
debug: 'bg-cyan-500/15 text-cyan-400 border-cyan-500/25 shadow-[0_0_6px_rgba(6,182,212,0.15)]',
|
|
30
|
-
trace: 'bg-gray-500/10 text-gray-400 border-gray-500/20',
|
|
31
|
-
unknown: 'bg-gray-500/8 text-gray-500 border-gray-500/15',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Props for LevelBadge component.
|
|
36
|
-
*/
|
|
37
|
-
export interface ILevelBadgeProps {
|
|
38
|
-
/** Log level to display */
|
|
39
|
-
level: TLogLevel;
|
|
40
|
-
/** Optional custom class name */
|
|
41
|
-
className?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Level badge component (memoized).
|
|
46
|
-
*
|
|
47
|
-
* Displays a colored badge with the log level label.
|
|
48
|
-
* Uses Synthwave Dark theme colors with glassmorphic effect.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```tsx
|
|
52
|
-
* <LevelBadge level="info" />
|
|
53
|
-
* // Renders: [INFO] with blue background
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export const LevelBadge = memo(function LevelBadge({ level, className }: ILevelBadgeProps): React.JSX.Element {
|
|
57
|
-
return (
|
|
58
|
-
<span
|
|
59
|
-
className={cn(
|
|
60
|
-
'px-2 py-0.5 rounded border font-mono text-[10px] font-bold tracking-wider',
|
|
61
|
-
LEVEL_COLORS[level],
|
|
62
|
-
className
|
|
63
|
-
)}
|
|
64
|
-
>
|
|
65
|
-
{level.toUpperCase()}
|
|
66
|
-
</span>
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Props for TimestampBadge component.
|
|
72
|
-
*/
|
|
73
|
-
export interface ITimestampBadgeProps {
|
|
74
|
-
/** Timestamp string to display */
|
|
75
|
-
timestamp: string;
|
|
76
|
-
/** Optional custom class name */
|
|
77
|
-
className?: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Timestamp badge component (memoized).
|
|
82
|
-
*
|
|
83
|
-
* Displays a timestamp with muted styling.
|
|
84
|
-
* Uses tabular numbers for consistent alignment.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```tsx
|
|
88
|
-
* <TimestampBadge timestamp="22:41:03" />
|
|
89
|
-
* // Renders: 22:41:03 in gray
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export const TimestampBadge = memo(function TimestampBadge({ timestamp, className }: ITimestampBadgeProps): React.JSX.Element {
|
|
93
|
-
// Truncate to HH:MM:SS format for consistent width
|
|
94
|
-
const timeOnly = timestamp.includes('.')
|
|
95
|
-
? timestamp.split('.')[0]
|
|
96
|
-
: timestamp;
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<span
|
|
100
|
-
className={cn(
|
|
101
|
-
'ml-auto text-muted-foreground font-mono text-xs tabular-nums',
|
|
102
|
-
'opacity-70',
|
|
103
|
-
className
|
|
104
|
-
)}
|
|
105
|
-
>
|
|
106
|
-
{timeOnly}
|
|
107
|
-
</span>
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Props for TagBadge component.
|
|
113
|
-
*/
|
|
114
|
-
export interface ITagBadgeProps {
|
|
115
|
-
/** Tag string to display */
|
|
116
|
-
tag: string;
|
|
117
|
-
/** Optional custom class name */
|
|
118
|
-
className?: string;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Tag badge component (memoized).
|
|
123
|
-
*
|
|
124
|
-
* Displays a component tag (e.g., "API", "ROUTES").
|
|
125
|
-
* Truncates long tags to 12 characters.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```tsx
|
|
129
|
-
* <TagBadge tag="WORKSPACEMANAGER" />
|
|
130
|
-
* // Renders: [WORKSPACEMAN...] in cyan
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export const TagBadge = memo(function TagBadge({ tag, className }: ITagBadgeProps): React.JSX.Element {
|
|
134
|
-
// Truncate long tags
|
|
135
|
-
const displayTag = tag.length > 12 ? tag.slice(0, 9) + '...' : tag;
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<span
|
|
139
|
-
className={cn(
|
|
140
|
-
'px-1.5 py-0.5 rounded border font-mono text-xs',
|
|
141
|
-
'bg-purple-500/10 text-purple-400 border-purple-500/20',
|
|
142
|
-
className
|
|
143
|
-
)}
|
|
144
|
-
>
|
|
145
|
-
{displayTag}
|
|
146
|
-
</span>
|
|
147
|
-
);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Props for TagBadges component.
|
|
152
|
-
*/
|
|
153
|
-
export interface ITagBadgesProps {
|
|
154
|
-
/** Array of tag strings */
|
|
155
|
-
tags: string[];
|
|
156
|
-
/** Optional custom class name */
|
|
157
|
-
className?: string;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Tag badges container component (memoized).
|
|
162
|
-
*
|
|
163
|
-
* Displays multiple tag badges with consistent spacing.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```tsx
|
|
167
|
-
* <TagBadges tags={['API', 'ROUTES']} />
|
|
168
|
-
* // Renders: [API][ROUTES] with spacing
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export const TagBadges = memo(function TagBadges({ tags, className }: ITagBadgesProps): React.JSX.Element | null {
|
|
172
|
-
if (!tags || tags.length === 0) return null;
|
|
173
|
-
|
|
174
|
-
return (
|
|
175
|
-
<span className={cn('flex items-center gap-1', className)}>
|
|
176
|
-
{tags.map((tag) => (
|
|
177
|
-
<TagBadge key={tag} tag={tag} />
|
|
178
|
-
))}
|
|
179
|
-
</span>
|
|
180
|
-
);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Content type badge color and label mapping.
|
|
185
|
-
*
|
|
186
|
-
* Maps each content type to its display label and Tailwind color classes.
|
|
187
|
-
* 'plain' entries are hidden (no badge rendered).
|
|
188
|
-
*/
|
|
189
|
-
const CONTENT_TYPE_STYLES: Record<TContentType, { label: string; className: string }> = {
|
|
190
|
-
plain: { label: '', className: '' },
|
|
191
|
-
http: {
|
|
192
|
-
label: 'HTTP',
|
|
193
|
-
className: 'bg-cyan-500/15 text-cyan-400 border-cyan-500/25 shadow-[0_0_6px_rgba(6,182,212,0.15)]',
|
|
194
|
-
},
|
|
195
|
-
json: {
|
|
196
|
-
label: 'JSON',
|
|
197
|
-
className: 'bg-emerald-500/15 text-emerald-400 border-emerald-500/25 shadow-[0_0_6px_rgba(16,185,129,0.15)]',
|
|
198
|
-
},
|
|
199
|
-
table: {
|
|
200
|
-
label: 'TABLE',
|
|
201
|
-
className: 'bg-violet-500/15 text-violet-400 border-violet-500/25 shadow-[0_0_6px_rgba(139,92,246,0.15)]',
|
|
202
|
-
},
|
|
203
|
-
error: {
|
|
204
|
-
label: 'ERR',
|
|
205
|
-
className: 'bg-red-500/20 text-red-400 border-red-500/30 shadow-[0_0_8px_rgba(239,68,68,0.2)]',
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Props for ContentTypeBadge component.
|
|
211
|
-
*/
|
|
212
|
-
export interface IContentTypeBadgeProps {
|
|
213
|
-
/** Content type of the log entry */
|
|
214
|
-
contentType: TContentType;
|
|
215
|
-
/** HTTP method (GET, POST, etc.) — shown instead of generic "HTTP" label */
|
|
216
|
-
httpMethod?: string;
|
|
217
|
-
/** Optional custom class name */
|
|
218
|
-
className?: string;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Content type badge component (memoized).
|
|
223
|
-
*
|
|
224
|
-
* Displays a colored badge indicating the content type of a log entry
|
|
225
|
-
* (HTTP, JSON, TABLE, ERR). HTTP entries show the actual method
|
|
226
|
-
* (GET, POST, etc.) instead of a generic "HTTP" label.
|
|
227
|
-
*
|
|
228
|
-
* Returns null for 'plain' content type — no badge rendered.
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* ```tsx
|
|
232
|
-
* <ContentTypeBadge contentType="http" httpMethod="GET" />
|
|
233
|
-
* // Renders: [GET] in cyan
|
|
234
|
-
*
|
|
235
|
-
* <ContentTypeBadge contentType="json" />
|
|
236
|
-
* // Renders: [JSON] in emerald
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
export const ContentTypeBadge = memo(function ContentTypeBadge({
|
|
240
|
-
contentType,
|
|
241
|
-
httpMethod,
|
|
242
|
-
className,
|
|
243
|
-
}: IContentTypeBadgeProps): React.JSX.Element | null {
|
|
244
|
-
if (contentType === 'plain' || !contentType) return null;
|
|
245
|
-
const style = CONTENT_TYPE_STYLES[contentType];
|
|
246
|
-
|
|
247
|
-
// HTTP entries show the actual method (GET, POST, etc.) instead of generic "HTTP"
|
|
248
|
-
const label = contentType === 'http' && httpMethod
|
|
249
|
-
? httpMethod.toUpperCase()
|
|
250
|
-
: style.label;
|
|
251
|
-
|
|
252
|
-
return (
|
|
253
|
-
<span className={cn(
|
|
254
|
-
'px-1.5 py-0.5 rounded border font-mono text-[10px] font-bold tracking-wider',
|
|
255
|
-
style.className,
|
|
256
|
-
className
|
|
257
|
-
)}>
|
|
258
|
-
{label}
|
|
259
|
-
</span>
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Props for LogLineContainer component.
|
|
265
|
-
*/
|
|
266
|
-
export interface ILogLineContainerProps {
|
|
267
|
-
/** Log level for styling */
|
|
268
|
-
level: TLogLevel;
|
|
269
|
-
/** Line number */
|
|
270
|
-
lineNumber: number;
|
|
271
|
-
/** Whether this is a continuation line */
|
|
272
|
-
isContinuation?: boolean;
|
|
273
|
-
/** Optional custom class name */
|
|
274
|
-
className?: string;
|
|
275
|
-
/** Child elements */
|
|
276
|
-
children: React.ReactNode;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Log line container component.
|
|
281
|
-
*
|
|
282
|
-
* Provides consistent styling and structure for log lines.
|
|
283
|
-
* Adds subtle hover effect and line number on hover.
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* ```tsx
|
|
287
|
-
* <LogLineContainer level="info" lineNumber={42}>
|
|
288
|
-
* <LevelBadge level="info" />
|
|
289
|
-
* <span>Log message here</span>
|
|
290
|
-
* </LogLineContainer>
|
|
291
|
-
* ```
|
|
292
|
-
*/
|
|
293
|
-
export function LogLineContainer({
|
|
294
|
-
level,
|
|
295
|
-
lineNumber,
|
|
296
|
-
isContinuation = false,
|
|
297
|
-
className,
|
|
298
|
-
children,
|
|
299
|
-
}: ILogLineContainerProps): React.JSX.Element {
|
|
300
|
-
return (
|
|
301
|
-
<div
|
|
302
|
-
className={cn(
|
|
303
|
-
'group flex items-start gap-2 py-0.5 px-2 rounded-sm',
|
|
304
|
-
'hover:bg-white/5 transition-colors duration-150',
|
|
305
|
-
'border-l-2',
|
|
306
|
-
isContinuation ? 'border-transparent ml-6' : 'border-transparent',
|
|
307
|
-
// Add colored left border on hover based on level
|
|
308
|
-
`hover:border-${level === 'error' || level === 'fatal' ? 'red' : level === 'warn' ? 'yellow' : 'blue'}-500/50`,
|
|
309
|
-
className
|
|
310
|
-
)}
|
|
311
|
-
title={`Line ${lineNumber}`}
|
|
312
|
-
>
|
|
313
|
-
{children}
|
|
314
|
-
</div>
|
|
315
|
-
);
|
|
316
|
-
}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Specialized syntax highlighter for different log content types.
|
|
3
|
-
*
|
|
4
|
-
* Provides syntax highlighting for HTTP requests, tables, and JSON
|
|
5
|
-
* with appropriate styling for each type.
|
|
6
|
-
*
|
|
7
|
-
* @module components/devenv/terminal/SpecializedSyntaxHighlighter
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use client';
|
|
11
|
-
|
|
12
|
-
import { HttpLogParser } from '../parsing/HttpLogParser';
|
|
13
|
-
import { TableParser, TABLE_CHARS } from '../parsing/TableParser';
|
|
14
|
-
import { HighlightedJson } from './SyntaxHighlight';
|
|
15
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Props for specialized syntax highlighting.
|
|
19
|
-
*/
|
|
20
|
-
export interface ISpecializedSyntaxHighlighterProps {
|
|
21
|
-
/** Content type */
|
|
22
|
-
contentType?: 'plain' | 'http' | 'json' | 'table' | 'error';
|
|
23
|
-
|
|
24
|
-
/** HTTP method (for HTTP content) */
|
|
25
|
-
httpMethod?: string;
|
|
26
|
-
|
|
27
|
-
/** HTTP path (for HTTP content) */
|
|
28
|
-
httpPath?: string;
|
|
29
|
-
|
|
30
|
-
/** Table data (for table content) */
|
|
31
|
-
tableData?: unknown;
|
|
32
|
-
|
|
33
|
-
/** JSON data (for JSON content) */
|
|
34
|
-
jsonData?: Record<string, unknown> | unknown;
|
|
35
|
-
|
|
36
|
-
/** Raw text to highlight */
|
|
37
|
-
text: string;
|
|
38
|
-
|
|
39
|
-
/** Optional custom class name */
|
|
40
|
-
className?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Singleton instances
|
|
44
|
-
const httpParser = new HttpLogParser();
|
|
45
|
-
const tableParser = new TableParser();
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Specialized syntax highlighter component.
|
|
49
|
-
*
|
|
50
|
-
* Applies appropriate highlighting based on content type:
|
|
51
|
-
* - HTTP: pink method, cyan path
|
|
52
|
-
* - JSON: structured syntax highlighting
|
|
53
|
-
* - Table: borders in gray, content in colors
|
|
54
|
-
* - Plain: default highlighting
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* <SpecializedSyntaxHighlighter
|
|
59
|
-
* contentType="http"
|
|
60
|
-
* httpMethod="GET"
|
|
61
|
-
* httpPath="/api/endpoint"
|
|
62
|
-
* text="GET /api/endpoint {"
|
|
63
|
-
* />
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export function SpecializedSyntaxHighlighter({
|
|
67
|
-
contentType = 'plain',
|
|
68
|
-
httpMethod: _httpMethod,
|
|
69
|
-
httpPath: _httpPath,
|
|
70
|
-
tableData: _tableData,
|
|
71
|
-
jsonData,
|
|
72
|
-
text,
|
|
73
|
-
className,
|
|
74
|
-
}: ISpecializedSyntaxHighlighterProps): React.JSX.Element {
|
|
75
|
-
// HTTP content highlighting
|
|
76
|
-
if (contentType === 'http') {
|
|
77
|
-
return <HttpHighlighter text={text} className={className} />;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// JSON content highlighting
|
|
81
|
-
if (contentType === 'json' && jsonData) {
|
|
82
|
-
return (
|
|
83
|
-
<div className={cn('font-mono text-xs', className)}>
|
|
84
|
-
<HighlightedJson json={jsonData as Record<string, unknown>} />
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Table content highlighting
|
|
90
|
-
if (contentType === 'table') {
|
|
91
|
-
return <TableHighlighter text={text} className={className} />;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Plain content - use default syntax highlighting
|
|
95
|
-
return <span className={cn('font-mono text-sm', className)}>{text}</span>;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* HTTP request syntax highlighter.
|
|
100
|
-
*
|
|
101
|
-
* Highlights HTTP method (pink) and path (cyan).
|
|
102
|
-
*/
|
|
103
|
-
function HttpHighlighter({ text, className }: { text: string; className?: string }): React.JSX.Element {
|
|
104
|
-
const parts = httpParser.highlightLine(text);
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<span className={cn('font-mono text-sm', className)}>
|
|
108
|
-
{parts.map((part, i) => (
|
|
109
|
-
<span key={i} className={part.className}>
|
|
110
|
-
{part.text}
|
|
111
|
-
</span>
|
|
112
|
-
))}
|
|
113
|
-
</span>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Table syntax highlighter.
|
|
119
|
-
*
|
|
120
|
-
* Renders detected tables as actual styled HTML tables
|
|
121
|
-
* with header detection, alternating rows, and proper borders.
|
|
122
|
-
* Falls back to box-drawing character highlighting.
|
|
123
|
-
*/
|
|
124
|
-
function TableHighlighter({ text, className }: { text: string; className?: string }): React.JSX.Element {
|
|
125
|
-
const lines = text.split('\n').filter((l) => l.trim().length > 0);
|
|
126
|
-
|
|
127
|
-
// Try to extract structured table data
|
|
128
|
-
const tableData = tableParser.parseTable(lines, 0);
|
|
129
|
-
const { headers, dataRows } = tableData;
|
|
130
|
-
|
|
131
|
-
// If we have structured data, render as an actual HTML table
|
|
132
|
-
if (dataRows.length > 0 && (headers || dataRows.length > 1)) {
|
|
133
|
-
const displayHeaders = headers || (dataRows.length > 1 ? dataRows[0] : undefined);
|
|
134
|
-
const displayRows = headers ? dataRows.filter((r) => r !== headers) : dataRows.slice(displayHeaders ? 1 : 0);
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<div className={cn('my-1 overflow-x-auto rounded-md border border-border/20', className)}>
|
|
138
|
-
<table className="w-full font-mono text-xs border-collapse">
|
|
139
|
-
{displayHeaders && (
|
|
140
|
-
<thead>
|
|
141
|
-
<tr className="bg-muted/30 border-b border-border/30">
|
|
142
|
-
{displayHeaders.map((header, i) => (
|
|
143
|
-
<th
|
|
144
|
-
key={i}
|
|
145
|
-
className="px-3 py-1.5 text-left text-[10px] font-bold uppercase tracking-wider text-muted-foreground/80"
|
|
146
|
-
>
|
|
147
|
-
{header}
|
|
148
|
-
</th>
|
|
149
|
-
))}
|
|
150
|
-
</tr>
|
|
151
|
-
</thead>
|
|
152
|
-
)}
|
|
153
|
-
<tbody>
|
|
154
|
-
{displayRows.map((row, i) => (
|
|
155
|
-
<tr
|
|
156
|
-
key={i}
|
|
157
|
-
className={cn(
|
|
158
|
-
'border-b border-border/10 transition-colors hover:bg-white/[0.04]',
|
|
159
|
-
i % 2 === 0 ? 'bg-transparent' : 'bg-white/[0.02]'
|
|
160
|
-
)}
|
|
161
|
-
>
|
|
162
|
-
{row.map((cell, j) => (
|
|
163
|
-
<td key={j} className="px-3 py-1 text-foreground/85 whitespace-nowrap">
|
|
164
|
-
{cell}
|
|
165
|
-
</td>
|
|
166
|
-
))}
|
|
167
|
-
</tr>
|
|
168
|
-
))}
|
|
169
|
-
</tbody>
|
|
170
|
-
</table>
|
|
171
|
-
</div>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Fallback: render with box-drawing character highlighting
|
|
176
|
-
return (
|
|
177
|
-
<div className={cn('font-mono text-xs', className)}>
|
|
178
|
-
{lines.map((line, i) => {
|
|
179
|
-
const rowType = tableParser.getRowType(line);
|
|
180
|
-
const rowClass = tableParser.getRowClass(rowType);
|
|
181
|
-
return (
|
|
182
|
-
<div key={i} className={rowClass}>
|
|
183
|
-
<TableRowLine line={line} />
|
|
184
|
-
</div>
|
|
185
|
-
);
|
|
186
|
-
})}
|
|
187
|
-
</div>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Individual table row with box-drawing character highlighting.
|
|
193
|
-
*/
|
|
194
|
-
function TableRowLine({ line }: { line: string }): React.JSX.Element {
|
|
195
|
-
const parts: React.ReactNode[] = [];
|
|
196
|
-
let lastIndex = 0;
|
|
197
|
-
|
|
198
|
-
for (let i = 0; i < line.length; i++) {
|
|
199
|
-
const char = line[i];
|
|
200
|
-
if (TABLE_CHARS.includes(char as typeof TABLE_CHARS[number])) {
|
|
201
|
-
if (i > lastIndex) {
|
|
202
|
-
parts.push(<span key={lastIndex}>{line.slice(lastIndex, i)}</span>);
|
|
203
|
-
}
|
|
204
|
-
parts.push(<span key={i} className="text-border/40">{char}</span>);
|
|
205
|
-
lastIndex = i + 1;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (lastIndex < line.length) {
|
|
210
|
-
parts.push(<span key={lastIndex}>{line.slice(lastIndex)}</span>);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (parts.length === 0) {
|
|
214
|
-
return <span>{line}</span>;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return <>{parts}</>;
|
|
218
|
-
}
|