{"id":23370674,"url":"https://github.com/battlefieldduck/xterm-svelte","last_synced_at":"2025-07-19T01:04:40.510Z","repository":{"id":236608675,"uuid":"788604434","full_name":"BattlefieldDuck/xterm-svelte","owner":"BattlefieldDuck","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.","archived":false,"fork":false,"pushed_at":"2025-02-13T15:54:09.000Z","size":359,"stargazers_count":33,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-30T11:04:00.357Z","etag":null,"topics":["svelte","svelte4","svelte5","sveltekit","xterm","xterm-js","xterm-svelte","xtermjs"],"latest_commit_sha":null,"homepage":"https://xterm-svelte.pages.dev","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BattlefieldDuck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"BattlefieldDuck","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-04-18T18:29:40.000Z","updated_at":"2025-05-24T07:58:06.000Z","dependencies_parsed_at":"2024-06-21T12:15:35.945Z","dependency_job_id":"2652f31c-3728-4e56-86e2-e58543eebd37","html_url":"https://github.com/BattlefieldDuck/xterm-svelte","commit_stats":{"total_commits":102,"total_committers":2,"mean_commits":51.0,"dds":0.4509803921568627,"last_synced_commit":"a44b59a40f7cf324772e53956d1eb682277c8bdc"},"previous_names":["battlefieldduck/xterm-svelte"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/BattlefieldDuck/xterm-svelte","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BattlefieldDuck%2Fxterm-svelte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BattlefieldDuck%2Fxterm-svelte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BattlefieldDuck%2Fxterm-svelte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BattlefieldDuck%2Fxterm-svelte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BattlefieldDuck","download_url":"https://codeload.github.com/BattlefieldDuck/xterm-svelte/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BattlefieldDuck%2Fxterm-svelte/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265866282,"owners_count":23840938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["svelte","svelte4","svelte5","sveltekit","xterm","xterm-js","xterm-svelte","xtermjs"],"created_at":"2024-12-21T15:48:05.855Z","updated_at":"2025-07-19T01:04:40.479Z","avatar_url":"https://github.com/BattlefieldDuck.png","language":"Svelte","funding_links":["https://github.com/sponsors/BattlefieldDuck"],"categories":[],"sub_categories":[],"readme":"# Xterm Svelte\n\n\u003cimg align=\"right\" width=\"100\" height=\"100\" src=\"https://github.com/BattlefieldDuck/xterm-svelte/assets/29337428/e1055940-ae66-48b5-9a1f-1965949b5757\"\u003e\n\n[![Node.js Build](https://github.com/BattlefieldDuck/xterm-svelte/actions/workflows/node-build.yml/badge.svg)](https://github.com/BattlefieldDuck/xterm-svelte/actions/workflows/node-build.yml)\n![NPM Type Definitions](https://img.shields.io/npm/types/%40battlefieldduck%2Fxterm-svelte)\n[![NPM Version](https://img.shields.io/npm/v/%40battlefieldduck%2Fxterm-svelte)](https://www.npmjs.com/package/@battlefieldduck/xterm-svelte)\n![NPM Downloads](https://img.shields.io/npm/dw/%40battlefieldduck%2Fxterm-svelte)\n![NPM Downloads](https://img.shields.io/npm/d18m/%40battlefieldduck%2Fxterm-svelte)\n![NPM License](https://img.shields.io/npm/l/%40battlefieldduck%2Fxterm-svelte)\n\nxterm-svelte is a wrapper for the [xterm.js](https://github.com/xtermjs/xterm.js) library, designed to work seamlessly with SvelteKit. This library allows you to embed a fully functional terminal in your SvelteKit application.\n\nCheck it out: https://xterm-svelte.pages.dev\n\n## Version Compatibility\n\n| Version | Svelte Version | Branch                                                                    | Demonstration                          |\n| ------- | -------------- | ------------------------------------------------------------------------- | -------------------------------------- |\n| 2.x.x   | Svelte 5       | [`main`](https://github.com/BattlefieldDuck/xterm-svelte)                 | https://xterm-svelte.pages.dev         |\n| 1.x.x   | Svelte 4       | [`svelte4`](https://github.com/BattlefieldDuck/xterm-svelte/tree/svelte4) | https://svelte4.xterm-svelte.pages.dev |\n\nFor 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).\n\n## Features\n\n- **Full integration with SvelteKit**\n\n  Xterm-Svelte is designed to work seamlessly with SvelteKit, allowing you to easily incorporate terminal functionality into your SvelteKit projects.\n\n- **Xterm addons management**\n\n  Xterm addons are managed within Xterm-Svelte, providing a unified and consistent interface for working with Xterm and its addons.\n\n- **Continuous package updates**\n\n  Xterm-Svelte is regularly updated to ensure compatibility with the latest versions of SvelteKit and Xterm.js. This means you can always use the latest features and improvements from these libraries in your projects.\n\n## Installation\n\nTo install Xterm-Svelte, run the following command in your project directory:\n\n```bash\nnpm install @battlefieldduck/xterm-svelte\n```\n\n## Usage\n\nHere's a basic example of how to use xterm-svelte in your SvelteKit application:\n\n```svelte\n\u003cscript lang=\"ts\"\u003e\n\timport { Xterm, XtermAddon } from '@battlefieldduck/xterm-svelte';\n\timport type {\n\t\tITerminalOptions,\n\t\tITerminalInitOnlyOptions,\n\t\tTerminal\n\t} from '@battlefieldduck/xterm-svelte';\n\n\tlet terminal: Terminal;\n\n\tlet options: ITerminalOptions \u0026 ITerminalInitOnlyOptions = {\n\t\tfontFamily: 'Consolas'\n\t};\n\n\tasync function onLoad() {\n\t\tconsole.log('Child component has loaded');\n\n\t\t// FitAddon Usage\n\t\tconst fitAddon = new (await XtermAddon.FitAddon()).FitAddon();\n\t\tterminal.loadAddon(fitAddon);\n\t\tfitAddon.fit();\n\n\t\tterminal.write('Hello World');\n\t}\n\n\tfunction onData(data: string) {\n\t\tconsole.log('onData()', data);\n\t}\n\n\tfunction onKey(data: { key: string; domEvent: KeyboardEvent }) {\n\t\tconsole.log('onKey()', data);\n\t}\n\u003c/script\u003e\n\n\u003cXterm bind:terminal {options} {onLoad} {onData} {onKey} /\u003e\n```\n\n## FAQ\n\n### When should I use `onLoad()`?\n\nThe `onLoad()` function fires when the xterm terminal is first initialized. You can use this function to perform actions such as initializing xterm addons.\n\n### Why is the `terminal` undefined?\n\nOne 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.\n\n## Real-world uses\n\n- [Thymis](https://thymis.io): Thymis is an open-source project that aims to provide a seamless and secure IoT device management solution.\nWith Thymis, users can easily configure and manage their devices running on the NixOS operating system.\n- [And much more...](https://github.com/BattlefieldDuck/xterm-svelte/network/dependents)\n\n## Contributing\nContributions are welcome! Please feel free to submit pull requests or open issues.\n\n![https://github.com/BattlefieldDuck/xterm-svelte/graphs/contributors](https://contrib.rocks/image?repo=BattlefieldDuck/xterm-svelte)\n\n## License\nxterm-svelte is licensed under the MIT License. See the `LICENSE` file for more details.\n\n## Stargazers over time\n[![Stargazers over time](https://starchart.cc/BattlefieldDuck/xterm-svelte.svg?variant=adaptive)](https://starchart.cc/BattlefieldDuck/xterm-svelte)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbattlefieldduck%2Fxterm-svelte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbattlefieldduck%2Fxterm-svelte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbattlefieldduck%2Fxterm-svelte/lists"}