Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

danikaze/ascii-ui

Repository files navigation

ascii-ui

Build Status

There are several projects [1][2] allowing you to use the JavaScript canvas in the terminal, while other projects [1][2][3][4] (know more? tell me!) give you some IU tools to create text-based interfaces in the terminal, but... have you ever needed (or just wanted) to use a text-based UI in a HTML page?

Really

Not even once?

. . .

Well, thanks to my lack of empathy, this project gives you access to a ncurses-like low-level interface working over a HTMLCanvasElement buffer to render characters like the old style terminals (apart from the great perk of using your time to fight with this library instead of being laying in the corner of a dark street giving yourself to the drugs and alcohol).

Input Widget demo

Excited yet? Jump directly to the API documentation!

Not enough? Well, lucky you, there are some prepared examples already deployed here, and here is their code so you to see how to use the library.

You can play with these examples, modify the code and try it running npm run start (or yarn start) to have a local server for development (or even build your own static version via npm run examples or yarn examples).

Just remember that this is a 0.x.x version and the interface can change from time to time until the version 1.0.0 is reached ;)

Changelog

0.3.0

  • Text (tokenizer) now supports new lines with \n

0.2.0

Core:

  • Added support for spriteFonts (Terminal.setImage)
  • Added minWidth, minHeight, maxWidth and maxHeight options to the Terminal
  • Added Widget.destruct

Widgets:

  • Added border feature in widgets/Grid
  • Improved widgets/Select with new methods and styling options

Others:

  • Added EventManager.removeListener (and rename listen to addListener)
  • Cleaner code with new tslint rules
  • Removed some dependencies

0.1.0

First version of the Terminal with a few widgets (Box, Grid, Input, ProgressBar, Select, Text), a FocusManager and an EventManager.

Usable but still in development, so the interface could change and bugs can happen.

Feel free to test it and create an issue with any bug you found or any idea/request you might have.