@battlefieldduck/xterm-svelte 2.1.0 → 2.1.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 +10 -11
- package/dist/Xterm.svelte +3 -3
- package/dist/XtermProps.d.ts +2 -2
- package/package.json +43 -40
package/README.md
CHANGED
|
@@ -57,9 +57,9 @@ Here's a basic example of how to use xterm-svelte in your SvelteKit application:
|
|
|
57
57
|
Terminal
|
|
58
58
|
} from '@battlefieldduck/xterm-svelte';
|
|
59
59
|
|
|
60
|
-
let terminal
|
|
60
|
+
let terminal = $state<Terminal>();
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
const options: ITerminalOptions & ITerminalInitOnlyOptions = {
|
|
63
63
|
fontFamily: 'Consolas'
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -68,10 +68,10 @@ Here's a basic example of how to use xterm-svelte in your SvelteKit application:
|
|
|
68
68
|
|
|
69
69
|
// FitAddon Usage
|
|
70
70
|
const fitAddon = new (await XtermAddon.FitAddon()).FitAddon();
|
|
71
|
-
terminal
|
|
71
|
+
terminal?.loadAddon(fitAddon);
|
|
72
72
|
fitAddon.fit();
|
|
73
73
|
|
|
74
|
-
terminal
|
|
74
|
+
terminal?.write('Hello World');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function onData(data: string) {
|
|
@@ -92,23 +92,22 @@ Here's a basic example of how to use xterm-svelte in your SvelteKit application:
|
|
|
92
92
|
|
|
93
93
|
The `onLoad()` function fires when the xterm terminal is first initialized. You can use this function to perform actions such as initializing xterm addons.
|
|
94
94
|
|
|
95
|
-
### Why is the `terminal` undefined?
|
|
96
|
-
|
|
97
|
-
One possible cause is that you called the `terminal` function before it was initialized. For example, if you run the `terminal` function in the `onMount` function without wrapping it with `if (terminal !== undefined)`, it can lead to this issue.
|
|
98
|
-
|
|
99
95
|
## Real-world uses
|
|
100
|
-
|
|
101
|
-
- [
|
|
102
|
-
|
|
96
|
+
- [Bitor](https://github.com/bitorscanner/Bitor): Bitor Scanning Software
|
|
97
|
+
- [Asm editor](https://github.com/Specy/asm-editor): A modern webapp to write, run and learn M68K, MIPS, RISC-V, X86 assembly
|
|
98
|
+
- [Sylve](https://github.com/AlchemillaHQ/Sylve): Lightweight GUI for managing Bhyve, Jails, ZFS, networking, and more on FreeBSD
|
|
103
99
|
- [And much more...](https://github.com/BattlefieldDuck/xterm-svelte/network/dependents)
|
|
104
100
|
|
|
105
101
|
## Contributing
|
|
102
|
+
|
|
106
103
|
Contributions are welcome! Please feel free to submit pull requests or open issues.
|
|
107
104
|
|
|
108
105
|

|
|
109
106
|
|
|
110
107
|
## License
|
|
108
|
+
|
|
111
109
|
xterm-svelte is licensed under the MIT License. See the `LICENSE` file for more details.
|
|
112
110
|
|
|
113
111
|
## Stargazers over time
|
|
112
|
+
|
|
114
113
|
[](https://starchart.cc/BattlefieldDuck/xterm-svelte)
|
package/dist/Xterm.svelte
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '@xterm/xterm/css/xterm.css';
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
|
-
import type { XtermProps } from './index.js';
|
|
4
|
+
import type { Terminal, XtermProps } from './index.js';
|
|
5
5
|
|
|
6
6
|
let parent = $state<HTMLElement>();
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
|
-
terminal = $bindable(),
|
|
9
|
+
terminal = $bindable<Terminal | undefined>(),
|
|
10
10
|
options,
|
|
11
11
|
onBell,
|
|
12
12
|
onBinary,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}: XtermProps = $props();
|
|
26
26
|
|
|
27
27
|
onMount(async () => {
|
|
28
|
-
const
|
|
28
|
+
const Terminal = (await import('@xterm/xterm')).Terminal;
|
|
29
29
|
|
|
30
30
|
terminal = new Terminal(options);
|
|
31
31
|
terminal.onBell(() => onBell?.());
|
package/dist/XtermProps.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Terminal } from
|
|
1
|
+
import type { Terminal } from '@xterm/xterm';
|
|
2
2
|
import type { ITerminalOptions, ITerminalInitOnlyOptions } from './index.js';
|
|
3
|
-
import type { HTMLAttributes } from
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
export type XtermProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Represents an xterm.js terminal.
|
package/package.json
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battlefieldduck/xterm-svelte",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A SvelteKit wrapper for Xterm.js, enabling terminal embedding in SvelteKit apps, managing Xterm addons, and providing seamless updates with the latest SvelteKit and Xterm.js versions.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"svelte",
|
|
7
|
-
"xterm",
|
|
8
|
-
"xterm-js",
|
|
9
|
-
"sveltekit",
|
|
10
|
-
"xterm-svelte"
|
|
11
|
-
],
|
|
12
5
|
"repository": {
|
|
13
6
|
"type": "git",
|
|
14
7
|
"url": "git+https://github.com/BattlefieldDuck/xterm-svelte.git"
|
|
@@ -20,57 +13,67 @@
|
|
|
20
13
|
"license": "MIT",
|
|
21
14
|
"scripts": {
|
|
22
15
|
"dev": "vite dev",
|
|
23
|
-
"build": "vite build && npm run
|
|
16
|
+
"build": "vite build && npm run prepack",
|
|
24
17
|
"preview": "vite preview",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"test": "npm run test:integration && npm run test:unit",
|
|
18
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
19
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
28
20
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
29
21
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
30
|
-
"lint": "prettier --check . && eslint .",
|
|
31
22
|
"format": "prettier --write .",
|
|
32
|
-
"
|
|
33
|
-
"test:
|
|
23
|
+
"lint": "prettier --check . && eslint .",
|
|
24
|
+
"test:e2e": "playwright test",
|
|
25
|
+
"test": "npm run test:e2e"
|
|
34
26
|
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"!dist/**/*.test.*",
|
|
30
|
+
"!dist/**/*.spec.*"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"**/*.css"
|
|
34
|
+
],
|
|
35
|
+
"svelte": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"type": "module",
|
|
35
38
|
"exports": {
|
|
36
39
|
".": {
|
|
37
40
|
"types": "./dist/index.d.ts",
|
|
38
41
|
"svelte": "./dist/index.js"
|
|
39
42
|
}
|
|
40
43
|
},
|
|
41
|
-
"files": [
|
|
42
|
-
"dist",
|
|
43
|
-
"!dist/**/*.test.*",
|
|
44
|
-
"!dist/**/*.spec.*"
|
|
45
|
-
],
|
|
46
44
|
"peerDependencies": {
|
|
47
45
|
"svelte": "^5.0.0"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
48
|
+
"@eslint/compat": "^1.2.5",
|
|
49
|
+
"@eslint/js": "^9.22.0",
|
|
50
|
+
"@playwright/test": "^1.49.1",
|
|
51
|
+
"@sveltejs/adapter-auto": "^6.0.0",
|
|
52
|
+
"@sveltejs/kit": "^2.22.0",
|
|
53
53
|
"@sveltejs/package": "^2.0.0",
|
|
54
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
55
|
-
"@types/
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"eslint": "^
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"prettier": "^3.
|
|
62
|
-
"
|
|
63
|
-
"publint": "^0.2.7",
|
|
54
|
+
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
55
|
+
"@types/node": "^24",
|
|
56
|
+
"eslint": "^9.22.0",
|
|
57
|
+
"eslint-config-prettier": "^10.0.1",
|
|
58
|
+
"eslint-plugin-svelte": "^3.0.0",
|
|
59
|
+
"globals": "^16.0.0",
|
|
60
|
+
"prettier": "^3.4.2",
|
|
61
|
+
"prettier-plugin-svelte": "^3.3.3",
|
|
62
|
+
"publint": "^0.3.2",
|
|
64
63
|
"svelte": "^5.0.0",
|
|
65
64
|
"svelte-check": "^4.0.0",
|
|
66
|
-
"
|
|
67
|
-
"typescript": "^
|
|
68
|
-
"vite": "^
|
|
69
|
-
"
|
|
65
|
+
"typescript": "^5.0.0",
|
|
66
|
+
"typescript-eslint": "^8.20.0",
|
|
67
|
+
"vite": "^7.0.4",
|
|
68
|
+
"vite-plugin-devtools-json": "^1.0.0"
|
|
70
69
|
},
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
"keywords": [
|
|
71
|
+
"svelte",
|
|
72
|
+
"xterm",
|
|
73
|
+
"xterm-js",
|
|
74
|
+
"sveltekit",
|
|
75
|
+
"xterm-svelte"
|
|
76
|
+
],
|
|
74
77
|
"dependencies": {
|
|
75
78
|
"@xterm/addon-attach": "^0.11.0",
|
|
76
79
|
"@xterm/addon-canvas": "^0.7.0",
|