console-gui-tools
Advanced tools
Comparing version 1.1.15 to 1.1.16
{ | ||
"name": "console-gui-tools", | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"description": "A simple library to draw option menu, text popup or other widgets and layout on a Node.js console.", | ||
@@ -38,4 +38,5 @@ "main": "src/ConsoleGui.js", | ||
"devDependencies": { | ||
"eslint": "^8.15.0", | ||
"jsdoc-to-markdown": "^7.1.1" | ||
} | ||
} |
# console-gui-tools | ||
A simple library to draw option menu, text popup or other widgets and layout on a Node.js console. | ||
[![npm version](https://badge.fury.io/js/console-gui-tools.svg)](https://npmjs.com/package/console-gui-tools) [![npm](https://img.shields.io/npm/dt/console-gui-tools)](https://npmjs.com/package/console-gui-tools) ![GitHub](https://img.shields.io/github/license/elius94/console-gui-tools) | ||
[![npm version](https://badge.fury.io/js/console-gui-tools.svg)](https://npmjs.com/package/console-gui-tools) [![npm](https://img.shields.io/npm/dt/console-gui-tools)](https://npmjs.com/package/console-gui-tools) ![npm bundle size](https://img.shields.io/bundlephobia/min/console-gui-tools) ![GitHub](https://img.shields.io/github/license/elius94/console-gui-tools) | ||
# console-gui-tools | ||
@@ -7,0 +7,0 @@ A simple Node.js library to create Console Apps like a wizard (or maybe if you like old style colored screen or something like "teletext" programs 😂) |
@@ -209,3 +209,3 @@ import { ConsoleManager } from "../../ConsoleGui.js" | ||
const trimmedTitle = [this.CM.truncate(this.page1Title, this.realWidth[0] - 4, false), this.CM.truncate(this.page2Title, this.realWidth[1] - 3, false)] | ||
const maxPageHeight = Math.max(this.page1.getPageHeight(), this.page2.getPageHeight()) | ||
const maxPageHeight = Math.max(this.page1.getViewedPageHeight(), this.page2.getViewedPageHeight()) | ||
const p1 = this.page1.getContent() | ||
@@ -212,0 +212,0 @@ const p2 = this.page2.getContent() |
@@ -101,2 +101,12 @@ /** | ||
/** | ||
* @description Returns the height of the viewed page. It excludes the rows that are not visible. | ||
* @returns {number} | ||
* @memberOf PageBuilder | ||
* @example page.getViewedPageHeight() // returns the height of the page that is visible | ||
*/ | ||
getViewedPageHeight() { | ||
return this.getContent().length | ||
} | ||
/** | ||
* @description Changes the index of the scroll bar. | ||
@@ -103,0 +113,0 @@ * @param {number} index - The index of the scroll bar. |
@@ -42,7 +42,8 @@ import { EventEmitter } from "events" | ||
let arg = arguments[i] | ||
if (arg.text) { | ||
if (arg.text !== undefined) { | ||
const txt = arg.text.toString() | ||
let style = arg.style | ||
style.index = [row.length, row.length + arg.text.length] | ||
style.index = [row.length, row.length + txt.length] | ||
newStyleIndex.push(style) | ||
row += arg.text | ||
row += txt | ||
} | ||
@@ -49,0 +50,0 @@ } |
import { EventEmitter } from "events" | ||
import readline from 'readline'; | ||
import { PageBuilder, Screen } from './components/index.js'; | ||
import readline from "readline"; | ||
import { PageBuilder, Screen } from "./components/index.js"; | ||
import { DoubleLayout } from "./components/layout/index.js"; | ||
@@ -40,6 +40,2 @@ import { InputPopup, OptionPopup, ButtonPopup, ConfirmPopup, CustomPopup, FileSelectorPopup } from "./components/widgets/index.js"; | ||
/** @const {PageBuilder} stdOut - The logs page */ | ||
this.stdOut = new PageBuilder(); | ||
this.stdOut.setRowsPerPage(this.logPageSize); | ||
/** @const {Array<PageBuilder>} homePage - The main application */ | ||
@@ -89,2 +85,6 @@ this.pages = [new PageBuilder(), new PageBuilder()]; | ||
/** @const {PageBuilder} stdOut - The logs page */ | ||
this.stdOut = new PageBuilder(); | ||
this.stdOut.setRowsPerPage(this.logPageSize); | ||
/** @const {DoubleLayout} layout - The layout instance */ | ||
@@ -300,6 +300,6 @@ if (this.logLocation === 'popup') { | ||
this.pages = pages | ||
if (this.logLocation === 'popup') { | ||
if (this.logLocation === "popup") { | ||
this.layout.setPage1(this.pages[0]) | ||
this.layout.setPage2(this.pages[1]) | ||
} else if (typeof this.logLocation === 'number') { | ||
} else if (typeof this.logLocation === "number") { | ||
if (this.logLocation === 0) { | ||
@@ -306,0 +306,0 @@ this.layout.setPage2(this.pages[0]) |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
195279
33
2666
2