Skip to content

Commit e03b811

Browse files
Merge pull request #99 from BattlefieldDuck/svelte5
Add support for additional XtermProps
2 parents aea095a + 6c3cfff commit e03b811

File tree

7 files changed

+43
-129
lines changed

7 files changed

+43
-129
lines changed

package-lock.json

-116
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"@sveltejs/package": "^2.0.0",
5454
"@sveltejs/vite-plugin-svelte": "^4.0.0",
5555
"@types/eslint": "^8.56.0",
56-
"@types/node": "^22.8.7",
5756
"@typescript-eslint/eslint-plugin": "^7.7.1",
5857
"@typescript-eslint/parser": "^7.7.1",
5958
"eslint": "^8.56.0",
@@ -78,7 +77,6 @@
7877
"@xterm/addon-clipboard": "^0.1.0",
7978
"@xterm/addon-fit": "^0.10.0",
8079
"@xterm/addon-image": "^0.8.0",
81-
"@xterm/addon-ligatures": "^0.9.0",
8280
"@xterm/addon-search": "^0.15.0",
8381
"@xterm/addon-serialize": "^0.13.0",
8482
"@xterm/addon-unicode11": "^0.8.0",

src/lib/Xterm.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
onScroll,
2020
onSelectionChange,
2121
onTitleChange,
22-
onLoad
22+
onLoad,
23+
...rest
2324
}: XtermProps = $props();
2425
2526
onMount(async () => {
@@ -48,4 +49,4 @@
4849
});
4950
</script>
5051

51-
<div bind:this={parent}></div>
52+
<div bind:this={parent} {...rest}></div>

src/lib/XtermAddon.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ export class XtermAddon {
4040
*
4141
* @returns A promise that resolves to the 'ligatures' addon module.
4242
*/
43-
static LigaturesAddon = async () => {
44-
if (typeof process === 'undefined' || process.versions == null || process.versions.node == null) {
45-
// This is not a Node.js environment
46-
throw new Error('This module can only be imported in a Node.js environment');
47-
}
43+
// static LigaturesAddon = async () => {
44+
// // @ts-ignore
45+
// if (typeof process === 'undefined' || process.versions == null || process.versions.node == null) {
46+
// // This is not a Node.js environment
47+
// throw new Error('This module can only be imported in a Node.js environment');
48+
// }
4849

49-
return await import('@xterm/addon-ligatures');
50-
}
50+
// return await import('@xterm/addon-ligatures');
51+
// }
5152

5253
/**
5354
* Dynamically imports the 'search' addon from `@xterm/addon-search`.

src/lib/XtermAddonType.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type * from '@xterm/addon-canvas';
33
export type * from '@xterm/addon-clipboard';
44
export type * from '@xterm/addon-fit';
55
export type * from '@xterm/addon-image';
6-
export type * from '@xterm/addon-ligatures';
6+
// export type * from '@xterm/addon-ligatures';
77
export type * from '@xterm/addon-search';
88
export type * from '@xterm/addon-serialize';
99
// export type * from '@xterm/addon-unicode-graphemes';

src/lib/XtermProps.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Terminal } from "@xterm/xterm";
22
import type { ITerminalOptions, ITerminalInitOnlyOptions } from './index.js';
3+
import type { HTMLAttributes } from "svelte/elements";
34

45
export type XtermProps = {
56
options?: ITerminalOptions & ITerminalInitOnlyOptions;
@@ -100,4 +101,4 @@ export type XtermProps = {
100101
* @returns an `IDisposable` to stop listening.
101102
*/
102103
onLoad?: (terminal: Terminal) => void;
103-
};
104+
} & HTMLAttributes<HTMLDivElement>;

src/routes/+page.svelte

+29
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,35 @@
2323
xterm-svelte
2424
</span>
2525
</h1>
26+
27+
<div class="mb-6 flex items-center justify-center gap-2 flex-wrap">
28+
<a href="https://github.com/BattlefieldDuck/xterm-svelte/actions/workflows/node-build.yml">
29+
<img
30+
src="https://github.com/BattlefieldDuck/xterm-svelte/actions/workflows/node-build.yml/badge.svg"
31+
alt="Node.js Build"
32+
/>
33+
</a>
34+
<img
35+
src="https://img.shields.io/npm/types/%40battlefieldduck%2Fxterm-svelte"
36+
alt="NPM Type Definitions"
37+
/>
38+
<a href="https://www.npmjs.com/package/@battlefieldduck/xterm-svelte">
39+
<img
40+
src="https://img.shields.io/npm/v/%40battlefieldduck%2Fxterm-svelte"
41+
alt="NPM Version"
42+
/>
43+
</a>
44+
<img
45+
src="https://img.shields.io/npm/dw/%40battlefieldduck%2Fxterm-svelte"
46+
alt="NPM Downloads"
47+
/>
48+
<img
49+
src="https://img.shields.io/npm/d18m/%40battlefieldduck%2Fxterm-svelte"
50+
alt="NPM Downloads"
51+
/>
52+
<img src="https://img.shields.io/npm/l/%40battlefieldduck%2Fxterm-svelte" alt="NPM License" />
53+
</div>
54+
2655
<p class="mb-6 text-lg font-normal text-gray-500 lg:text-xl dark:text-gray-400">
2756
A SvelteKit wrapper for
2857
<a

0 commit comments

Comments
 (0)