termweb 0.8.11 → 0.9.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 +86 -13
- package/lib/index.js +13 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ Web browser in your terminal using Kitty graphics protocol.
|
|
|
8
8
|
|
|
9
9
|
## Demo: CLI - browsing the web in terminal
|
|
10
10
|
|
|
11
|
-
https://github.com/user-attachments/assets/
|
|
11
|
+
https://github.com/user-attachments/assets/4019aaa6-754a-4793-9ce7-08da66f20790
|
|
12
|
+
|
|
12
13
|
|
|
13
14
|
## Demo: SDK: building apps with termweb as render engine
|
|
14
15
|
|
|
@@ -97,27 +98,68 @@ termweb.open('https://vscode.dev', {
|
|
|
97
98
|
if (termweb.isAvailable()) {
|
|
98
99
|
termweb.open('https://example.com');
|
|
99
100
|
}
|
|
101
|
+
|
|
102
|
+
// Load a Chrome extension
|
|
103
|
+
termweb.open('https://example.com', {
|
|
104
|
+
extensionPath: '/path/to/unpacked/extension',
|
|
105
|
+
});
|
|
100
106
|
```
|
|
101
107
|
|
|
108
|
+
### Chrome Extensions
|
|
109
|
+
|
|
110
|
+
You can inject unpacked Chrome extensions to extend browser capabilities:
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
// Ad blocker extension
|
|
114
|
+
termweb.open('https://example.com', {
|
|
115
|
+
extensionPath: '/path/to/ublock-origin',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Custom content scripts
|
|
119
|
+
termweb.open('https://myapp.com', {
|
|
120
|
+
extensionPath: './extensions/custom-injector',
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Extensions can provide:
|
|
125
|
+
- **Content Scripts** - Inject custom JS/CSS into pages
|
|
126
|
+
- **Ad Blocking** - Block ads and trackers
|
|
127
|
+
- **Authentication** - Auto-fill credentials or handle OAuth
|
|
128
|
+
- **Page Manipulation** - Modify DOM, intercept requests
|
|
129
|
+
- **Custom APIs** - Expose additional functionality to pages
|
|
130
|
+
|
|
131
|
+
> **Note:** termweb creates a temporary Chrome profile in `/tmp/termweb-profile-*` that is cleaned up on each launch. Extensions are loaded fresh each session via the `--load-extension` flag, so extension state (settings, data) does not persist between sessions.
|
|
132
|
+
|
|
102
133
|
## Controls
|
|
103
134
|
|
|
104
135
|
### Keyboard
|
|
105
136
|
|
|
106
|
-
> **Note:**
|
|
137
|
+
> **Note:** All shortcuts use `Ctrl` on both macOS and Linux
|
|
107
138
|
|
|
108
139
|
| Key | Action |
|
|
109
140
|
|-----|--------|
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
141
|
+
| `Ctrl+Q` | Quit |
|
|
142
|
+
| `Ctrl+L` | Focus address bar |
|
|
143
|
+
| `Ctrl+R` | Reload page |
|
|
144
|
+
| `Ctrl+[` | Go back |
|
|
145
|
+
| `Ctrl+]` | Go forward |
|
|
146
|
+
| `Ctrl+.` | Stop loading |
|
|
147
|
+
| `Ctrl+T` | Show tab picker |
|
|
148
|
+
| `Ctrl+C` | Copy selection |
|
|
149
|
+
| `Ctrl+X` | Cut selection |
|
|
150
|
+
| `Ctrl+V` | Paste |
|
|
151
|
+
| `Ctrl+A` | Select all |
|
|
152
|
+
| `Ctrl+H` | Hint mode (Vimium-style click navigation) |
|
|
153
|
+
| `Ctrl+J` | Scroll down |
|
|
154
|
+
| `Ctrl+K` | Scroll up |
|
|
155
|
+
|
|
156
|
+
### Hint Mode (Vimium-style)
|
|
157
|
+
|
|
158
|
+
Press `Ctrl+H` to enter hint mode. Yellow labels appear on all clickable elements (links, buttons, inputs). Type the label letters to click that element. Press `Escape` to cancel.
|
|
159
|
+
|
|
160
|
+
- Labels are sequential: a-z, then aa-zz, then aaa-zzz
|
|
161
|
+
- Type partial labels to filter visible hints
|
|
162
|
+
- After 300ms pause with an exact match, auto-clicks
|
|
121
163
|
|
|
122
164
|
### Mouse
|
|
123
165
|
- **Click** - Interact with page elements (links, buttons, inputs)
|
|
@@ -129,6 +171,37 @@ if (termweb.isAvailable()) {
|
|
|
129
171
|
- Click the tab button in toolbar (shows tab count)
|
|
130
172
|
- Native OS dialog appears to select tabs (AppleScript on macOS, zenity on Linux)
|
|
131
173
|
|
|
174
|
+
## Terminal Apps
|
|
175
|
+
|
|
176
|
+
Pre-built terminal applications powered by termweb:
|
|
177
|
+
|
|
178
|
+
### @termweb/code
|
|
179
|
+
|
|
180
|
+
Full-featured code editor with syntax highlighting for 20+ languages.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npx @termweb/code ./src/index.js
|
|
184
|
+
npx @termweb/code ~/projects/app/main.py
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### @termweb/markdown
|
|
188
|
+
|
|
189
|
+
Markdown editor with live preview pane.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npx @termweb/markdown ./README.md
|
|
193
|
+
npx @termweb/markdown ~/docs/notes.md
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### @termweb/json
|
|
197
|
+
|
|
198
|
+
JSON editor with validation, formatting, and key sorting.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx @termweb/json ./package.json
|
|
202
|
+
npx @termweb/json ~/config/settings.json
|
|
203
|
+
```
|
|
204
|
+
|
|
132
205
|
## Documentation
|
|
133
206
|
|
|
134
207
|
- [Installation Guide](INSTALLATION.md) - Setup instructions and dependencies
|
package/lib/index.js
CHANGED
|
@@ -40,15 +40,26 @@ for (const modulePath of searchPaths) {
|
|
|
40
40
|
* @param {string} url - URL to open
|
|
41
41
|
* @param {Object} [options] - Options
|
|
42
42
|
* @param {boolean} [options.toolbar=true] - Show navigation toolbar
|
|
43
|
+
* @param {boolean} [options.hotkeys=true] - Enable keyboard shortcuts (Ctrl+L, Ctrl+R, etc.)
|
|
44
|
+
* @param {boolean} [options.hints=true] - Enable Ctrl+H hint mode (Vimium-style navigation)
|
|
43
45
|
* @param {boolean} [options.mobile=false] - Use mobile viewport
|
|
44
46
|
* @param {number} [options.scale=1.0] - Page zoom scale
|
|
45
47
|
* @param {boolean} [options.noProfile=false] - Start with fresh profile
|
|
48
|
+
* @returns {Promise<void>}
|
|
46
49
|
*/
|
|
47
50
|
function open(url, options = {}) {
|
|
48
51
|
if (!native) {
|
|
49
|
-
|
|
52
|
+
return Promise.reject(new Error('Native module not found. Build with: zig build'));
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
// Wrap synchronous blocking call in a Promise
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
try {
|
|
57
|
+
native.open(url, options);
|
|
58
|
+
resolve();
|
|
59
|
+
} catch (err) {
|
|
60
|
+
reject(err);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "termweb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Web browser in your terminal using Kitty graphics protocol. SDK for building terminal apps with web technologies.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"cli",
|
|
25
25
|
"web"
|
|
26
26
|
],
|
|
27
|
-
"author": "
|
|
27
|
+
"author": "teamchong",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
"arm64"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {}
|
|
48
|
-
}
|
|
48
|
+
}
|