@cli-use/tui 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/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/cli/index.cjs +549 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +526 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/hooks/index.cjs +309 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +280 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index-DAO84gkm.d.cts +272 -0
- package/dist/index-DAO84gkm.d.ts +272 -0
- package/dist/index.cjs +970 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +181 -0
- package/dist/index.d.ts +181 -0
- package/dist/index.js +917 -0
- package/dist/index.js.map +1 -0
- package/package.json +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 cli-use Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# cli-use
|
|
2
|
+
|
|
3
|
+
> Build beautiful terminal user interfaces with Ink
|
|
4
|
+
|
|
5
|
+
A powerful TUI (Terminal User Interface) framework using **Ink** (React for CLIs). Create stunning terminal interfaces with tables, lists, markdown rendering, custom styles, and flex-like layouts.
|
|
6
|
+
|
|
7
|
+
## 🎯 Overview
|
|
8
|
+
|
|
9
|
+
`cli-use` lets you build beautiful terminal applications using **Ink** - the most popular React-based TUI framework. Create tables, lists, markdown rendering, custom styles, and flex-like layouts - all with React components you already know.
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **🎨 Beautiful Styling** - CSS-like properties for stunning interfaces
|
|
14
|
+
- **📊 Tables** - Render beautiful tables with borders, colors, and alignment
|
|
15
|
+
- **📝 Lists** - Create interactive lists with selection states and custom enumerators
|
|
16
|
+
- **📖 Markdown** - Render markdown with themes
|
|
17
|
+
- **📐 Layouts** - Flex-like horizontal/vertical layouts
|
|
18
|
+
- **🔧 TypeScript** - Full type safety and excellent IDE support
|
|
19
|
+
- **⚡ Cross-Platform** - Works on macOS, Linux, and Windows
|
|
20
|
+
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install
|
|
25
|
+
npm install cli-use
|
|
26
|
+
|
|
27
|
+
# Run the demo
|
|
28
|
+
npm run example:ink-demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 💡 Examples
|
|
32
|
+
|
|
33
|
+
### Basic App
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import React from 'react';
|
|
37
|
+
import { render, Box, Text } from 'ink';
|
|
38
|
+
|
|
39
|
+
const App = () => (
|
|
40
|
+
<Box borderStyle="round" padding={1}>
|
|
41
|
+
<Text bold>Hello from cli-use!</Text>
|
|
42
|
+
</Box>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
render(<App />);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Interactive Counter
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import React, { useState } from 'react';
|
|
52
|
+
import { render, Box, Text, useInput } from 'ink';
|
|
53
|
+
|
|
54
|
+
const Counter = () => {
|
|
55
|
+
const [count, setCount] = useState(0);
|
|
56
|
+
|
|
57
|
+
useInput((input, key) => {
|
|
58
|
+
if (key.return) setCount(c => c + 1);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Box>
|
|
63
|
+
<Text>Count: {count}</Text>
|
|
64
|
+
<Text dim>Press Enter to increment</Text>
|
|
65
|
+
</Box>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
render(<Counter />);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 📦 API
|
|
73
|
+
|
|
74
|
+
### Core Components
|
|
75
|
+
|
|
76
|
+
- **`Box`** - Container component for layout and styling
|
|
77
|
+
- **`Text`** - Text rendering with colors and styles
|
|
78
|
+
- **`render()`** - Render Ink apps to terminal
|
|
79
|
+
- **`useInput()`** - Handle keyboard input
|
|
80
|
+
- **`useApp()`** - App instance management
|
|
81
|
+
|
|
82
|
+
## 🧰 Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Install dependencies
|
|
86
|
+
npm install
|
|
87
|
+
|
|
88
|
+
# Build
|
|
89
|
+
npm run build
|
|
90
|
+
|
|
91
|
+
# Run tests
|
|
92
|
+
npm run test:unit
|
|
93
|
+
|
|
94
|
+
# Type check
|
|
95
|
+
npm run typecheck
|
|
96
|
+
|
|
97
|
+
# Run demo
|
|
98
|
+
npm run example:ink-demo
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 📁 Project Structure
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
cli-use/
|
|
105
|
+
├── src/
|
|
106
|
+
│ ├── renderer/
|
|
107
|
+
│ │ └── terminal.ts # Terminal handling
|
|
108
|
+
│ └── examples/
|
|
109
|
+
│ │ └── ink-demo.tsx # Interactive demo
|
|
110
|
+
├── package.json
|
|
111
|
+
├── tsconfig.json
|
|
112
|
+
└── README.md
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 🤝 Contributing
|
|
116
|
+
|
|
117
|
+
Contributions welcome! Please read our contributing guidelines before submitting PRs.
|
|
118
|
+
|
|
119
|
+
## 📄 License
|
|
120
|
+
|
|
121
|
+
MIT © 2025 cli-use contributors
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
**Built with ❤️ and Ink**
|