From b492d8a7ce37b2e5e04e614c78ae3e28d5e807c2 Mon Sep 17 00:00:00 2001 From: TatLead Date: Mon, 4 Nov 2024 15:00:45 +0800 Subject: [PATCH 1/4] Add support for additional XtermProps --- src/lib/Xterm.svelte | 5 +++-- src/lib/XtermProps.ts | 3 ++- src/routes/+page.svelte | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/lib/Xterm.svelte b/src/lib/Xterm.svelte index f862bb1..bc43b0b 100644 --- a/src/lib/Xterm.svelte +++ b/src/lib/Xterm.svelte @@ -19,7 +19,8 @@ onScroll, onSelectionChange, onTitleChange, - onLoad + onLoad, + ...rest }: XtermProps = $props(); onMount(async () => { @@ -48,4 +49,4 @@ }); -
+
diff --git a/src/lib/XtermProps.ts b/src/lib/XtermProps.ts index 6b9b3b6..ee5e4c3 100644 --- a/src/lib/XtermProps.ts +++ b/src/lib/XtermProps.ts @@ -1,5 +1,6 @@ import type { Terminal } from "@xterm/xterm"; import type { ITerminalOptions, ITerminalInitOnlyOptions } from './index.js'; +import type { HTMLAttributes } from "svelte/elements"; export type XtermProps = { options?: ITerminalOptions & ITerminalInitOnlyOptions; @@ -100,4 +101,4 @@ export type XtermProps = { * @returns an `IDisposable` to stop listening. */ onLoad?: (terminal: Terminal) => void; -}; \ No newline at end of file +} & HTMLAttributes; \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9253839..da36875 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -23,6 +23,35 @@ xterm-svelte + +
+ + Node.js Build + + NPM Type Definitions + + NPM Version + + NPM Downloads + NPM Downloads + NPM License +
+

A SvelteKit wrapper for Date: Mon, 4 Nov 2024 15:20:31 +0800 Subject: [PATCH 2/4] Update package.json --- package-lock.json | 7 +++++-- package.json | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d832d89..ca9ade6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "@sveltejs/package": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", "@types/eslint": "^8.56.0", - "@types/node": "^22.8.7", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.56.0", @@ -1116,6 +1115,8 @@ "integrity": "sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "undici-types": "~6.19.8" } @@ -4027,7 +4028,9 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/uri-js": { "version": "4.4.1", diff --git a/package.json b/package.json index c26690d..dd1d542 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "@sveltejs/package": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", "@types/eslint": "^8.56.0", - "@types/node": "^22.8.7", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.56.0", From 53b2fb77397acb2ffcf1c46dc64bad5f1c5439cf Mon Sep 17 00:00:00 2001 From: TatLead Date: Mon, 4 Nov 2024 15:38:51 +0800 Subject: [PATCH 3/4] Update package-lock.json --- package-lock.json | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca9ade6..99d75c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1109,18 +1109,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/node": { - "version": "22.8.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.7.tgz", - "integrity": "sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "undici-types": "~6.19.8" - } - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.18.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", @@ -4023,15 +4011,6 @@ "node": ">=14.17" } }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", From 6c3cfffcfa72ce1523296a3b3ca71be9f94645d1 Mon Sep 17 00:00:00 2001 From: TatLead Date: Mon, 4 Nov 2024 15:50:45 +0800 Subject: [PATCH 4/4] Remove @xterm/addon-ligatures --- package-lock.json | 98 --------------------------------------- package.json | 1 - src/lib/XtermAddon.ts | 15 +++--- src/lib/XtermAddonType.ts | 2 +- 4 files changed, 9 insertions(+), 107 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99d75c5..dc0e0a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-fit": "^0.10.0", "@xterm/addon-image": "^0.8.0", - "@xterm/addon-ligatures": "^0.9.0", "@xterm/addon-search": "^0.15.0", "@xterm/addon-serialize": "^0.13.0", "@xterm/addon-unicode11": "^0.8.0", @@ -1470,22 +1469,6 @@ "@xterm/xterm": "^5.2.0" } }, - "node_modules/@xterm/addon-ligatures": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@xterm/addon-ligatures/-/addon-ligatures-0.9.0.tgz", - "integrity": "sha512-zVV1AHV1SIm/rdzR5VDPyg+qUnR1SjH4H75iXiB7r6YDa1yEHIqc/EwnUIwz+yeeZozkh8hjbH80L7luEgtxtQ==", - "license": "MIT", - "dependencies": { - "font-finder": "^1.1.0", - "font-ligatures": "^1.4.1" - }, - "engines": { - "node": ">8.0.0" - }, - "peerDependencies": { - "@xterm/xterm": "^5.0.0" - } - }, "node_modules/@xterm/addon-search": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/@xterm/addon-search/-/addon-search-0.15.0.tgz", @@ -2375,33 +2358,6 @@ "dev": true, "license": "ISC" }, - "node_modules/font-finder": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/font-finder/-/font-finder-1.1.0.tgz", - "integrity": "sha512-wpCL2uIbi6GurJbU7ZlQ3nGd61Ho+dSU6U83/xJT5UPFfN35EeCW/rOtS+5k+IuEZu2SYmHzDIPL9eA5tSYRAw==", - "license": "MIT", - "dependencies": { - "get-system-fonts": "^2.0.0", - "promise-stream-reader": "^1.0.1" - }, - "engines": { - "node": ">8.0.0" - } - }, - "node_modules/font-ligatures": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/font-ligatures/-/font-ligatures-1.4.1.tgz", - "integrity": "sha512-7W6zlfyhvCqShZ5ReUWqmSd9vBaUudW0Hxis+tqUjtHhsPU+L3Grf8mcZAtCiXHTzorhwdRTId2WeH/88gdFkw==", - "license": "MIT", - "dependencies": { - "font-finder": "^1.0.3", - "lru-cache": "^6.0.0", - "opentype.js": "^0.8.0" - }, - "engines": { - "node": ">8.0.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2424,15 +2380,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-system-fonts": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-system-fonts/-/get-system-fonts-2.0.2.tgz", - "integrity": "sha512-zzlgaYnHMIEgHRrfC7x0Qp0Ylhw/sHpM6MHXeVBTYIsvGf5GpbnClB+Q6rAPdn+0gd2oZZIo6Tj3EaWrt4VhDQ==", - "license": "MIT", - "engines": { - "node": ">8.0.0" - } - }, "node_modules/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", @@ -2839,18 +2786,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/magic-string": { "version": "0.30.12", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", @@ -3017,18 +2952,6 @@ "wrappy": "1" } }, - "node_modules/opentype.js": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-0.8.0.tgz", - "integrity": "sha512-FQHR4oGP+a0m/f6yHoRpBOIbn/5ZWxKd4D/djHVJu8+KpBTYrJda0b7mLcgDEMWXE9xBCJm+qb0yv6FcvPjukg==", - "license": "MIT", - "dependencies": { - "tiny-inflate": "^1.0.2" - }, - "bin": { - "ot": "bin/ot" - } - }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -3366,15 +3289,6 @@ "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" } }, - "node_modules/promise-stream-reader": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-stream-reader/-/promise-stream-reader-1.0.1.tgz", - "integrity": "sha512-Tnxit5trUjBAqqZCGWwjyxhmgMN4hGrtpW3Oc/tRI4bpm/O2+ej72BB08l6JBnGQgVDGCLvHFGjGgQS6vzhwXg==", - "license": "MIT", - "engines": { - "node": ">8.0.0" - } - }, "node_modules/publint": { "version": "0.2.12", "resolved": "https://registry.npmjs.org/publint/-/publint-0.2.12.tgz", @@ -3878,12 +3792,6 @@ "globrex": "^0.1.2" } }, - "node_modules/tiny-inflate": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", - "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", - "license": "MIT" - }, "node_modules/tinybench": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", @@ -4260,12 +4168,6 @@ "dev": true, "license": "ISC" }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "license": "ISC" - }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", diff --git a/package.json b/package.json index dd1d542..0b2dfcb 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-fit": "^0.10.0", "@xterm/addon-image": "^0.8.0", - "@xterm/addon-ligatures": "^0.9.0", "@xterm/addon-search": "^0.15.0", "@xterm/addon-serialize": "^0.13.0", "@xterm/addon-unicode11": "^0.8.0", diff --git a/src/lib/XtermAddon.ts b/src/lib/XtermAddon.ts index 3e6cf20..85bdbc2 100644 --- a/src/lib/XtermAddon.ts +++ b/src/lib/XtermAddon.ts @@ -40,14 +40,15 @@ export class XtermAddon { * * @returns A promise that resolves to the 'ligatures' addon module. */ - static LigaturesAddon = async () => { - if (typeof process === 'undefined' || process.versions == null || process.versions.node == null) { - // This is not a Node.js environment - throw new Error('This module can only be imported in a Node.js environment'); - } + // static LigaturesAddon = async () => { + // // @ts-ignore + // if (typeof process === 'undefined' || process.versions == null || process.versions.node == null) { + // // This is not a Node.js environment + // throw new Error('This module can only be imported in a Node.js environment'); + // } - return await import('@xterm/addon-ligatures'); - } + // return await import('@xterm/addon-ligatures'); + // } /** * Dynamically imports the 'search' addon from `@xterm/addon-search`. diff --git a/src/lib/XtermAddonType.ts b/src/lib/XtermAddonType.ts index 19c308e..01ea736 100644 --- a/src/lib/XtermAddonType.ts +++ b/src/lib/XtermAddonType.ts @@ -3,7 +3,7 @@ export type * from '@xterm/addon-canvas'; export type * from '@xterm/addon-clipboard'; export type * from '@xterm/addon-fit'; export type * from '@xterm/addon-image'; -export type * from '@xterm/addon-ligatures'; +// export type * from '@xterm/addon-ligatures'; export type * from '@xterm/addon-search'; export type * from '@xterm/addon-serialize'; // export type * from '@xterm/addon-unicode-graphemes';