@mks2508/mks-ui 0.5.4 → 0.5.8
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/primitives/waapi/Gooey/Gooey.types.d.ts +23 -4
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +2 -2
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +292 -31
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.js +6 -1
- package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-Cm6-VceQ.css → DynamicToggle-DJLwEkHr.css} +116 -51
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +116 -51
- 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 +9 -3
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +61 -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 +68 -37
- 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 -123
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -80
- 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 -244
- 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 -303
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -174
- package/src/react-ui/ui/DynamicToggle/index.tsx +0 -294
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
- 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
package/src/index.css
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@import "tw-animate-css";
|
|
3
|
-
@import "shadcn/tailwind.css";
|
|
4
|
-
@import "@fontsource-variable/geist-mono";
|
|
5
|
-
|
|
6
|
-
@custom-variant dark (&:is(.dark *));
|
|
7
|
-
|
|
8
|
-
:root {
|
|
9
|
-
--background: oklch(1 0 0);
|
|
10
|
-
--foreground: oklch(0.145 0 0);
|
|
11
|
-
--card: oklch(1 0 0);
|
|
12
|
-
--card-foreground: oklch(0.145 0 0);
|
|
13
|
-
--popover: oklch(1 0 0);
|
|
14
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
15
|
-
--primary: oklch(0.577 0.245 27.325);
|
|
16
|
-
--primary-foreground: oklch(0.971 0.013 17.38);
|
|
17
|
-
--secondary: oklch(0.967 0.001 286.375);
|
|
18
|
-
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
19
|
-
--muted: oklch(0.97 0 0);
|
|
20
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
21
|
-
--accent: oklch(0.97 0 0);
|
|
22
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
23
|
-
--destructive: oklch(0.58 0.22 27);
|
|
24
|
-
--border: oklch(0.922 0 0);
|
|
25
|
-
--input: oklch(0.922 0 0);
|
|
26
|
-
--ring: oklch(0.708 0 0);
|
|
27
|
-
--chart-1: oklch(0.808 0.114 19.571);
|
|
28
|
-
--chart-2: oklch(0.637 0.237 25.331);
|
|
29
|
-
--chart-3: oklch(0.577 0.245 27.325);
|
|
30
|
-
--chart-4: oklch(0.505 0.213 27.518);
|
|
31
|
-
--chart-5: oklch(0.444 0.177 26.899);
|
|
32
|
-
--radius: 0.625rem;
|
|
33
|
-
--sidebar: oklch(0.985 0 0);
|
|
34
|
-
--sidebar-foreground: oklch(0.145 0 0);
|
|
35
|
-
--sidebar-primary: oklch(0.577 0.245 27.325);
|
|
36
|
-
--sidebar-primary-foreground: oklch(0.971 0.013 17.38);
|
|
37
|
-
--sidebar-accent: oklch(0.97 0 0);
|
|
38
|
-
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
39
|
-
--sidebar-border: oklch(0.922 0 0);
|
|
40
|
-
--sidebar-ring: oklch(0.708 0 0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.dark {
|
|
44
|
-
--background: oklch(0.145 0 0);
|
|
45
|
-
--foreground: oklch(0.985 0 0);
|
|
46
|
-
--card: oklch(0.205 0 0);
|
|
47
|
-
--card-foreground: oklch(0.985 0 0);
|
|
48
|
-
--popover: oklch(0.205 0 0);
|
|
49
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
50
|
-
--primary: oklch(0.637 0.237 25.331);
|
|
51
|
-
--primary-foreground: oklch(0.971 0.013 17.38);
|
|
52
|
-
--secondary: oklch(0.274 0.006 286.033);
|
|
53
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
54
|
-
--muted: oklch(0.269 0 0);
|
|
55
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
56
|
-
--accent: oklch(0.371 0 0);
|
|
57
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
58
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
59
|
-
--border: oklch(1 0 0 / 10%);
|
|
60
|
-
--input: oklch(1 0 0 / 15%);
|
|
61
|
-
--ring: oklch(0.556 0 0);
|
|
62
|
-
--chart-1: oklch(0.808 0.114 19.571);
|
|
63
|
-
--chart-2: oklch(0.637 0.237 25.331);
|
|
64
|
-
--chart-3: oklch(0.577 0.245 27.325);
|
|
65
|
-
--chart-4: oklch(0.505 0.213 27.518);
|
|
66
|
-
--chart-5: oklch(0.444 0.177 26.899);
|
|
67
|
-
--sidebar: oklch(0.205 0 0);
|
|
68
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
69
|
-
--sidebar-primary: oklch(0.637 0.237 25.331);
|
|
70
|
-
--sidebar-primary-foreground: oklch(0.971 0.013 17.38);
|
|
71
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
72
|
-
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
73
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
74
|
-
--sidebar-ring: oklch(0.556 0 0);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@theme inline {
|
|
78
|
-
--font-mono: 'Geist Mono Variable', monospace;
|
|
79
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
80
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
81
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
82
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
83
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
84
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
85
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
86
|
-
--color-sidebar: var(--sidebar);
|
|
87
|
-
--color-chart-5: var(--chart-5);
|
|
88
|
-
--color-chart-4: var(--chart-4);
|
|
89
|
-
--color-chart-3: var(--chart-3);
|
|
90
|
-
--color-chart-2: var(--chart-2);
|
|
91
|
-
--color-chart-1: var(--chart-1);
|
|
92
|
-
--color-ring: var(--ring);
|
|
93
|
-
--color-input: var(--input);
|
|
94
|
-
--color-border: var(--border);
|
|
95
|
-
--color-destructive: var(--destructive);
|
|
96
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
97
|
-
--color-accent: var(--accent);
|
|
98
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
99
|
-
--color-muted: var(--muted);
|
|
100
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
101
|
-
--color-secondary: var(--secondary);
|
|
102
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
103
|
-
--color-primary: var(--primary);
|
|
104
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
105
|
-
--color-popover: var(--popover);
|
|
106
|
-
--color-card-foreground: var(--card-foreground);
|
|
107
|
-
--color-card: var(--card);
|
|
108
|
-
--color-foreground: var(--foreground);
|
|
109
|
-
--color-background: var(--background);
|
|
110
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
111
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
112
|
-
--radius-lg: var(--radius);
|
|
113
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
114
|
-
--radius-2xl: calc(var(--radius) + 8px);
|
|
115
|
-
--radius-3xl: calc(var(--radius) + 12px);
|
|
116
|
-
--radius-4xl: calc(var(--radius) + 16px);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@layer base {
|
|
120
|
-
* {
|
|
121
|
-
@apply border-border outline-ring/50;
|
|
122
|
-
}
|
|
123
|
-
body {
|
|
124
|
-
@apply font-sans bg-background text-foreground;
|
|
125
|
-
}
|
|
126
|
-
html {
|
|
127
|
-
@apply font-sans;
|
|
128
|
-
}
|
|
129
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mks2508/mks-ui
|
|
3
|
-
*
|
|
4
|
-
* UI component library - Framework-agnostic core types and React components.
|
|
5
|
-
*
|
|
6
|
-
* ## Entry Points
|
|
7
|
-
*
|
|
8
|
-
* ### Main Entry (Core Types)
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import type { StyleSlots, SlotOverrides, IBaseConfig } from '@mks2508/mks-ui';
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* ### React Entry (Components, Hooks, Icons, Utils)
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { Button, Card, CornerBracket } from '@mks2508/mks-ui/react';
|
|
16
|
-
* import { useAutoHeight } from '@mks2508/mks-ui/react';
|
|
17
|
-
* import { Check, Search } from '@mks2508/mks-ui/react';
|
|
18
|
-
* import { cn } from '@mks2508/mks-ui/react';
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* import type { StyleSlots } from '@mks2508/mks-ui';
|
|
24
|
-
* import { Button, Card, CornerBracket } from '@mks2508/mks-ui/react';
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
// Core types (framework-agnostic)
|
|
29
|
-
export * from './core';
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ResttyAdapter - ITerminalAdapter implementation for restty.
|
|
3
|
-
*
|
|
4
|
-
* Wraps restty's GPU-accelerated terminal renderer into the
|
|
5
|
-
* pluggable adapter interface, enabling renderer switching in the UI.
|
|
6
|
-
*
|
|
7
|
-
* Key differences from XTermAdapter:
|
|
8
|
-
* - Restty manages its own PTY WebSocket via custom PtyTransport
|
|
9
|
-
* - GPU rendering (WebGPU/WebGL2) instead of DOM/canvas
|
|
10
|
-
* - No write()/writeln() for injecting display text — restty renders PTY output
|
|
11
|
-
* - Built-in multi-pane, theme catalog, and text shaping with ligatures
|
|
12
|
-
*
|
|
13
|
-
* @module components/devenv/terminal/ResttyAdapter
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import type {
|
|
17
|
-
ITerminalAdapter,
|
|
18
|
-
ITerminalAdapterCapabilities,
|
|
19
|
-
ITerminalBackendType,
|
|
20
|
-
ITerminalMode,
|
|
21
|
-
ITerminalOptions,
|
|
22
|
-
IPtyTransport,
|
|
23
|
-
IPtyTransportFactory,
|
|
24
|
-
} from './Terminal.types';
|
|
25
|
-
import type { Restty, ResttyPaneHandle } from 'restty';
|
|
26
|
-
import { getSynthwaveGhosttyTheme, xtermThemeToGhostty } from './Terminal.theme.restty';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* ITerminalAdapter implementation backed by restty.
|
|
30
|
-
*
|
|
31
|
-
* Uses restty's Restty class with a custom DevenvPtyTransport
|
|
32
|
-
* that bridges the mks-devenv WebSocket JSON protocol. Status messages
|
|
33
|
-
* are not rendered in the terminal — they should be handled as React overlays.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* const adapter = new ResttyAdapter({ fontSize: 14 });
|
|
38
|
-
* await adapter.initialize(containerEl, options);
|
|
39
|
-
* adapter.connectPty?.('ws://localhost:3100/terminal/session-1');
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export class ResttyAdapter implements ITerminalAdapter {
|
|
43
|
-
/** Backend type identifier for factory pattern */
|
|
44
|
-
public readonly type: ITerminalBackendType = 'xterm'; // kept for backward compat with union
|
|
45
|
-
|
|
46
|
-
/** Adapter capabilities — restty manages its own connection and supports GPU */
|
|
47
|
-
public readonly capabilities: ITerminalAdapterCapabilities = {
|
|
48
|
-
managesOwnConnection: true,
|
|
49
|
-
gpuRendering: true,
|
|
50
|
-
multiPane: true,
|
|
51
|
-
builtinThemes: true,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
private restty: Restty | null = null;
|
|
55
|
-
private transport: IPtyTransport | null = null;
|
|
56
|
-
private options: ITerminalOptions;
|
|
57
|
-
private rootElement: HTMLElement | null = null;
|
|
58
|
-
private createTransport?: IPtyTransportFactory;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @param options - Terminal initialization options
|
|
62
|
-
* @param createTransport - Optional factory to create a custom PTY transport.
|
|
63
|
-
* If not provided, restty manages its own PTY connection internally.
|
|
64
|
-
*/
|
|
65
|
-
constructor(options: ITerminalOptions, createTransport?: IPtyTransportFactory) {
|
|
66
|
-
this.options = options;
|
|
67
|
-
this.createTransport = createTransport;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Initialize restty in the given container element.
|
|
72
|
-
* Dynamically imports restty to enable code-splitting and SSR safety.
|
|
73
|
-
*
|
|
74
|
-
* @param container - DOM element to render the terminal into
|
|
75
|
-
* @param options - Terminal initialization options
|
|
76
|
-
*/
|
|
77
|
-
async initialize(container: HTMLElement, options: ITerminalOptions): Promise<void> {
|
|
78
|
-
this.options = { ...this.options, ...options };
|
|
79
|
-
this.rootElement = container;
|
|
80
|
-
|
|
81
|
-
const { Restty } = await import('restty');
|
|
82
|
-
|
|
83
|
-
// Create custom PtyTransport if factory provided
|
|
84
|
-
this.transport = this.createTransport?.() ?? null;
|
|
85
|
-
|
|
86
|
-
this.restty = new Restty({
|
|
87
|
-
root: container,
|
|
88
|
-
appOptions: {
|
|
89
|
-
renderer: 'auto',
|
|
90
|
-
fontSize: this.options.fontSize ?? 14,
|
|
91
|
-
autoResize: true,
|
|
92
|
-
...(this.transport ? { ptyTransport: this.transport } : {}),
|
|
93
|
-
},
|
|
94
|
-
fontSources: this.buildFontSources(),
|
|
95
|
-
createInitialPane: true,
|
|
96
|
-
shortcuts: false, // Disable built-in pane splitting shortcuts
|
|
97
|
-
defaultContextMenu: true,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Apply theme
|
|
101
|
-
if (this.options.theme) {
|
|
102
|
-
this.restty.applyTheme(xtermThemeToGhostty(this.options.theme));
|
|
103
|
-
} else {
|
|
104
|
-
this.restty.applyTheme(getSynthwaveGhosttyTheme());
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Write data to the terminal display.
|
|
110
|
-
* No-op for restty — it renders PTY output via its own connection.
|
|
111
|
-
* Status messages should be displayed as React overlays.
|
|
112
|
-
*/
|
|
113
|
-
write(_data: string): void {
|
|
114
|
-
// No-op: restty renders from PTY stream, not injected text
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Write data with newline to the terminal display.
|
|
119
|
-
* No-op for restty — see write().
|
|
120
|
-
*/
|
|
121
|
-
writeln(_data: string): void {
|
|
122
|
-
// No-op: restty renders from PTY stream, not injected text
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Clear the terminal screen and scrollback.
|
|
127
|
-
*/
|
|
128
|
-
clear(): void {
|
|
129
|
-
this.restty?.clearScreen();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Resize the terminal to explicit dimensions.
|
|
134
|
-
* Uses Restty's native resize() (v0.1.21+) for precise control.
|
|
135
|
-
*
|
|
136
|
-
* @param cols - Number of columns
|
|
137
|
-
* @param rows - Number of rows
|
|
138
|
-
*/
|
|
139
|
-
resize(cols: number, rows: number): void {
|
|
140
|
-
this.restty?.resize(cols, rows);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Dispose of restty and release all resources (GPU, WASM, WebSocket).
|
|
145
|
-
*/
|
|
146
|
-
dispose(): void {
|
|
147
|
-
this.restty?.destroy();
|
|
148
|
-
this.restty = null;
|
|
149
|
-
this.transport = null;
|
|
150
|
-
this.rootElement = null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Switch between interactive and readonly modes.
|
|
155
|
-
* No-op for restty — mode is determined by PTY connection state.
|
|
156
|
-
*/
|
|
157
|
-
setMode(_mode: ITerminalMode): void {
|
|
158
|
-
// Restty doesn't have a separate readonly mode
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Focus the terminal for keyboard input.
|
|
163
|
-
* Uses Restty's native focus() (v0.1.21+) which handles pane focus correctly.
|
|
164
|
-
*/
|
|
165
|
-
focus(): void {
|
|
166
|
-
this.restty?.focus();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Remove focus from the terminal.
|
|
171
|
-
* Uses Restty's native blur() (v0.1.21+).
|
|
172
|
-
*/
|
|
173
|
-
blur(): void {
|
|
174
|
-
this.restty?.blur();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Connect to a PTY backend via WebSocket URL.
|
|
179
|
-
*
|
|
180
|
-
* @param url - WebSocket URL for PTY connection
|
|
181
|
-
*/
|
|
182
|
-
connectPty(url: string): void {
|
|
183
|
-
this.restty?.connectPty(url);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Disconnect from the PTY backend.
|
|
188
|
-
*/
|
|
189
|
-
disconnectPty(): void {
|
|
190
|
-
this.restty?.disconnectPty();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Check if PTY WebSocket is connected.
|
|
195
|
-
*/
|
|
196
|
-
isPtyConnected(): boolean {
|
|
197
|
-
return this.restty?.isPtyConnected() ?? false;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Update font size at runtime.
|
|
202
|
-
*
|
|
203
|
-
* @param size - Font size in CSS pixels
|
|
204
|
-
*/
|
|
205
|
-
setFontSize(size: number): void {
|
|
206
|
-
this.restty?.setFontSize(size);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Send raw input data to the terminal PTY.
|
|
211
|
-
*
|
|
212
|
-
* @param data - Input data string
|
|
213
|
-
*/
|
|
214
|
-
sendInput(data: string): void {
|
|
215
|
-
this.restty?.sendInput(data);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Copy the current text selection to the clipboard.
|
|
220
|
-
*/
|
|
221
|
-
async copySelection(): Promise<boolean> {
|
|
222
|
-
return this.restty?.copySelectionToClipboard() ?? false;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Paste clipboard contents into the terminal.
|
|
227
|
-
*/
|
|
228
|
-
async pasteClipboard(): Promise<boolean> {
|
|
229
|
-
return this.restty?.pasteFromClipboard() ?? false;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Get the underlying Restty instance for advanced usage.
|
|
234
|
-
* Use sparingly — prefer the adapter interface.
|
|
235
|
-
*/
|
|
236
|
-
getResttyInstance(): Restty | null {
|
|
237
|
-
return this.restty;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Get the active pane handle for direct restty pane operations.
|
|
242
|
-
*/
|
|
243
|
-
getActivePane(): ResttyPaneHandle | null {
|
|
244
|
-
return this.restty?.activePane() ?? null;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Build font source list following restty's priority pattern:
|
|
249
|
-
* local fonts first (fast), then CDN fallback.
|
|
250
|
-
*/
|
|
251
|
-
private buildFontSources() {
|
|
252
|
-
const family = this.options.fontFamily;
|
|
253
|
-
|
|
254
|
-
if (family) {
|
|
255
|
-
// Parse comma-separated font family string into matchers
|
|
256
|
-
const matchers = family
|
|
257
|
-
.split(',')
|
|
258
|
-
.map((f) => f.trim().replace(/['"]/g, '').toLowerCase())
|
|
259
|
-
.filter(Boolean);
|
|
260
|
-
|
|
261
|
-
return [{ type: 'local' as const, matchers }];
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Default: prefer local system fonts commonly available in dev environments
|
|
265
|
-
return [
|
|
266
|
-
{
|
|
267
|
-
type: 'local' as const,
|
|
268
|
-
matchers: [
|
|
269
|
-
'jetbrains mono',
|
|
270
|
-
'fira code',
|
|
271
|
-
'sf mono',
|
|
272
|
-
'cascadia code',
|
|
273
|
-
'meslo',
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
];
|
|
277
|
-
}
|
|
278
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal adapter interface and factory.
|
|
3
|
-
*
|
|
4
|
-
* Allows switching between xterm.js, WebContainer, and Monaco backends
|
|
5
|
-
* through a unified interface. Backends are loaded dynamically to enable
|
|
6
|
-
* code-splitting and reduce initial bundle size.
|
|
7
|
-
*
|
|
8
|
-
* @module components/devenv/terminal/adapter
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
ITerminalAdapter,
|
|
13
|
-
ITerminalBackendType,
|
|
14
|
-
ITerminalRendererType,
|
|
15
|
-
ITerminalOptions,
|
|
16
|
-
} from './Terminal.types';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create terminal adapter based on backend type.
|
|
20
|
-
*
|
|
21
|
-
* Factory function that instantiates the appropriate terminal backend
|
|
22
|
-
* adapter. Currently only xterm.js is implemented, with WebContainer
|
|
23
|
-
* and Monaco planned for future releases.
|
|
24
|
-
*
|
|
25
|
-
* @param backend - Backend type to instantiate
|
|
26
|
-
* @param options - Terminal options to pass to the adapter
|
|
27
|
-
* @returns Promise resolving to the configured adapter
|
|
28
|
-
*
|
|
29
|
-
* @throws {Error} If backend type is not supported yet
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* const adapter = await createTerminalAdapter('xterm', {
|
|
34
|
-
* mode: 'interactive',
|
|
35
|
-
* wsUrl: 'ws://localhost:3100/terminal/session-123',
|
|
36
|
-
* });
|
|
37
|
-
* await adapter.initialize(container, options);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export async function createTerminalAdapter(
|
|
41
|
-
backend: ITerminalBackendType,
|
|
42
|
-
options: ITerminalOptions
|
|
43
|
-
): Promise<ITerminalAdapter> {
|
|
44
|
-
switch (backend) {
|
|
45
|
-
case 'xterm':
|
|
46
|
-
const { XTermAdapter } = await import('./XTermAdapter');
|
|
47
|
-
return new XTermAdapter(options);
|
|
48
|
-
|
|
49
|
-
// TODO: Implement WebContainer and Monaco adapters
|
|
50
|
-
case 'webcontainer':
|
|
51
|
-
case 'monaco':
|
|
52
|
-
throw new Error(
|
|
53
|
-
`Backend '${backend}' is not yet implemented. Use 'xterm' backend for now.`
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
default:
|
|
57
|
-
throw new Error(`Unknown terminal backend: ${backend}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create terminal adapter based on renderer type.
|
|
63
|
-
*
|
|
64
|
-
* Factory function that instantiates the appropriate terminal renderer
|
|
65
|
-
* adapter. Uses dynamic import for code-splitting — restty's WASM bundle
|
|
66
|
-
* is only loaded when the `'restty'` renderer is selected.
|
|
67
|
-
*
|
|
68
|
-
* @param renderer - Renderer type to instantiate
|
|
69
|
-
* @param options - Terminal options to pass to the adapter
|
|
70
|
-
* @returns Promise resolving to the configured adapter
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* const adapter = await createTerminalAdapterForRenderer('restty', {
|
|
75
|
-
* mode: 'interactive',
|
|
76
|
-
* wsUrl: 'ws://localhost:3100/terminal/session-123',
|
|
77
|
-
* });
|
|
78
|
-
* await adapter.initialize(container, options);
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export async function createTerminalAdapterForRenderer(
|
|
82
|
-
renderer: ITerminalRendererType,
|
|
83
|
-
options: ITerminalOptions
|
|
84
|
-
): Promise<ITerminalAdapter> {
|
|
85
|
-
switch (renderer) {
|
|
86
|
-
case 'restty': {
|
|
87
|
-
const { ResttyAdapter } = await import('./ResttyAdapter');
|
|
88
|
-
return new ResttyAdapter(options);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
case 'xterm':
|
|
92
|
-
default: {
|
|
93
|
-
const { XTermAdapter } = await import('./XTermAdapter');
|
|
94
|
-
return new XTermAdapter(options);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Theme bridge between ITerminalTheme (xterm.js format) and GhosttyTheme (restty format).
|
|
3
|
-
*
|
|
4
|
-
* Converts the mks-dev-environment Synthwave theme colors into
|
|
5
|
-
* restty's Ghostty-compatible theme format for GPU-rendered terminals.
|
|
6
|
-
*
|
|
7
|
-
* @module components/devenv/terminal/theme-restty
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { ITerminalTheme } from './Terminal.types';
|
|
11
|
-
import { SYNTHWAVE_TERMINAL_THEME } from './Terminal.theme';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* RGB color as used by restty's Ghostty theme format.
|
|
15
|
-
* Each channel is 0-255.
|
|
16
|
-
*/
|
|
17
|
-
export interface IResttyThemeColor {
|
|
18
|
-
r: number;
|
|
19
|
-
g: number;
|
|
20
|
-
b: number;
|
|
21
|
-
a?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Ghostty theme structure compatible with restty's applyTheme().
|
|
26
|
-
* Mirrors the GhosttyTheme type from restty/theme.
|
|
27
|
-
*/
|
|
28
|
-
export interface IResttyGhosttyTheme {
|
|
29
|
-
name?: string;
|
|
30
|
-
colors: {
|
|
31
|
-
background?: IResttyThemeColor;
|
|
32
|
-
foreground?: IResttyThemeColor;
|
|
33
|
-
cursor?: IResttyThemeColor;
|
|
34
|
-
cursorText?: IResttyThemeColor;
|
|
35
|
-
selectionBackground?: IResttyThemeColor;
|
|
36
|
-
selectionForeground?: IResttyThemeColor;
|
|
37
|
-
palette: Array<IResttyThemeColor | undefined>;
|
|
38
|
-
};
|
|
39
|
-
raw: Record<string, string>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Convert a hex color string (#RRGGBB or #RGB) to restty's ThemeColor format.
|
|
44
|
-
*
|
|
45
|
-
* @param hex - Hex color string (e.g., '#D40C67', '#fff')
|
|
46
|
-
* @returns RGB color object with channels 0-255
|
|
47
|
-
*/
|
|
48
|
-
export function hexToResttyColor(hex: string): IResttyThemeColor {
|
|
49
|
-
let clean = hex.replace('#', '');
|
|
50
|
-
|
|
51
|
-
// Handle shorthand (#RGB → #RRGGBB)
|
|
52
|
-
if (clean.length === 3) {
|
|
53
|
-
clean = clean[0] + clean[0] + clean[1] + clean[1] + clean[2] + clean[2];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
r: parseInt(clean.slice(0, 2), 16),
|
|
58
|
-
g: parseInt(clean.slice(2, 4), 16),
|
|
59
|
-
b: parseInt(clean.slice(4, 6), 16),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Convert an rgba() color string to restty's ThemeColor format.
|
|
65
|
-
* Falls back to opaque white for unparseable values.
|
|
66
|
-
*
|
|
67
|
-
* @param rgba - CSS rgba() string (e.g., 'rgba(0, 217, 255, 0.3)')
|
|
68
|
-
* @returns RGB color object
|
|
69
|
-
*/
|
|
70
|
-
function rgbaToResttyColor(rgba: string): IResttyThemeColor {
|
|
71
|
-
const match = rgba.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/);
|
|
72
|
-
if (!match) return { r: 255, g: 255, b: 255 };
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
r: parseInt(match[1], 10),
|
|
76
|
-
g: parseInt(match[2], 10),
|
|
77
|
-
b: parseInt(match[3], 10),
|
|
78
|
-
a: match[4] ? Math.round(parseFloat(match[4]) * 255) : undefined,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Parse any CSS color value (hex or rgba) to restty ThemeColor.
|
|
84
|
-
*
|
|
85
|
-
* @param color - CSS color string
|
|
86
|
-
* @returns RGB color object
|
|
87
|
-
*/
|
|
88
|
-
function cssColorToResttyColor(color: string): IResttyThemeColor {
|
|
89
|
-
if (color.startsWith('#')) return hexToResttyColor(color);
|
|
90
|
-
if (color.startsWith('rgb')) return rgbaToResttyColor(color);
|
|
91
|
-
return { r: 255, g: 255, b: 255 };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Convert ITerminalTheme (xterm.js format) to GhosttyTheme (restty format).
|
|
96
|
-
*
|
|
97
|
-
* Maps the 16-color ANSI palette plus background, foreground, cursor,
|
|
98
|
-
* and selection colors to restty's Ghostty theme structure.
|
|
99
|
-
*
|
|
100
|
-
* @param theme - xterm.js theme with hex color values
|
|
101
|
-
* @returns Ghostty theme compatible with restty's applyTheme()
|
|
102
|
-
*/
|
|
103
|
-
export function xtermThemeToGhostty(theme: ITerminalTheme): IResttyGhosttyTheme {
|
|
104
|
-
const palette: Array<IResttyThemeColor | undefined> = new Array(256).fill(undefined);
|
|
105
|
-
|
|
106
|
-
// Standard ANSI colors (indices 0-7)
|
|
107
|
-
palette[0] = hexToResttyColor(theme.black);
|
|
108
|
-
palette[1] = hexToResttyColor(theme.red);
|
|
109
|
-
palette[2] = hexToResttyColor(theme.green);
|
|
110
|
-
palette[3] = hexToResttyColor(theme.yellow);
|
|
111
|
-
palette[4] = hexToResttyColor(theme.blue);
|
|
112
|
-
palette[5] = hexToResttyColor(theme.magenta);
|
|
113
|
-
palette[6] = hexToResttyColor(theme.cyan);
|
|
114
|
-
palette[7] = hexToResttyColor(theme.white);
|
|
115
|
-
|
|
116
|
-
// Bright ANSI colors (indices 8-15)
|
|
117
|
-
palette[8] = hexToResttyColor(theme.brightBlack);
|
|
118
|
-
palette[9] = hexToResttyColor(theme.brightRed);
|
|
119
|
-
palette[10] = hexToResttyColor(theme.brightGreen);
|
|
120
|
-
palette[11] = hexToResttyColor(theme.brightYellow);
|
|
121
|
-
palette[12] = hexToResttyColor(theme.brightBlue);
|
|
122
|
-
palette[13] = hexToResttyColor(theme.brightMagenta);
|
|
123
|
-
palette[14] = hexToResttyColor(theme.brightCyan);
|
|
124
|
-
palette[15] = hexToResttyColor(theme.brightWhite);
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
name: 'Synthwave Industrial Dark',
|
|
128
|
-
colors: {
|
|
129
|
-
background: hexToResttyColor(theme.background),
|
|
130
|
-
foreground: hexToResttyColor(theme.foreground),
|
|
131
|
-
cursor: hexToResttyColor(theme.cursor),
|
|
132
|
-
cursorText: theme.cursorAccent ? hexToResttyColor(theme.cursorAccent) : undefined,
|
|
133
|
-
selectionBackground: theme.selectionBackground
|
|
134
|
-
? cssColorToResttyColor(theme.selectionBackground)
|
|
135
|
-
: undefined,
|
|
136
|
-
selectionForeground: theme.selectionForeground
|
|
137
|
-
? cssColorToResttyColor(theme.selectionForeground)
|
|
138
|
-
: undefined,
|
|
139
|
-
palette,
|
|
140
|
-
},
|
|
141
|
-
raw: {},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Get the Synthwave Industrial Dark theme in Ghostty format for restty.
|
|
147
|
-
*
|
|
148
|
-
* Pre-built conversion of the default terminal theme, ready to pass
|
|
149
|
-
* directly to `restty.applyTheme()`.
|
|
150
|
-
*
|
|
151
|
-
* @returns GhosttyTheme with Synthwave colors
|
|
152
|
-
*/
|
|
153
|
-
export function getSynthwaveGhosttyTheme(): IResttyGhosttyTheme {
|
|
154
|
-
return xtermThemeToGhostty(SYNTHWAVE_TERMINAL_THEME);
|
|
155
|
-
}
|