@textui/kit 0.1.0 → 0.3.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 +18 -23
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @textui/kit
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@textui/kit) [](https://github.com/softov/textui/blob/main/LICENSE)
|
|
4
|
+
|
|
3
5
|
Build a terminal UI in TypeScript. One install, one import.
|
|
4
6
|
|
|
5
7
|
```bash
|
|
@@ -28,13 +30,9 @@ console.log('App exited');
|
|
|
28
30
|
|
|
29
31
|
## What this package is
|
|
30
32
|
|
|
31
|
-
The runtime ([`@textui/core`](https://
|
|
32
|
-
([`@textui/terminal`](https://github.com/softov/textui/tree/main/packages/terminal)), and `render`. Every other name here is
|
|
33
|
-
re-exported from those two - importing from them directly is the same thing
|
|
34
|
-
with a longer name.
|
|
33
|
+
The runtime ([`@textui/core`](https://www.npmjs.com/package/@textui/core)), a terminal to put it on ([`@textui/terminal`](https://www.npmjs.com/package/@textui/terminal)), and `render`. Every other name here is re-exported from those two - importing from them directly is the same thing with a longer name.
|
|
35
34
|
|
|
36
|
-
`render` mounts and keeps running. It returns a handle rather than a promise,
|
|
37
|
-
so the application is up before the next line:
|
|
35
|
+
`render` mounts and keeps running. It returns a handle rather than a promise, so the application is up before the next line:
|
|
38
36
|
|
|
39
37
|
| | |
|
|
40
38
|
|---|---|
|
|
@@ -43,18 +41,13 @@ so the application is up before the next line:
|
|
|
43
41
|
| `unmount()` | Stop, put the terminal back, resolve `waitUntilExit` |
|
|
44
42
|
| `rerender(node)` | Swap the root |
|
|
45
43
|
|
|
46
|
-
For one frame and no terminal - a report, `--help`, a test - use `renderOnce`
|
|
47
|
-
or `renderToString` instead. Those return; this one runs.
|
|
44
|
+
For one frame and no terminal - a report, `--help`, a test - use `renderOnce` or `renderToString` instead. Those return; this one runs.
|
|
48
45
|
|
|
49
46
|
## ctrl+c
|
|
50
47
|
|
|
51
|
-
Handled, and it has to be handled as a **key rather than a signal**. The
|
|
52
|
-
terminal is in raw mode from the moment the app starts, and raw mode is
|
|
53
|
-
exactly the mode where ctrl+c stops being SIGINT and becomes the byte `0x03` -
|
|
54
|
-
so process signal handlers never fire.
|
|
48
|
+
Handled, and it has to be handled as a **key rather than a signal**. The terminal is in raw mode from the moment the app starts, and raw mode is exactly the mode where ctrl+c stops being SIGINT and becomes the byte `0x03` - so process signal handlers never fire.
|
|
55
49
|
|
|
56
|
-
`exitOnCtrlC: false` gives you the key instead, which is what an editor with
|
|
57
|
-
unsaved work wants.
|
|
50
|
+
`exitOnCtrlC: false` gives you the key instead, which is what an editor with unsaved work wants.
|
|
58
51
|
|
|
59
52
|
## Components
|
|
60
53
|
|
|
@@ -68,14 +61,9 @@ npm install @textui/widgets
|
|
|
68
61
|
import { Card, Badge } from '@textui/widgets';
|
|
69
62
|
```
|
|
70
63
|
|
|
71
|
-
Nothing to register. `<Card/>` compiles to a node that carries the imported
|
|
72
|
-
function, and the runtime uses that in preference to any registry - so
|
|
73
|
-
importing a component *is* registering it. That is why the catalog is not
|
|
74
|
-
bundled here: a screen made of `Box` and `Text` should not carry eighty
|
|
75
|
-
components it never mentions.
|
|
64
|
+
Nothing to register. `<Card/>` compiles to a node that carries the imported function, and the runtime uses that in preference to any registry - so importing a component *is* registering it. That is why the catalog is not bundled here: a screen made of `Box` and `Text` should not carry eighty components it never mentions.
|
|
76
65
|
|
|
77
|
-
The one case that needs a registry is a screen named in data, where a string
|
|
78
|
-
has to resolve to something:
|
|
66
|
+
The one case that needs a registry is a screen named in data, where a string has to resolve to something:
|
|
79
67
|
|
|
80
68
|
```tsx
|
|
81
69
|
import { registerBuiltins } from '@textui/widgets';
|
|
@@ -85,9 +73,16 @@ render(<App />, { onBoot: registerBuiltins });
|
|
|
85
73
|
|
|
86
74
|
## Runtime
|
|
87
75
|
|
|
88
|
-
No dependencies outside the two packages it re-exports, and no `node:` imports
|
|
89
|
-
of its own. Node 22+ and Bun.
|
|
76
|
+
No dependencies outside the two packages it re-exports, and no `node:` imports of its own. Node 22+ and Bun.
|
|
90
77
|
|
|
91
78
|
## Documentation
|
|
92
79
|
|
|
93
80
|
<https://softov.github.io/textui/>
|
|
81
|
+
|
|
82
|
+
<!-- family -->
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
Part of **[TextUI](https://github.com/softov/textui)** - [documentation](https://softov.github.io/textui/) - [getting started](https://softov.github.io/textui/getting-started.html)
|
|
87
|
+
|
|
88
|
+
**`@textui/kit`** one install · [`@textui/core`](https://www.npmjs.com/package/@textui/core) the runtime · [`@textui/widgets`](https://www.npmjs.com/package/@textui/widgets) the catalog · [`@textui/terminal`](https://www.npmjs.com/package/@textui/terminal) adapters and input · [`@textui/testing`](https://www.npmjs.com/package/@textui/testing) the harness · [`@textui/cli`](https://www.npmjs.com/package/@textui/cli) the CLI
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textui/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "One install for TextUI - the runtime, a terminal, and render",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"terminal",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"import": "./dist/jsx-dev-runtime.js"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"@textui/terminal": "^0.1.0",
|
|
54
|
-
"@textui/core": "^0.1.0"
|
|
55
|
-
},
|
|
56
|
-
"publishConfig": {
|
|
57
|
-
"access": "public"
|
|
58
|
-
},
|
|
59
52
|
"scripts": {
|
|
60
53
|
"build": "tsc -p tsconfig.json",
|
|
61
54
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
|
|
62
55
|
"test": "vitest run"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@textui/core": "^0.3.0",
|
|
59
|
+
"@textui/terminal": "^0.3.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|