A simple library to draw option menu or other popup inputs and layout on Node.js console.

Overview

console-gui-tools

A simple library to draw option menu or other popup inputs and layout on Node.js console.

npm version npm npm bundle size GitHub

console-gui-tools

A simple Node.js library to create Console Apps like wizard (or maybe if you like old style colored screen or something like "teletext" programs πŸ˜‚ ) Apart from jokes, it is a library that allows you to create a screen divided into a part with everything you want to see (such as variable values) and another in which the logs run. Moreover in this way the application is managed by the input event "keypressed" to which each key corresponds to a bindable command. For example, to change variables you can open popups with an option selector or with a textbox. It's in embryonic phase, any suggestion will be constructive :D

Animation

Readme Card https://nodei.co/npm/console-gui-tools.png?downloads=true&downloadRank=true&stars=true

Installation

Install with:

npm i console-gui-tools

Options

The library has a few options that can be set in the constructor.

options.title

The title of the application. It will be displayed in the top of the screen.

options.logsPageSize

The number of lines that will be displayed in the logs page.

options.changeLayoutKey

The key that will be used to change the layout. (To switch between the two pages, logs and main page)

options.layoutBorder

To enable the border of the layout and the title.

Example of usage:

// Import module with ES6 syntax
import { ConsoleManager, OptionPopup, InputPopup } from '../index.js'
const GUI = new ConsoleManager({
    title: 'TCP Simulator', // Title of the console
    logsPageSize: 12, // Number of lines to show in logs page
    changeLayoutKey: 'ctrl+l', // Change layout with ctrl+l to switch to the logs page
})

// Creating a main page updater:
const updateConsole = async() => {
    let screen = ""
    screen += chalk.yellow(`TCP server simulator app! Welcome...`) + `\n`
    screen += chalk.green(`TCP Server listening on ${HOST}:${PORT}`) + `\n`
    screen += chalk.green(`Connected clients: `) + chalk.white(`${connectedClients}\n`)
    screen += chalk.magenta(`TCP Messages sent: `) + chalk.white(`${tcpCounter}`) + `\n\n`

    // Print if simulator is running or not
    if (!valueEmitter) {
        screen += chalk.red(`Simulator is not running! `) + chalk.white(`press 'space' to start`) + `\n`
    } else {
        screen += chalk.green(`Simulator is running! `) + chalk.white(`press 'space' to stop`) + `\n`
    }
    // Print mode:
    screen += chalk.cyan(`Mode:`) + chalk.white(` ${mode}`) + `\n`;
    // Print message frequency:
    screen += chalk.cyan(`Message period:`) + chalk.white(` ${period} ms`) + `\n`;
    // Print Min and Max
    screen += chalk.cyan(`Min:`) + chalk.white(` ${min}`) + `\n`;
    screen += chalk.cyan(`Max:`) + chalk.white(` ${max}`) + `\n`;
    // Print current values:
    screen += chalk.cyan(`Values:`) + chalk.white(` ${values.map(v => v.toFixed(4)).join('   ')}`) + `\n`;

    // Spacer
    screen += `\n\n`;

    if (lastErr.length > 0) {
        screen += lastErr + `\n\n`
    }

    screen += chalk.bgBlack(`Commands:`) + `\n`;
    screen += `  ${chalk.bold('space')}   - ${chalk.italic('Start/stop simulator')}\n`;
    screen += `  ${chalk.bold('m')}       - ${chalk.italic('Select simulation mode')}\n`;
    screen += `  ${chalk.bold('s')}       - ${chalk.italic('Select message period')}\n`;
    screen += `  ${chalk.bold('h')}       - ${chalk.italic('Set max value')}\n`;
    screen += `  ${chalk.bold('l')}       - ${chalk.italic('Set min value')}\n`;
    screen += `  ${chalk.bold('q')}       - ${chalk.italic('Quit')}\n`;

    GUI.setHomePage(screen)
}

// And manage the keypress event from the library
GUI.on("keypressed", (key) => {
    switch (key.name) {
        case 'space':
            if (valueEmitter) {
                clearInterval(valueEmitter)
                valueEmitter = null
            } else {
                valueEmitter = setInterval(frame, period)
            }
            break
        case 'm':
            new OptionPopup("popupSelectMode", "Select simulation mode", modeList, mode).show().on("confirm", (_mode) => {
                mode = _mode
                GUI.warn(`NEW MODE: ${mode}`)
                drawGui()
            })
            break
        case 's':
            new OptionPopup("popupSelectPeriod", "Select simulation period", periodList, period).show().on("confirm", (_period) => {
                period = _period
                GUI.warn(`NEW PERIOD: ${period}`)
                drawGui()
            })
            break
        case 'h':
            new InputPopup("popupTypeMax", "Type max value", max, true).show().on("confirm", (_max) => {
                max = _max
                GUI.warn(`NEW MAX VALUE: ${max}`)
                drawGui()
            })
            break
        case 'l':
            new InputPopup("popupTypeMin", "Type min value", min, true).show().on("confirm", (_min) => {
                min = _min
                GUI.warn(`NEW MIN VALUE: ${min}`)
                drawGui()
            })
            break
        case 'q':
            closeApp()
            break
        default:
            break
    }
})

const drawGui = () => {
    updateConsole()
}

To create an option popup (select)

new OptionPopup("popupSelectPeriod", "Select simulation period", periodList, period).show().on("confirm", (_period) => {
    period = _period
    GUI.warn(`NEW PERIOD: ${period}`)
    drawGui()
})

Class OptionPopup:

constructor(id, title, options, selected)

  • id: string
  • title: string
  • options: Array<string | number>
  • selected: string | number

The response is triggered via EventEmitter using "on" The result is this:

Animation

Pressing enter it will close the popup and set the new value

To create an input popup (numeric or string)

new InputPopup("popupTypeMax", "Type max value", max, true).show().on("confirm", (_max) => {
    max = _max
    GUI.warn(`NEW MAX VALUE: ${max}`)
    drawGui()
})

Class InputPopup:

constructor(id, title, value, isNumeric)

  • id: string
  • title: string
  • value: string | number
  • isNumeric: boolean

You can use it for example to set a numeric threshold:

Animation

If you set isNumeric to true, only numbers are allowed. All class of components will be destroyed when the popup is closed. The event listeners are removed from the store. Then the garbage collector will clean the memory.

Console.log and other logging tools

To log you have to use the following functions:

GUI.log(`NEW MIN VALUE: ${min}`)
GUI.warn(`NEW MIN VALUE: ${min}`)
GUI.error(`NEW MIN VALUE: ${min}`)
GUI.info(`NEW MIN VALUE: ${min}`)

And they written to the bottom of the page.

Animation

You can switch to the log view by pressing the "changeLayoutKey" key or combination: The maximum number of lines is set to 10 by default but you can change it by setting the option "logsPageSize". When the logs exceed the limit, you can scroll up and down with up and down arrows (if you are in the log view).

Animation

This library is in development now. New componets will come asap.

Comments
  • Suggestion for InputPopup.js

    Suggestion for InputPopup.js

    Hi, I have been playing around with your library to learn Node.js. I was wondering if you can allow for the copy and pasting of text into InputPopup, specifically with the "ctr-v" command. I also noticed that sometimes if my logs get too long, I have to drag down my command prompt window to resize the length to make it work. I really do enjoy tinkering with your code and would like to say to keep up the good work!

    enhancement 
    opened by lather205 5
  • Set up Typescript environment to build project for both es2022 and commonjs

    Set up Typescript environment to build project for both es2022 and commonjs

    Hi, I just say this issue. I actually had to convert my project from CJS to ESM when I installed your library. Does converting it all to Typescript mean that my program will break again if it is not converted back?

    Originally posted by @lather205 in https://github.com/Elius94/console-gui-tools/issues/35#issuecomment-1131931655

    enhancement 
    opened by Elius94 4
  • Extends color patterns from chalk

    Extends color patterns from chalk

    Currently we can set colors using chalk. If we need to set a color or style on the home page we still have to use it. I wish to add color syntax to the homepage string like html tags or other escaped strings that will be changed to chalk function in the library.

    enhancement help wanted 
    opened by Elius94 2
  • New type of widgets: In page widget

    New type of widgets: In page widget

    The goal is to make a new kind of widgets. A widget that is printed inside a PageBuilder class, it will use fiew characters or multiple lines but it will embedded inside the rows of the page. To use the page widgets the user must select one of them (maybe with tab) and use the keyboard, so it's neccessary to add a sort of tabindex on PageBuilder class. The following list represent some of the possible page widget to do:

    • Checkbox / Checkbox Group
    • Radio / Radio Group
    • Scrollbar
    • Ascii Charts
    • Table / Grid
    • Button
    enhancement 
    opened by Elius94 1
  • Elius94/issue5

    Elius94/issue5

    Progress ⇐ Control

    Kind: global class
    Extends: Control

    new Progress(id, length, thickness, x, y, style, theme, orientation, interactive, visible, enabled)

    This class is an overload of Control that is used to create a Progress bar.

    Progress

    Emits the following events:

    • "valueChanged" when the user changes the value of the progress bar with the scroll wheel (if interactive is true).
    • "click" when the user clicks on the progress bar (if interactive is true).
    • "relese" when the user releases the mouse button on the progress bar (if interactive is true).
    • "rightClick" when the user clicks on the progress bar with right button (if interactive is true).
    • "rightRelese" when the user releases the right mouse button on the progress bar (if interactive is true).

    Example of interactive progress bar

    Progress_Interactive

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the Progress.

    | | length | number |

    The length of the Progress.

    | | thickness | number |

    The thickness of the Progress.

    | | x | number |

    The x position of the Progress.

    | | y | number |

    The y position of the Progress.

    | | style | ProgressStyle |

    The style of the Progress.

    | | theme | string |

    The theme of the Progress.

    | | orientation | string |

    The orientation of the Progress.

    | | interactive | boolean |

    If the Progress is interactive.

    | | visible | boolean |

    If the Progress is visible.

    | | enabled | boolean |

    If the Progress is enabled.

    |

    Example

     const pStyle = {
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: false,
     }
     const p = new Progress("prog1", 20, 1, 3, 23, pStyle, "htop", "horizontal")
     p.setText("Mem")
     const incr = setInterval(() => {
         const value = p.getValue() + 0.25
         p.setValue(value)
         if (value >= p.getMax()) {
             clearInterval(incr)
         }
     }, 100)
    
     const p1Style = {
         background: "bgBlack",
         borderColor: "yellow",
         color: "green",
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: true,
    
     }
     const p1 = new Progress("prog2", 25, 2, 3, 25, p1Style, "precision", "horizontal")
     p1.setText("Precision")
     const incr1 = setInterval(() => {
         const value = p1.getValue() + 0.25
         p1.setValue(value)
         if (value >= p1.getMax()) {
             clearInterval(incr1)
         }
     }, 100)
     const p2Style = {
         background: "bgBlack",
         borderColor: "yellow",
         color: "magenta",
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: true,
     }
     const p2 = new Progress("prog3", 25, 2, 3, 31, p2Style, "precision", "horizontal", true)
     p2.setText("Interactive")
     p2.on("valueChanged", (value) => {
         console.log(`Value changed: ${value}`)
     })
    
    opened by Elius94 0
  • Elius94/issue6

    Elius94/issue6

    Button ⇐ Control

    Kind: global class
    Extends: Control

    new Button(id, text, width, height, x, y, style, visible, enabled, onClick, onRelease)

    This class is an overload of Control that is used to create a button.

    Button

    Emits the following events:

    • "click" when the user confirm
    • "relese" when the user cancel

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the button.

    | | text | string |

    The text of the button.

    | | width | number |

    The width of the button.

    | | height | number |

    The height of the button.

    | | x | number |

    The x position of the button.

    | | y | number |

    The y position of the button.

    | | style | ButtonStyle |

    To set the style of the button.

    | | visible | boolean |

    If the button is visible. Default is true (make it hide using hide()).

    | | enabled | boolean |

    If the button is enabled. Default is true (make it disabled using disable()).

    | | onClick | function |

    The function to call when the button is clicked.

    | | onRelease | function |

    The function to call when the button is released.

    |

    Example

    new Button("btnRun", "Run me!", 10, 3, 21, 18, 
         { 
             color: "magentaBright", 
             bold: true, 
             italic: true,
             borderColor: "green"
         },
         () => {
             GUI.log("Button clicked!")
         })
    
    opened by Elius94 0
  • Elius94/issue22

    Elius94/issue22

    #ADDED IN PAGE WIDGET And cleaned code

    Control ⇐ EventEmitter

    Kind: global class
    Extends: EventEmitter

    new Control(id, visible, attributes, children)

    This class is used to create a custom control (widget) with That is showed in a absolute position on the screen. It's a base class for all the controls (widgets).

    Emits the following events:

    • "mouse": It carries the pure mouse event, but it fires only if the mouse is over the control.
    • "relativeMouse": It's like the "mouse" event, but it carries the relative mouse X and Y (relative to the control).

    InPageWidget

    Emits the following events:

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the popup.

    | | visible | boolean |

    If the popup is visible. Default is false (make it appears using show()).

    | | attributes | PhisicalValues |

    The phisical values of the control (x, y, width, height).

    | | children | InPageWidgetBuilder |

    The content of the control.

    |

    Example

    const widget1 = new InPageWidgetBuilder()
    widget1.addRow({ text: "β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”", color: "yellow", style: "bold" })
    widget1.addRow({ text: "β”‚ START! β”‚", color: "yellow", style: "bold" })
    widget1.addRow({ text: "β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜", color: "yellow", style: "bold" })
    
    const button1 = new Control("btn1", false, { x: 30, y: 18, width: 10, height: 3 }, widget1)
    button1.on("relativeMouse", (event) => {
        // The relative mouse event is triggered with the mouse position relative to the widget
        //console.log(`Mouse event: x: ${event.data.x}, y: ${event.data.y}`)
        if (event.name === "MOUSE_LEFT_BUTTON_RELEASED") {
            GUI.log("Button 1 clicked!")
            if (valueEmitter) {
                clearInterval(valueEmitter)
                valueEmitter = null
            } else {
                valueEmitter = setInterval(frame, period)
            }
        }
    })
    button1.show()
    
    opened by Elius94 0
  • Elius94/issue43

    Elius94/issue43

    New Feature:

    options.enableMouse

    Enable mouse support. It works well on most linux terminals, but it doesn't work on Windows 10 and 11 unless you use WSL (Windows Subsystem for Linux).

    Mouse Example

    opened by Elius94 0
  • Elius94/issue41

    Elius94/issue41

    Changed Layouts

    The application instance needs to output the content through a layout class. In the "layoutOptions" provided to the ConsoleManager, we can set the layout:

    • boxed: Set to true to enable boxed layout mode (default: true) image "boxed" image "not boxed"
    • showTitle: Set to false to hide titles (default: true, on title per page)
    • changeFocusKey: The key or the combination that will change the focus between the pages of the layout (default: 'ctrl+l')
    • type: Can be "single", "double" or "quad" to choose the layout type (default: "double") image "single" image "double" image "quad"
    • direction: Set to 'horizontal' to enable horizontal layout (only for "double" layout) image "horizontal" example
    • boxColor: The color of the box (default: 'yellow')
    • boxStyle: The style of the box (default: 'bold')

    To draw multiple pages, we need to use the setPage or setPages methods:

    GUI.setPage(p, 0) // Add the first page without explicit name (default: application title)
    
    const p1 = new PageBuilder()
    p1.addRow({ text: "SECOND PAGE", color: "green" })
    
    const P2 = new PageBuilder()
    P2.addRow({ text: "THIRD PAGE", color: "cyan" })
    
    GUI.setPage(p1, 1, "Top Right")
    GUI.setPage(P2, 2, "Bottom Left")
    
    // Or if we want to add the pages in the same order (only one render):
    GUI.setPages([p, p1, P2], ["App Title", "Top Right", "Bottom Left"])
    

    If we are in quad layout mode or double horizontal layout, we can change the aspect ratio of the layout rows by pressing the "left" and "right" keys: changeratio

    If you are using the quad layout mode the arrow keys will change the aspect ratio of the layout selected row (the top or the bottom row, depending on the selected page)

    opened by Elius94 0
  • Elius94/issue8

    Elius94/issue8

    Improved Layout styling and definitions: Now the following options are allowed:

    {
    logLocation: 1, // Location of the logs page - it can be 0, 1 or 'popup'
        layoutOptions: {
            boxed: true, // Set to true to enable boxed layout
            showTitle: true, // Set to false to hide title
            changeFocusKey: 'ctrl+l', // Change layout with ctrl+l to switch to the logs page
            type: 'double', // Set to 'double' to enable double layout
            direction: 'vertical', // Set to 'horizontal' to enable horizontal layout
            boxColor: 'yellow',
            boxStyle: 'bold',
        }
    }
    
    opened by Elius94 0
  • New widget: Filemanager

    New widget: Filemanager

    Fixes #20

    Classes

    FileManagerPopup ⇐ EventEmitter

    Constants

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    FileManagerPopup ⇐ EventEmitter

    Kind: global class Extends: EventEmitter

    new FileManagerPopup(id, title, basePath, [limitToPath], [allowedExtensions], visible)

    This class is used to create a popup with a file input to select a file or a directory. It will run a promise with fs.readdir to get the list of files and directories. The user can select a file or a directory and the popup will be closed.

    FileManagerPopup

    Emits the following events:

    • "confirm" when the user confirm the file or directory selection. The file or directory path is passed as parameter like this: {path: "path/to/file", name: "file.ext"}
    • "cancel" when the user cancel the file or directory selection.
    • "exit" when the user exit

    | Param | Type | Default | Description | | --- | --- | --- | --- | | id | string | | The id of the popup. | | title | string | | The title of the popup. | | basePath | string | | The main path of the popup. re case sensitive. | | [limitToPath] | boolean | false | If true, the user * @param {boolean} [selectDirectory=false] - If true, the user can select a directory. Otherwise, only files are selectable. When true, to enter a directory, the user must press the space key instead of the enter key. | | [allowedExtensions] | Array.<string> | [] | The allowed extensions. If not set, all extensions are allowed. The extensions a can only select files in the path. If false, the user can select files in the path and parent directories. | | visible | boolean | | If the popup is visible. Default is false (make it appears using show()). |

    Example

    const popup = new FileManagerPopup("popup1", "Choose the file", "./examples").show().on("confirm", (selected) => { console.log(selected) }) // show the popup and wait for the user to confirm
    

    fileManagerPopup.listDir(path) β‡’ Promise.<Array.<object>>

    This function is used to load the list of files and directories in the current path. it return a promise with the list of files and directories. The list is an array of objects like this: [{text: "πŸ“„ file.ext", name: "file.ext", type: "file", path: "path/to/file.ext"}, {text: "πŸ“ dir/", name: "dir", type: "dir", path: "path/to/dir"}]

    Kind: instance method of FileManagerPopup Returns: Promise.<Array.<object>> - The list of files and directories.

    | Param | Type | Description | | --- | --- | --- | | path | string | The path to load the list. |

    fileManagerPopup.updateList(path)

    This function calls the updateList function and store the result to this.options, it also refresh the list of files and directories.

    Kind: instance method of FileManagerPopup

    | Param | Type | Description | | --- | --- | --- | | path | string | The path to load the list. |

    fileManagerPopup.keyListner(str, key)

    This function is used to make the ConsoleManager handle the key events when the popup is showed. Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.

    Kind: instance method of FileManagerPopup

    | Param | Type | Description | | --- | --- | --- | | str | string | The string of the input. | | key | Object | The key object. |

    fileManagerPopup.getSelected() β‡’ string | number

    This function is used to get the selected option.

    Kind: instance method of FileManagerPopup Returns: string | number - The selected value of the popup.

    fileManagerPopup.setSelected(selected) β‡’ FileManagerPopup

    This function is used to change the selection of the popup. It also refresh the ConsoleManager.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    | Param | Type | Description | | --- | --- | --- | | selected | string | number | The new value of the selection. |

    fileManagerPopup.show() β‡’ FileManagerPopup

    This function is used to show the popup. It also register the key events and refresh the ConsoleManager.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    fileManagerPopup.hide() β‡’ FileManagerPopup

    This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    fileManagerPopup.isVisible() β‡’ boolean

    This function is used to get the visibility of the popup.

    Kind: instance method of FileManagerPopup Returns: boolean - The visibility of the popup.

    fileManagerPopup.manageInput() β‡’ FileManagerPopup

    This function is used to add the FileManagerPopup key listener callback to te ConsoleManager.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    fileManagerPopup.unManageInput() β‡’ FileManagerPopup

    This function is used to remove the FileManagerPopup key listener callback to te ConsoleManager.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    fileManagerPopup.draw() β‡’ FileManagerPopup

    This function is used to draw the FileManagerPopup to the screen in the middle.

    Kind: instance method of FileManagerPopup Returns: FileManagerPopup - The instance of the FileManagerPopup.

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    Kind: global constant

    opened by Elius94 0
  • Add the possibility to include a Control Widget inside a PageBuilder instance

    Add the possibility to include a Control Widget inside a PageBuilder instance

    In this way it should be possible to add a Control to a customPopup or to a part of a layout.

    If a control will be placed inside another pagebuilder, his X and Y should be anchored to the parent PageBuilder.

    enhancement 
    opened by Elius94 0
Releases(v2.1.2)
  • v2.1.2(Dec 23, 2022)

  • v2.1.1(Dec 23, 2022)

  • v2.0.1(Dec 21, 2022)

  • v1.4.2(Nov 29, 2022)

    What's Changed

    • Elius94/issue52 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/53

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.4.0...v1.4.2

    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Nov 29, 2022)

  • v1.4.0(Nov 24, 2022)

  • v1.3.2(Nov 23, 2022)

  • v1.3.1(Nov 23, 2022)

  • v1.3.0(Nov 23, 2022)

    What's Changed

    • Elius94/issue5 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/51

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.2.1...v1.3.0

    Progress ⇐ Control

    Kind: global class
    Extends: Control

    new Progress(id, length, thickness, x, y, style, theme, orientation, interactive, visible, enabled)

    This class is an overload of Control that is used to create a Progress bar.

    Progress

    Emits the following events:

    • "valueChanged" when the user changes the value of the progress bar with the scroll wheel (if interactive is true).
    • "click" when the user clicks on the progress bar (if interactive is true).
    • "relese" when the user releases the mouse button on the progress bar (if interactive is true).
    • "rightClick" when the user clicks on the progress bar with right button (if interactive is true).
    • "rightRelese" when the user releases the right mouse button on the progress bar (if interactive is true).

    Example of interactive progress bar

    Progress_Interactive

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the Progress.

    | | length | number |

    The length of the Progress.

    | | thickness | number |

    The thickness of the Progress.

    | | x | number |

    The x position of the Progress.

    | | y | number |

    The y position of the Progress.

    | | style | ProgressStyle |

    The style of the Progress.

    | | theme | string |

    The theme of the Progress.

    | | orientation | string |

    The orientation of the Progress.

    | | interactive | boolean |

    If the Progress is interactive.

    | | visible | boolean |

    If the Progress is visible.

    | | enabled | boolean |

    If the Progress is enabled.

    |

    Example

     const pStyle = {
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: false,
     }
     const p = new Progress("prog1", 20, 1, 3, 23, pStyle, "htop", "horizontal")
     p.setText("Mem")
     const incr = setInterval(() => {
         const value = p.getValue() + 0.25
         p.setValue(value)
         if (value >= p.getMax()) {
             clearInterval(incr)
         }
     }, 100)
    
     const p1Style = {
         background: "bgBlack",
         borderColor: "yellow",
         color: "green",
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: true,
    
     }
     const p1 = new Progress("prog2", 25, 2, 3, 25, p1Style, "precision", "horizontal")
     p1.setText("Precision")
     const incr1 = setInterval(() => {
         const value = p1.getValue() + 0.25
         p1.setValue(value)
         if (value >= p1.getMax()) {
             clearInterval(incr1)
         }
     }, 100)
     const p2Style = {
         background: "bgBlack",
         borderColor: "yellow",
         color: "magenta",
         boxed: true,
         showTitle: true,
         showValue: true,
         showPercentage: true,
         showMinMax: true,
     }
     const p2 = new Progress("prog3", 25, 2, 3, 31, p2Style, "precision", "horizontal", true)
     p2.setText("Interactive")
     p2.on("valueChanged", (value) => {
         console.log(`Value changed: ${value}`)
     })
    

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.2.1...v1.3.0

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Nov 19, 2022)

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.2.0...v1.2.1

    MILESTONE 1.2.x releases

    since 1.x.x is the current stable release. After many months of development, I'm now ready to release the first 1.2.x release. This release is a major milestone for the project, as it brings many new features and improvements. I'm very excited to share this release with you, and I hope you will enjoy using it as much as I enjoyed developing it.

    What's new in 1.2.x

    New features and improvements since 1.1.x

    1.2.0 (Nov 2022) View on GitHub

    #ADDED IN PAGE WIDGET And cleaned code

    Control ⇐ EventEmitter

    Kind: global class
    Extends: EventEmitter

    new Control(id, visible, attributes, children)

    This class is used to create a custom control (widget) with That is showed in a absolute position on the screen. It's a base class for all the controls (widgets).

    Emits the following events:

    • "mouse": It carries the pure mouse event, but it fires only if the mouse is over the control.
    • "relativeMouse": It's like the "mouse" event, but it carries the relative mouse X and Y (relative to the control).

    InPageWidget

    Emits the following events:

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the popup.

    | | visible | boolean |

    If the popup is visible. Default is false (make it appears using show()).

    | | attributes | PhisicalValues |

    The phisical values of the control (x, y, width, height).

    | | children | InPageWidgetBuilder |

    The content of the control.

    |

    Example

    const widget1 = new InPageWidgetBuilder()
    widget1.addRow({ text: "β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”", color: "yellow", style: "bold" })
    widget1.addRow({ text: "β”‚ START! β”‚", color: "yellow", style: "bold" })
    widget1.addRow({ text: "β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜", color: "yellow", style: "bold" })
    
    const button1 = new Control("btn1", false, { x: 30, y: 18, width: 10, height: 3 }, widget1)
    button1.on("relativeMouse", (event) => {
        // The relative mouse event is triggered with the mouse position relative to the widget
        //console.log(`Mouse event: x: ${event.data.x}, y: ${event.data.y}`)
        if (event.name === "MOUSE_LEFT_BUTTON_RELEASED") {
            GUI.log("Button 1 clicked!")
            if (valueEmitter) {
                clearInterval(valueEmitter)
                valueEmitter = null
            } else {
                valueEmitter = setInterval(frame, period)
            }
        }
    })
    button1.show()
    

    Button ⇐ Control

    Kind: global class
    Extends: Control

    new Button(id, text, width, height, x, y, style, visible, enabled, onClick, onRelease)

    This class is an overload of Control that is used to create a button.

    Button

    Emits the following events:

    • "click" when the user confirm
    • "relese" when the user cancel

    | Param | Type | Description | | --- | --- | --- | | id | string |

    The id of the button.

    | | text | string |

    The text of the button.

    | | width | number |

    The width of the button.

    | | height | number |

    The height of the button.

    | | x | number |

    The x position of the button.

    | | y | number |

    The y position of the button.

    | | style | ButtonStyle |

    To set the style of the button.

    | | visible | boolean |

    If the button is visible. Default is true (make it hide using hide()).

    | | enabled | boolean |

    If the button is enabled. Default is true (make it disabled using disable()).

    | | onClick | function |

    The function to call when the button is clicked.

    | | onRelease | function |

    The function to call when the button is released.

    |

    Example

    new Button("btnRun", "Run me!", 10, 3, 21, 18, 
         { 
             color: "magentaBright", 
             bold: true, 
             italic: true,
             borderColor: "green"
         },
         () => {
             GUI.log("Button clicked!")
         })
    

    1.1.40 (Nov 2022) View on GitHub

    What's Changed

    • Elius94/issue43 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/44

    New Feature:

    options.enableMouse

    Enable mouse support. It works well on most linux terminals, but it doesn't work on Windows 10 and 11 unless you use WSL (Windows Subsystem for Linux).

    Mouse Example

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.32...v1.1.40

    1.1.31 (May 2022) View on GitHub

    Changed Layouts

    The application instance needs to output the content through a layout class. In the "layoutOptions" provided to the ConsoleManager, we can set the layout:

    • boxed: Set to true to enable boxed layout mode (default: true) image "boxed" image "not boxed"
    • showTitle: Set to false to hide titles (default: true, on title per page)
    • changeFocusKey: The key or the combination that will change the focus between the pages of the layout (default: 'ctrl+l')
    • type: Can be "single", "double" or "quad" to choose the layout type (default: "double") image "single" image "double" image "quad"
    • direction: Set to 'horizontal' to enable horizontal layout (only for "double" layout) image "horizontal" example
    • boxColor: The color of the box (default: 'yellow')
    • boxStyle: The style of the box (default: 'bold')

    To draw multiple pages, we need to use the setPage or setPages methods:

    GUI.setPage(p, 0) // Add the first page without explicit name (default: application title)
    
    const p1 = new PageBuilder()
    p1.addRow({ text: "SECOND PAGE", color: "green" })
    
    const P2 = new PageBuilder()
    P2.addRow({ text: "THIRD PAGE", color: "cyan" })
    
    GUI.setPage(p1, 1, "Top Right")
    GUI.setPage(P2, 2, "Bottom Left")
    
    // Or if we want to add the pages in the same order (only one render):
    GUI.setPages([p, p1, P2], ["App Title", "Top Right", "Bottom Left"])
    

    If we are in quad layout mode or double horizontal layout, we can change the aspect ratio of the layout rows by pressing the "left" and "right" keys: changeratio

    If you are using the quad layout mode the arrow keys will change the aspect ratio of the layout selected row (the top or the bottom row, depending on the selected page)

    1.1.16 (May 2022) View on GitHub

    What's Changed

    • InputPopup numeric should be able to manage decimal numbers by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/31
    • In PageBuilder Class: getPageHeight returns the exact number of rows but not the visible rows. Need to fix by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/32
    • GUI.log(), GUI.warn(), GUI.info(), GUI.error() functions have issues when the input is a number by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/34

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.15...v1.1.16

    1.1.11 (Apr 2022) View on GitHub

    What's Changed

    • New widget: Filemanager by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/26

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/1.1.10...1.1.11

    Classes

    FileSelectorPopup ⇐ EventEmitter

    Constants

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    FileSelectorPopup ⇐ EventEmitter

    Kind: global class
    Extends: EventEmitter

    new FileSelectorPopup(id, title, basePath, [limitToPath], [allowedExtensions], visible)

    This class is used to create a popup with a file input to select a file or a directory. It will run a promise with fs.readdir to get the list of files and directories. The user can select a file or a directory and the popup will be closed.

    FileSelectorPopup

    Emits the following events:

    • "confirm" when the user confirm the file or directory selection. The file or directory path is passed as parameter like this: {path: "path/to/file", name: "file.ext"}
    • "cancel" when the user cancel the file or directory selection.
    • "exit" when the user exit

    | Param | Type | Default | Description | | --- | --- | --- | --- | | id | string | | The id of the popup. | | title | string | | The title of the popup. | | basePath | string | | The main path of the popup. re case sensitive. | | [limitToPath] | boolean | false | If true, the user can select a directory. Otherwise, only files are selectable. When true, to enter a directory, the user must press the space key instead of the enter key. | | [allowedExtensions] | Array.<string> | [] | The allowed extensions. If not set, all extensions are allowed. The extensions a can only select files in the path. If false, the user can select files in the path and parent directories. | | visible | boolean | | If the popup is visible. Default is false (make it appears using show()). |

    Example

    const popup = new FileSelectorPopup("popup1", "Choose the file", "./examples").show().on("confirm", (selected) => { console.log(selected) }) // show the popup and wait for the user to confirm
    

    fileSelectorPopup.listDir(path) β‡’ Promise.<Array.<object>>

    This function is used to load the list of files and directories in the current path. it return a promise with the list of files and directories. The list is an array of objects like this: [{text: "πŸ“„ file.ext", name: "file.ext", type: "file", path: "path/to/file.ext"}, {text: "πŸ“ dir/", name: "dir", type: "dir", path: "path/to/dir"}]

    Kind: instance method of FileSelectorPopup
    Returns: Promise.<Array.<object>> - The list of files and directories.

    | Param | Type | Description | | --- | --- | --- | | path | string | The path to load the list. |

    fileSelectorPopup.updateList(path)

    This function calls the updateList function and store the result to this.options, it also refresh the list of files and directories.

    Kind: instance method of FileSelectorPopup

    | Param | Type | Description | | --- | --- | --- | | path | string | The path to load the list. |

    fileSelectorPopup.keyListner(str, key)

    This function is used to make the ConsoleManager handle the key events when the popup is showed. Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.

    Kind: instance method of FileSelectorPopup

    | Param | Type | Description | | --- | --- | --- | | str | string | The string of the input. | | key | Object | The key object. |

    fileSelectorPopup.getSelected() β‡’ string | number

    This function is used to get the selected option.

    Kind: instance method of FileSelectorPopup
    Returns: string | number - The selected value of the popup.

    fileSelectorPopup.setSelected(selected) β‡’ FileSelectorPopup

    This function is used to change the selection of the popup. It also refresh the ConsoleManager.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    | Param | Type | Description | | --- | --- | --- | | selected | string | number | The new value of the selection. |

    fileSelectorPopup.show() β‡’ FileSelectorPopup

    This function is used to show the popup. It also register the key events and refresh the ConsoleManager.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    fileSelectorPopup.hide() β‡’ FileSelectorPopup

    This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    fileSelectorPopup.isVisible() β‡’ boolean

    This function is used to get the visibility of the popup.

    Kind: instance method of FileSelectorPopup
    Returns: boolean - The visibility of the popup.

    fileSelectorPopup.manageInput() β‡’ FileSelectorPopup

    This function is used to add the FileSelectorPopup key listener callback to te ConsoleManager.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    fileSelectorPopup.unManageInput() β‡’ FileSelectorPopup

    This function is used to remove the FileSelectorPopup key listener callback to te ConsoleManager.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    fileSelectorPopup.draw() β‡’ FileSelectorPopup

    This function is used to draw the FileSelectorPopup to the screen in the middle.

    Kind: instance method of FileSelectorPopup
    Returns: FileSelectorPopup - The instance of the FileSelectorPopup.

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    Kind: global constant

    1.1.10 (Apr 2022) View on GitHub

    What's Changed

    • Elius94/issue21 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/25

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/1.1.9...1.1.10

    New widget: Free content popup Fixes #21

    Animation

    Added new widget: CustomPopup

    See the example using

    npm test
    

    and press "1"

    Usage

    const p = new PageBuilder(5) // Add a scroll limit so it will be scrollable with up and down
    p.addRow({ text: `Example of a custom popup content!`, color: 'yellow' })
    p.addRow({ text: `This is a custom popup!`, color: 'green' })
    p.addRow({ text: `It can be used to show a message,`, color: 'green' })
    p.addRow({ text: `or to show variables.`, color: 'green' })
    p.addRow({ text: `TCP Message sent: `, color: 'green' }, { text: `${tcpCounter}`, color: 'white' })
    p.addRow({ text: `Connected clients: `, color: 'green' }, { text: `${connectedClients}`, color: 'white' })
    p.addRow({ text: `Mode: `, color: 'green' }, { text: `${mode}`, color: 'white' })
    p.addRow({ text: `Message period: `, color: 'green' }, { text: `${period} ms`, color: 'white' })
    new CustomPopup("popupCustom1", "See that values", p, 32).show()
    

    Description

    Draws a popup that allows to pass a PageBuilder class to be drawed inside it.

    Docs

    Classes

    CustomPopup ⇐ EventEmitter

    Constants

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    CustomPopup ⇐ EventEmitter

    Kind: global class
    Extends: EventEmitter

    new CustomPopup(id, title, content, width, visible)

    This class is used to create a popup with a free content built- "data" when the user send custom event - the data is an object with the data and the event name

    | Param | Type | Description | | --- | --- | --- | | id | string | The id of the popup. | | title | string | The title of the popup. |
    | content | PageBuilder | The content of the popup. | | width | number | The width of the popup. |
    | visible | boolean | If the popup is visible. Default is false (make it appears using show()). |

    Example

    const popup = new CustomPopup("popup1", "Choose the number", selectedNumber, true).show().on("confirm", (value) => { console.log(value) }) // show the popup and wait for the user to confirm
    

    customPopup.keyListner(str, key)

    This function is used to make the ConsoleManager handle the keInside this function are defined all the keys that can be pressed and the actions to do when they are pressed.

    Kind: instance method of CustomPopup

    | Param | Type | Description | | --- | --- | --- | | str | string | The string of the input. |
    | key | Object | The key object. |

    customPopup.getContent() β‡’ PageBuilder

    This function is used to get the content of the popup.

    Kind: instance method of CustomPopup Returns: PageBuilder - The content of the popup.

    customPopup.setContent(newContent) β‡’ CustomPopup

    This function is used to change the content of the popup. It also refresh the ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    | Param | Type | Description | | --- | --- | --- | | newContent | PageBuilder | The new content of the popup. |

    customPopup.setWidth(newWidth) β‡’ CustomPopup

    This function is used to change the popup width. It also refresh the ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    | Param | Type | Description | | --- | --- | --- | | newWidth | number | The new width of the popup. |

    customPopup.show() β‡’ CustomPopup

    This function is used to show the popup. It also register the key events and refresh the ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    customPopup.hide() β‡’ CustomPopup

    This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    customPopup.isVisible() β‡’ boolean

    This function is used to get the visibility of the popup.

    Kind: instance method of CustomPopup Returns: boolean - The visibility of the popup.

    customPopup.manageInput() β‡’ CustomPopup

    This function is used to add the CustomPopup key listener callback to te ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    customPopup.unManageInput() β‡’ CustomPopup

    This function is used to remove the CustomPopup key listener callback to te ConsoleManager.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    customPopup.drawLine(line) β‡’ void

    This function is used to draw a single line of the layout to the screen. It also trim the line if it is too long.

    Kind: instance method of CustomPopup

    | Param | Type | Description | | --- | --- | --- | | line | Array.<object> | the line to be drawn |

    customPopup.draw() β‡’ CustomPopup

    This function is used to draw the CustomPopup to the screen in the middle.

    Kind: instance method of CustomPopup Returns: CustomPopup - The instance of the CustomPopup.

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    Kind: global constant

    1.1.7 (Apr 2022) View on GitHub

    What's Changed

    • Add PageDown and PageUp function in scrollable OptionPopup by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/18
    • Add new widget: Confirm Popup (Yes, no) by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/19

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/1.1.6...1.1.7

    Added two Widgets

    ButtonPopup

    Animation

    Classes

    ButtonPopup ⇐ EventEmitter

    Constants

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    Functions

    key)(str, key)

    This function is used to make the ConsoleManager handle the key events when the popup is showed. Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.

    ButtonPopup ⇐ EventEmitter

    Kind: global class
    Extends: EventEmitter

    new ButtonPopup(id, title, message, buttons, visible)

    • "exit" when the user exitncelrmpup with That asks for a confirm.

    | Param | Type | Description | | --- | --- | --- | | id | string | The id of the popup. | | title | string | The title of the popup. | | message | string | The message of the popup. | | buttons | Array.<string> | The buttons of the popup (default is ["Yes", "No"]). | | visible | boolean | If the popup is visible. Default is false (make it appears using show()). |

    Example

    const popup = new ButtonPopup("popup1", "Choose the option", ["YES", "NO", "?"]).show().on("confirm", (answer) => { console.log(answer) }) // show the popup and wait for the user to confirm
    

    buttonPopup.show() β‡’ ButtonPopup

    This function is used to show the popup. It also register the key events and refresh the ConsoleManager.

    Kind: instance method of ButtonPopup
    Returns: ButtonPopup - The instance of the ButtonPopup.

    buttonPopup.hide() β‡’ ButtonPopup

    This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.

    Kind: instance method of ButtonPopup
    Returns: ButtonPopup - The instance of the ButtonPopup.

    buttonPopup.isVisible() β‡’ boolean

    This function is used to get the visibility of the popup.

    Kind: instance method of ButtonPopup
    Returns: boolean - The visibility of the popup.

    buttonPopup.manageInput() β‡’ ButtonPopup

    This function is used to add the ButtonPopup key listener callback to te ConsoleManager.

    Kind: instance method of ButtonPopup
    Returns: ButtonPopup - The instance of the ButtonPopup.

    buttonPopup.unManageInput() β‡’ ButtonPopup

    This function is used to remove the ButtonPopup key listener callback to te ConsoleManager.

    Kind: instance method of ButtonPopup
    Returns: ButtonPopup - The instance of the ButtonPopup.

    buttonPopup.draw() β‡’ ButtonPopup

    This function is used to draw the ButtonPopup to the screen in the middle.

    Kind: instance method of ButtonPopup
    Returns: ButtonPopup - The instance of the ButtonPopup.

    CM : ConsoleManager

    the instance of ConsoleManager (singleton)

    Kind: global constant

    ConfirmPopup

    Animation

    ConfirmPopup ⇐ ButtonPopup

    Kind: global class Extends: ButtonPopup

    new ConfirmPopup(id, title, message, visible)

    This class is an overload of ButtonPopup that is used to create a popup wi- "exit" when the user exitncelrmNo].

    | Param | Type | Description | | --- | --- | --- | | id | string | The id of the popup. | | title | string | The title of the popup. | | message | string | The message of the popup. | | visible | boolean | If the popup is visible. Default is false (make it appears using show()). |

    Example

    const popup = new ConfirmPopup("popup1", "Are you shure").show().on("confirm", (answer) => { console.log(answer) }) // show the popup and wait for the user to confirm
    

    1.1.5 (Apr 2022) View on GitHub

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/1.1.2...1.1.5

    NEW DRAWING ALGORYTM

    Animation

    Now there's no more flickering in the screen! all the page is prerendered before printing on the console.

    Introduced new styling design pattern:

    Each page need to be created with the new class

    const p = new PageBuilder()
    

    and to add a styled row it's neccessary to call:

    p.addRow({ text: `  'm'`, color: 'gray', bold: true }, { text: `       - Select simulation mode`, color: 'white', italic: true })
    

    The arguments of that function is an array of object (function arguments syntax, no []!), so in a row you can add different phrases with different styles.

    The styles are converted to the Chalk modificator:

    colors:

    • black
    • red
    • green
    • yellow
    • blue
    • magenta
    • cyan
    • white
    • blackBright (alias: gray, grey)
    • redBright
    • greenBright
    • yellowBright
    • blueBright
    • magentaBright
    • cyanBright
    • whiteBright

    Background colors ('bg')

    • bgBlack
    • bgRed
    • bgGreen
    • bgYellow
    • bgBlue
    • bgMagenta
    • bgCyan
    • bgWhite
    • bgBlackBright (alias: bgGray, bgGrey)
    • bgRedBright
    • bgGreenBright
    • bgYellowBright
    • bgBlueBright
    • bgMagentaBright
    • bgCyanBright
    • bgWhiteBright

    Formatters (Each is a prop):

    • italic
    • bold
    • dim
    • underline
    • overline
    • inverse
    • hidden
    • strikethrough

    eg:

    p.addRow({ text: `TCP messages sent:`, color: 'green', bg: 'bgRed', bold: true, italic: true, underline: true }, { text: ` ${tcpCounter}`, color: 'white' })
    

    And so, we can add the PageBuilder to the home page

    GUI.setHomePage(p)
    

    The new Screen class is used internally by the ConsoleManager.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Nov 19, 2022)

    What's Changed

    • Elius94/issue22 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/45
    • Elius94/issue6 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/46

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.41...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.41(Nov 16, 2022)

  • v1.1.40(Nov 15, 2022)

    What's Changed

    • Elius94/issue43 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/44

    New Feature:

    options.enableMouse

    Enable mouse support. It works well on most linux terminals, but it doesn't work on Windows 10 and 11 unless you use WSL (Windows Subsystem for Linux).

    Mouse Example

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.32...v1.1.40

    Source code(tar.gz)
    Source code(zip)
  • v1.1.32(Nov 9, 2022)

  • v1.1.31(May 30, 2022)

    What's Changed

    • Elius94/issue41 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/42

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.30...v1.1.31

    Source code(tar.gz)
    Source code(zip)
  • v1.1.30(May 23, 2022)

  • v1.1.29(May 23, 2022)

  • v1.1.28(May 23, 2022)

    What's Changed

    • Fixed procedure by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/40

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.24...v1.1.28

    Source code(tar.gz)
    Source code(zip)
  • v1.1.27(May 23, 2022)

  • v1.1.24(May 20, 2022)

    What's Changed

    • Set up Typescript environment to build project for both es2022 and co… by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/39

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.22...v1.1.24

    Source code(tar.gz)
    Source code(zip)
  • v1.1.22(May 20, 2022)

  • v1.1.21(May 20, 2022)

    What's Changed

    • Back by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/37

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.18...v1.1.21

    Source code(tar.gz)
    Source code(zip)
  • v1.1.20(May 20, 2022)

  • v1.1.18(May 20, 2022)

  • v1.1.17(May 20, 2022)

    What's Changed

    • Elius94/issue35 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/36

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.16...v1.1.17

    Source code(tar.gz)
    Source code(zip)
  • v1.1.16(May 19, 2022)

    What's Changed

    • InputPopup numeric should be able to manage decimal numbers by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/31
    • In PageBuilder Class: getPageHeight returns the exact number of rows but not the visible rows. Need to fix by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/32
    • GUI.log(), GUI.warn(), GUI.info(), GUI.error() functions have issues when the input is a number by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/34

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/v1.1.15...v1.1.16

    Source code(tar.gz)
    Source code(zip)
  • v1.1.15(May 19, 2022)

  • v1.1.14(May 19, 2022)

  • v1.1.13(May 19, 2022)

  • 1.1.12(May 11, 2022)

    What's Changed

    • Elius94/issue8 by @Elius94 in https://github.com/Elius94/console-gui-tools/pull/28

    Full Changelog: https://github.com/Elius94/console-gui-tools/compare/1.1.11...1.1.12

    Source code(tar.gz)
    Source code(zip)
Owner
Elia Lazzari
Software Developer πŸ§‘β€πŸ’» Javascript, NodeJS Entusiast, Mountain lover, Landscapes Photographer πŸ”οΈπŸ“·
Elia Lazzari
This is collection of the CNCF logos packed into a draw.io importable file to draw cloud native architectures

draw-io-cncf-shape This is collection of the CNCF logos packed into a draw.io importable file to draw cloud native architectures How to embed the shap

Jan-Otto KrΓΆpke 10 Dec 26, 2022
jSide Menu is a well designed, simple and clean side navigation menu with dropdowns.

jQuery jSide Menu jSide Menu is a well designed, simple and clean side navigation menu with dropdowns. Browse: Live Demo & Using Guide Main Features F

CodeHim 24 Feb 14, 2022
VanillaSelectBox - A dropdown menu with lots of features that takes a select tag and transforms it into a single or multi-select menu with 1 or 2 levels

vanillaSelectBox v1.0.0 vanillaSelectBox : v1.00 : Adding a package.json file New : Possibility to change the dropdown tree and change the remote sear

philippe MEYER 103 Dec 16, 2022
This restaurant project is a SPA (single-page application) website. The user can navigate between the home, menu and contact page. I used the MealDB API to display some menu items.

Fresh Cuisine This restaurant project is from the Odin Project and it is a SPA (single-page application) website. The user can navigate between the ho

Virag Kormoczy 7 Nov 2, 2022
Obsidian-dataview-table-filter-menu - Dynamically created filter menu for dataview tables in obsidian

Dataview table Filter Menu for Obsidian Dynamically created filter menu for data

shiro 17 Sep 24, 2022
A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.

Letter Shuffle Animation for a Menu A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item

Codrops 29 Dec 4, 2022
πŸ‘¨πŸΌβ€πŸŽ¨ It is a virtual blackboard, where you can make πŸ–Œ drawings through πŸ–± the mouse. You have the option to choose 🎨 colors and line thickness.

????‍?? Lets Draw ?? ÍNDICE 1. Lets-Draw 2. Realization of the Project 3. Technologies used 4. Authors 1. Lets-Draw ????‍?? It is a virtual blackboard

Rosamaria Rodriguez 2 Mar 7, 2022
Rust's Option and Result, implemented for TypeScript.

oxide.ts Rust's Option<T> and Result<T, E>, implemented for TypeScript. Features Zero dependencies, full test coverage and examples for every function

null 331 Jan 3, 2023
A simple JS example for NextAuth Google login with a popup window instead of redirect.

A simple JS example for NextAuth Google login with a popup window instead of redirect.

null 13 Dec 7, 2022
This is a tic-tac-toe game but differs from most others as it carries the option of playing against an AI (COM) or against a friend.

TIC-TAC-TOE This is a simple tic-tac-toe game with the exception of playing against an algorithm or against a friend. At the very start, you have to s

Paul Ibeabuchi C. 4 Jul 2, 2022
The frontend of a full stack application of a personal wallet made with React, Node and MongoDB that allows you to add inputs, outputs and see all your extract.

The frontend of a full stack application of a personal wallet made with React, Node and MongoDB that allows you to add inputs, outputs and see all your extract.

Bernardo Rodrigues 5 Jun 2, 2022
The backend of a full stack application of a personal wallet made with React, Node and MongoDB that allows you to add inputs, outputs and see all your extract.

My first full stack application with the concept of a personal wallet that allows you to create a personal account to keep track of your entire statement by adding incoming and outgoing transactions, as well as calculating the total balance and being able to edit and delete old transactions.

Bernardo Rodrigues 6 Jun 23, 2022
A jQuery-free general purpose library for building credit card forms, validating inputs and formatting numbers.

A jQuery-free general purpose library for building credit card forms, validating inputs and formatting numbers.

Jesse Pollak 528 Dec 30, 2022
Simple material-style text inputs

Material-style inputs for Bootstrap 4 View Codepen: ralphvk/pen/LXpomR Add material-style inputs to your project. Include Bootstrap and jQuery First,

Ralph van Kruiselbergen 4 May 13, 2021
A beautiful, responsive, highly customizable and accessible replacement for JavaScript's popup boxes. Zero dependencies.Alerts ,dialogs

AsgarAlert (v1) for JS Install <script defer src="/asgar-alert.js"></script> Examples The most basic message: asgar("Hello world!"); A message signali

Asgar Aliyev 5 Dec 20, 2022
Popup without jQuery

popup.js Popup without jQuery Demos https://ohno.github.io/popup.js/ CDN <script src="https://cdn.jsdelivr.net/gh/ohno/[email protected]/popup.min.js"></

Shuhei Ohno 2 Mar 24, 2022
Base provides advanced Promise Queue Manager, Custom Console Logger and other utilities.

Base Base provides frequently used functionality like cutome logger, response helper, Custom Promise and Instance composer. These are used in almost a

PLG Works 14 Jun 14, 2022