Git Product home page Git Product logo

xterm-js-sys's Introduction

xterm-js-sys

Build Status License: MIT crates.io API Docs

Rust bindings for xterm.js.

xterm-js-sys with-input demo

Features

Currently this covers most of the xterm.js API.

This crate has two features:

  • ext: Adds some nicer, more rust-y functions on top of the core bindings; all the functions are in this module.
  • crossterm-support: Provides a wrapper type that let's crossterm use xterm.js as a backend (located here). This enables xterm.js to be used with, for example,the tui crate. Usually you won't have to enable this feature yourself; you should be able to just use crossterm and pass it a [Terminal].

This crate also does support the infrastructure xterm.js has for addons. It also lets you define your own addons in Rust, if you'd like. Currently only the xterm-addon-fit package has Rust bindings. If you do end up making bindings for an xterm.js addon (or your own addon in Rust), feel free to send in a PR to update this list!

xterm.js addons

First party addon packages:

Usage

Add this to your Cargo.toml:

[dependencies]
xterm-js-sys = "4.6.0-alpha1"

And make sure that your bundler/JS package manager is set to grab the corresponding verison of the xterm.js package. The examples in this repo use parcel for which all that's needed is adding xterm to your package.json:

  "dependencies": {
    "xterm": "^4.6.0"
  }

Make sure you also add the packages for any addons you're using; see our examples' package.json for an example.

The xterm.js documentation is a good reference for actual usage of the API; these bindings are usually one to one. Though, as of this writing, the xterm.js docs still correspond to version 4.4.

Examples

This repo has a few examples that show usage of the bindings, usage with the ext feature, and usage with crossterm and the tui crate.

To build these, enter the folder of the example you wish to run (i.e. examples/basic) and:

  • install the packages (npm i or yarn install)
  • run the watch script (npm run watch or yarn run watch)

It should (hopefully) just work! ๐Ÿคž

These examples are also deployed here.

Minimum Supported Rust Version (MSRV)

This crate is currently guaranteed to compile on stable Rust 1.43 and newer. We offer no guarantees that this will remain true in future releases but do promise to always support (at minimum) the latest stable Rust version and to document changes to the MSRV in the changelog.

Contributing

PRs are (very) welcome!

xterm-js-sys's People

Contributors

rrbutani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ichn-hu

xterm-js-sys's Issues

Switch the examples back to mainline xterm.js, pending manual box char drawing

As mentioned in 62d38dc, we're using a fork that has a patch (xtermjs/xterm.js@master...guregu:box-drawing from xtermjs/xterm.js#2409 (comment)) that renders these characters correctly.

Once xtermjs/xterm.js#2409 is resolved, we should switch the examples back to using mainline xterm.js.

"//": "switch back when xtermjs/xterm.js#2409 gets resolved: 'xterm': '^4.7.0'",
"xterm": "https://pkg.githubusercontent.com/272294459/576f5500-ae67-11ea-99ba-6a68eeed3a23?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200614%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200614T225631Z&X-Amz-Expires=300&X-Amz-Signature=3e453570a46130497bad93ca6dcc282b24c6fcc5739f845384c12ddcb193cab7&X-Amz-SignedHeaders=host&actor_id=0&repo_id=0&response-content-disposition=filename%3Dxterm-4.7.0-npm.tgz&response-content-type=application%2Foctet-stream",

[Question] How to use as a crossterm backend?

This crate has two features:

  • ...
  • crossterm-support: Provides a wrapper type that let's crossterm use xterm.js as a backend (located here). This enables xterm.js to be used with, for example,the tui crate. Usually you won't have to enable this feature yourself; you should be able to just use crossterm and pass it a [Terminal].

I can't figure out what this means: "You should be able to just use crossterm and pass it a Terminal."

And a more general question: I have an app which uses tui / crossterm. I'd like to be able to run it in the browser, in addition to Linux / macOS / Windows which are already supported. Do you have any suggestions on structure, so that all the xterm.js glue code is separated from the rest? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.