@battlefieldduck/xterm-svelte 2.0.0 → 2.1.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 +23 -3
- package/dist/Xterm.svelte +2 -1
- package/dist/Xterm.svelte.d.ts +2 -1
- package/dist/XtermProps.d.ts +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Xterm Svelte
|
|
2
2
|
|
|
3
3
|
<img align="right" width="100" height="100" src="https://github.com/BattlefieldDuck/xterm-svelte/assets/29337428/e1055940-ae66-48b5-9a1f-1965949b5757">
|
|
4
4
|
|
|
@@ -20,6 +20,8 @@ Check it out: https://xterm-svelte.pages.dev
|
|
|
20
20
|
| 2.x.x | Svelte 5 | [`main`](https://github.com/BattlefieldDuck/xterm-svelte) | https://xterm-svelte.pages.dev |
|
|
21
21
|
| 1.x.x | Svelte 4 | [`svelte4`](https://github.com/BattlefieldDuck/xterm-svelte/tree/svelte4) | https://svelte4.xterm-svelte.pages.dev |
|
|
22
22
|
|
|
23
|
+
For details on migrating from version 1.x.x to 2.x.x, refer to the [Migration Guide](https://github.com/BattlefieldDuck/xterm-svelte/releases/tag/2.0.0).
|
|
24
|
+
|
|
23
25
|
## Features
|
|
24
26
|
|
|
25
27
|
- **Full integration with SvelteKit**
|
|
@@ -55,11 +57,13 @@ Here's a basic example of how to use xterm-svelte in your SvelteKit application:
|
|
|
55
57
|
Terminal
|
|
56
58
|
} from '@battlefieldduck/xterm-svelte';
|
|
57
59
|
|
|
60
|
+
let terminal: Terminal;
|
|
61
|
+
|
|
58
62
|
let options: ITerminalOptions & ITerminalInitOnlyOptions = {
|
|
59
63
|
fontFamily: 'Consolas'
|
|
60
64
|
};
|
|
61
65
|
|
|
62
|
-
async function onLoad(
|
|
66
|
+
async function onLoad() {
|
|
63
67
|
console.log('Child component has loaded');
|
|
64
68
|
|
|
65
69
|
// FitAddon Usage
|
|
@@ -79,9 +83,25 @@ Here's a basic example of how to use xterm-svelte in your SvelteKit application:
|
|
|
79
83
|
}
|
|
80
84
|
</script>
|
|
81
85
|
|
|
82
|
-
<Xterm {options} {onLoad} {onData} {onKey} />
|
|
86
|
+
<Xterm bind:terminal {options} {onLoad} {onData} {onKey} />
|
|
83
87
|
```
|
|
84
88
|
|
|
89
|
+
## FAQ
|
|
90
|
+
|
|
91
|
+
### When should I use `onLoad()`?
|
|
92
|
+
|
|
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
|
+
|
|
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
|
+
## Real-world uses
|
|
100
|
+
|
|
101
|
+
- [Thymis](https://thymis.io): Thymis is an open-source project that aims to provide a seamless and secure IoT device management solution.
|
|
102
|
+
With Thymis, users can easily configure and manage their devices running on the NixOS operating system.
|
|
103
|
+
- [And much more...](https://github.com/BattlefieldDuck/xterm-svelte/network/dependents)
|
|
104
|
+
|
|
85
105
|
## Contributing
|
|
86
106
|
Contributions are welcome! Please feel free to submit pull requests or open issues.
|
|
87
107
|
|
package/dist/Xterm.svelte
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
let parent = $state<HTMLElement>();
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
|
+
terminal = $bindable(),
|
|
9
10
|
options,
|
|
10
11
|
onBell,
|
|
11
12
|
onBinary,
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
|
|
26
27
|
onMount(async () => {
|
|
27
28
|
const { Terminal } = await import('@xterm/xterm');
|
|
28
|
-
const terminal = new Terminal(options);
|
|
29
29
|
|
|
30
|
+
terminal = new Terminal(options);
|
|
30
31
|
terminal.onBell(() => onBell?.());
|
|
31
32
|
terminal.onBinary((data) => onBinary?.(data));
|
|
32
33
|
terminal.onCursorMove(() => onCursorMove?.());
|
package/dist/Xterm.svelte.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@xterm/xterm/css/xterm.css';
|
|
2
2
|
import type { XtermProps } from './index.js';
|
|
3
|
-
declare const Xterm: import("svelte").Component<XtermProps, {}, "">;
|
|
3
|
+
declare const Xterm: import("svelte").Component<XtermProps, {}, "terminal">;
|
|
4
|
+
type Xterm = ReturnType<typeof Xterm>;
|
|
4
5
|
export default Xterm;
|
package/dist/XtermProps.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import type { Terminal } from "@xterm/xterm";
|
|
|
2
2
|
import type { ITerminalOptions, ITerminalInitOnlyOptions } from './index.js';
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
4
|
export type XtermProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Represents an xterm.js terminal.
|
|
7
|
+
*/
|
|
8
|
+
terminal?: Terminal;
|
|
9
|
+
/**
|
|
10
|
+
* An object containing options for the terminal.
|
|
11
|
+
*/
|
|
5
12
|
options?: ITerminalOptions & ITerminalInitOnlyOptions;
|
|
6
13
|
/**
|
|
7
14
|
* Adds an event listener for when the bell is triggered.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battlefieldduck/xterm-svelte",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
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
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"!dist/**/*.spec.*"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"svelte": "^
|
|
47
|
+
"svelte": "^5.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@playwright/test": "^1.28.1",
|