Terminosaurus

Agnostic terminal GUI library for TypeScript, distributed with a native React renderer
GitHub
77
Created 7 months ago, last commit 7 months ago
2 contributors
16 commits
Stars added on GitHub, month by month
N/A
N/A
N/A
N/A
N/A
N/A
N/A
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
Stars added on GitHub, per day, on average
Yesterday
=
Last week
0.0
/day
Last month
0.0
/day
Package on NPM
terminosaurus
3.0.0-rc.1
Monthly downloads on NPM
0
0
0
0
0
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
README

Terminosaurus is a DOM-like UI library for TypeScript that makes it easy to build powerful graphical interfaces for your terminal without having to deal with complex positioning or state updates.

Features

  • Framework-agnostic API
  • React renderer
  • Advanced layout positioning
  • Event handlers
  • Text wrapping
  • CSS properties
  • Fast rendering

Getting Started

Framework Agnostic React Syntax
import {
    TermElement,
    TermText,
    run,
} from 'terminosaurus';

run({}, async screen => {
    const text = new TermText();
    text.appendTo(screen.rootNode);

    let counter = 0;

    const increaseCounter = () => {
        counter += 1;
        text.setText(`Counter: ${counter}`);
    };

    text.onClick.addEventListener(() => {
        increaseCounter();
    });

    increaseCounter();
});
import {
    useState
} from 'react'
import {
    render,
} from 'terminosaurus/react';

function App() {
    const [counter, setCounter] = useState(0);

    const increaseCounter = () => {
        setCounter(counter + 1);
    };

    return (
        <term:div onClick={increaseCounter}>
            Counter: {counter}
        </term:div>
    );
}

render({}, <App/>);