@cplieger/web-terminal-ui 2.1.4 → 3.0.1
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 +57 -32
- package/css/03-v3.css +590 -0
- package/css/MANIFEST +1 -0
- package/package.json +9 -5
- package/scaffold/index.html +8 -6
- package/src/composition.ts +15 -0
- package/src/features/activity-monitor.ts +64 -0
- package/src/features/animations.ts +29 -0
- package/src/features/clipboard.ts +98 -0
- package/src/features/connection-banner.ts +53 -0
- package/src/features/context-menu.ts +207 -0
- package/src/features/dom.ts +15 -0
- package/src/features/mobile-toolbar.ts +82 -0
- package/src/features/predictive-echo.ts +63 -0
- package/src/features/scroll-to-bottom.ts +49 -0
- package/src/features/tabs.ts +687 -0
- package/src/index.ts +30 -9
- package/src/kernel/a11y.ts +102 -0
- package/src/kernel/bus.ts +61 -0
- package/src/kernel/conn-state.ts +133 -0
- package/src/kernel/kernel.ts +688 -0
- package/src/kernel/regions.ts +119 -0
- package/src/kernel/types.ts +286 -0
- package/src/presets.ts +46 -0
- package/src/mount.ts +0 -903
- package/src/status.ts +0 -228
package/README.md
CHANGED
|
@@ -11,18 +11,25 @@ The reference touch-first browser UI for
|
|
|
11
11
|
that turns the engine's render/scroll/connection/keyboard modules into a
|
|
12
12
|
usable terminal on a phone as well as a desktop.
|
|
13
13
|
|
|
14
|
-
One `
|
|
15
|
-
element you provide
|
|
14
|
+
One `createTerminal(root, { features })` call builds the entire terminal UI
|
|
15
|
+
inside a single container element you provide. A small always-present kernel
|
|
16
|
+
(the display output, the hidden keyboard textarea, IME, engine wiring, the
|
|
17
|
+
sanitizing input funnel, connection-state, and named layout regions) composes
|
|
18
|
+
with opt-in feature modules that own everything above the raw terminal:
|
|
16
19
|
|
|
17
20
|
- a **display-only** terminal output (native text selection survives redraws)
|
|
18
|
-
|
|
21
|
+
and a hidden `<textarea>` that owns the keyboard and IME (the kernel)
|
|
22
|
+
- **tabs**: multiple independent terminals with a desktop strip, a mobile
|
|
23
|
+
bottom switcher, and a modal overview sheet
|
|
24
|
+
- an **activity monitor** that drives per-tab status dots (working / idle /
|
|
25
|
+
needs-input / exited) from the server's status stream
|
|
19
26
|
- a **mobile key toolbar** (Tab / Esc / arrows / Enter / sticky-Ctrl) and a
|
|
20
27
|
scroll-to-bottom control
|
|
21
|
-
- a **
|
|
22
|
-
-
|
|
23
|
-
- **IME / composition**
|
|
24
|
-
|
|
25
|
-
and font-load reflows
|
|
28
|
+
- a **context menu** (Copy / Select All / Paste), reachable by right-click and
|
|
29
|
+
by long-press on touch
|
|
30
|
+
- **predictive local echo**, **IME / composition** (CJK, dictation,
|
|
31
|
+
autocorrect), and **viewport + keyboard-inset** handling for the iOS soft
|
|
32
|
+
keyboard, rotation, and font-load reflows
|
|
26
33
|
- a connection-status banner and a copy toast
|
|
27
34
|
|
|
28
35
|
It is published as TypeScript source (no build step) to npm and JSR, alongside
|
|
@@ -43,8 +50,9 @@ pins the engine version explicitly.
|
|
|
43
50
|
|
|
44
51
|
Serve the bundled CSS (`css/` concatenated per `css/MANIFEST` into the
|
|
45
52
|
`style.css` your page links) plus a minimal HTML page that has one empty
|
|
46
|
-
container element for the terminal, then call `
|
|
47
|
-
module
|
|
53
|
+
container element for the terminal, then call `createTerminal(root, { features })`
|
|
54
|
+
from your entry module. Feature bundles (presets) live at the `./presets`
|
|
55
|
+
sub-path:
|
|
48
56
|
|
|
49
57
|
```html
|
|
50
58
|
<div id="terminal"></div>
|
|
@@ -53,45 +61,62 @@ module:
|
|
|
53
61
|
{
|
|
54
62
|
"imports": {
|
|
55
63
|
"@cplieger/web-terminal-engine": "/vendor/cplieger-web-terminal-engine/index.js",
|
|
56
|
-
"@cplieger/web-terminal-ui": "/vendor/cplieger-web-terminal-ui/index.js"
|
|
64
|
+
"@cplieger/web-terminal-ui": "/vendor/cplieger-web-terminal-ui/index.js",
|
|
65
|
+
"@cplieger/web-terminal-ui/presets": "/vendor/cplieger-web-terminal-ui/presets.js"
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
</script>
|
|
60
69
|
<script type="module">
|
|
61
|
-
import {
|
|
62
|
-
|
|
70
|
+
import { createTerminal } from "@cplieger/web-terminal-ui";
|
|
71
|
+
import { presetTabbed } from "@cplieger/web-terminal-ui/presets";
|
|
72
|
+
createTerminal(document.getElementById("terminal"), {
|
|
73
|
+
features: presetTabbed(),
|
|
63
74
|
loading: document.getElementById("loading"),
|
|
64
75
|
});
|
|
65
76
|
// or, for a server that exposes the WebSocket elsewhere / a custom font:
|
|
66
|
-
//
|
|
77
|
+
// createTerminal(root, { features: presetTabbed(), wsPath: "/api/shell/ws", fontReady: '14px "MyMono"' });
|
|
67
78
|
</script>
|
|
68
79
|
```
|
|
69
80
|
|
|
70
|
-
`
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
copy and adapt.
|
|
81
|
+
`createTerminal(root, opts?)` builds the entire terminal subtree (the kernel
|
|
82
|
+
plus every feature's chrome) inside `root` itself — there is no element-id
|
|
83
|
+
contract for the host page to reproduce. Call it exactly once; the engine's
|
|
84
|
+
render/connection/scroll modules are single-instance per page (tabs multiplex
|
|
85
|
+
sessions over the one kernel). `scaffold/index.html` is a complete reference page
|
|
86
|
+
to copy and adapt.
|
|
87
|
+
|
|
88
|
+
Three presets are provided (import from `@cplieger/web-terminal-ui/presets`); each
|
|
89
|
+
is a plain feature-array factory, so you can spread and edit it, or hand-pick
|
|
90
|
+
individual features instead:
|
|
91
|
+
|
|
92
|
+
- `presetSingle()` — single-pane desktop UI (context menu, clipboard,
|
|
93
|
+
scroll-to-bottom, predictive echo, connection banner).
|
|
94
|
+
- `presetTouch()` — `presetSingle()` plus the mobile key toolbar.
|
|
95
|
+
- `presetTabbed()` — the full reference UI: `presetTouch()` plus tabs, the
|
|
96
|
+
activity monitor, and animations. Requires a server that speaks the session
|
|
97
|
+
API (`/api/sessions`, the status SSE, and `/ws?session=`), such as
|
|
98
|
+
`web-terminal-server` or `vibecli`.
|
|
76
99
|
|
|
77
100
|
### Options
|
|
78
101
|
|
|
79
|
-
| Option | Default | Purpose
|
|
80
|
-
| ----------- | -------------------------- |
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
102
|
+
| Option | Default | Purpose |
|
|
103
|
+
| ----------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
104
|
+
| `features` | _(none — bare kernel)_ | The feature list. Omitted or empty builds only the terminal (no chrome). Use a preset from `./presets` or a hand-picked array. |
|
|
105
|
+
| `wsPath` | `"/ws"` | WebSocket endpoint path the engine connects to. |
|
|
106
|
+
| `fontReady` | `'14px "MonaspiceNe NFM"'` | CSS font shorthand awaited before the first resize, so the server is sized against the real web font's cell metrics rather than a fallback. |
|
|
107
|
+
| `loading` | _(none)_ | A pre-JS loading overlay element (kept in your served HTML so it paints before this module loads); it is faded out and removed once the first frame renders. |
|
|
84
108
|
|
|
85
|
-
`
|
|
86
|
-
(and opens the soft keyboard on touch)
|
|
109
|
+
`createTerminal()` returns a handle: `focus()` re-focuses the terminal input
|
|
110
|
+
(and opens the soft keyboard on touch), and `destroy()` tears every feature down
|
|
111
|
+
and releases the kernel.
|
|
87
112
|
|
|
88
113
|
## What ships
|
|
89
114
|
|
|
90
|
-
| Path | Purpose
|
|
91
|
-
| ------------------------ |
|
|
92
|
-
| `src
|
|
93
|
-
| `css/*.css` + `MANIFEST` | The default theme + layout; concatenate in MANIFEST order.
|
|
94
|
-
| `scaffold/index.html` | A reference HTML page: `<head>` + one empty root element + importmap.
|
|
115
|
+
| Path | Purpose |
|
|
116
|
+
| ------------------------ | --------------------------------------------------------------------------------------------------------------- |
|
|
117
|
+
| `src/**/*.ts` | The UI modules: the kernel (`kernel/`), opt-in features (`features/`), presets, IME, predictive echo, viewport. |
|
|
118
|
+
| `css/*.css` + `MANIFEST` | The default theme + layout; concatenate in MANIFEST order. |
|
|
119
|
+
| `scaffold/index.html` | A reference HTML page: `<head>` + one empty root element + importmap. |
|
|
95
120
|
|
|
96
121
|
## Related projects
|
|
97
122
|
|