termui 0.1.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/README.md +198 -0
- package/package.json +38 -0
- package/packages/cli/package.json +36 -0
- package/packages/components/dist/data/List.d.ts +15 -0
- package/packages/components/dist/data/List.d.ts.map +1 -0
- package/packages/components/dist/data/List.js +40 -0
- package/packages/components/dist/data/List.js.map +1 -0
- package/packages/components/dist/data/Table.d.ts +17 -0
- package/packages/components/dist/data/Table.d.ts.map +1 -0
- package/packages/components/dist/data/Table.js +74 -0
- package/packages/components/dist/data/Table.js.map +1 -0
- package/packages/components/dist/data/index.d.ts +5 -0
- package/packages/components/dist/data/index.d.ts.map +1 -0
- package/packages/components/dist/data/index.js +3 -0
- package/packages/components/dist/data/index.js.map +1 -0
- package/packages/components/dist/feedback/Alert.d.ts +10 -0
- package/packages/components/dist/feedback/Alert.d.ts.map +1 -0
- package/packages/components/dist/feedback/Alert.js +23 -0
- package/packages/components/dist/feedback/Alert.js.map +1 -0
- package/packages/components/dist/feedback/ProgressBar.d.ts +13 -0
- package/packages/components/dist/feedback/ProgressBar.d.ts.map +1 -0
- package/packages/components/dist/feedback/ProgressBar.js +13 -0
- package/packages/components/dist/feedback/ProgressBar.js.map +1 -0
- package/packages/components/dist/feedback/Spinner.d.ts +9 -0
- package/packages/components/dist/feedback/Spinner.d.ts.map +1 -0
- package/packages/components/dist/feedback/Spinner.js +26 -0
- package/packages/components/dist/feedback/Spinner.js.map +1 -0
- package/packages/components/dist/feedback/index.d.ts +7 -0
- package/packages/components/dist/feedback/index.d.ts.map +1 -0
- package/packages/components/dist/feedback/index.js +4 -0
- package/packages/components/dist/feedback/index.js.map +1 -0
- package/packages/components/dist/forms/Form.d.ts +22 -0
- package/packages/components/dist/forms/Form.d.ts.map +1 -0
- package/packages/components/dist/forms/Form.js +45 -0
- package/packages/components/dist/forms/Form.js.map +1 -0
- package/packages/components/dist/forms/index.d.ts +3 -0
- package/packages/components/dist/forms/index.d.ts.map +1 -0
- package/packages/components/dist/forms/index.js +2 -0
- package/packages/components/dist/forms/index.js.map +1 -0
- package/packages/components/dist/index.d.ts +11 -0
- package/packages/components/dist/index.d.ts.map +1 -0
- package/packages/components/dist/index.js +21 -0
- package/packages/components/dist/index.js.map +1 -0
- package/packages/components/dist/input/TextInput.d.ts +14 -0
- package/packages/components/dist/input/TextInput.d.ts.map +1 -0
- package/packages/components/dist/input/TextInput.js +44 -0
- package/packages/components/dist/input/TextInput.js.map +1 -0
- package/packages/components/dist/input/index.d.ts +3 -0
- package/packages/components/dist/input/index.d.ts.map +1 -0
- package/packages/components/dist/input/index.js +2 -0
- package/packages/components/dist/input/index.js.map +1 -0
- package/packages/components/dist/layout/Box.d.ts +11 -0
- package/packages/components/dist/layout/Box.d.ts.map +1 -0
- package/packages/components/dist/layout/Box.js +18 -0
- package/packages/components/dist/layout/Box.js.map +1 -0
- package/packages/components/dist/layout/Grid.d.ts +8 -0
- package/packages/components/dist/layout/Grid.d.ts.map +1 -0
- package/packages/components/dist/layout/Grid.js +12 -0
- package/packages/components/dist/layout/Grid.js.map +1 -0
- package/packages/components/dist/layout/ScrollView.d.ts +9 -0
- package/packages/components/dist/layout/ScrollView.d.ts.map +1 -0
- package/packages/components/dist/layout/ScrollView.js +26 -0
- package/packages/components/dist/layout/ScrollView.js.map +1 -0
- package/packages/components/dist/layout/Stack.d.ts +12 -0
- package/packages/components/dist/layout/Stack.d.ts.map +1 -0
- package/packages/components/dist/layout/Stack.js +6 -0
- package/packages/components/dist/layout/Stack.js.map +1 -0
- package/packages/components/dist/layout/index.d.ts +9 -0
- package/packages/components/dist/layout/index.d.ts.map +1 -0
- package/packages/components/dist/layout/index.js +5 -0
- package/packages/components/dist/layout/index.js.map +1 -0
- package/packages/components/dist/navigation/Tabs.d.ts +15 -0
- package/packages/components/dist/navigation/Tabs.d.ts.map +1 -0
- package/packages/components/dist/navigation/Tabs.js +34 -0
- package/packages/components/dist/navigation/Tabs.js.map +1 -0
- package/packages/components/dist/navigation/index.d.ts +3 -0
- package/packages/components/dist/navigation/index.d.ts.map +1 -0
- package/packages/components/dist/navigation/index.js +2 -0
- package/packages/components/dist/navigation/index.js.map +1 -0
- package/packages/components/dist/overlays/Modal.d.ts +10 -0
- package/packages/components/dist/overlays/Modal.d.ts.map +1 -0
- package/packages/components/dist/overlays/Modal.js +16 -0
- package/packages/components/dist/overlays/Modal.js.map +1 -0
- package/packages/components/dist/overlays/index.d.ts +3 -0
- package/packages/components/dist/overlays/index.d.ts.map +1 -0
- package/packages/components/dist/overlays/index.js +2 -0
- package/packages/components/dist/overlays/index.js.map +1 -0
- package/packages/components/dist/selection/Checkbox.d.ts +10 -0
- package/packages/components/dist/selection/Checkbox.d.ts.map +1 -0
- package/packages/components/dist/selection/Checkbox.js +26 -0
- package/packages/components/dist/selection/Checkbox.js.map +1 -0
- package/packages/components/dist/selection/Select.d.ts +17 -0
- package/packages/components/dist/selection/Select.d.ts.map +1 -0
- package/packages/components/dist/selection/Select.js +44 -0
- package/packages/components/dist/selection/Select.js.map +1 -0
- package/packages/components/dist/selection/index.d.ts +5 -0
- package/packages/components/dist/selection/index.d.ts.map +1 -0
- package/packages/components/dist/selection/index.js +3 -0
- package/packages/components/dist/selection/index.js.map +1 -0
- package/packages/components/dist/typography/Badge.d.ts +9 -0
- package/packages/components/dist/typography/Badge.d.ts.map +1 -0
- package/packages/components/dist/typography/Badge.js +18 -0
- package/packages/components/dist/typography/Badge.js.map +1 -0
- package/packages/components/dist/typography/Text.d.ts +15 -0
- package/packages/components/dist/typography/Text.d.ts.map +1 -0
- package/packages/components/dist/typography/Text.js +6 -0
- package/packages/components/dist/typography/Text.js.map +1 -0
- package/packages/components/dist/typography/index.d.ts +5 -0
- package/packages/components/dist/typography/index.d.ts.map +1 -0
- package/packages/components/dist/typography/index.js +3 -0
- package/packages/components/dist/typography/index.js.map +1 -0
- package/packages/components/dist/utility/Panel.d.ts +14 -0
- package/packages/components/dist/utility/Panel.d.ts.map +1 -0
- package/packages/components/dist/utility/Panel.js +8 -0
- package/packages/components/dist/utility/Panel.js.map +1 -0
- package/packages/components/dist/utility/Toggle.d.ts +11 -0
- package/packages/components/dist/utility/Toggle.d.ts.map +1 -0
- package/packages/components/dist/utility/Toggle.js +23 -0
- package/packages/components/dist/utility/Toggle.js.map +1 -0
- package/packages/components/dist/utility/index.d.ts +5 -0
- package/packages/components/dist/utility/index.d.ts.map +1 -0
- package/packages/components/dist/utility/index.js +3 -0
- package/packages/components/dist/utility/index.js.map +1 -0
- package/packages/components/package.json +36 -0
- package/packages/core/dist/hooks/index.d.ts +18 -0
- package/packages/core/dist/hooks/index.d.ts.map +1 -0
- package/packages/core/dist/hooks/index.js +13 -0
- package/packages/core/dist/hooks/index.js.map +1 -0
- package/packages/core/dist/hooks/useAnimation.d.ts +7 -0
- package/packages/core/dist/hooks/useAnimation.d.ts.map +1 -0
- package/packages/core/dist/hooks/useAnimation.js +40 -0
- package/packages/core/dist/hooks/useAnimation.js.map +1 -0
- package/packages/core/dist/hooks/useAsync.d.ts +25 -0
- package/packages/core/dist/hooks/useAsync.d.ts.map +1 -0
- package/packages/core/dist/hooks/useAsync.js +37 -0
- package/packages/core/dist/hooks/useAsync.js.map +1 -0
- package/packages/core/dist/hooks/useClipboard.d.ts +9 -0
- package/packages/core/dist/hooks/useClipboard.d.ts.map +1 -0
- package/packages/core/dist/hooks/useClipboard.js +14 -0
- package/packages/core/dist/hooks/useClipboard.js.map +1 -0
- package/packages/core/dist/hooks/useFocus.d.ts +10 -0
- package/packages/core/dist/hooks/useFocus.d.ts.map +1 -0
- package/packages/core/dist/hooks/useFocus.js +6 -0
- package/packages/core/dist/hooks/useFocus.js.map +1 -0
- package/packages/core/dist/hooks/useFocusManager.d.ts +9 -0
- package/packages/core/dist/hooks/useFocusManager.d.ts.map +1 -0
- package/packages/core/dist/hooks/useFocusManager.js +6 -0
- package/packages/core/dist/hooks/useFocusManager.js.map +1 -0
- package/packages/core/dist/hooks/useInput.d.ts +22 -0
- package/packages/core/dist/hooks/useInput.d.ts.map +1 -0
- package/packages/core/dist/hooks/useInput.js +6 -0
- package/packages/core/dist/hooks/useInput.js.map +1 -0
- package/packages/core/dist/hooks/useInterval.d.ts +6 -0
- package/packages/core/dist/hooks/useInterval.d.ts.map +1 -0
- package/packages/core/dist/hooks/useInterval.js +18 -0
- package/packages/core/dist/hooks/useInterval.js.map +1 -0
- package/packages/core/dist/hooks/useKeymap.d.ts +13 -0
- package/packages/core/dist/hooks/useKeymap.d.ts.map +1 -0
- package/packages/core/dist/hooks/useKeymap.js +36 -0
- package/packages/core/dist/hooks/useKeymap.js.map +1 -0
- package/packages/core/dist/hooks/useMouse.d.ts +19 -0
- package/packages/core/dist/hooks/useMouse.d.ts.map +1 -0
- package/packages/core/dist/hooks/useMouse.js +60 -0
- package/packages/core/dist/hooks/useMouse.js.map +1 -0
- package/packages/core/dist/hooks/useResize.d.ts +7 -0
- package/packages/core/dist/hooks/useResize.d.ts.map +1 -0
- package/packages/core/dist/hooks/useResize.js +27 -0
- package/packages/core/dist/hooks/useResize.js.map +1 -0
- package/packages/core/dist/hooks/useTerminal.d.ts +4 -0
- package/packages/core/dist/hooks/useTerminal.d.ts.map +1 -0
- package/packages/core/dist/hooks/useTerminal.js +17 -0
- package/packages/core/dist/hooks/useTerminal.js.map +1 -0
- package/packages/core/dist/hooks/useTheme.d.ts +2 -0
- package/packages/core/dist/hooks/useTheme.d.ts.map +1 -0
- package/packages/core/dist/hooks/useTheme.js +3 -0
- package/packages/core/dist/hooks/useTheme.js.map +1 -0
- package/packages/core/dist/index.d.ts +4 -0
- package/packages/core/dist/index.d.ts.map +1 -0
- package/packages/core/dist/index.js +7 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/core/dist/styling/ThemeProvider.d.ts +15 -0
- package/packages/core/dist/styling/ThemeProvider.d.ts.map +1 -0
- package/packages/core/dist/styling/ThemeProvider.js +44 -0
- package/packages/core/dist/styling/ThemeProvider.js.map +1 -0
- package/packages/core/dist/styling/index.d.ts +7 -0
- package/packages/core/dist/styling/index.d.ts.map +1 -0
- package/packages/core/dist/styling/index.js +7 -0
- package/packages/core/dist/styling/index.js.map +1 -0
- package/packages/core/dist/styling/style.d.ts +25 -0
- package/packages/core/dist/styling/style.d.ts.map +1 -0
- package/packages/core/dist/styling/style.js +57 -0
- package/packages/core/dist/styling/style.js.map +1 -0
- package/packages/core/dist/styling/themes/default.d.ts +3 -0
- package/packages/core/dist/styling/themes/default.d.ts.map +1 -0
- package/packages/core/dist/styling/themes/default.js +49 -0
- package/packages/core/dist/styling/themes/default.js.map +1 -0
- package/packages/core/dist/styling/themes/dracula.d.ts +3 -0
- package/packages/core/dist/styling/themes/dracula.d.ts.map +1 -0
- package/packages/core/dist/styling/themes/dracula.js +49 -0
- package/packages/core/dist/styling/themes/dracula.js.map +1 -0
- package/packages/core/dist/styling/themes/nord.d.ts +3 -0
- package/packages/core/dist/styling/themes/nord.d.ts.map +1 -0
- package/packages/core/dist/styling/themes/nord.js +49 -0
- package/packages/core/dist/styling/themes/nord.js.map +1 -0
- package/packages/core/dist/styling/tokens.d.ts +57 -0
- package/packages/core/dist/styling/tokens.d.ts.map +1 -0
- package/packages/core/dist/styling/tokens.js +6 -0
- package/packages/core/dist/styling/tokens.js.map +1 -0
- package/packages/core/dist/terminal/ansi.d.ts +107 -0
- package/packages/core/dist/terminal/ansi.d.ts.map +1 -0
- package/packages/core/dist/terminal/ansi.js +153 -0
- package/packages/core/dist/terminal/ansi.js.map +1 -0
- package/packages/core/dist/terminal/capabilities.d.ts +21 -0
- package/packages/core/dist/terminal/capabilities.d.ts.map +1 -0
- package/packages/core/dist/terminal/capabilities.js +74 -0
- package/packages/core/dist/terminal/capabilities.js.map +1 -0
- package/packages/core/dist/terminal/index.d.ts +3 -0
- package/packages/core/dist/terminal/index.d.ts.map +1 -0
- package/packages/core/dist/terminal/index.js +3 -0
- package/packages/core/dist/terminal/index.js.map +1 -0
- package/packages/core/package.json +49 -0
- package/registry/components/alert/meta.json +9 -0
- package/registry/components/badge/meta.json +9 -0
- package/registry/components/box/meta.json +9 -0
- package/registry/components/checkbox/meta.json +9 -0
- package/registry/components/form/meta.json +9 -0
- package/registry/components/grid/meta.json +9 -0
- package/registry/components/list/meta.json +9 -0
- package/registry/components/modal/meta.json +9 -0
- package/registry/components/panel/meta.json +9 -0
- package/registry/components/progress-bar/meta.json +9 -0
- package/registry/components/scroll-view/meta.json +9 -0
- package/registry/components/select/meta.json +9 -0
- package/registry/components/spinner/meta.json +9 -0
- package/registry/components/stack/meta.json +9 -0
- package/registry/components/table/meta.json +9 -0
- package/registry/components/tabs/meta.json +9 -0
- package/registry/components/text/meta.json +9 -0
- package/registry/components/text-input/meta.json +9 -0
- package/registry/components/toggle/meta.json +9 -0
- package/registry/schema.json +178 -0
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# TermUI
|
|
2
|
+
|
|
3
|
+
> The missing terminal UI framework for TypeScript.
|
|
4
|
+
> Built with React/Ink. Distributed like shadcn. Designed for developers.
|
|
5
|
+
|
|
6
|
+
[](https://github.com/Arindam200/termui/actions)
|
|
7
|
+
[](https://www.npmjs.com/package/termui)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why TermUI?
|
|
13
|
+
|
|
14
|
+
The TypeScript/JS terminal UI ecosystem is fragmented:
|
|
15
|
+
- **Ink** ships ~5 basic primitives
|
|
16
|
+
- **Blessed** is abandoned
|
|
17
|
+
- Nothing has shadcn-style copy-paste distribution
|
|
18
|
+
|
|
19
|
+
TermUI fixes all three.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Initialize in your project
|
|
27
|
+
npx termui init
|
|
28
|
+
|
|
29
|
+
# 2. Add components
|
|
30
|
+
npx termui add spinner
|
|
31
|
+
npx termui add table select alert
|
|
32
|
+
|
|
33
|
+
# 3. Browse all components
|
|
34
|
+
npx termui list
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Your first TermUI app
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import { render } from 'ink';
|
|
42
|
+
import { ThemeProvider } from '@termui/core';
|
|
43
|
+
import { Spinner, ProgressBar, Alert, Select } from '@termui/components';
|
|
44
|
+
|
|
45
|
+
function App() {
|
|
46
|
+
return (
|
|
47
|
+
<ThemeProvider>
|
|
48
|
+
<Spinner style="dots" label="Loading…" />
|
|
49
|
+
<ProgressBar value={72} total={100} label="Installing…" />
|
|
50
|
+
<Alert variant="success" title="Done!">
|
|
51
|
+
Your app is ready.
|
|
52
|
+
</Alert>
|
|
53
|
+
<Select
|
|
54
|
+
options={[
|
|
55
|
+
{ value: 'npm', label: 'npm' },
|
|
56
|
+
{ value: 'pnpm', label: 'pnpm' },
|
|
57
|
+
{ value: 'bun', label: 'bun' },
|
|
58
|
+
]}
|
|
59
|
+
onSubmit={(val) => console.log('Selected:', val)}
|
|
60
|
+
/>
|
|
61
|
+
</ThemeProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
render(<App />);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Components (v0.1.0 — 19 components)
|
|
71
|
+
|
|
72
|
+
| Category | Components |
|
|
73
|
+
|---|---|
|
|
74
|
+
| Layout | `Box` `Stack` `Grid` `ScrollView` |
|
|
75
|
+
| Typography | `Text` `Badge` |
|
|
76
|
+
| Input | `TextInput` |
|
|
77
|
+
| Selection | `Select` `Checkbox` |
|
|
78
|
+
| Data | `List` `Table` |
|
|
79
|
+
| Feedback | `Spinner` `ProgressBar` `Alert` |
|
|
80
|
+
| Navigation | `Tabs` |
|
|
81
|
+
| Overlays | `Modal` |
|
|
82
|
+
| Forms | `Form` |
|
|
83
|
+
| Utility | `Panel` `Toggle` |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Theming
|
|
88
|
+
|
|
89
|
+
TermUI ships 3 built-in themes: **Default**, **Dracula**, **Nord**.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { ThemeProvider, draculaTheme, nordTheme } from '@termui/core';
|
|
93
|
+
|
|
94
|
+
// Wrap your app
|
|
95
|
+
<ThemeProvider theme={draculaTheme}>
|
|
96
|
+
<App />
|
|
97
|
+
</ThemeProvider>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Custom theme
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import { createTheme } from '@termui/core';
|
|
104
|
+
|
|
105
|
+
const myTheme = createTheme({
|
|
106
|
+
name: 'my-brand',
|
|
107
|
+
colors: {
|
|
108
|
+
primary: '#FF6B6B',
|
|
109
|
+
focusRing: '#FF6B6B',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Hooks
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import {
|
|
120
|
+
useInput, // keyboard input
|
|
121
|
+
useFocus, // component focus state
|
|
122
|
+
useFocusManager, // programmatic focus
|
|
123
|
+
useTheme, // access theme tokens
|
|
124
|
+
useTerminal, // cols, rows, color depth
|
|
125
|
+
useAnimation, // frame-based animation
|
|
126
|
+
useInterval, // safe setInterval
|
|
127
|
+
useClipboard, // OSC 52 clipboard
|
|
128
|
+
useKeymap, // declarative keybindings
|
|
129
|
+
useMouse, // mouse events
|
|
130
|
+
useResize, // terminal resize
|
|
131
|
+
useAsync, // async data loading
|
|
132
|
+
} from '@termui/core';
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Stack
|
|
138
|
+
|
|
139
|
+
| Layer | Technology |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Language | TypeScript (ESM-only) |
|
|
142
|
+
| Renderer | [Ink](https://github.com/vadimdemedes/ink) (React for terminal) |
|
|
143
|
+
| Layout | Yoga (Facebook's flexbox engine) |
|
|
144
|
+
| Distribution | shadcn/ui-style CLI |
|
|
145
|
+
| Runtime | Node.js 18+ |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Monorepo Structure
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
termui/
|
|
153
|
+
├── packages/
|
|
154
|
+
│ ├── core/ # Terminal layer, styling engine, 12 hooks
|
|
155
|
+
│ ├── components/ # 19+ UI components
|
|
156
|
+
│ └── cli/ # npx termui CLI tool
|
|
157
|
+
├── registry/ # Component registry (schema + meta)
|
|
158
|
+
├── examples/
|
|
159
|
+
│ └── demo/ # Interactive demo app
|
|
160
|
+
└── .github/
|
|
161
|
+
└── workflows/ # CI (Node 18, 20, 22)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Development
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Install dependencies
|
|
170
|
+
pnpm install
|
|
171
|
+
|
|
172
|
+
# Run all tests
|
|
173
|
+
pnpm test
|
|
174
|
+
|
|
175
|
+
# Run interactive demo
|
|
176
|
+
pnpm --filter @termui/demo start
|
|
177
|
+
|
|
178
|
+
# Test CLI
|
|
179
|
+
node --import tsx/esm packages/cli/src/cli.ts help
|
|
180
|
+
node --import tsx/esm packages/cli/src/cli.ts list
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Roadmap
|
|
186
|
+
|
|
187
|
+
| Phase | Status | Description |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| **Phase 1** | ✅ **Done** | 19 components, CLI (init/add/list), 3 themes, 12 hooks |
|
|
190
|
+
| **Phase 2** | 🔜 Planned | 50+ components, full theming, docs site — v1.0 |
|
|
191
|
+
| **Phase 3** | 🔜 Planned | All 90+ components, charts, dev tools, templates |
|
|
192
|
+
| **Phase 4** | 🔜 Planned | Plugin system, community registry, Vue/Svelte adapters |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT © [Arindam Majumder](https://studio1hq.com)
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "termui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "turbo run build",
|
|
8
|
+
"dev": "turbo run dev --parallel",
|
|
9
|
+
"test": "turbo run test",
|
|
10
|
+
"lint": "turbo run lint",
|
|
11
|
+
"format": "prettier --write \"**/*.{ts,tsx,json,md}\"",
|
|
12
|
+
"typecheck": "turbo run typecheck"
|
|
13
|
+
},
|
|
14
|
+
"workspaces": [
|
|
15
|
+
"packages/*"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"turbo": "^2.0.0",
|
|
19
|
+
"typescript": "^5.4.0",
|
|
20
|
+
"prettier": "^3.2.0",
|
|
21
|
+
"eslint": "^9.0.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
23
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
24
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
25
|
+
"husky": "^9.0.0",
|
|
26
|
+
"lint-staged": "^15.0.0",
|
|
27
|
+
"cross-env": "^7.0.0",
|
|
28
|
+
"tsx": "^4.7.0"
|
|
29
|
+
},
|
|
30
|
+
"lint-staged": {
|
|
31
|
+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
|
32
|
+
"*.{json,md}": ["prettier --write"]
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.0.0"
|
|
36
|
+
},
|
|
37
|
+
"packageManager": "pnpm@9.0.0"
|
|
38
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "termui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TermUI CLI — shadcn-style terminal UI component distribution",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"termui": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/cli.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.build.json",
|
|
12
|
+
"dev": "tsx src/cli.ts",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@termui/core": "workspace:*",
|
|
18
|
+
"glob": "^11.0.0",
|
|
19
|
+
"semver": "^7.6.0",
|
|
20
|
+
"latest-version": "^9.0.0",
|
|
21
|
+
"proper-lockfile": "^4.1.2",
|
|
22
|
+
"simple-git": "^3.22.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.0.0",
|
|
26
|
+
"@types/semver": "^7.5.0",
|
|
27
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
28
|
+
"typescript": "^5.4.0",
|
|
29
|
+
"vitest": "^1.0.0",
|
|
30
|
+
"tsx": "^4.7.0",
|
|
31
|
+
"msw": "^2.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ListItem {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ListProps {
|
|
8
|
+
items: ListItem[];
|
|
9
|
+
onSelect?: (item: ListItem) => void;
|
|
10
|
+
filterable?: boolean;
|
|
11
|
+
height?: number;
|
|
12
|
+
cursor?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function List({ items, onSelect, filterable, height, cursor }: ListProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=List.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/data/List.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAkB,EAAE,MAAW,EAAE,MAAY,EAAE,EAAE,SAAS,2CA+DjG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
|
+
import { useInput, useTheme } from '@termui/core';
|
|
5
|
+
export function List({ items, onSelect, filterable = false, height = 10, cursor = '›' }) {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
8
|
+
const [filter, setFilter] = useState('');
|
|
9
|
+
const filtered = useMemo(() => {
|
|
10
|
+
if (!filter)
|
|
11
|
+
return items;
|
|
12
|
+
const q = filter.toLowerCase();
|
|
13
|
+
return items.filter((item) => item.label.toLowerCase().includes(q));
|
|
14
|
+
}, [items, filter]);
|
|
15
|
+
useInput((input, key) => {
|
|
16
|
+
if (key.upArrow) {
|
|
17
|
+
setActiveIndex((i) => Math.max(0, i - 1));
|
|
18
|
+
}
|
|
19
|
+
else if (key.downArrow) {
|
|
20
|
+
setActiveIndex((i) => Math.min(filtered.length - 1, i + 1));
|
|
21
|
+
}
|
|
22
|
+
else if (key.return) {
|
|
23
|
+
const item = filtered[activeIndex];
|
|
24
|
+
if (item)
|
|
25
|
+
onSelect?.(item);
|
|
26
|
+
}
|
|
27
|
+
else if (filterable && key.backspace) {
|
|
28
|
+
setFilter((f) => f.slice(0, -1));
|
|
29
|
+
}
|
|
30
|
+
else if (filterable && !key.escape && !key.return && !key.upArrow && !key.downArrow) {
|
|
31
|
+
setFilter((f) => f + input);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const visible = filtered.slice(0, height);
|
|
35
|
+
return (_jsxs(Box, { flexDirection: "column", children: [filterable && (_jsx(Box, { borderStyle: "round", borderColor: theme.colors.border, paddingX: 1, marginBottom: 1, children: _jsx(Text, { dimColor: !filter, children: filter || 'Type to filter…' }) })), visible.map((item, idx) => {
|
|
36
|
+
const isActive = idx === activeIndex;
|
|
37
|
+
return (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: isActive ? theme.colors.primary : undefined, children: isActive ? cursor : ' ' }), _jsx(Text, { color: item.color ?? (isActive ? theme.colors.primary : theme.colors.foreground), bold: isActive, children: item.label }), item.description && (_jsx(Text, { color: theme.colors.mutedForeground, dimColor: true, children: item.description }))] }, item.key));
|
|
38
|
+
}), filtered.length > height && (_jsxs(Text, { color: theme.colors.mutedForeground, dimColor: true, children: [filtered.length - height, " more\u2026"] }))] }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/data/List.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,OAAO,EA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IAAI,IAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,YACrD,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GACnB,EACP,KAAC,IAAI,IACH,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,EAChF,IAAI,EAAE,QAAQ,YAEb,IAAI,CAAC,KAAK,GACN,EACN,IAAI,CAAC,WAAW,IAAI,CACnB,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,kBAChD,IAAI,CAAC,WAAW,GACZ,CACR,KAdO,IAAI,CAAC,GAAG,CAeZ,CACP,CAAC;YACJ,CAAC,CAAC,EACD,QAAQ,CAAC,MAAM,GAAG,MAAM,IAAI,CAC3B,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,mBAChD,QAAQ,CAAC,MAAM,GAAG,MAAM,mBACpB,CACR,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Column<T = Record<string, unknown>> {
|
|
2
|
+
key: keyof T & string;
|
|
3
|
+
header: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
align?: 'left' | 'right' | 'center';
|
|
6
|
+
}
|
|
7
|
+
export interface TableProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
|
+
data: T[];
|
|
9
|
+
columns: Column<T>[];
|
|
10
|
+
sortable?: boolean;
|
|
11
|
+
selectable?: boolean;
|
|
12
|
+
onSelect?: (row: T) => void;
|
|
13
|
+
maxRows?: number;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ data, columns, sortable, selectable, onSelect, maxRows, borderColor, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/data/Table.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjD,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACrC;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrF,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAeD,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACjF,IAAI,EACJ,OAAO,EACP,QAAgB,EAChB,UAAkB,EAClB,QAAQ,EACR,OAAY,EACZ,WAAW,GACZ,EAAE,UAAU,CAAC,CAAC,CAAC,2CAmFf"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
|
+
import { useInput, useTheme } from '@termui/core';
|
|
5
|
+
function pad(str, width, align = 'left') {
|
|
6
|
+
const s = String(str);
|
|
7
|
+
if (s.length >= width)
|
|
8
|
+
return s.slice(0, width);
|
|
9
|
+
const diff = width - s.length;
|
|
10
|
+
if (align === 'right')
|
|
11
|
+
return ' '.repeat(diff) + s;
|
|
12
|
+
if (align === 'center') {
|
|
13
|
+
const left = Math.floor(diff / 2);
|
|
14
|
+
const right = diff - left;
|
|
15
|
+
return ' '.repeat(left) + s + ' '.repeat(right);
|
|
16
|
+
}
|
|
17
|
+
return s + ' '.repeat(diff);
|
|
18
|
+
}
|
|
19
|
+
export function Table({ data, columns, sortable = false, selectable = false, onSelect, maxRows = 20, borderColor, }) {
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const [sortKey, setSortKey] = useState(null);
|
|
22
|
+
const [sortDir, setSortDir] = useState('asc');
|
|
23
|
+
const [activeRow, setActiveRow] = useState(0);
|
|
24
|
+
const [sortColIdx, setSortColIdx] = useState(0);
|
|
25
|
+
const resolvedBorderColor = borderColor ?? theme.colors.border;
|
|
26
|
+
const sorted = useMemo(() => {
|
|
27
|
+
if (!sortKey)
|
|
28
|
+
return data;
|
|
29
|
+
return [...data].sort((a, b) => {
|
|
30
|
+
const av = a[sortKey];
|
|
31
|
+
const bv = b[sortKey];
|
|
32
|
+
const cmp = String(av).localeCompare(String(bv));
|
|
33
|
+
return sortDir === 'asc' ? cmp : -cmp;
|
|
34
|
+
});
|
|
35
|
+
}, [data, sortKey, sortDir]);
|
|
36
|
+
const visible = sorted.slice(0, maxRows);
|
|
37
|
+
useInput((input, key) => {
|
|
38
|
+
if (key.upArrow)
|
|
39
|
+
setActiveRow((r) => Math.max(0, r - 1));
|
|
40
|
+
else if (key.downArrow)
|
|
41
|
+
setActiveRow((r) => Math.min(visible.length - 1, r + 1));
|
|
42
|
+
else if (key.return && selectable)
|
|
43
|
+
onSelect?.(visible[activeRow]);
|
|
44
|
+
else if (sortable && key.leftArrow)
|
|
45
|
+
setSortColIdx((i) => Math.max(0, i - 1));
|
|
46
|
+
else if (sortable && key.rightArrow)
|
|
47
|
+
setSortColIdx((i) => Math.min(columns.length - 1, i + 1));
|
|
48
|
+
else if (sortable && input === 's') {
|
|
49
|
+
const col = columns[sortColIdx];
|
|
50
|
+
if (!col)
|
|
51
|
+
return;
|
|
52
|
+
if (sortKey === col.key) {
|
|
53
|
+
setSortDir((d) => d === 'asc' ? 'desc' : 'asc');
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
setSortKey(col.key);
|
|
57
|
+
setSortDir('asc');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// Auto-size columns
|
|
62
|
+
const colWidths = columns.map((col) => {
|
|
63
|
+
const dataMax = data.reduce((max, row) => Math.max(max, String(row[col.key] ?? '').length), 0);
|
|
64
|
+
return col.width ?? Math.max(col.header.length, dataMax) + 2;
|
|
65
|
+
});
|
|
66
|
+
const headerRow = columns.map((col, i) => pad(col.header, colWidths[i] ?? col.header.length, col.align)).join(' │ ');
|
|
67
|
+
const separator = colWidths.map((w) => '─'.repeat(w)).join('─┼─');
|
|
68
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: resolvedBorderColor, children: [_jsx(Box, { paddingX: 1, children: _jsx(Text, { bold: true, color: theme.colors.primary, children: headerRow }) }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: resolvedBorderColor, children: separator }) }), visible.map((row, rowIdx) => {
|
|
69
|
+
const isActive = rowIdx === activeRow && selectable;
|
|
70
|
+
const cells = columns.map((col, i) => pad(String(row[col.key] ?? ''), colWidths[i] ?? 8, col.align)).join(' │ ');
|
|
71
|
+
return (_jsx(Box, { paddingX: 1, children: _jsx(Text, { color: isActive ? theme.colors.selectionForeground : theme.colors.foreground, inverse: isActive, children: cells }) }, rowIdx));
|
|
72
|
+
}), data.length > maxRows && (_jsx(Box, { paddingX: 1, children: _jsxs(Text, { color: theme.colors.mutedForeground, dimColor: true, children: ["\u2026 ", data.length - maxRows, " more rows"] }) }))] }));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/data/Table.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAmBlD,SAAS,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,QAAqC,MAAM;IAClF,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;QAC1B,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;A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,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type AlertVariant = 'success' | 'error' | 'warning' | 'info';
|
|
3
|
+
export interface AlertProps {
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
title?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
icon?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Alert({ variant, title, children, icon }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/feedback/Alert.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AASpE,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,KAAK,CAAC,EAAE,OAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,UAAU,2CA6B5E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useTheme } from '@termui/core';
|
|
4
|
+
const ICONS = {
|
|
5
|
+
success: '✓',
|
|
6
|
+
error: '✗',
|
|
7
|
+
warning: '⚠',
|
|
8
|
+
info: 'ℹ',
|
|
9
|
+
};
|
|
10
|
+
export function Alert({ variant = 'info', title, children, icon }) {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
const variantColor = (() => {
|
|
13
|
+
switch (variant) {
|
|
14
|
+
case 'success': return theme.colors.success;
|
|
15
|
+
case 'error': return theme.colors.error;
|
|
16
|
+
case 'warning': return theme.colors.warning;
|
|
17
|
+
default: return theme.colors.info;
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
const resolvedIcon = icon ?? ICONS[variant];
|
|
21
|
+
return (_jsxs(Box, { borderStyle: "round", borderColor: variantColor, paddingX: 1, paddingY: 0, flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: variantColor, bold: true, children: resolvedIcon }), title && _jsx(Text, { bold: true, color: variantColor, children: title })] }), children && _jsx(Text, { children: children })] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/feedback/Alert.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,MAAM,KAAK,GAAiC;IAC1C,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AASF,MAAM,UAAU,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAc;IAC3E,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE;QACzB,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YAC5C,KAAK,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACxC,KAAK,SAAS,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YAC5C,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;QACpC,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAE5C,OAAO,CACL,MAAC,GAAG,IACF,WAAW,EAAC,OAAO,EACnB,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,aAEtB,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,aACT,KAAC,IAAI,IAAC,KAAK,EAAE,YAAY,EAAE,IAAI,kBAAE,YAAY,GAAQ,EACpD,KAAK,IAAI,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,YAAY,YAAG,KAAK,GAAQ,IACpD,EACL,QAAQ,IAAI,KAAC,IAAI,cAAE,QAAQ,GAAQ,IAChC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ProgressBarProps {
|
|
2
|
+
value: number;
|
|
3
|
+
total?: number;
|
|
4
|
+
width?: number;
|
|
5
|
+
showPercent?: boolean;
|
|
6
|
+
showEta?: boolean;
|
|
7
|
+
fillChar?: string;
|
|
8
|
+
emptyChar?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function ProgressBar({ value, total, width, showPercent, showEta, fillChar, emptyChar, color, label, }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/feedback/ProgressBar.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAK,EACL,KAAU,EACV,WAAkB,EAClB,OAAe,EACf,QAAc,EACd,SAAe,EACf,KAAK,EACL,KAAK,GACN,EAAE,gBAAgB,2CAwBlB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useTheme } from '@termui/core';
|
|
4
|
+
export function ProgressBar({ value, total, width = 30, showPercent = true, showEta = false, fillChar = '█', emptyChar = '░', color, label, }) {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
const resolvedColor = color ?? theme.colors.primary;
|
|
7
|
+
const percent = total !== undefined ? Math.min(100, Math.round((value / total) * 100)) : Math.min(100, Math.round(value));
|
|
8
|
+
const filled = Math.round((percent / 100) * width);
|
|
9
|
+
const empty = width - filled;
|
|
10
|
+
const bar = fillChar.repeat(filled) + emptyChar.repeat(empty);
|
|
11
|
+
return (_jsxs(Box, { flexDirection: "column", children: [label && _jsx(Text, { children: label }), _jsxs(Box, { gap: 1, children: [_jsx(Text, { color: resolvedColor, children: bar }), showPercent && _jsxs(Text, { color: theme.colors.mutedForeground, children: [percent, "%"] }), total !== undefined && (_jsxs(Text, { color: theme.colors.mutedForeground, dimColor: true, children: [value, "/", total] }))] })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/feedback/ProgressBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAcxC,MAAM,UAAU,WAAW,CAAC,EAC1B,KAAK,EACL,KAAK,EACL,KAAK,GAAG,EAAE,EACV,WAAW,GAAG,IAAI,EAClB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,GAAG,EACd,SAAS,GAAG,GAAG,EACf,KAAK,EACL,KAAK,GACY;IACjB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,aAAa,GAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IAEpD,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1H,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAE7B,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9D,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACxB,KAAK,IAAI,KAAC,IAAI,cAAE,KAAK,GAAQ,EAC9B,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,aACT,KAAC,IAAI,IAAC,KAAK,EAAE,aAAa,YAAG,GAAG,GAAQ,EACvC,WAAW,IAAI,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,aAAG,OAAO,SAAS,EAC3E,KAAK,KAAK,SAAS,IAAI,CACtB,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,mBAChD,KAAK,OAAG,KAAK,IACT,CACR,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SpinnerStyle = 'dots' | 'line' | 'star' | 'clock' | 'bounce' | 'bar' | 'arc' | 'arrow' | 'toggle' | 'box' | 'pipe' | 'earth';
|
|
2
|
+
export interface SpinnerProps {
|
|
3
|
+
style?: SpinnerStyle;
|
|
4
|
+
label?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
fps?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function Spinner({ style: spinnerStyle, label, color, fps }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/feedback/Spinner.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GACpB,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GACrD,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAiB1D,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,YAAqB,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQ,EAAE,EAAE,YAAY,2CAa7F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { useAnimation, useTheme } from '@termui/core';
|
|
4
|
+
const FRAMES = {
|
|
5
|
+
dots: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
6
|
+
line: ['—', '\\', '|', '/'],
|
|
7
|
+
star: ['✶', '✸', '✹', '✺', '✹', '✸'],
|
|
8
|
+
clock: ['🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚', '🕛'],
|
|
9
|
+
bounce: ['⠁', '⠂', '⠄', '⡀', '⡈', '⠠', '⠐', '⠈'],
|
|
10
|
+
bar: ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '█', '▉', '▊', '▋', '▌', '▍', '▎'],
|
|
11
|
+
arc: ['◜', '◠', '◝', '◞', '◡', '◟'],
|
|
12
|
+
arrow: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],
|
|
13
|
+
toggle: ['⊶', '⊷'],
|
|
14
|
+
box: ['▖', '▘', '▝', '▗'],
|
|
15
|
+
pipe: ['┤', '┘', '┴', '└', '├', '┌', '┬', '┐'],
|
|
16
|
+
earth: ['🌍', '🌎', '🌏'],
|
|
17
|
+
};
|
|
18
|
+
export function Spinner({ style: spinnerStyle = 'dots', label, color, fps = 12 }) {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const frame = useAnimation(fps);
|
|
21
|
+
const frames = FRAMES[spinnerStyle];
|
|
22
|
+
const icon = frames[frame % frames.length];
|
|
23
|
+
const resolvedColor = color ?? theme.colors.primary;
|
|
24
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: resolvedColor, children: icon }), label && _jsxs(Text, { children: [" ", label] })] }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../src/feedback/Spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAMtD,MAAM,MAAM,GAAmC;IAC7C,IAAI,EAAE,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAC;IAC/C,IAAI,EAAE,CAAC,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,GAAG,CAAC;IACxB,IAAI,EAAE,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAC;IAC/B,KAAK,EAAE,CAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,CAAC;IACpE,MAAM,EAAE,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAC;IACzC,GAAG,EAAE,CAAC,GAAG,EAAC,GA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BAAG,KAAK,IAAQ,IAC1B,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Spinner } from './Spinner.js';
|
|
2
|
+
export { ProgressBar } from './ProgressBar.js';
|
|
3
|
+
export { Alert } from './Alert.js';
|
|
4
|
+
export type { SpinnerProps, SpinnerStyle } from './Spinner.js';
|
|
5
|
+
export type { ProgressBarProps } from './ProgressBar.js';
|
|
6
|
+
export type { AlertProps, AlertVariant } from './Alert.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|