awesome-logging
Advanced tools
Comparing version 0.2.9 to 0.2.10-pre1
@@ -24,2 +24,4 @@ "use strict"; | ||
this.changeKeyListener(undefined); | ||
let isIncomplete = false; | ||
let incompletePart = ''; | ||
stdin.on('data', (key) => { | ||
@@ -32,3 +34,19 @@ var _a; | ||
} | ||
(_a = this._currentKeyListener) === null || _a === void 0 ? void 0 : _a.call(this, key.toString()); | ||
// This incomplete logic is a workaround for stackblitz | ||
// where data is triggered on a per-character basis | ||
if (isIncomplete) { | ||
incompletePart += key; | ||
return; | ||
} | ||
if (key.toString() === ansi_utils_1.CONTROL_PREFIX_FIRST_CHAR) { | ||
isIncomplete = true; | ||
incompletePart = ansi_utils_1.CONTROL_PREFIX_FIRST_CHAR; | ||
setTimeout(() => { | ||
var _a; | ||
(_a = this._currentKeyListener) === null || _a === void 0 ? void 0 : _a.call(this, incompletePart); | ||
}, 10); | ||
} | ||
else { | ||
(_a = this._currentKeyListener) === null || _a === void 0 ? void 0 : _a.call(this, key.toString()); | ||
} | ||
}); | ||
@@ -35,0 +53,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export {}; | ||
export declare const CONTROL_PREFIX: string; |
@@ -6,7 +6,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.KEY_ARROW_LEFT = exports.KEY_ARROW_RIGHT = exports.KEY_ARROW_DOWN = exports.KEY_ARROW_UP = exports.RESTORE_CURSOR = exports.SAVE_CURSOR = exports.STOP_BLINK_CURSOR = exports.START_BLINK_CURSOR = exports.SHOW_CURSOR = exports.HIDE_CURSOR = exports.CLEAR_LINE = exports.DELETE_LINE = exports.INSERT_NEW_LINE = exports.INSERT_LINE = exports.MOVE_DOWN = exports.MOVE_UP = exports.MOVE_LEFT = exports.CONTROL_PREFIX = void 0; | ||
exports.KEY_ARROW_LEFT = exports.KEY_ARROW_RIGHT = exports.KEY_ARROW_DOWN = exports.KEY_ARROW_UP = exports.RESTORE_CURSOR = exports.SAVE_CURSOR = exports.STOP_BLINK_CURSOR = exports.START_BLINK_CURSOR = exports.SHOW_CURSOR = exports.HIDE_CURSOR = exports.CLEAR_LINE = exports.DELETE_LINE = exports.INSERT_NEW_LINE = exports.INSERT_LINE = exports.MOVE_DOWN = exports.MOVE_UP = exports.MOVE_LEFT = exports.CONTROL_PREFIX = exports.CONTROL_PREFIX_FIRST_CHAR = void 0; | ||
const restore_cursor_1 = __importDefault(require("restore-cursor")); | ||
restore_cursor_1.default(); | ||
// @internal | ||
exports.CONTROL_PREFIX = '\u001b['; | ||
exports.CONTROL_PREFIX_FIRST_CHAR = '\u001b'; | ||
exports.CONTROL_PREFIX = `${exports.CONTROL_PREFIX_FIRST_CHAR}[`; | ||
let cursorVisible = true; | ||
@@ -13,0 +14,0 @@ const debug = false; |
{ | ||
"name": "awesome-logging", | ||
"version": "0.2.9", | ||
"version": "0.2.10-pre1", | ||
"description": "Advanced logging messages, interactive prompts, loading animations and more in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Awesome Logging | ||
![npm](https://img.shields.io/npm/v/awesome-logging?style=for-the-badge) ![Azure DevOps builds](https://img.shields.io/azure-devops/build/loaderb0t/7dce405f-9e33-4681-90c6-b067f1880cb0/30?style=for-the-badge) | ||
[![npm](https://img.shields.io/npm/v/awesome-logging?style=for-the-badge)](https://www.npmjs.com/package/awesome-logging) | ||
[![Azure DevOps builds](https://img.shields.io/azure-devops/build/loaderb0t/7dce405f-9e33-4681-90c6-b067f1880cb0/30?style=for-the-badge)](https://dev.azure.com/loaderb0t/awesome-logging/_build?definitionId=30&_a=summary) | ||
[![Sonar Quality Gate](https://img.shields.io/sonar/alert_status/LoaderB0T_awesome-logging?server=https%3A%2F%2Fsonarcloud.io&sonarVersion=8.8&style=for-the-badge)](https://sonarcloud.io/dashboard?id=LoaderB0T_awesome-logging) | ||
**awesome-logging** is a collection of fancy text outputs and inputs for CLI tools written in NodeJS. | ||
@@ -5,0 +8,0 @@ No matter what you want to log to the terminal or what information you need from the user, **awesome-logging** will help you do so. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
176241
164
2438
199