@battlefieldduck/xterm-svelte 2.1.0 → 2.2.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 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: Terminal;
60
+ let terminal = $state<Terminal>();
61
61
 
62
- let options: ITerminalOptions & ITerminalInitOnlyOptions = {
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.loadAddon(fitAddon);
71
+ terminal?.loadAddon(fitAddon);
72
72
  fitAddon.fit();
73
73
 
74
- terminal.write('Hello World');
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
- - [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.
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
  ![https://github.com/BattlefieldDuck/xterm-svelte/graphs/contributors](https://contrib.rocks/image?repo=BattlefieldDuck/xterm-svelte)
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
  [![Stargazers over time](https://starchart.cc/BattlefieldDuck/xterm-svelte.svg?variant=adaptive)](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 { Terminal } = await import('@xterm/xterm');
28
+ const Terminal = (await import('@xterm/xterm')).Terminal;
29
29
 
30
30
  terminal = new Terminal(options);
31
31
  terminal.onBell(() => onBell?.());
@@ -10,15 +10,6 @@ export declare class XtermAddon {
10
10
  default: typeof import("@xterm/addon-attach");
11
11
  AttachAddon: typeof import("@xterm/addon-attach").AttachAddon;
12
12
  }>;
13
- /**
14
- * Dynamically imports the 'canvas' addon from `@xterm/addon-canvas`.
15
- * For more details, visit: https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas
16
- * @returns A promise that resolves to the 'canvas' addon module.
17
- */
18
- static CanvasAddon: () => Promise<{
19
- default: typeof import("@xterm/addon-canvas");
20
- CanvasAddon: typeof import("@xterm/addon-canvas").CanvasAddon;
21
- }>;
22
13
  /**
23
14
  * Dynamically imports the 'clipboard' addon from `@xterm/addon-clipboard`.
24
15
  * @returns A promise that resolves to the 'clipboard' addon module.
@@ -53,6 +44,14 @@ export declare class XtermAddon {
53
44
  *
54
45
  * @returns A promise that resolves to the 'ligatures' addon module.
55
46
  */
47
+ /**
48
+ * Dynamically imports the 'progress' addon from `@xterm/addon-progress`.
49
+ * @returns A promise that resolves to the 'progress' addon module.
50
+ */
51
+ static ProgressAddon: () => Promise<{
52
+ default: typeof import("@xterm/addon-progress");
53
+ ProgressAddon: typeof import("@xterm/addon-progress").ProgressAddon;
54
+ }>;
56
55
  /**
57
56
  * Dynamically imports the 'search' addon from `@xterm/addon-search`.
58
57
  * @returns A promise that resolves to the 'search' addon module.
@@ -7,12 +7,6 @@ export class XtermAddon {
7
7
  * @returns A promise that resolves to the 'attach' addon module.
8
8
  */
9
9
  static AttachAddon = async () => await import('@xterm/addon-attach');
10
- /**
11
- * Dynamically imports the 'canvas' addon from `@xterm/addon-canvas`.
12
- * For more details, visit: https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas
13
- * @returns A promise that resolves to the 'canvas' addon module.
14
- */
15
- static CanvasAddon = async () => await import('@xterm/addon-canvas');
16
10
  /**
17
11
  * Dynamically imports the 'clipboard' addon from `@xterm/addon-clipboard`.
18
12
  * @returns A promise that resolves to the 'clipboard' addon module.
@@ -43,6 +37,11 @@ export class XtermAddon {
43
37
  // }
44
38
  // return await import('@xterm/addon-ligatures');
45
39
  // }
40
+ /**
41
+ * Dynamically imports the 'progress' addon from `@xterm/addon-progress`.
42
+ * @returns A promise that resolves to the 'progress' addon module.
43
+ */
44
+ static ProgressAddon = async () => await import('@xterm/addon-progress');
46
45
  /**
47
46
  * Dynamically imports the 'search' addon from `@xterm/addon-search`.
48
47
  * @returns A promise that resolves to the 'search' addon module.
@@ -1,8 +1,8 @@
1
1
  export type * from '@xterm/addon-attach';
2
- export type * from '@xterm/addon-canvas';
3
2
  export type * from '@xterm/addon-clipboard';
4
3
  export type * from '@xterm/addon-fit';
5
4
  export type * from '@xterm/addon-image';
5
+ export type * from '@xterm/addon-progress';
6
6
  export type * from '@xterm/addon-search';
7
7
  export type * from '@xterm/addon-serialize';
8
8
  export type * from '@xterm/addon-unicode11';
@@ -1,6 +1,6 @@
1
- import type { Terminal } from "@xterm/xterm";
1
+ import type { Terminal } from '@xterm/xterm';
2
2
  import type { ITerminalOptions, ITerminalInitOnlyOptions } from './index.js';
3
- import type { HTMLAttributes } from "svelte/elements";
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.0",
3
+ "version": "2.2.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
- "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,68 +13,78 @@
20
13
  "license": "MIT",
21
14
  "scripts": {
22
15
  "dev": "vite dev",
23
- "build": "vite build && npm run package",
16
+ "build": "vite build && npm run prepack",
24
17
  "preview": "vite preview",
25
- "package": "svelte-kit sync && svelte-package && publint",
26
- "prepublishOnly": "npm run package",
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
- "test:integration": "playwright test",
33
- "test:unit": "vitest"
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
- "svelte": "^5.0.0"
45
+ "svelte": "^5.46.0"
48
46
  },
49
47
  "devDependencies": {
50
- "@playwright/test": "^1.28.1",
51
- "@sveltejs/adapter-auto": "^3.0.0",
52
- "@sveltejs/kit": "^2.5.27",
53
- "@sveltejs/package": "^2.0.0",
54
- "@sveltejs/vite-plugin-svelte": "^4.0.0",
55
- "@types/eslint": "^8.56.0",
56
- "@typescript-eslint/eslint-plugin": "^7.7.1",
57
- "@typescript-eslint/parser": "^7.7.1",
58
- "eslint": "^8.56.0",
59
- "eslint-config-prettier": "^9.1.0",
60
- "eslint-plugin-svelte": "^2.45.1",
61
- "prettier": "^3.1.1",
62
- "prettier-plugin-svelte": "^3.2.6",
63
- "publint": "^0.2.7",
64
- "svelte": "^5.0.0",
65
- "svelte-check": "^4.0.0",
66
- "tslib": "^2.4.1",
67
- "typescript": "^5.5.0",
68
- "vite": "^5.4.4",
69
- "vitest": "^2.0.3"
48
+ "@eslint/compat": "^2.0.0",
49
+ "@eslint/js": "^9.39.2",
50
+ "@playwright/test": "^1.57.0",
51
+ "@sveltejs/adapter-auto": "^7.0.0",
52
+ "@sveltejs/kit": "^2.49.2",
53
+ "@sveltejs/package": "^2.5.7",
54
+ "@sveltejs/vite-plugin-svelte": "^6.2.1",
55
+ "@types/node": "^25.0.3",
56
+ "eslint": "^9.39.2",
57
+ "eslint-config-prettier": "^10.1.8",
58
+ "eslint-plugin-svelte": "^3.13.1",
59
+ "globals": "^16.5.0",
60
+ "prettier": "^3.7.4",
61
+ "prettier-plugin-svelte": "^3.4.1",
62
+ "publint": "^0.3.16",
63
+ "svelte": "^5.46.0",
64
+ "svelte-check": "^4.3.5",
65
+ "typescript": "^5.9.3",
66
+ "typescript-eslint": "^8.50.1",
67
+ "vite": "^7.3.0",
68
+ "vite-plugin-devtools-json": "^1.0.0"
70
69
  },
71
- "svelte": "./dist/index.js",
72
- "types": "./dist/index.d.ts",
73
- "type": "module",
70
+ "keywords": [
71
+ "svelte",
72
+ "xterm",
73
+ "xterm-js",
74
+ "sveltekit",
75
+ "xterm-svelte"
76
+ ],
74
77
  "dependencies": {
75
- "@xterm/addon-attach": "^0.11.0",
76
- "@xterm/addon-canvas": "^0.7.0",
77
- "@xterm/addon-clipboard": "^0.1.0",
78
- "@xterm/addon-fit": "^0.10.0",
79
- "@xterm/addon-image": "^0.8.0",
80
- "@xterm/addon-search": "^0.15.0",
81
- "@xterm/addon-serialize": "^0.13.0",
82
- "@xterm/addon-unicode11": "^0.8.0",
83
- "@xterm/addon-web-links": "^0.11.0",
84
- "@xterm/addon-webgl": "^0.18.0",
85
- "@xterm/xterm": "^5.5.0"
78
+ "@xterm/addon-attach": "^0.12.0",
79
+ "@xterm/addon-clipboard": "^0.2.0",
80
+ "@xterm/addon-fit": "^0.11.0",
81
+ "@xterm/addon-image": "^0.9.0",
82
+ "@xterm/addon-progress": "^0.2.0",
83
+ "@xterm/addon-search": "^0.16.0",
84
+ "@xterm/addon-serialize": "^0.14.0",
85
+ "@xterm/addon-unicode11": "^0.9.0",
86
+ "@xterm/addon-web-links": "^0.12.0",
87
+ "@xterm/addon-webgl": "^0.19.0",
88
+ "@xterm/xterm": "^6.0.0"
86
89
  }
87
90
  }