@xterm/xterm 6.1.0-beta.176 → 6.1.0-beta.178
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 +31 -10
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +1 -1
- package/lib/xterm.mjs.map +2 -2
- package/package.json +2 -2
- package/src/common/Version.ts +1 -1
- package/src/common/input/Keyboard.ts +7 -1
package/README.md
CHANGED
|
@@ -24,7 +24,36 @@ First, you need to install the module. We ship exclusively through [npm](https:/
|
|
|
24
24
|
npm install --save @xterm/xterm
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The recommended way to load xterm.js with the ES module syntax, either using TypeScript or a modern JS tooling. Note that both CommonJS and ES module files are shipped with the npm package.
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
import { Terminal } from '@xterm/xterm';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then instantiate a `Terminal` object, open it on an element and write to it:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
const term = new Terminal();
|
|
37
|
+
term.open(document.getElementById('terminal'));
|
|
38
|
+
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Most use cases will hook up input and output to a pseudoterminal API such as [node-pty](https://www.npmjs.com/package/node-pty) which will drive the terminal.
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
pty.onData(data => term.write(data));
|
|
45
|
+
term.onData(data => pty.write(data));
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then make sure to also include the `css/xterm.css` file, for example in HTML:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<link rel="stylesheet" href="node_modules/@xterm/xterm/css/xterm.css" />
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Standalone example
|
|
55
|
+
|
|
56
|
+
Here is a complete standalone example in a HTML file:
|
|
28
57
|
|
|
29
58
|
```html
|
|
30
59
|
<!doctype html>
|
|
@@ -36,7 +65,7 @@ To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to t
|
|
|
36
65
|
<body>
|
|
37
66
|
<div id="terminal"></div>
|
|
38
67
|
<script>
|
|
39
|
-
|
|
68
|
+
const term = new Terminal();
|
|
40
69
|
term.open(document.getElementById('terminal'));
|
|
41
70
|
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
|
|
42
71
|
</script>
|
|
@@ -44,14 +73,6 @@ To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to t
|
|
|
44
73
|
</html>
|
|
45
74
|
```
|
|
46
75
|
|
|
47
|
-
### Importing
|
|
48
|
-
|
|
49
|
-
The recommended way to load xterm.js is via the ES6 module syntax:
|
|
50
|
-
|
|
51
|
-
```javascript
|
|
52
|
-
import { Terminal } from '@xterm/xterm';
|
|
53
|
-
```
|
|
54
|
-
|
|
55
76
|
### Addons
|
|
56
77
|
|
|
57
78
|
Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon, you first need to install it in your project:
|