aboutsummaryrefslogtreecommitdiff
path: root/node_modules/cli-cursor
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
committerMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
commit01160246e4a0c0052181c72a53737e356ea7d02d (patch)
treec6f8ea675f9147d4c06ef503697fb35d58493991 /node_modules/cli-cursor
parentaf898a152a14e31bdbcbbedb952ad333697553ef (diff)
downloadtwilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.gz
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.bz2
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.zip
First commit
Diffstat (limited to 'node_modules/cli-cursor')
-rw-r--r--node_modules/cli-cursor/index.d.ts47
-rw-r--r--node_modules/cli-cursor/index.js39
-rw-r--r--node_modules/cli-cursor/license9
-rw-r--r--node_modules/cli-cursor/package.json49
-rw-r--r--node_modules/cli-cursor/readme.md51
5 files changed, 195 insertions, 0 deletions
diff --git a/node_modules/cli-cursor/index.d.ts b/node_modules/cli-cursor/index.d.ts
new file mode 100644
index 0000000..bfd4f63
--- /dev/null
+++ b/node_modules/cli-cursor/index.d.ts
@@ -0,0 +1,47 @@
+declare const cliCursor: {
+ /**
+ Show cursor.
+
+ @param stream - Default: `process.stderr`.
+
+ @example
+ ```
+ import cliCursor from 'cli-cursor';
+
+ cliCursor.show();
+ ```
+ */
+ show(stream?: NodeJS.WritableStream): void;
+
+ /**
+ Hide cursor.
+
+ @param stream - Default: `process.stderr`.
+
+ @example
+ ```
+ import cliCursor from 'cli-cursor';
+
+ cliCursor.hide();
+ ```
+ */
+ hide(stream?: NodeJS.WritableStream): void;
+
+ /**
+ Toggle cursor visibility.
+
+ @param force - Is useful to show or hide the cursor based on a boolean.
+ @param stream - Default: `process.stderr`.
+
+ @example
+ ```
+ import cliCursor from 'cli-cursor';
+
+ const unicornsAreAwesome = true;
+ cliCursor.toggle(unicornsAreAwesome);
+ ```
+ */
+ toggle(force?: boolean, stream?: NodeJS.WritableStream): void;
+};
+
+export default cliCursor;
diff --git a/node_modules/cli-cursor/index.js b/node_modules/cli-cursor/index.js
new file mode 100644
index 0000000..8435813
--- /dev/null
+++ b/node_modules/cli-cursor/index.js
@@ -0,0 +1,39 @@
+import process from 'node:process';
+import restoreCursor from 'restore-cursor';
+
+let isHidden = false;
+
+const cliCursor = {};
+
+cliCursor.show = (writableStream = process.stderr) => {
+ if (!writableStream.isTTY) {
+ return;
+ }
+
+ isHidden = false;
+ writableStream.write('\u001B[?25h');
+};
+
+cliCursor.hide = (writableStream = process.stderr) => {
+ if (!writableStream.isTTY) {
+ return;
+ }
+
+ restoreCursor();
+ isHidden = true;
+ writableStream.write('\u001B[?25l');
+};
+
+cliCursor.toggle = (force, writableStream) => {
+ if (force !== undefined) {
+ isHidden = force;
+ }
+
+ if (isHidden) {
+ cliCursor.show(writableStream);
+ } else {
+ cliCursor.hide(writableStream);
+ }
+};
+
+export default cliCursor;
diff --git a/node_modules/cli-cursor/license b/node_modules/cli-cursor/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/node_modules/cli-cursor/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/cli-cursor/package.json b/node_modules/cli-cursor/package.json
new file mode 100644
index 0000000..4ae8153
--- /dev/null
+++ b/node_modules/cli-cursor/package.json
@@ -0,0 +1,49 @@
+{
+ "name": "cli-cursor",
+ "version": "4.0.0",
+ "description": "Toggle the CLI cursor",
+ "license": "MIT",
+ "repository": "sindresorhus/cli-cursor",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "type": "module",
+ "exports": "./index.js",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "cli",
+ "cursor",
+ "ansi",
+ "toggle",
+ "display",
+ "show",
+ "hide",
+ "term",
+ "terminal",
+ "console",
+ "tty",
+ "shell",
+ "command-line"
+ ],
+ "dependencies": {
+ "restore-cursor": "^4.0.0"
+ },
+ "devDependencies": {
+ "@types/node": "^16.7.1",
+ "ava": "^3.15.0",
+ "tsd": "^0.17.0",
+ "xo": "^0.44.0"
+ }
+}
diff --git a/node_modules/cli-cursor/readme.md b/node_modules/cli-cursor/readme.md
new file mode 100644
index 0000000..addfea8
--- /dev/null
+++ b/node_modules/cli-cursor/readme.md
@@ -0,0 +1,51 @@
+# cli-cursor
+
+> Toggle the CLI cursor
+
+The cursor is [gracefully restored](https://github.com/sindresorhus/restore-cursor) if the process exits.
+
+## Install
+
+```
+$ npm install cli-cursor
+```
+
+## Usage
+
+```js
+import cliCursor from 'cli-cursor';
+
+cliCursor.hide();
+
+const unicornsAreAwesome = true;
+cliCursor.toggle(unicornsAreAwesome);
+```
+
+## API
+
+### .show(stream?)
+
+### .hide(stream?)
+
+### .toggle(force?, stream?)
+
+#### force
+
+Useful for showing or hiding the cursor based on a boolean.
+
+#### stream
+
+Type: `stream.Writable`\
+Default: `process.stderr`
+
+---
+
+<div align="center">
+ <b>
+ <a href="https://tidelift.com/subscription/pkg/npm-cli-cursor?utm_source=npm-cli-cursor&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+ </b>
+ <br>
+ <sub>
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+ </sub>
+</div>