{ "_id": "ink", "_rev": "82-91a84ad3a1e3da4489993e38703fdf37", "name": "ink", "description": "React for CLI", "dist-tags": { "latest": "3.0.8", "next": "3.0.0-7" }, "versions": { "0.0.1": { "name": "ink", "version": "0.0.1", "description": "Automated versioning", "main": "main.js", "author": { "name": "Giles Lavelle" }, "license": "MIT", "dependencies": { "semver": "*", "prompt": "*" }, "bin": { "ink": "main.js" }, "repository": { "type": "git", "url": "https://github.com/lavelle/ink.git" }, "bugs": { "url": "https://github.com/lavelle/ink/issues" }, "_id": "ink@0.0.1", "dist": { "shasum": "7b44688d0269ce6fb9fdacf64d9edf8d723b1862", "tarball": "https://registry.npmjs.org/ink/-/ink-0.0.1.tgz" }, "_from": ".", "_npmVersion": "1.3.2", "_npmUser": { "name": "lavelle", "email": "giles.lavelle@gmail.com" }, "maintainers": [ { "name": "lavelle", "email": "giles.lavelle@gmail.com" } ], "directories": {} }, "0.0.2": { "name": "ink", "version": "0.0.2", "description": "Automated versioning", "main": "main.js", "author": { "name": "Giles Lavelle" }, "license": "MIT", "dependencies": { "semver": "*", "prompt": "*" }, "bin": { "ink": "main.js" }, "repository": { "type": "git", "url": "https://github.com/lavelle/ink.git" }, "bugs": { "url": "https://github.com/lavelle/ink/issues" }, "_id": "ink@0.0.2", "dist": { "shasum": "9a9e445745be1ae3ab0307b9a847a1c4d0977ebf", "tarball": "https://registry.npmjs.org/ink/-/ink-0.0.2.tgz" }, "_from": ".", "_npmVersion": "1.3.2", "_npmUser": { "name": "lavelle", "email": "giles.lavelle@gmail.com" }, "maintainers": [ { "name": "lavelle", "email": "giles.lavelle@gmail.com" } ], "directories": {} }, "0.1.0": { "name": "ink", "version": "0.1.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">= 4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli" ], "dependencies": { "arrify": "^1.0.1", "chalk": "github:chalk/chalk", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2" }, "devDependencies": { "ava": "^0.19.1", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.12.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/prop-types": 0 }, "settings": { "react": { "pragma": "h" } } }, "gitHead": "5a149313c90a3389ed5a4c51bfe2709047d700fd", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.1.0", "_npmVersion": "5.0.3", "_nodeVersion": "8.1.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-Ru4tuMEcMjCxE2CKOUHlGFGnwDrBVkmKALe3qYhDvkJWQahPAXs7kjtqz45ZJYONJaulxs4M7KbwCkZuvRarBw==", "shasum": "6cd4433d4c7b21fe84902c7640b424904eeabef4", "tarball": "https://registry.npmjs.org/ink/-/ink-0.1.0.tgz" }, "maintainers": [ { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.1.0.tgz_1499275680445_0.39902304066345096" }, "directories": {} }, "0.1.1": { "name": "ink", "version": "0.1.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">= 4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2" }, "devDependencies": { "ava": "^0.19.1", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.12.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/prop-types": 0 }, "settings": { "react": { "pragma": "h" } } }, "gitHead": "a3de3422dbf346b3e9ee55bb28059f9bd77005d3", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.1.1", "_npmVersion": "5.0.3", "_nodeVersion": "8.1.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-xE7ARmHrgSFLXlPENwyGKJHIyESXMOcMorUY0pb2iGx7mvwHv2R1h/d8mKD3a8XCHDdR0kjhoA1u9k2HJR2Q0Q==", "shasum": "87ec0a7230d3815190f398569e453eb0dad827ff", "tarball": "https://registry.npmjs.org/ink/-/ink-0.1.1.tgz" }, "maintainers": [ { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.1.1.tgz_1499275924019_0.8920578227844089" }, "directories": {} }, "0.1.2": { "name": "ink", "version": "0.1.2", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">= 4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2" }, "devDependencies": { "ava": "^0.19.1", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.12.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/prop-types": 0 }, "settings": { "react": { "pragma": "h" } } }, "gitHead": "16cf8c6df8466323c0b6eb176a21619f97fc0918", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.1.2", "_npmVersion": "5.0.3", "_nodeVersion": "8.1.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-HComzeD29NDTrAVOwvdbeS5HPEiA/MgFMp15XMBSN3rpYapOaLxA37RU+2MxhrUrttaLRQVmC14SKGCU+Bytdw==", "shasum": "fb74b660aea1291e7effe8cef47908f7da98b8a4", "tarball": "https://registry.npmjs.org/ink/-/ink-0.1.2.tgz" }, "maintainers": [ { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.1.2.tgz_1499624023582_0.8917997947428375" }, "directories": {} }, "0.2.0": { "name": "ink", "version": "0.2.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2" }, "devDependencies": { "ava": "^0.20.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "rules": { "react/prop-types": 0 }, "settings": { "react": { "pragma": "h" } } }, "gitHead": "d09c472ae315a4c138b054f75ee2aa10812c2298", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.2.0", "_npmVersion": "5.1.0", "_nodeVersion": "8.1.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-nlhGIguGAAHXmqXU50BgNxbI5NOJv9omVg8zHdLX9fvkwzpWF1k5rpeo0pxxa9Cv6B0wrJsWgk/1ivT77bYalg==", "shasum": "a5c7e377f83a52b0d83cac91a9ad38ca18042eed", "tarball": "https://registry.npmjs.org/ink/-/ink-0.2.0.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.2.0.tgz_1500052207208_0.4311827812343836" }, "directories": {} }, "0.2.1": { "name": "ink", "version": "0.2.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2", "prop-types": "^15.5.10" }, "devDependencies": { "ava": "^0.20.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h" } }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0 } } ] }, "gitHead": "09d75c2542400888e6a151a80170848a0f9a0d5a", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.2.1", "_npmVersion": "5.1.0", "_nodeVersion": "8.1.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-3enpXrGoIp3BXXZRGoqsyvDYzFoOpU3fZrhA+d+vKU87ck4UOW6Bzc40yWE1u+HC+UqakOt87l5Urti7fcjS5g==", "shasum": "dabf43e4a54431f955baaef49ab178ebdc334bb0", "tarball": "https://registry.npmjs.org/ink/-/ink-0.2.1.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.2.1.tgz_1500130352939_0.4120405027642846" }, "directories": {} }, "0.3.0": { "name": "ink", "version": "0.3.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^1.0.2", "prop-types": "^15.5.10" }, "devDependencies": { "ansi-styles": "^3.1.0", "ava": "^0.21.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h" } }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0 } } ] }, "gitHead": "0a66d0f1383b153085e2a62882acf39338fc2972", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.3.0", "_npmVersion": "5.0.3", "_nodeVersion": "8.1.4", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-DPcPpqhojqGVzW2FAeeI9+VDWzErnApeV76ddnh+AOnBbWRsAk6XRoP3vyBeMXpgEjB9aS4q9vadBQ9qL/TYag==", "shasum": "f6c0f611dba64494a99d2e10a85ae6433fd7ac1d", "tarball": "https://registry.npmjs.org/ink/-/ink-0.3.0.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.3.0.tgz_1500222309912_0.09638189687393606" }, "directories": {} }, "0.3.1": { "name": "ink", "version": "0.3.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=6" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "lodash.flattendeep": "^4.4.0", "lodash.isequal": "^4.5.0", "log-update": "^2.1.0", "prop-types": "^15.5.10" }, "devDependencies": { "ansi-styles": "^3.1.0", "ava": "^0.21.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h" } }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0 } } ] }, "gitHead": "0b096c89ffaa275ca6692f7eb5525d5ace542a35", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.3.1", "_npmVersion": "5.0.3", "_nodeVersion": "8.1.4", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-e3JOOBLE6cDO2aWWkIYXXT7qhb9HN4mBHSiOj2Hv94VAMDiDb0J50koYtxY0tZBq9N117QENGoURmL+tunxQJw==", "shasum": "551047276cb93baa3f14eafaef2ae5b1526e8213", "tarball": "https://registry.npmjs.org/ink/-/ink-0.3.1.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.3.1.tgz_1502129334115_0.019377577817067504" }, "directories": {} }, "0.4.0": { "name": "ink", "version": "0.4.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=6" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "is-equal-shallow": "^0.1.3", "lodash.flattendeep": "^4.4.0", "log-update": "^2.1.0", "prop-types": "^15.5.10" }, "devDependencies": { "ansi-styles": "^3.1.0", "ava": "^0.21.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h" } }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0 } } ] }, "gitHead": "6e96cdf5a7e37b09ed76126f2f59566747ec83d4", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.4.0", "_npmVersion": "5.6.0", "_nodeVersion": "9.4.0", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-81mKT9LbUYwYkGrqqaI8F1vgyfqO65J1pz8Vgt+MwGQie86uggpcvh8VtkbR46yDv3ekrzwk+e6/QliOd4ZIdA==", "shasum": "31e806a47e38dc995dea6ef09a8943564d762f88", "tarball": "https://registry.npmjs.org/ink/-/ink-0.4.0.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.4.0.tgz_1516656496051_0.8783806047867984" }, "directories": {} }, "0.4.1": { "name": "ink", "version": "0.4.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=6" }, "scripts": { "test": "xo && ava" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "is-equal-shallow": "^0.1.3", "lodash.flattendeep": "^4.4.0", "log-update": "^2.1.0", "prop-types": "^15.5.10" }, "devDependencies": { "ansi-styles": "^3.1.0", "ava": "^0.21.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-register": "^6.24.1", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "ava": { "require": [ "babel-register" ], "babel": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "transform-react-jsx", { "pragma": "h" } ] ] } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h" } }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0 } } ] }, "gitHead": "0667bc768e126fffb0fbe831815e4ca68656271a", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.4.1", "_npmVersion": "5.6.0", "_nodeVersion": "9.4.0", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-42rsCNdZ7X0eHKZpFwspffIaxJ2Qa5Vciwzl9+G1Uvw6Asb2gH/ohilRFhtzeVV1jH/FGbgQTKlcl2ADjx3Qjw==", "shasum": "8f93fcf5e0f2d671558256ba38a632b56bd2452b", "tarball": "https://registry.npmjs.org/ink/-/ink-0.4.1.tgz" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink-0.4.1.tgz_1516657307172_0.4682195042259991" }, "directories": {} }, "0.5.0": { "name": "ink", "version": "0.5.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=6" }, "scripts": { "test": "xo && ava", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "is-equal-shallow": "^0.1.3", "lodash.flattendeep": "^4.4.0", "log-update": "^2.1.0", "prop-types": "^15.5.10" }, "devDependencies": { "@babel/core": "^7.0.0-beta.44", "@babel/plugin-transform-react-jsx": "^7.0.0-beta.44", "@babel/register": "^7.0.0-beta.44", "ansi-styles": "^3.1.0", "ava": "^1.0.0-beta.3", "babel-eslint": "^8.2.2", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.18.2" }, "ava": { "require": [ "@babel/register" ], "babel": { "testOptions": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "@babel/plugin-transform-react-jsx", { "pragma": "h", "pragmaFrag": "h.Fragment" } ] ] } } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h", "pragmaFrag": "h.Fragment" } }, "parser": "babel-eslint", "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0, "quotes": 0 } } ] }, "gitHead": "7cca6e4faaab770304ca352f72a141cac9b893ae", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.5.0", "_npmVersion": "5.6.0", "_nodeVersion": "8.9.4", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-ra7zlI9Nz8v8JqLEOTazxPsoI12Ume1EWbyFQoSLQsPV/dLe8mBay546hRnadQ1KCjkZ9jQYzDqXusGkzmXsHg==", "shasum": "38911f1e4102388b4095336f0470cfc6419154dc", "tarball": "https://registry.npmjs.org/ink/-/ink-0.5.0.tgz", "fileCount": 22, "unpackedSize": 32523, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa5bgKCRA9TVsSAnZWagAAQo0P/0axZoj4Atz6gpQloBNF\n1loUA/hGcFqXlsOmRbAARxGqdbDxhTy7V1d8h46cV59f8PhkEZyJT04ZtL8V\nfe+Xloz98kmFrkzb9L1erWQhnsxXWQ78fJRdH6B+Qkjdiox7CnWVUikLcefs\n6zSJIGeMKF07p07fRkIx1hpyCfWNLRAtvBRHZdqZd+PphGckF6qQm/A7uAOG\noKsHLx4XiZOBS9P023JjKoJ/uWw5+yjYfiYK1uTuGRxXE/ZmWIHm0h5hApBT\nwvFq7mQJEQmL3TUaABDcyzXxw3HBZ3TS7bdGc8V2jZLo+llTsZQPByh8emqY\nvwMKyv3lHHaqegkjh/MMQT07nZy3xikA76xmn3KjvixJwxxN5bk0Ay4rXgEw\nkrM7gDWJAsAwwwWyMcsiag54NeBNNBwzjhzg43ah06wHtqyHGXzagbgT0mA0\nhtJIdNJRGfb9yan0T4aNeS/KnIWuSlBQFawoXiIpYkfp+6gw+W7impji+V9M\nFLyFZXCbO3/lwBYGpGjl06fLdgi/FRW1nYFtx27bTJIOTN4yi47CHe2WWLLE\nQhi/0pe5hKpqkO1UvYyilp7mF7fgTnEPQvy3FkV6MJRH3accWVMCQE27BjEX\nPt2YGJDR9sTzRKwOoCI/XCbRVZquR/GXkX1EKWWGULwg7QBpzZyYevGloA2v\nK9XQ\r\n=0MZC\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_0.5.0_1525004297470_0.6321646227222923" }, "_hasShrinkwrap": false }, "0.5.1": { "name": "ink", "version": "0.5.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=6" }, "scripts": { "test": "xo && ava", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "files": [ "lib", "index.js" ], "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.0.1", "indent-string": "^3.1.0", "is-equal-shallow": "^0.1.3", "lodash.flattendeep": "^4.4.0", "log-update": "^2.1.0", "prop-types": "^15.5.10" }, "devDependencies": { "@babel/core": "^7.0.0-beta.44", "@babel/plugin-transform-react-jsx": "^7.0.0-beta.44", "@babel/register": "^7.0.0-beta.44", "ansi-styles": "^3.1.0", "ava": "^1.0.0-beta.3", "babel-eslint": "^8.2.2", "eslint-config-xo-react": "^0.13.0", "eslint-plugin-react": "^7.1.0", "sinon": "^2.3.4", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.18.2" }, "ava": { "require": [ "@babel/register" ], "babel": { "testOptions": { "presets": [ "@ava/stage-4" ], "plugins": [ [ "@babel/plugin-transform-react-jsx", { "pragma": "h", "pragmaFrag": "h.Fragment" } ] ] } } }, "xo": { "extends": [ "xo-react" ], "settings": { "react": { "pragma": "h", "pragmaFrag": "h.Fragment" } }, "parser": "babel-eslint", "rules": { "react/no-deprecated": 0 }, "overrides": [ { "files": "test/*.js", "rules": { "react/prop-types": 0, "quotes": 0 } } ] }, "gitHead": "890120254ba705399d736c4407194a77069f0a8b", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@0.5.1", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-y+mE4HJ6rml4MQfLnKylTBinhtv3OmbBDaUKj2pNKti/1oLQGBhIMGDhpjy3kp4ILUV5+/TZBtlxbsEeO7e6SA==", "shasum": "fc989c6c82f30f4667e711310b5134e8f7f2b17a", "tarball": "https://registry.npmjs.org/ink/-/ink-0.5.1.tgz", "fileCount": 23, "unpackedSize": 32811, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbQvITCRA9TVsSAnZWagAAbW8P/jsB91nxdBNpEXAfvhsu\ncS0ur08wVgNZOuki4WFBgHM9NY7ivsHDcn0gPUXHhzc4ok2qgWg2byx2EmrC\n8JLlZzmKq5Em/jBSrHq8+e/0DEbXj9VQtW4kp6ShinL003Rgd7r4Um2rtEot\nN4k/YILrleg+BeoEJKvA9CTnHB69yc0slQFrjnTSrZdQ9OF89Cr7f84uFSd/\ngcObVlKbK0Fft8sm3MhA72fxQeiQ4h37qnPC+L1EcgJjMhum2R27moKBbMAg\nVKA+3jsq6IsQzvwEKzoF2ra8CFm3oeK3sd03mxyWtqvIwJfR8mgKoHHbUGqZ\nqINkxh+FENx/UyG93EmfuYef1N6/7uTGIwM9OwV4IGEKOlyDHTKBhCoVtHDh\nA1Z2f6+G9pr+mwaZO7wKUGVoaasjE6QzROs4psHbXeJ2uFZ64QclRZPdv3xT\nmFecvhmF/UC+fYbN9srfPTQBfkocQwfeYGE/FeLEAgOy3iDLZVulK8d/4AHk\nx9XCuRZhKwsZ5s340i5Iv0x0Gaf4elyQLlXL9DTKPxefrRZ6uV8B+eL/f/hF\n7aHevhUhw7jlbekcHC7jbRfJmCZ3pUck4I9L8UfEuGiNTzwzpGsBrEUre6tW\nXj7Yjc2sYyGrH6sw2ZAa8ub56ASYYZe1r9wbtFgst9U0go7W4bxNGQ3vaMgl\n2LaW\r\n=+TGb\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_0.5.1_1531114003661_0.9567687305483727" }, "_hasShrinkwrap": false }, "2.0.0-0": { "name": "ink", "version": "2.0.0-0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #${this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### \n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### \n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### \n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "60c0848af7ecefb83d676853d1d0b66780f9bc96", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-0", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-R8upq4Q/qLtQ7mLVBQzKkIwUajJn/4u6iMbGYGEWOmKQEwMOav3PFaKVpvgfGMVXjFU4krZ0qsLOZ4dVpd1h3Q==", "shasum": "8275fd19d3416555559392d372e3f80da67fa6f5", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-0.tgz", "fileCount": 14, "unpackedSize": 43393, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsaRxCRA9TVsSAnZWagAAclMP/317Dx/Kh/mOqEHrXTVt\nIYzzOIycXWyfLQQGGrombcnA/FzbkFPR+BbEVbZlQVdpQHA7gU1iDqQHIhVH\nFT21MeaEA78N/UVL+1jNA6tHPd7pcaNjoGEtVV9ln0iNbJeDGKjpAFG4a6Uf\nq9+JjVK998CUzcQwqUP/vOZsUqfKXKVfyDdgTRy+ADXd42HeQKQzkx/5eCID\neR/25o3s42Yzr6q5han7uPnlYjersOXcVtU/0RDPzF7lIe9M1pmxdC/BNNnJ\nwoUZLmYCgj1pfnpTg4f5nLiPGK/Xw69pyOowuI+jS2qXzrNztOzTB6RVJP3B\nwYaSi8fRDgUOWRo7p4JFXW90h27CfAJi3ibkX/wGCKi4f3i+ptvCEt2I+9lS\nNDKLe8deFetERSBzrwDr9+2U1ey8CQBpMUK285m5xlssNLBQnkYK2DZ5/afk\nmd2+GizEhK121qLMQktzPIhWCXFJDzouLDNXEnbImciAlX9R1dh24DrKIsIm\nxv37s/b9OKjIclsDeppIrL3SMpII32ib+JXatBy3geiy7XmD5dkB8mombh+p\nfFkSSu+eP3EKXn9LZjwQ6y5gs/1WwwHU17s8eAxsuIGiz+rranebfpeQBC0M\nlZaA1Qw4CJ3GWR2mSX51S4ACtkxkPqlyjOwhBtrIkU80K9ASOsFD4h8ZCnRg\noODD\r\n=0qm8\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-0_1538368624819_0.09001293259960508" }, "_hasShrinkwrap": false }, "2.0.0-1": { "name": "ink", "version": "2.0.0-1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #${this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### \n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### \n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### \n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "f6cfbb1f86a4b9dbd749859229d775e105bfb340", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-1", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-ylsf3fjsIRuMAYfY5iIN1thvrEV9AIprW7KeI4ZjYRN6+z2djIV63l+vaKo0wt+rme9aubhMJIBpaCPY9J7DCw==", "shasum": "4a861ef90af8899c297c861a6880ad2afb35b0a6", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-1.tgz", "fileCount": 15, "unpackedSize": 43722, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbscYMCRA9TVsSAnZWagAAe+4P/3t5d/hbQf0odXk1SIX6\nDGYXfr45RiOdvpG/7fVx14ijhNTqKK2Qhrrfmaaab3ZqBx6EgEou4LgZfy6/\nhdVqEzvpsGq72Q2NbFDw9wmmDmK3EM1KLc52Dq8UgoQZWtwMdfputQcQZf6C\nkYdlCHHkGermgGPTGkJv92/qjEGi+y4jv06rt36nVPWYeJ9Qe36ALI/J+7Bq\n5iH/79gxnQxfVueNnoSFvawR19RlE0ryVAF0xTu0nnT4/iEEg6QmGJ3sEgP/\n8IOZHIiLWdxc8F6RHZrjB1WQy5FjyFIdEaWbgPKABd6OXiq9YFO7I9YGKySN\nCKplgu3ePDzzJvT1VE6aHhwGcHOD04sz71M+xv3UthB5/IzqfeZVHAV2vCVU\nZWh1KCR8fCZO5WH9FI0VjyskqLf4avDdRhHcHF8NYCqO2Lp4AagZVG3JKPS/\n69ao6Rmc02jXPzokj7TfkLSElhP0xFRs0UMitD78QJoNio0Gig5Zod1XIFDQ\nzgYtyLZQIju6Bg4UGMOodVfLziAlOxK4K6JgMNX25GMOy+QNcm8MDCjX1Sqd\nironSiPQpNs/wHCrLkejL1NtJqlpzZnXhatvlZZuaoQkSt+UEMWHx/vbSaa6\nbdAkXJCqBGLIBYtVrLmMiUcgBBTuWR/gFhGLuKItnHhwHZzeoU5oKhYXyWeE\nLTTV\r\n=YKNI\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-1_1538377227429_0.8412346470517647" }, "_hasShrinkwrap": false }, "2.0.0-2": { "name": "ink", "version": "2.0.0-2", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "debounce-fn": "^1.0.0", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #${this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### \n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### \n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### \n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "f65a8d9c624fdd89577fe3b633560ac7005842ac", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-2", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-2VtTU/iO7HTb9UI7PQm6nSalhzM6M7RyVKD8/uINnlfLsecqFoGVRZ+rWuRs/4GIg1IMua7mW1TEITyQeZo+Yw==", "shasum": "365184df26b341c42d7391aea665268e706c335f", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-2.tgz", "fileCount": 15, "unpackedSize": 44311, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbuWmXCRA9TVsSAnZWagAAWcMQAJS0wiDuqB3G8Vvx0IVQ\nv5qhg6QnXX2ufTaruFDHCvVUyxTv/z6mVi9mohXZdybhahuqr6J/lx5Q/dhO\nxs9y5nk/dxZvtHFkgwjsZR0fq9RQEyzK9POrSOKgS+ImbGpHO+zNjY5f7+kb\nH6XdC4oakXZSR7ZIs+kiesSIxs7XhPGd+7toxC+7Tp+40Q80yDLGKahILW+Y\nfxhC/24CrQ2i9AUMZVOlWWCmDLodeO/luhb0jeMezkN71A2As0e7RNFxbWqo\nRmiR2bZ1MAm6E66iZSAdyaYFMrHEQFs7DOozmcCO7wgyh2cTkEW3lc97XZEi\nzoUEJDmO7PG9eBSuxtXB/tmHOnzU5LdT5zNqDVUWl4rr+N+IX/g/4CGqAIjm\n927I1TcMVoTSp2SHoG1QN+6VD/4KUfwMgiIaWOXOT3WFCXtMLElqRSFi8BOa\nWBPu076We8xIXTumQ6XCNtJ4YQNTLXEggauSSaNHweNIdANeV7Hn4X8649FS\n2vAZjNSSWUrnAYY1M2QAvR4LNmLtEDUhhIANgcW2uwmDGCQAW5LwVhFSqcmv\nXpw37rIgt0tYiqwX8JgqVKxKrGQboC+XwupwI7Mo0fO+pONK5R+YBdeGmSD7\nouK/hjdhIo14mSciky2H4uEfat0FD7XvQrQjv7LGCaBblMcT6NJdQm/i9nCn\nUQDW\r\n=E7sK\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-2_1538877846802_0.2361508769700924" }, "_hasShrinkwrap": false }, "2.0.0-3": { "name": "ink", "version": "2.0.0-3", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "debounce-fn": "^1.0.0", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #${this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### \n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### \n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### \n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### \n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "1e1783d1a2b9d0a077fb12610b1b080fa080aa6b", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-3", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-gC0elLXy/ehvzJCXxeRRMGWKxcBsI6YdQkWjSF9HU23GN6tTDgurDb8jJ20yequi+5kSyIIXa2PFpewGELQ09w==", "shasum": "4136b0bc2e65001f1bd6d750d98821d2c69e3f85", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-3.tgz", "fileCount": 15, "unpackedSize": 44508, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbzUfDCRA9TVsSAnZWagAANM8P/0j6EcU5XAbvSy7NLziZ\njZyI7aE/x0OQSCggdU5N+zhN9byHyJJcR/NtpN1jiXYxgzm7VCJ686gOQmbR\nRoFGyQ1vjgCfukpl0GkPmg7ysYqRHFxBVJF99gfYrteUpq/EAERmwHjQ5nOw\nI1KD9r4YhXemtpXHDKMGfKV0hfBOFnYmPArWByVLpEt/k8pekj3Br4QSBY+n\nZjX4Ro2cf+4tvSzKFN/96sjMZISdm9wzLsJQcdgRABRnpKOIpBsZWhK/BsJx\nQoskb3QZemZbqncJcfaIR9c3AcEXbrbQpSVj46uhbcjHHm8s7JYTo4HHCfaL\nBpYbgXcPGgxOeRCxPExR4XjuR9kfvt1YzyvU1EyJNMchVl5VETl62UWNKweJ\nXEglVcXxy55pI7J7jR2qJkFHko+2o3IEE6FZNr7yMfTfpbukGqZjMZnKkRJy\nykECbZbHYbxm7d3vUkBFy6aYBtFbTs6mEYRQ4hmxK80pjF4bWjh+O75uZyIc\nx9M1FokvOwdHep2oLagVrleDugm+8KucOIijTTJU7bWwlcF9CO5koimzOt1U\nUBkD/FItD7bvMuB7qjl90NwqiON7Ft5kf0GFnFPXEUxNKTf/ID4OFfViPPaI\n/hmgW8GrwyfhTU6JaQ8mo3WRFb1j/BM9BIRBWUMfHZQVjlDK/67HBi4X3gsE\nHdpV\r\n=Jzgf\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-3_1540179906614_0.8366597582492439" }, "_hasShrinkwrap": false }, "2.0.0-4": { "name": "ink", "version": "2.0.0-4", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "debounce-fn": "^1.0.0", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "19d5ad92f13d4246188871cb88f5af2369021098", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-4", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-p3mygxCow2SiKozrL0GSI7awkv+wLj1C3CXL2As6w80gsJZx2MboTNLkC2v1a1j+N9giN0DGkSMXSKr7pS/dLg==", "shasum": "a843d227420c7a835eb1974318f16f344569d665", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-4.tgz", "fileCount": 21, "unpackedSize": 54254, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4lPOCRA9TVsSAnZWagAAnhcP/RbL40n6IImbxIdhWYpN\njRTkA0wTNX7GNG1PUnOfWTOxH23NBffhFRNF6tvT64siHZK6NBBiU7Siuy5S\nubo6B6Z4La5SrWJm1HpLAMcrUb3VFXYePoway5jPyKxidCgk+geF5lJ5hRPf\niXoNe/+1cEI2Y/zOO3im6G/P4t9CX1waD6m6ee5SREbWCOxjU0C9GMWXzAc+\n5sosHNLk0XXD/LlsJBoplkmJr8PkXTrQkOUJZhmGjOSpeuhlgx5m3q6U1fAM\no0YknAPj7RrQXfHb/0v9rY2IKdoodqpKNHWgqGANkaXtQNQUM+b1bF7oqZFP\nTzlSx5XRYUvBP7YXynpUoshrJskoOB0vsi7xmTCL1Qlp+uWdN4tUYrSkXPIv\nPeCkPFl7W+3AYyXXgrVpypqDrQJQpq/Nr0gDXsGqdO9Gx5+U6D7HFTuMliAJ\nI+9EHraqGg1J5oVl2Sslp8mrzsDkKEZqPykx0pV4XqLjRcmkuSSftyhNgR1H\nOf23wuxkVXYfe5LWH9r5MEtF7pe6pkpP0zKuhmBKKTjJpIMV75RuGgN1LBXV\n6JNI5w83xpa2YiXhWJehxmRQNE9Nkw9ADTu74T1Dgx9ha41mz5Vq4Qx/8YrY\nGWaLMcs5gqAyG3b9jn5sqd+yMeMt5H/svcSAaRxXMyyAF9UwVkZNAL6V7RvQ\nn/ui\r\n=IZRB\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-4_1541559245301_0.17671070458531357" }, "_hasShrinkwrap": false }, "2.0.0-5": { "name": "ink", "version": "2.0.0-5", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react": "^16.4.2", "react-reconciler": "^0.12.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "c622ddde991f78ec85c55b689dff79e7ab05d444", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-5", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-7hFyx6WmUEy6WW4OhtyKKRHkx5h1/KvyiwEBDrpjIYOBaHXFU+7BgDkty03FRq5lJzDG6UU+vqDYqsSbilXZPA==", "shasum": "a8b9c5b53af791831bece589a6f8612a8f53feef", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-5.tgz", "fileCount": 21, "unpackedSize": 54361, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb49LuCRA9TVsSAnZWagAA0moP/17xhEpbeQS1EliJID2F\nj+jHWR9s5BXlMygqmWhoF2LMJXTwe27dLl0qikGVTGTJP8ZldzwifuRNwQRa\noN3m9NYLb9iKJwOevj+HwChQP6BINphvOicgxSQF3p8WLqLShqBUP01DREXo\nMk16eQvR+5mHqJl/rXfjEzvENbW5Ek1QKuSFcRyen6xeMStgwflG4JbRMhJ/\npAYVCJdk/ZhPCZp19RY6ln8PH9Aept1oiR/+w34LhWjNvuyQyvPR6/LBjVLh\nbwV8HiTmp9a6IRm/Gwdr+/bn2i21m09UuAOJI+vLb8aMAHX1NnlsNkp3tCfW\nZ49jmFjCgd0P8oQNWcnFD06m/LlMKTw+vQ6QyoAatkRcSu5vZTM+gVJEUZZj\nyc1rWZvg0TKyG6RcKdd8xv66ZBbp5Fr0NliH+at647/AWnIrzyY011hCiwwS\n0/5OAZdXq6t0ufWqNNaXxfNfSGYo75PxZ7gSi5uPwrKQiaCRSeMcCrTYkLKe\n0ULsOutL2W4NazCAwq39D7o/tchx40Rb9Yn6W2TWhhqA3f9czm9Q2IQiQgJc\nM53c+7Xp6fGhUkHrTE1Aq7j0/BXbbNQDtv7QPASwyGqG+iFt1DuWVbXjyeg9\nbLFrvOtLeYVNd+kE1hcUnYpNJoY3kUwc4qjWaW0I1Ss4z3v1ZLaEFzu7+dRq\n9TA5\r\n=iVfa\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-5_1541657325432_0.09097908734231486" }, "_hasShrinkwrap": false }, "2.0.0-6": { "name": "ink", "version": "2.0.0-6", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "undom": "^0.4.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "059801f6c3ce763da451005d2b4e831df3fc2945", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-6", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-FWJygZEOgU9Rj13TDpO6lCM5vkQbrpEbk/vU3hWi1F5ADVf6qwFQ1m6IoAny2vkT/XAKxBo2APDgbxLVaEIcpA==", "shasum": "c5400dcf612580f11781918653bdf212359eb6d0", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-6.tgz", "fileCount": 21, "unpackedSize": 54361, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5mmnCRA9TVsSAnZWagAA77IP/jRNyEmV/jew+1Xr6NJy\n5hI75eTqsrFEZGcKdCujLVzrvGYxLIE2SRRF11GcODvB02JFlLb1qRVLN2eX\nnXnH39XzojMobRX7XvGX/neQADCHke3qaSe7eJTt+i2915SOdq2BeeKUNLlY\nPfVjgojC3Rdhe4vSTYcNLkYoniUrRoDP6YHov5vSsWHw/U/WWsJCvm0SPhZ9\nIRWqyB6QETM3HT71hisMJkW3165EKPFPiwgsvdcuNXt9Iw1/y+EmK/gWCmQr\ngWaCFp+LJQ/nnmgz4beQHsmvLjLzv4v046tPuKu9TQe2PfOwAsAzqlUxclUD\nQzTcT8it6TuzPAeg4eJahRAUkUKinlvEJWqtiQRA8MvHq+xmS33lhAv+OHjh\nxkvLHXGZgzy3G4l8GYBDcTT/7R/fbD8i9najPKknbOe3VQjyGake7t53xiSB\nFdeFDKhqanSle5VsSYSCzR4kkphZn9jHJN00vtEsuOmW1VR3b+RwCWt/2H7a\nF5ZanjAjgX9ycKHRa7zTHTE3bXo8mIp3s/d4y9OC3vvDjEKnqec6sb4GeXZK\nF9Yo+xLVGgAZtiol7PWvNVPRtVLkkH247+rn52XqDT+G7P/HhLA8e1qFEJ8Q\nrN+wGuDnn0tEK4tSEWzOOeKyubUuhjf0avI1+X4+nO0PYbeNS8Z1bCuYJ0kM\nzBq2\r\n=/0Lo\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-6_1541826982117_0.4315407406326992" }, "_hasShrinkwrap": false }, "2.0.0-7": { "name": "ink", "version": "2.0.0-7", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "6b53dbb98e696c95689317ccdc25ad2f5318f3a3", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-7", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-cVjOHQQIPWCBkMsaQlrtQjPbPTd6JFILjcdlWErrQFNdEibpP45XHsO4NGOMdPxeFlzKNzfkWShZDU+bS0ULDw==", "shasum": "b6d20b2a3afd202a1e5cf7aa28bca14937d36ba6", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-7.tgz", "fileCount": 22, "unpackedSize": 57865, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6LJvCRA9TVsSAnZWagAACGwP/RqikaeLO9M6oe0IFwzi\nyVYDAF/HKwPRAM6Y3Cq67duByLq0EUUxf3R9+GY3EQHO8HjpoJUu8rpeNX2b\nz4wWpj/jCEOxbBasVmlGGg0mjyXFIzo2l/WNC34Y17yOf7jnWHsnKi+IDSPb\nM/GA0iKoChznPMdrEtQ1oJfADVXX7F4NJviodMLqR543sLK+z0LaZj3D/lX9\nY6tkjrAjPuk3XzyWo3hv3g/KgtpBG8Vh+pzQYMune7Xi8ycOm1Gq16ppQXnc\nVB/rqLvO0MQDJJfKIZTP1PzwHNbLDSjXXBpJED2cfPSiiY31brtBGqv68XPR\nwa3qdcgNFQ+V3hd7AY7+xDRbcjld/0aSGk/2KU7fz1MOidmKpGnwhtAMhzvY\njVWSP/EDjN6M+Wh4XD1wR95LxYQY0XkntNnM/xdrH93/maBcvrPlVrM9BYnb\nbJNEaY7XW8T7w6ghQc5Ck3pjjxx79kXjIXhldUMFwm/y5arslis7BoA5365c\nsGLKOTqD/aWWsgxOObXLhvotou9FlT2yWjVPDuwRbwLYfi/tcLLBlf5H1bNI\nmqP3+1vcevHctcCPqSHVTq5+c5rkP36WYpQtGxEUB1yuGISGjufZ7gzN/s3u\nTt5PlK5dl8Z33zzSOZJztrk+TVQWkLLaHQ5nNcWOZRD7AomU/xBC7OX7NgDh\ngP04\r\n=6n6q\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-7_1541976686729_0.48458319720932663" }, "_hasShrinkwrap": false }, "2.0.0-8": { "name": "ink", "version": "2.0.0-8", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "76c5700f6f59c4f6a98bf64db9ace35c23545d6d", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-8", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-4b2PtDHoKwc5ddgGpkc77u+k35euM9WImXeJgYXoxGzh8ELstWlX8hPk8ynEyV4Qd9NCRfUgiu7jq0giDG/xvg==", "shasum": "6c4df9fe39650ff11c563e339ba11748508e5526", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-8.tgz", "fileCount": 22, "unpackedSize": 56710, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6lgECRA9TVsSAnZWagAAG88P/06+bhneNaBLfqINMFLB\nMZZ2vIGh2vX19mrLjcbbM7PURdYhYIh0Xm+dIwO5TDzaC74O0Xj8epLf7GKA\nTgDyWd28Xc4MY3FOwD2Bue+IrRhx0bbHg5p9cXRDS60n1JapGVZufj/42Hs8\nArxUbg9pLuv4NcoV5IUzbnjRRp0atzw/Gnc7Y4bxz7X9YT3GJ/41G+T5G7Fm\niaoFOqw91EHFJHfDuLy/19uT+LV5mvntGzHcfLk/i2F7MUEZuzOOLTyRFITK\ntrO4iF6SZl5BJ1QKWsmZDfb0mjwus62KZMCugqbREGWOE0yYe2dfgayiIcia\n/6yloPoywx2tUDXKX2nI5tEaJOtok+rMARaPJe3fv3nJyGk7M/SGhnqqVXmq\n2APTTZHpf13v+3KaZjbjiGN7GevgKdQH0mCVpiHh5vDOTkqDa7D7ZQn336fe\nX4KJyjgUdLgWvmpQKaqg+Xglw1EDzpksnO3DG6KKKI1CLtnCRQ+nB40vutcR\nwUbCWxNFgwWcDkDFSxprYtLv5khipJTUorHPhj+LJBpVJqJDzwRf7mx8S9pd\nQUA0zwu0Lego6iQme36AFWIoZp+SWhYu1Qpo5vrnBtJ8vpyyV3RcclMOHrlU\nfDW54wDspiGPfSEtwRoBwW82aFIKm4M5Vi+70QVIcFn5swu5G9Rknsucrh5N\nnfso\r\n=ykft\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-8_1542084611995_0.8337301807851012" }, "_hasShrinkwrap": false }, "2.0.0-9": { "name": "ink", "version": "2.0.0-9", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "67d0c348d3adb0aaaf336ac2e17145ab02fc567e", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-9", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-AMrzVwcobyxT6uks66elLK/0wMrDCJlfcxWA0yiHjeEg6b8BbecodB8T12ufENnDkqxLhA+7J6OmrPVd0i5t3g==", "shasum": "d27a3422a6cf3bb4f6af0a4a7ae92df8e0b4f1f0", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-9.tgz", "fileCount": 22, "unpackedSize": 57292, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8sZrCRA9TVsSAnZWagAAwAIP/0e7FZ/TWGzKVTYbODwA\navawFiZNBCmpzNZ8T8ETbuxDmKEu8VBOSNfoK3/9dESje7kEtwIFCYbVAhrt\nT5NQ3X+YUqmXqA0Pc4G05xq7ikXv8qfdV34CG1i9RM/qu2lRVAlbnpxqDTRA\nN74GuWwtTds7arb9Xjg7ihlrUzvHYM2dcBvo1elBBgc9xyF6RPiBsBUoWwGa\nyeiGCnaw0eKOY7uW4+RBE4qIAe2joHPnFJ25qYkywBCPEcMgqyu2h2djGtPG\nIxhGiOz3NmafBK7hkSy5WMVyZLRq0BEpTIXxGL2XzlI8b39zxgKhGPvW4IGe\nrCIdEzpo500mkxiu/mW7nPJd8EpBS6JyTCzbCOXshnFbn9mVER/9z6tVpYUh\nvlN3rOLWdgs76SP/HZqqPGW2Z5RncgANVU+S0Nzxo/P+ckNWDnluO3B8HvtG\n0gTifGYOaveHqowcKZD8WGEP78TxEYT1jr7zcPEWmb7mUuxxcQH+INCy+Drj\np4/bkks4ntL9pSQN4/gGrMylA1WTFP9aq9q7KvC9xB68S1Q2sEwIMM8wgDP5\n1SnEPvdi3SRkMUBrSOe1g+9/nLGKJKoAlwPNcoJ/OAdxpsq2alRw3YYZ0eH2\n1XNzqQmUPZROASy9vv0qoIkysDG6zIUZ9GLURib0E8hfO2rZT3wY6hIzuTm0\nxVos\r\n=oMbl\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-9_1542637162842_0.4088685835987018" }, "_hasShrinkwrap": false }, "2.0.0-10": { "name": "ink", "version": "2.0.0-10", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^2.3.0", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "808723012f5512f6d3eb1e973fabbfb6e3574511", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-10", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-x9IL7kHFSLvGcQOooO/2LFu3VO9YG9SFBT6SeSiGe0M6hB2LIw8mEbgnJGcZwmOC3gzeqfWtv0szDPR0ONQeBg==", "shasum": "56d0c2e0dc7f9e02e9a67967a00d720ac3c121a2", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-10.tgz", "fileCount": 22, "unpackedSize": 57321, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb+2G7CRA9TVsSAnZWagAAH7cP/i0r3ZGiNWfjJRIasl8J\nlQ7SvaI6haHt3q9amexMNvXM4/TVZP1kq+3qs5nu3syGMMsyMtgy1O+s+lXK\nEx82UwkBt20MTegCo6r66wWZaBLvaNL0uUNDOgo3SlxuIDeGeeY2JMq5ojd4\n1bmTj1/NavuUKNgje0ZfK8M66l0Xvk3+dUBv7XRRoccxnrC1MQjzyhAxHipZ\n0ueDHhVI6Ht/la2yZ6QE/t2RT4bbpQ3PtiQsywEu55CzMpqi1cHwiufrTqtw\nSHGfz5EXQwkY/Ft2Mktnm0T6NnLJHe+q2iUQmm1yVU3ejyMDAh5sSs/7/oo2\nYYR5mL+OStRtVupH+0TMNHs3qta2pMT72+BNmQM3givLZZ3bRSFy6QClofJ8\nUEov0iCpnE0vUb3ltNG8O35EolBBMMAR4SKKnyL7WaGnpUo2VZwjkc+HMRbY\nonUBvE5zGiyehMqjNzcSBzAiYbi8l/i0WXCzHDgYlg9r4HSdcmm/8Su6f9KB\n0Svx3nVfStu6QQ5WVkNkWUZNue7WE1yhKE+w3v2jjU2ppQfgr+JMMRk1X8wn\nv9P23lijt0MRvETgtqHJubEahwK0skzCBM9n51s0/11jlQ+avds17frykM8h\nqzXls8GkFWbwCx+3EolT+PfKjfPX9HiWvRASDuHGv8tk+swjrL5JK/wBy8ft\n2Qcx\r\n=mVCZ\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-10_1543201210290_0.6327703623116874" }, "_hasShrinkwrap": false }, "2.0.0-11": { "name": "ink", "version": "2.0.0-11", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepublish": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.1.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.17.0", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.23.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "ef103e0e98f8f04d156834085699ed46a3874eae", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-11", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-f9ewmS37cbROEBUZ+KAp+BwOPgfLDoHdRT7IDw+y5N46NpofJqLxrMjJkp0N9ykUBxOvmBU43xNa0Tma9ojgKw==", "shasum": "1af71f717e5ed549ba577531c7df8a9ac90e649a", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-11.tgz", "fileCount": 23, "unpackedSize": 54973, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcTdksCRA9TVsSAnZWagAAzwsQAJ5tD8DVsY0flhLQT5PO\n/+HdPIT4weZBkCdA4xPxt6yE2As69dHxhTNEv+Kltd1vCXFJUVzmnur82YrI\nEtYxXRXzAX4s23pO7VLwwDJv5m9ectVEGnJqHuxOCOIVADyAsydmS8NWHfjs\n+q2nIPNzOa3JZD9OJzpQ6qTe1IazJ5WLY+lyv2J0eiICVcCmL1+qR0vbKbQI\nUOtCM/Wr17JPYEmtpoGOGz6Ohu9Liif9s9oBJ0lvVUsHsLhAJRzshmya8Zo6\n2A8laXx2Oudp72RuwrdYeAW0XOvNApW5KQtJEnKbEqTD/91r3+sbbma4Jayo\njOJnXbCDT8zEapLSgIQbw7vdLw0/am20UJcHrPk4zP2gJRTTnNERB3SPf3cW\n8acLZcA5n9kppDL9lvjNieobFkAqvgp4ul5uvjEtchrABvEWun7qGBBCuaiO\n12h93kg6diwdXC7ATzq+VZfJbmZz+yCgjQPIwe+i1mrjDjythdnOHXbahHTr\nyNc5weomhOwxeu5YgjqscTtOGC4avuBgqFf3UAO+CqyuzkH+itDRhG+uF9hy\nvVMHgTD60tlEEPY9vtut/u7iRzgEdBqMqJADfrCs7N5hWGAk13KGLmOsxsOj\nUUJwvhmel44U5gNkj2EvBecejlhWBPMto8hNK4IuRrg8dHCmStcYuuFPi20z\nQa+M\r\n=ZMC3\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-11_1548605739741_0.5182708095845263" }, "_hasShrinkwrap": false }, "2.0.0-12": { "name": "ink", "version": "2.0.0-12", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.2.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n\n\n## Guide\n\n- [Getting Started](#getting-started)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\n\n### Getting Started\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {Box} from 'ink';\n\nconst Demo = () => ;\n```\n\nTo get started, quickly scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n### API\n\nSince Ink is a React renderer, it means that all of React is supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst unmount = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tunmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n\n### Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes several props.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "72d77167b4667c0427458fefaf5875efce828423", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-12", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-szqB3IJCM6KiKTsF/PMtnOUejXOo+wkAWe0sbJzLB1CaAgtAJpwfrJno+i2LLNfVEI5xsjNDFUBphrTWmRj0LA==", "shasum": "22e46e1ba60b0d829ecfeeca84527a22768536e1", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-12.tgz", "fileCount": 19, "unpackedSize": 58199, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcaLCQCRA9TVsSAnZWagAA3YUP/3MHq8ge0BFzAvrBqeYH\n4FTs0iyQhd5i99dOD88DZukPZJBThD4zVSj/o0jdY/BRLX2vsDd5QGHF6sCn\n2dLiku9tOzo1EVVXFp9z6OYkvgzpL8+LBWEZTFsSxmkjVtpp4n+6kVxTfQSm\nnArNl94q28Gwu20aPnV6AB46thi8vxU+3Iy8hnxfMW1vBKVlamATT8aPAee4\nslkNkOqBd371avH65VLtId9K2ru+4tA1J5i/WzTpXrXvNYXRDJCS/VcbTH2o\nBmAhK/2/LM7HYaLTPhEg4jEM5Bn5n/L9cRvO+v36ljqkE4HLDjo15KSY/IE7\nYxvZmME+yzsTSF+uVgBKth5p5ZCQPO8fzTMeu46RWAkazTQYimBy/6pcAlJu\nHDMQqk/vdqtMIAUn9ETqLEgJfLOaXX6nKxtzoa6Q+62eW6R71NLPZYuJO1q5\nU0AKMjOaZJfOS/rmvq8kMzsJzoKSogZBRntd7NhOxS9iGjLMu+IZamPaoA3A\nz6n9/8f8DDAxyonEqWNISjsOIWRYe55sg1TzC1qyyIaCnMdmZ0pX80DEFdEl\nCnoTz/gglfH90ZfJCXz5QgHN2ECL8SySXiEnmcO4A9xxg50+bN3w2VoqD1iX\n/ZlD83wXviinq2EXQ4NcT5AuVbERggOFvgThzFJK5EGSBQU/Sd9Pj5YAli5+\ni1FE\r\n=h5uc\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-12_1550364815436_0.6525158852463468" }, "_hasShrinkwrap": false }, "2.0.0-13": { "name": "ink", "version": "2.0.0-13", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.2.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^4.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n- [Useful Components](#useful-components)\n\n\n## Getting Started\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {render, Box} from 'ink';\n\nconst Demo = () => (\n\t\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nTo get started quickly, scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI.\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms.\n\n\n## API\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nReturns: `App`\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `Boolean`
\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst app = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tapp.unmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n#### App\n\nThis is the object that `render()` returns.\n\n##### unmount\n\nManually unmount the whole Ink app.\n\n```jsx\nconst app = render();\napp.unmount();\n```\n\n##### waitUntilExit\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst app = render();\n\nsetTimeout(() => {\n\tapp.unmount();\n}, 1000);\n\nawait app.waitUntilExit(); // resolves after `app.unmount()` is called\n```\n\n## Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`
\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`
\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <AppContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes a method to manually exit the app (unmount).\n\nImport:\n\n```js\nimport {AppContext} from 'ink';\n```\n\n##### exit\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\nUsage:\n\n```jsx\n\n\t{({ exit }) => (\n\t\t{/* Calling `onExit()` from within will unmount the app */}\n\t\t\n\t)}\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes input stream.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-figlet](https://github.com/KimotoYanke/ink-figlet) - Large text component with Figlet fonts.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "a48964276591d21881c4be6c7ec1c52cbdad40c8", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-13", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-VjpB8OXG3VSeye5yvPAr8uCkC9PGiBQjjyL4ZqkftyFq1ZLuo8MLR23rTOTsDtzHROUAcjniYg5saNwsCQkm0g==", "shasum": "448c0626446de529567d1972a9e910dc0567e77d", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-13.tgz", "fileCount": 22, "unpackedSize": 62182, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJca05sCRA9TVsSAnZWagAA0z4P/0GWSnBWuoImcw8u0psA\nwkVhed+pMwbB374ZvzaQWWb28Ntt41JCYRje/+q+3i/C1hRyorPcywmqjRkc\nJ/xmgceK9y2azGiHD5NXxmAGIwMe3+iboN9P88yaikjCH/FAKbn6U0t2T3+Q\nGAg76YPk45uzy+Zi5EVz79Jbo8+idUCvbOh/ggmU9qhRlVsf2Uf5y9a23GI6\nhfRTkRE3OtI8YfYigXXjnJT4zQ1yAYJHrOU0kg5GLGToI8MH0wT20+JDsYLn\nv83rKh5YsP4WBYRR39BSa+q1+IGO5EyIdZQ5vC0d0NgMZP/I9zdRxddmd8yB\nXn80jvAUjuAA1F0Vk/ry9s3BKMgjibYVK0aoMrGhv626MZ1DMTJEo83O6vsA\no9adIgG0uM3AmyuDycGTqx5Q9YKew5Jm4Lk34oZQr4T1XPqxhztcB1ScTMBN\ndZYVEh/S7+mxkqyRXoOhWdAHfLHArXJsedtFXE0whV9qwiLJlByjKsIKfU6l\n7kabR9hLYN/RgIfTPGAjRd3+fvIPIYWr+Y9fULHJ8IwaelQ0em4P896UuXIl\nyehTrptuwPol67W38MR7w3KleZEO3WgBVfDtsF4Poaxv7aWwfoo3DL1QyAwB\nddQaZWrhNWYaSG+q9SAAIRjrI1mb/V52Eyt2CnXC9idMes1KlS/cLNKp77Ro\nblAm\r\n=5M3t\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-13_1550536299276_0.8316699464013746" }, "_hasShrinkwrap": false }, "2.0.0-14": { "name": "ink", "version": "2.0.0-14", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.2.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^4.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n- [Useful Components](#useful-components)\n\n\n## Getting Started\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {render, Box} from 'ink';\n\nconst Demo = () => (\n\t\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nTo get started quickly, scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n\n\n## API\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nReturns: `App`\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `Boolean`
\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst app = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tapp.unmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n#### App\n\nThis is the object that `render()` returns.\n\n##### unmount\n\nManually unmount the whole Ink app.\n\n```jsx\nconst app = render();\napp.unmount();\n```\n\n##### waitUntilExit\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst app = render();\n\nsetTimeout(() => {\n\tapp.unmount();\n}, 1000);\n\nawait app.waitUntilExit(); // resolves after `app.unmount()` is called\n```\n\n## Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`
\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`
\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <AppContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes a method to manually exit the app (unmount).\n\nImport:\n\n```js\nimport {AppContext} from 'ink';\n```\n\n##### exit\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\nUsage:\n\n```jsx\n\n\t{({ exit }) => (\n\t\t{/* Calling `onExit()` from within will unmount the app */}\n\t\t\n\t)}\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes input stream.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n## Useful Components\n\n- [ink-redux](https://github.com/vadimdemedes/ink-redux) - Redux bindings.\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-password-input](https://github.com/vadimdemedes/ink-password-input) - Password input.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-figlet](https://github.com/KimotoYanke/ink-figlet) - Large text component with Figlet fonts.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "f55436e213d2afe95a848a80ddf28c73ea5a3bd1", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-14", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-FhunVo8PkNjvLZk+p+U9Rmud9ZACF3n/tIeKqqeNxOwgShUBRP6plqnf8nVdbQJRLgoeIv5By/7Po/rlGdxqMw==", "shasum": "d0155a9c89401b66565db678307bc3352a0320e5", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-14.tgz", "fileCount": 23, "unpackedSize": 65409, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJca4pKCRA9TVsSAnZWagAAqHAP/A1ucBzfk/MfMtEHuuNy\nS0LUR6F+R31wCbcJMBmzNC23D+Jq/Bvc9mY+iIYohLkG5L4hyzu9Frrs7GEZ\nZ3a7Qf9h2+plfmZ1piw1PqMSmgNZgc9Fk+PH7fRHsVwinOYg4ULw+qTPekZa\nf0XUzQsp285BoODYYTy98OMXsiJiKvZe8pDwVWQ+QywECoIh1cmDOh4NruOz\n8At76fYWiovnx1E+kjW3rm8uNqYmBRnrB5LkZv/6z4rhISwnhTGK7iM/bgej\nFzEw5iDX/17wVBQBonRQaw4POZOTIdglsF9vHS/8UGvXu2Q9JPRrv6NfNBFL\nVCO7vfVc9rNa5b/rcljB7KBSp6yeqkxP7SC6S/zailnUMv1pM3GVjyWiMnMB\nF7m4z02gu8AMenPdO9GHCS2/L7j/2YqgH/Q2o+Aj1OxWhTotLhGlIx4usNdV\nuDJfU1AqdxEUCsT7iA0YLONIwuC7xoFeO9faAW/kJOCRDfAYLHAE3rpydh8q\n2d8fIFoXEHumunObQQnolN88iUWxrRUDZJeJU1yclWfUEwG0kx9n6TEYkd/T\nodiBcvUbb4Js4wyalxiGFXDTqMlf/Ih5LVtrlAALnffwaV0TQCentJ8bbXGP\nBf/xwPRwsqUPjz1FLr9RpZfwqb2R1cAAvNrmL8uKzbk9jf4w1L0C6aRD7S4S\n7rW1\r\n=m/pX\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-14_1550551625137_0.24475216340587425" }, "_hasShrinkwrap": false }, "2.0.0-15": { "name": "ink", "version": "2.0.0-15", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.2.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^4.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n- [Useful Components](#useful-components)\n\n\n## Getting Started\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {render, Box} from 'ink';\n\nconst Demo = () => (\n\t\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nTo get started quickly, scaffold out a project using [Ink CLI](https://github.com/vadimdemedes/generator-ink-cli) Yeoman generator. To create a new component that you intend to publish, you can use [Ink Component](https://github.com/vadimdemedes/generator-ink-component) generator.\n\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n\n\n## API\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nReturns: `App`\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `Boolean`
\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst app = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tapp.unmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n#### App\n\nThis is the object that `render()` returns.\n\n##### unmount\n\nManually unmount the whole Ink app.\n\n```jsx\nconst app = render();\napp.unmount();\n```\n\n##### waitUntilExit\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst app = render();\n\nsetTimeout(() => {\n\tapp.unmount();\n}, 1000);\n\nawait app.waitUntilExit(); // resolves after `app.unmount()` is called\n```\n\n## Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`
\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`
\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <AppContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes a method to manually exit the app (unmount).\n\nImport:\n\n```js\nimport {AppContext} from 'ink';\n```\n\n##### exit\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\nUsage:\n\n```jsx\n\n\t{({ exit }) => (\n\t\t{/* Calling `onExit()` from within will unmount the app */}\n\t\t\n\t)}\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes input stream.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n\n### Incompatible components\n\nThese are components that haven't migrated to Ink 2 yet:\n\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-figlet](https://github.com/KimotoYanke/ink-figlet) - Large text component with Figlet fonts.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "a2a469d6a2218ef77ccea0d09d414c7d148c7cf2", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-15", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-BpUMOBJr1flk6k0kv0xZtWF+cVMDBau0LTxlu1agmOx5QRboHearFN+9Xed1yJkGn2OlqdshXnNSSUOw5kXRrw==", "shasum": "af62e5bade875784ddc87657791237d057a81043", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-15.tgz", "fileCount": 23, "unpackedSize": 65479, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJca5uDCRA9TVsSAnZWagAAmAUP/38ualn90IoiBIxU8HWI\n3fOklmvKdxjkP96KGbSAu/jhz3fJXGXLFTscko1ShDZ1LTwV74ijtSiQcapp\nBxfZeITY5ME9WnG6FYrORN/bXsI88QepkYAnlNjcMK20+Aj9y8JVuaI82a5x\n9tEsuILiLX8W4AsmZpprTVl/KrQcgzoxoopckR51s3h5sQ6q3WJrKkgXCgdD\nNjW2O4y31fuxtxYIQPFiZDX63UX3YBLCPIbCsmQEfWHGr8Vc2xbW6WRIy87Y\ndnwHzpjNpFhAjaIWcQk5hBgzydYp8Irenjt+cB+g826tkMfj5IZWMs9WrOry\nkQnmW+4cIgyzUU2OXBWSZizj4jsFj1QWHvuv2DkT+fyGPa2wdkb5hiWRf/Yv\nQu7utFtEzxfvpcqJz2RhR96ky5PdNk8vBr3VYDKlfqJseK2ZqHkpdZPYIWRa\nQnXQSk0dXrIQ7lcuJWmD/qDRMyYVYw330kjpk/FUBXKitQjQsTF4vHAislmh\nR2f7P8w98yzUcLQNyPS7bk6Zq6jAhEedHV08BDnt/YGBAc6N3gJE5o0iw3Dd\nUANC/jsaiQdUvmJxCuLqtko1WY4B8bfiFXmDB1Fx7tQZAWAMyirGxJseqrc8\nbWUWekiKBFIIYrcGVID6Km+OIHKES0kUD9pFIaHKmQ+kDgDZvat6+UAdq3ef\nOIiM\r\n=y0aK\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-15_1550556035394_0.2006240017326022" }, "_hasShrinkwrap": false }, "2.0.0-16": { "name": "ink", "version": "2.0.0-16", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^3.2.0", "arrify": "^1.0.1", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^4.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n- [Useful Components](#useful-components)\n\n\n## Getting Started\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {render, Box} from 'ink';\n\nconst Demo = () => (\n\t\n\t\tHello World\n\t\n);\n\nrender();\n```\n\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n\n\n## API\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nReturns: `App`\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `Boolean`
\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst app = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tapp.unmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n#### App\n\nThis is the object that `render()` returns.\n\n##### unmount\n\nManually unmount the whole Ink app.\n\n```jsx\nconst app = render();\napp.unmount();\n```\n\n##### waitUntilExit\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst app = render();\n\nsetTimeout(() => {\n\tapp.unmount();\n}, 1000);\n\nawait app.waitUntilExit(); // resolves after `app.unmount()` is called\n```\n\n## Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`
\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`
\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <AppContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes a method to manually exit the app (unmount).\n\nImport:\n\n```js\nimport {AppContext} from 'ink';\n```\n\n##### exit\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\nUsage:\n\n```jsx\n\n\t{({ exit }) => (\n\t\t{/* Calling `onExit()` from within will unmount the app */}\n\t\t\n\t)}\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes input stream.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n\n### Incompatible components\n\nThese are components that haven't migrated to Ink 2 yet:\n\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-figlet](https://github.com/KimotoYanke/ink-figlet) - Large text component with Figlet fonts.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "da5ff3df952c817a305f3fc1c33165d04dfa17c1", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-16", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-JkyI3g++pv4z1R8neI9buniNmu4c+SxuXKZapx73f4EUIQArUonM76iCC9x5sWjQWr5uKEpqMAKPP9yVDTDXUQ==", "shasum": "e601384fb8559739483c39725ac720c9611ac83b", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-16.tgz", "fileCount": 23, "unpackedSize": 65376, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbN3sCRA9TVsSAnZWagAAUYMP/1ikXXavQ/w+g1IQ/1le\nQyJZJtXSZfPPlHT2bn6oHOKxQnWjKma0M79wTHovJ8baqfD5GysAqm9xz+p2\nluT8ifh0k9GzujBwBtwMDwojw2DRbCDwbFwc7gB36/MYjwvuyV/v92Kmr+38\n+bWokqIVCNjC2tH7lLV5YesRn33pfuSOyO/1DXE9cbevq80qC60nW2MMmcEH\nKG8EhhIo7KCfNRJWBkxnolGefEuob75PGM3rqmsbbf5euBRVC3A9QuGGc/Zt\naDLMKK8DioKGmUXYg/erixN3Js8puq8VinKD/IRUVsDrwTLknaWqbuzqDw46\nNezKa15y2okbQ0uKjreXGTRL1L32jmgKLcESkjLICZJgZZ6Qg9oA/VfLv+e6\nMDiG71vCLprREyXKQe+GU5cTqKxqNP8GWRlY5HQnCgZoaD9PGsc29Ph+FvcN\nA6ihwtmLMCCwTqf3dli8LfD//Zi1jsTpPhCSTMDYETIpG/2G/gpPmKq39K03\nlXoW9WrLgnLlm9DbKZ7o/2VdyMF8HFzjk0h0zGPel+M+6aEA2UGdGPzb/qvR\n8+7KPwZawV2rszBVfQ2lrclIeDgGqa8kR5aSG4Fk9vqXE6Bapvn0PMGsl9ys\nRMJ6Tw53NBLW9TdhRo9z9TfmLp9LyjW5YFgsC6d5jkupnfcR8b0K6toNHpUD\ny+eD\r\n=Bxhh\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-16_1550638571385_0.18130966395568526" }, "_hasShrinkwrap": false }, "2.0.0-17": { "name": "ink", "version": "2.0.0-17", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://travis-ci.org/vadimdemedes/ink.svg?branch=next)](https://travis-ci.org/vadimdemedes/ink)\n\n\n## Install\n\n```\n$ npm install ink@next\n```\n\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Color} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.i} tests passed\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState({\n\t\t\t\ti: this.state.i + 1\n\t\t\t});\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n\n## Built with Ink\n\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [API](#api)\n- [Building Layouts](#building-layouts)\n- [Built-in Components](#built-in-components)\n- [Useful Components](#useful-components)\n\n\n## Getting Started\n\nInk's goal is to provide the same component-based UI building experience that React provides, but for command-line apps. It uses [yoga-layout](https://github.com/facebook/yoga) to allow Flexbox layouts in the terminal. If you are already familiar with React, you already know Ink.\n\nThe key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to the output.\n\nTo ensure all examples work and you can begin your adventure with Ink, make sure to set up Babel with a React preset. After [installing Babel](https://babeljs.io/docs/en/usage), configure it in `package.json`:\n\n```json\n{\n\t\"babel\": {\n\t\t\"presets\": [\n\t\t\t\"@babel/preset-react\"\n\t\t]\n\t}\n}\n```\n\nDon't forget to import `React` into every file that contains JSX:\n\n```jsx\nimport React from 'react';\nimport {render, Box} from 'ink';\n\nconst Demo = () => (\n\t\n\t\tHello World\n\t\n);\n\nrender();\n```\n\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n\n\n## API\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org/) website for documentation on how to use it.\nIn this readme only Ink's methods will be documented.\n\n#### render(tree, options)\n\nReturns: `Instance`\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\n###### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `Boolean`
\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### debug\n\nType: `Boolean`
\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n```jsx\nimport React, {Component} from 'react';\nimport {render, Box} from 'ink';\n\nclass Counter extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.state = {\n\t\t\ti: 0\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t\n\t\t\t\tIteration #{this.state.i}\n\t\t\t\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis.setState(prevState => ({\n\t\t\t\ti: prevState.i + 1\n\t\t\t}));\n\t\t}, 100);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n}\n\nconst app = render();\n\nsetTimeout(() => {\n\t// Enough counting\n\tapp.unmount();\n}, 1000);\n```\n\nThere's also a shortcut to avoid passing `options` object:\n\n```jsx\nrender(, process.stdout);\n```\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender\n\nReplace previous root node with a new one or update props of the current root node.\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n## Building Layouts\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee `` built-in component below for documentation on how to use Flexbox layouts in Ink.\n\n\n### Built-in Components\n\n#### <Box>\n\n`` it's an essential Ink component to build your layout. It's like a `
` in a browser.\n\nImport:\n\n```js\nimport {Box} from 'ink';\n```\n\n##### Padding\n\n###### paddingTop\n\nType: `number`
\nDefault: `0`\n\n###### paddingBottom\n\nType: `number`
\nDefault: `0`\n\n###### paddingLeft\n\nType: `number`
\nDefault: `0`\n\n###### paddingRight\n\nType: `number`
\nDefault: `0`\n\n###### paddingX\n\nType: `number`
\nDefault: `0`\n\n###### paddingY\n\nType: `number`
\nDefault: `0`\n\n###### padding\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Margin\n\n###### marginTop\n\nType: `number`
\nDefault: `0`\n\n###### marginBottom\n\nType: `number`
\nDefault: `0`\n\n###### marginLeft\n\nType: `number`
\nDefault: `0`\n\n###### marginRight\n\nType: `number`
\nDefault: `0`\n\n###### marginX\n\nType: `number`
\nDefault: `0`\n\n###### marginY\n\nType: `number`
\nDefault: `0`\n\n###### margin\n\nType: `number`
\nDefault: `0`\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n##### Flex\n\n###### flexGrow\n\nType: `number`
\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n###### flexShrink\n\nType: `number`
\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n###### flexDirection\n\nType: `string`
\nAllowed values: `row`, `row-reverse`, `column` and `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\tX\n\tY\n\n// X Y\n\n\n\tX\n\tY\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n###### alignItems\n\nType: `string`
\nAllowed values: `flex-start`, `center` and `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/f/align-items/).\n\n```jsx\n\n\tX\n\t{`A\\nB\\nC`}\n\n// X A\n// B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// X B\n// C\n\n\n\tX\n\t{`A\\nB\\nC`}\n\n// A\n// B\n// X C\n```\n\n###### justifyContent\n\nType: `string`
\nAllowed values: `flex-start`, `center`, `flex-end`, `space-between` and `space-around`.\n\nSee [justify-content](https://css-tricks.com/almanac/properties/f/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n\n#### <Color>\n\nThe `` compoment is a simple wrapper around [the `chalk` API](https://github.com/chalk/chalk#api).\nIt supports all of the chalk's methods as `props`.\n\nImport:\n\n```js\nimport {Color} from 'ink';\n```\n\nUsage:\n\n```jsx\n\n\tHello!\n\n\n\n\tHey there\n\n\n\n\tI'm blue\n\n```\n\n#### <Text>\n\nThis component can change the style of the text, make it bold, underline, italic or strikethrough.\n\nImport:\n\n```js\nimport {Text} from 'ink';\n```\n\n##### bold\n\nType: `boolean`
\nDefault: `false`\n\n##### italic\n\nType: `boolean`
\nDefault: `false`\n\n##### underline\n\nType: `boolean`
\nDefault: `false`\n\n##### strikethrough\n\nType: `boolean`
\nDefault: `false`\n\nUsage:\n\n```jsx\nI am bold\nI am italic\nI am underline\nI am strikethrough\n```\n\n#### <Static>\n\n`` component allows permanently rendering output to stdout and preserving it across renders.\nComponents passed to `` as children will be written to stdout only once and will never be rerendered.\n`` output comes first, before any other output from your components, no matter where it is in the tree.\nIn order for this mechanism to work properly, at most one `` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `` and render them to stdout.\n\n**Note:** `` accepts only an array of children and each of them must have a unique key.\n\nExample use case for this component is Jest's output:\n\n![](https://jestjs.io/img/content/feature-fast.png)\n\nJest continuosuly writes the list of completed tests to the output, while updating test results at the bottom of the output in real-time. Here's how this user interface could be implemented with Ink:\n\n```jsx\n\n\t\n\t\t{tests.map(test => (\n\t\t\t\n\t\t))}\n\t\n\n\t\n\t\t\n\t\n\n```\n\nSee [examples/jest](examples/jest/jest.js) for a basic implementation of Jest's UI.\n\n#### <AppContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes a method to manually exit the app (unmount).\n\nImport:\n\n```js\nimport {AppContext} from 'ink';\n```\n\n##### exit\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\nUsage:\n\n```jsx\n\n\t{({ exit }) => (\n\t\t{/* Calling `onExit()` from within will unmount the app */}\n\t\t\n\t)}\n\n```\n\n#### <StdinContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes input stream.\n\nImport:\n\n```js\nimport {StdinContext} from 'ink';\n```\n\n##### stdin\n\nType: `Stream`
\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\nUsage:\n\n```jsx\n\n\t{({ stdin }) => (\n\t\t\n\t)}\n\n```\n\n##### setRawMode\n\nType: `function`
\n\nSee [setRawMode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function via own `` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\nUsage:\n\n```jsx\n\n\t{({ setRawMode }) => (\n\t\t\n\t)}\n\n```\n\n#### <StdoutContext>\n\n`` is a [React context](https://reactjs.org/docs/context.html#reactcreatecontext), which exposes stdout stream, where Ink renders your app.\n\nImport:\n\n```js\nimport {StdoutContext} from 'ink';\n```\n\n##### stdout\n\nType: `Stream`
\nDefault: `process.stdout`\n\nUsage:\n\n```jsx\n\n\t{({ stdout }) => (\n\t\t\n\t)}\n\n```\n\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n\n### Incompatible components\n\nThese are components that haven't migrated to Ink 2 yet:\n\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-console](https://github.com/ForbesLindesay/ink-console) - Render output from `console[method]` calls in a scrollable panel.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n- [ink-checkbox-list](https://github.com/MaxMEllon/ink-checkbox-list) - Checkbox.\n- [ink-quicksearch](https://github.com/aicioara/ink-quicksearch) - Select Component with fast quicksearch-like navigation\n- [ink-autocomplete](https://github.com/maticzav/ink-autocomplete) - Autocomplete.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-broadcast](https://github.com/jimmed/ink-broadcast) - Implementation of react-broadcast for Ink.\n- [ink-router](https://github.com/jimmed/ink-router) - Implementation of react-router for Ink.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-select](https://github.com/karaggeorge/ink-select) - Select component.\n- [ink-scrollbar](https://github.com/karaggeorge/ink-scrollbar) - Scrollbar component.\n- [ink-text-animation](https://github.com/yardnsm/ink-text-animation) - Text animation component.\n- [ink-figlet](https://github.com/KimotoYanke/ink-figlet) - Large text component with Figlet fonts.\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n\n\n## License\n\nMIT © [Vadim Demedes](https://github.com/vadimdemedes)\n", "readmeFilename": "readme.md", "gitHead": "139b9a53ecb8c88cd272761d8da59b3972832ecd", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0-17", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-BTu3+VyfWIwmVzEAvhhPKEQvIO2WvIo81Y979eaXimPh0DfPdVFmb7EvjF9tsrpg9xvF619qyrp7jmjFXsjOgQ==", "shasum": "ea6678b99d689fdba00d2f1a8fa2ba82b769c535", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0-17.tgz", "fileCount": 26, "unpackedSize": 73834, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfNLoCRA9TVsSAnZWagAA80kQAIPH9zDpNb6PYKLQuSE0\nCztgql5WZjazD6j1L8yzNqogOdXb387nyAxYWwucFdqQ/wec2EPCe+aVD+zh\nYNsp98Lp+QZscZGkSJupCmpON7C7ISTNAhXV9VUyhknQDmKEMNdgt9+dSBaZ\n0ha9xzQJXHoiTukEr33lNU+nZChbHqrh7XZuNZk4G8EPrWgRxGFzO97O1HVV\nCm/z+wObyOH+IJ/9s4ezMg+WYTBeydYKQi6/FQVdCzg0HXblpVs43v3X5eBu\nK5B690ek2ssBUbhbKe6izdFK2Dxyl/ds4D8pQ3mgaGCFGkfTu+srbq2VkdHe\nwcht6os4zXjy2Jh+Qp/haNZwTMSfjxheyuDzs+io+Ffc79FOHOSfSvw3yHrH\n7HvHriou9xCjd+/MXEgujp8Kacv9mKmOhcrdGQluyCmmgtazNt4HSWSrzSWU\nPrLr1XaQqzVL8GLrrJNMyBk4I592OZHtRb27LhSdvC4z4CW/e6jrG6qWLRd6\nN4RcOkkHhFqAxG7L1dRzfiVlEJVOVBKDqPyvpcT2YoW7ZUeY9hHHxZM+59Ug\nIn2jaCv4N74dC0v69j6m28i/eW0+ohhtnOU/RZKTNep4WlaOjOKzTFH54fA7\nnxIA523D9jgHtSKX6Q+mtQ2NSscApBtoIK5VEgrrcQPTsyvE3JWIscLrrGl7\nbpTO\r\n=jDXy\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0-17_1551684327654_0.026339040429774307" }, "_hasShrinkwrap": false }, "2.0.0": { "name": "ink", "version": "2.0.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "gitHead": "f7386d7864ecbd1b4134399c07706b21cac19dcf", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.0", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-kCt9ucBO+0NRkzcsXhAbYC7n9q+EOfl4jl0XsoFtMjv3jCE0a7tn8FMkzlMvXurrMWvFXLlBaIe0ErnMrQNsRQ==", "shasum": "e543b786e3eb33fd78f17b1c009e954557b25c6b", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.0.tgz", "fileCount": 21, "unpackedSize": 63000, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfNZjCRA9TVsSAnZWagAAIbgP/jS26nzh6Kvn8fqv7K+y\nPPrmr1auEZGxQbhxMxXu7Pdyn9WL4fCxtjFKQvuExTXYbAZ2zRflcfoRl6B9\njfQYp87KbYhUdWocRekDnijZfGP9i5GirY2X+aDyuOMH7qBh3M1Zv69Urvgj\n96ukJibaqCTngWs6IlchnYXYvbkqG+nmkXaQ1/u6wXO39xhCFku9YQRnjL7a\n+nkUS13oIcfIrnP1grLCjFYA+puVZHNlyxMy8WvTtcPkGdLUu/aHwbB68pLu\nhK1ubQkkMUNmWhgaZWro5nOkVQMqLLtUsPyCzKsaExELNyk/ZBgaW+BUFoNI\n72ORfo5qKlb3BKNz8l7GXWTMYpKHK5C6HobapKwbI6gw2ISPXWly3Uf3cNMJ\niiMuipn36yepPtQSqjXn/VXwm0Y/Y9DEgaoewMpVZMlD1P1WOvjn0e9PZN08\nophVAu3awb3IKmYF7ZjWggv8sQgSw8QuCmZvIf5P/rOywr+t6xh9XVL/DSWz\nLL6HQp+bqtdqEMVunK6IRrndcH4qCk0aEHDxadWnyHZYlJ1vyPFEo69cyujw\nobf2vo10ZUbVo5jcitVrN+jXZ8TVr3daKNltCZamLrXIrFzJPcgBTNH9bDXl\nkZDPXI+r1g2qNQS8Bpn9C752jaIQEheZuyxKXe6aYsAJdwW4E5TYcA/VnIKw\n4bml\r\n=u55P\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.0_1551685218816_0.7028771477003657" }, "_hasShrinkwrap": false }, "2.0.1": { "name": "ink", "version": "2.0.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "gitHead": "737df2459b474c2b70eddf0eaf39c3fc0914ffa0", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.1", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-f9FZWlBlZUyOI3g449J50JB3LV1awJoQIDIFc4A+vHJ/F7lnBq/NC+zFY8PjIh3lcjmJI2kbBgyQSLr+d4/aTw==", "shasum": "0b04108029ca112e0f884d948b2056912a301fca", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.1.tgz", "fileCount": 21, "unpackedSize": 63024, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfhXRCRA9TVsSAnZWagAABRkP/0zfwuUI4HmPLIw/tlIn\nS0cS+HPS/AM8XhEFvXDXpS5IRHTKhxXhEbWlinxs/5Ny9S2ZtlN4Ph9mvFsW\n50nta5Ezd929K+zijIowmsY2AOX1FHyDt9rcrc2Lj+8cWeBl1bP8IhKnkjJM\nEFLq4N2Lpyn9LXUbZbhqo9+VJ/C3hFhsuuGAM76WXHj9au61ErRWf0yrFMYB\nhp1AA/onApaZ85YqQvfzguhzJyKPB/FK65O1dX/5VhFZdLL7FdVI1p2Xs2Xp\nZtq/ShYTUMvL5ISVXDDxzSFG8m1vrsGBZSn0SOEl3Kj7VvujomvFTpfJhCE7\nLM6tc+7f2Ju6Q3kxhG6XXT31eQZ5HjtgQgX8P+ZHbbBIFtcuRNCYHt58aFJq\nxYpWECOhAB7mUJip0GJwq9jZVe1A07dWJsl3SBKoylD0znbyeNubGgyfJ0ab\nvPp0ZxOstKRnBkEqqxongclAYI3Iu48nlbdSzMv2Lk+Zt1U6llGBylIjS/9z\noYghVbYG42JuRNCwM0KaBKW4b2KUbf3xUolqoYRTJbhV1BFoCm1dkPEO4oIA\n4xayYqaZTUh5l4ueMByJFF4omTy+a6eLy2UkfPkBL1UccOpaBIGRH6yYXZaR\ntdiR/VWDLCwT4jvjr0dMY/uKA1AP9796iCm9ny7B9VWi/2C2s05LH+9nwDR9\nZqsp\r\n=gxpa\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.1_1551766991893_0.29390216591028206" }, "_hasShrinkwrap": false }, "2.0.2": { "name": "ink", "version": "2.0.2", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "gitHead": "34f3bb7ed08b47e672c58d105601fc10699a499e", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.2", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-igt+u1n1jdoxhFRpC0DRKZA3d/SEwOFda4USazIDrkFBnEUhdsTVKxmKxPM0ULl8OBygjXhhI3wMgwdDItl7eA==", "shasum": "52d5f2b8d523d63cb129f6a2e05ee5ebfc4a276b", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.2.tgz", "fileCount": 22, "unpackedSize": 69592, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfhfbCRA9TVsSAnZWagAAJIwP/1TeG4e6bCvumuJg2lmh\nh0MCljcjSnQzwgg8WJxHuX+P0mMhEz5gPWBOpP+q8wZkJLMzzDvjhwZg42E2\ntNQHQ+30rDpv4u0cENkZGmrE3zFLaTDon6MW6eauNSVTNXT2njOeyRDpqb0n\n/wUiNh7clqAP6gk2YrK5Erb0LvO15jybglwZ8+EHPLEbHp7+rt3w40Kb49Qm\nPGMPLxks1mNh9zN3oKMEOJCaq4IVabR/qNX6C8kgN7I75vpjay3Ilo/bv2kP\npinv/+PucW+zbb97Ok+HENf5ndRfEIYpP4zMCuVuNQWej/+Bw3Jy6MlfJKg5\nbweHJ6SpAhQJKUuh+41GiezEb0tOK3w+1lyejVlrWMMAi+gMlfb8BU+Z5UWV\nrw8KhmBwq4wchutSJfXHAoOjnywwdaM2yOn95A9gfxP4WPlsDeCItg89nwSh\nvLlfuD9G/NeteIf9e26yHtzFMn0WdZMXA0z/Ai7baUcdgl2DLVCY8lzv9j0I\nt/557lVMfK+5UAxgBWl7PFndbVqxgBH7HdNrTCDLxDckH8She0ToDpAcRAgE\nXSdmeO9+OzTazEP73ak8w1aTjcbhHFE0oKZxNHoyBZD/FwobsupJRR6GTO/A\nPdka2ys/XDi12/LG8xWSX8A5mWZB47jtcCIbTMBkqD8qsSYeS1baIUY8D7Fi\nEHd9\r\n=Yr+X\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.2_1551767514317_0.29711368846442676" }, "_hasShrinkwrap": false }, "2.0.3": { "name": "ink", "version": "2.0.3", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command 'node media/demo.js' --out media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "main": "build", "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "1.0.0-beta.8", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.11.1", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "strip-ansi": "^4.0.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": 0, "react/require-default-props": 1 } }, { "files": "test/*.js", "rules": { "import/default": 0 } } ] }, "gitHead": "724020145a525ebc6ad0d4466c00994c50be54d8", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.3", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-xnB7jKEyXFmEHvx9dVvfmsjhjcN8r8c/gloxFvh6S4mhhyyLiKpV+Y18atFyRxuQnACF077zlPZXDNrHQGkcrw==", "shasum": "be59b501398a0cf8b18d8ee26cee060a126c25a2", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.3.tgz", "fileCount": 22, "unpackedSize": 70063, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfiVwCRA9TVsSAnZWagAAiX8QAKSD5/DoG0tzLT1vb7Jw\nLF4a1yOThdDDnyvwpGVuxwe7zEYb4+niPxRv2yxma/6aQVfAlcrrunn3Rg5z\nWlD2rGhLcQZCtBTE2/LOp8OmelS8bCYvXBr5LSDfDng+t5FVyfn5XvIk3fR4\nxHwor8Ii90+qnZZ1ZjlYtTF3xBWv021jvD7Y/q26xcEHgv9ZAKsLir/RU1QI\nBhIUgGgXy18IZwCl6+lwGfVAf4TilmjQS5tL3xwKeAaXikfvn/ihtC4i8BGm\n1g8+3H1P0EKqWj1fk/kdWX0Le4Nk9HVPxxIUy0vxpOtsoxN2sCrRjVkY4sop\nIeG2VaRtwP+efTKIzc90eFQMSrLf5YiojrZEWZ/K4qYhnmUYdc4ifoAg2q6Q\nbf0rMJBbY1RIZrAjnVWbgSTzr6+8Kvivh8dH8JDpXrZaXrEdC/FaRxumDlhA\ne2y1l+q9DwaQ68KsVUm2IbIe/PeHsN4C2fs8twNUi9TmPkPMF/w7V51Gr5ZA\nfey2uYFz0ezXcAbD8FGVmDCBJ//vsxKejXknS9RjD4q6bh5Mx4fmdIwdruGJ\nj7dFmiEF//8r/4knXhmdeKQ/ct9kBNOU6eZexS04aQMOIMji6ginVuOkXo+K\nghShRTz33avgS78C/OnOZ/ve8oiVIN8G192xXpBbbNKfRYlPkTMWOPJQYut5\nB51E\r\n=eKoG\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.3_1551770991786_0.09192090943020848" }, "_hasShrinkwrap": false }, "2.0.4": { "name": "ink", "version": "2.0.4", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "b90d8a05a8f317cd7973c2cdf69cd400092c1012", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.4", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-09KQBIXRP2OPsB+a1wRga5TNUrhirRPdV4mxSKpvzHgS80q9g7rxbDOjZYTyM0wS/hQt15eUavJ6Jpya92lEig==", "shasum": "fc6531583d6928719256f8d7bb5af9d92578057b", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.4.tgz", "fileCount": 22, "unpackedSize": 71115, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcggKPCRA9TVsSAnZWagAABH0P/iBqasXOCQrgOyBATcXj\nFXFYlETfA7Ju0a702J7lrYsXdQ0UqzI81vXqv52e3HzvxeL3zKcRI/AglGN0\n43ww3zTzV+ofAR3wtQnX2jMbuf5mBZMisov5BNJQmfLBx655kC/TPYcfJ/k+\nALr9YIaxbU1XxoyZd82i2trMf1ejpXOhojrZUY+WlgckvpQXl2hMJzokd4Ka\nPtWXjzrvLXbXdRiOSDbBKypyaQI8MmvCn+xqilQKuAAVx1cmsyMiG5QrTEvl\neMPexMqeUSvqNcPQ2IlMyNH9nJe44kGXVUfG5bI9HAR9G+adJmh8sV2yLqkN\n4prHWNsmO8D3vmuoSm7KIYOtJiNtiUUp8i0dGcgoRfeKSi3HUEG0N95JvfjW\n6Xi1Zd5P7uQhd6X/l/z2ZPYnUUjlFCfNzfEo7VBBX7/R7G9CCWJAHJmNrX1n\npXabtqAn1Lagah1cOPX6Q39tUMtcF1znsVWbHPy7hAun7YMuwUct9sBggJ8n\nXnxHyHhgOEYD4JnoDnAsMiBtTtvfKrczJz+Ao8k7YU81uE96CI0p52gXd7J6\n/EQQQ92N/hgvCHDgBQVcnV6alDl3VnsRY0j/awWQ3se3x2aHnGJmgNlu3/p8\nhb3cYCjIdp+ITmzb+3Nk4tjjK/5/SZodfx4oO/17XT5KPEMR6lwX+C8IhQU4\nFYCS\r\n=4ZqH\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.4_1552024206222_0.921194265140928" }, "_hasShrinkwrap": false }, "2.0.5": { "name": "ink", "version": "2.0.5", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "4218e3ebc02f5ed8f716f6679fc286abfc3ac36a", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.5", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-uqJBW4ro8SfMnwEVSfH0hAMGA2T8bhrOb9TUcdhvHval9edVESUcSQBfQ0wTXOENnavQXzAXWB1CznufHYBxiQ==", "shasum": "a7fcd79372f57bef0e436d087cbef9e545ee1051", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.5.tgz", "fileCount": 22, "unpackedSize": 71690, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcg2ooCRA9TVsSAnZWagAAvVoP/09kokYfh6ROBuaJkkAI\nI31FUpYuYqoxCsXx3YVJTk+0pmVIUVojPdCQql8q+1Fmfa20CNt+9Ajh0Ny+\nKUsOqnnDHZgViWoeQdo2QFVZK/DIIk0JS9g5xIdeuUXBPhXh3LP6yh4tRaLO\n0v6BHnT/lVZRbZmYQf9rz3wdhcwEJ1vjcHX1+K9Rugx6727N4Yndx+ybW5vt\netGR6x7AwzL73lOOHwxT0Pw0JDBq4REjlqZZ1np/TaMWwxXCMSPP3JlAJDhW\n3OmvPBfwhH7tJtgIfqvdMLxQejoOHUYaOkdLE0NtERhgRStD2DjaWeKOiSgJ\n1H2kQNnoWc4L7y2ChXk+f23LsJFXMmjaRAYZg/oPVN+Z/0+VvBdBegGHEh7i\n6FA6a4kyeV8O/UHJK2VzspM2VZcmttNvRfAAQ9CjuxOBscYJErjC3Trvbtm4\nbvD7a471rBmdhukGwRb5hg2QThmAxN2KCM7tWNzggkUjStMgKuq+hOHfmuB1\nUOeUkyf00KKcn71qJPj694ZYrle0Mje/BPXB0jtbBBq3Q3CnAXS8cSS4v3Ey\niEs5VYBn7qpvGtlcJgE7FSeGLtdKGbo2peWlqeZEfAiiAjFRzFyWGlFU69q2\n+rsILUkjamYAgc8+gscdOFuGVOmHAQhtKmOuxo3n+WoVyplTirJZkZYHjCph\nMTFF\r\n=xjan\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.5_1552116263956_0.462118515869802" }, "_hasShrinkwrap": false }, "2.0.6": { "name": "ink", "version": "2.0.6", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "7f6f5ba7ccfd0ed22dbcd0c27dcf8369f0b7798a", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.0.6", "_nodeVersion": "8.11.2", "_npmVersion": "6.8.0", "dist": { "integrity": "sha512-FGsR0tlVkeQJQDzOff/rIENgVWmQ7jZN1F4pXrE1WLjAaMl1th6lsj5+QhnlL28TMA+RAKo6Y7vKc7WZrbpj5Q==", "shasum": "1ac54812ecd89e68ec53513a5d2f458f602f51dc", "tarball": "https://registry.npmjs.org/ink/-/ink-2.0.6.tgz", "fileCount": 22, "unpackedSize": 71913, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcjwsxCRA9TVsSAnZWagAAO5QP/RDoGbUNZxKzEHBlyBt1\ng0po5lBAGdpHbMtpnmKi7PKK7kmjDqiZqigWJiXMdALL4yiCP14jVUoPmZmR\nt/NZevxC/RwIkXqid3jUmIyOLFwwdQ14HuvlJpScHzHxLo6kW/blBlurm3ri\nuJcmqdX+cCmz2ngQ8BBm2CX9vrGpZ1eop68vxgXuVDCT0eKLwGVYvLAF2fg9\nLu9yeIpMDGr/Wgh+/t1f4gckUKzl1lLzRaDRaq14LI4MekOZus2pGHj1kYXK\nDQb0JehV1yqz6Flu4fpJNbJcx6pTyarfYLi/j/UOT8Dj+e45SaooJVBc3DSQ\nPHql+jr0qpd80JDV5BvhQ9d9jfc494WFKfWrzs76gj28ABgahMEm/aZa5GAt\nOBcN9ypZosBOlM6SbmNo63bydwmXAgpk83UTcVe9VtsvGDkc02EwJkVC6J2R\njWoGsbC0c5kb+k5zceCaiEcQb0viSrJobrsjaO81wgpclvrozpKjnexoRAo0\nYuSWdxMcYiQVPzlneLJPrRmdVif2fJxhuoTk2mI7BbiAoD3u/2aZHaarB76d\nuyt1rDDFTLVPtGiAcWD8U6CqecnSvbCpqaylRBbzDvaQWmhUUY5cL/klOhRH\npaPTJHn7aDvyRjZcqFO8vTQxDh5lHSgNV05pJ3d707a/FgqLZSs3LEjjIsar\nnzqO\r\n=ZcX9\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.0.6_1552878384414_0.43244161165924444" }, "_hasShrinkwrap": false }, "2.1.0": { "name": "ink", "version": "2.1.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "b3d6ad85a2585979e363de3f1d780173f84fb464", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.1.0", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-2TtQ4lJgxCW2fU22j/5tSdap6v0dFeSjPuq5zTLOXLcHheEzDqS86weJA4BV0gibTAbWklvjlgM1NAUb4DmrUg==", "shasum": "3b6072e90ca25b657fa1262f0fe018f8dcc82d8e", "tarball": "https://registry.npmjs.org/ink/-/ink-2.1.0.tgz", "fileCount": 27, "unpackedSize": 83476, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcoEYZCRA9TVsSAnZWagAAS5sP/RksGH+4Z5vBYonilA6E\n75mCQ5jTQeedSOve1vemQmSDQILeQnD0X2v0hvUmzrYTOrKQmSD3vzlfhxNI\nfbqoqJBQxNI51paS/bo5ui3VkUNRIQyOd8vnAzstTuCbfp13hjjf03FIo+X3\nkIUjPqJaVw+3v2crDhD+7QPI+cz4j4adiCrszaOkw1/VIWtUYw3hH+oOHuU8\nDbdz9FCAALvegz8VGuIou/C47GEM10GjkQLA22+IB+0ZJkZa/F3tnU+NrW9l\nH+2Wzo0WuyCTFTTZrv46gvWLYC+n6HYAe+SfFBnAOF18huDIkmVTQLxFZzGq\nkyg/mAD3Rj4Y41Rxltn58Z3+aI4tpgnyQyvtmp8iAgD5/OP/dDKQrR1LJtBx\n3S/g+jJlArTk2MeJUGLhwuQ/qKqwfc5JUtt1lxQoad2mDqfm4sPKBM5rEP0D\ns1mu5cI0fmtwixOsM74UMNPLW8Vr5K1bYkRYv4arOZA1fP38pbQ/SUR9P51l\nsX/Y+bqWGm8aWhN5Ov7baE/tyanlhRMf6L2rMyIivvA0LrZFdibw0FAn2I3s\nhyaKatEOoe1fs9v5hr96ETJ3xboMl3cagLcUQ1VJCYu/D/mEav1Hs76t9CRj\npC8GF6hiXkJ27KC/n+1tGqydgcZ4UUFB4//ULvS/1iqWiMoG/d2ruXB9NEV8\nnnpK\r\n=v9/b\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.1.0_1554007576124_0.6700357842981084" }, "_hasShrinkwrap": false }, "2.1.1": { "name": "ink", "version": "2.1.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "e8008db7e2d83295cc69a8dbc53a291fd2cac2c5", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.1.1", "_npmVersion": "5.6.0", "_nodeVersion": "8.11.2", "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "dist": { "integrity": "sha512-vP1yE/uJoiY6uB9yHalczUA02I9fg7xDUbTEZitPK5y6dvnPo9a/6UWqIB2uCYkHOhEZMN+D/TsVr4v2sz8qYA==", "shasum": "efb2adbd30be79b4f640d7c67b524bfb030205ba", "tarball": "https://registry.npmjs.org/ink/-/ink-2.1.1.tgz", "fileCount": 27, "unpackedSize": 83655, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcos6oCRA9TVsSAnZWagAAoJ4QAKSFQzc/OzZMSp8tCB4i\n1/5ztgFL4i8ljCLgHQVztGjGTlm2iCR1QAD8Z4S7IJAL0HgSK1KrJzjxt9ik\n0rJeoz/Dn8g+Tbenm8Swk16I9D8iTqDIDiDgTlNmanvMy0/Bs8/Mm6kJE6Km\nmzOuGi4DCDKUwPg58uIDtThNjq9DMqgdx+AIVz7J/PhOjyO7Y+EuXYduAz7b\nH1LGcbz6yt1Vf1ejyVzCPKak2tnxKXiMW8B40ND5btTQrBVVszNsA/wNUNzz\n2cgUfLHJhug//A5pwQgOwtXBs1JNnnSFc1BqL+9f4ZT+jw+YuEDLjvXpGYAE\njJ6gmxdNVYTX+pRPYQDHsvs8akY2VT0fC+Fe1Tp/7qM+5g8bT4bP+lB78wv4\nm52c2v0sMgjn269y3TJnczQsylgYf8yPOTxaKDghALT/12w3jicMT11URLcB\n6EvCi3OpKn4vOreikdmFyQEb5XIMqHuG0py6v5zA0sCH2wAJdyXGdjgo2bCh\nTd4hyb/7QaWVrW/AYey6F785blqA2BX+EZ5UM8tMBeNz/u4GUg1pKL3Y/SXj\nwnkDIfAZs8T43o/vtznmZYoYDFX6fbdqyHCFRUDF5xOBVbYhUzBUQB7o/nWD\n+3SDkcNRRbbwLtqkPEr9eKgfXa7GJbvjbUx9OzxlNqEpNyaMGjbJ4TgDQr9S\n5orb\r\n=VhCr\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.1.1_1554173608009_0.6855544616583942" }, "_hasShrinkwrap": false }, "2.2.0": { "name": "ink", "version": "2.2.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "a1a7ed8a3a82c9a9e84d33ec81595ee3f8989b05", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.2.0", "_nodeVersion": "10.15.3", "_npmVersion": "6.9.0", "dist": { "integrity": "sha512-BQl7jpmLxPqFGjdQdgXQS0+mAyn1BHkEW1YXur3dahNNwLB6MWsfAZ1GWVdj+Mbpmj+u33KaFOosw3067t3d9g==", "shasum": "8231cbaf03799634cb333ec4e461f50e25e93fc0", "tarball": "https://registry.npmjs.org/ink/-/ink-2.2.0.tgz", "fileCount": 27, "unpackedSize": 86109, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5hwwCRA9TVsSAnZWagAAIkUP/3+o6yiCYwZId6lL/eRk\n3lw1MlccE0ncMa0IUU7VynasQblTgllgIATJGobAj6o+c3vr9akeM5ZkyRvJ\nsGnyhogvzW3yfNjiqhGiCaKWl+X5VstV95GmLP9CjhK/wXIph4ssFO4GsagM\n+fPrir3hdQ0AAB/i6f1/5OnRrOJuaIvtYPf1x0oFWGwgu/9XTc6owRV5Z1LL\nBR3QVjbUgBK47w7acyiWk0/P9uunXrm7VTzbUQKbFpaYqXBDbVyYccPWmT4V\nI7dElxebwhxeUthpJu68Kb3eunyDiYzGPBQg0ImZt9H8Juz6mrC0nVdnfZ5b\nhTck3/ZTpZzOqxX1c3e+xoG0KBoiBysZtJTMKlJHRQVHWkh5WaROEk7XFzPV\nzzSsmAirN98xTV30N0ECIitE1xXZIizAe5R/jgzeRPV/Ki31+uNttGBApjyB\n5nDMtGiuOdH7Yz0kGDPh9c6NUcaQeh4PDURX2NzSG+X5wyYDp9lz93qAlL5p\nQAPNhR9GWYmJyg7wGGgXEC5nuyd9nZukbz9dDS/qx7oqHEMSqihb8/5A0RY1\nreAihdccgzj0cz8H+t+U1yJ8/mkwh+pnYkBK4Yvh8GCg+R0xuLgPXPTtjMjo\n/XXtWePsMQounmdFk2FTcmfOOXxFr2dNiTZZuG8l5knCwfy3x9DHw+dTi+kQ\n6RhF\r\n=94md\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.2.0_1558584367943_0.4246376604418902" }, "_hasShrinkwrap": false }, "2.3.0": { "name": "ink", "version": "2.3.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true ava", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.20.0", "scheduler": "^0.13.2", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.6.1", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "overrides": [ { "files": "src/components/*.js", "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "a8fee0fd7fdb4b96ca7080bc0f0b54e534281cee", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.3.0", "_nodeVersion": "10.15.3", "_npmVersion": "6.9.0", "dist": { "integrity": "sha512-931rgXHAS3hM++8ygWPOBeHOFwTzHh3pDAVZtiBVOUH6tVvJijym43ODUy22ySo2NwYUFeR/Zj3xuWzBEKMiHw==", "shasum": "222136be17bb72fc742e19090483e7e0e7dc3690", "tarball": "https://registry.npmjs.org/ink/-/ink-2.3.0.tgz", "fileCount": 28, "unpackedSize": 87116, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdEigTCRA9TVsSAnZWagAAzDMQAJ1OowU1zgP7eqKLAkk+\n6Bm6GoVyMQffc17fheQZxtLon7VPRS06VqVYTXeEPKdhCbXAJMCtwBv1HKrY\nxOvJUQstFZHRGrTZf3Z1pyzHkE4xk1h+CHynGWAoM23sCKThTSHVrclLtASC\nQguidIwn2goON+0AVtmIc/SZ4HXNejT3e3OzXauihkKKyVGmP7yKPz+GIN80\nceQycoKGPtkoSdgwx0Atw4LzgS2BmKh0UIFT9JRBnfcOEYn75w4XFfYV6t/g\nlx62ac4F43hSWkxth7qJiScAYoJXnI3HQ7UVKr1k97iN/E9qYCTfGbTRo3i2\nB6y5N8FYTLvIdSxnCyOW9I8JViGoCQGO+D5EkmfTHyRrrv5wua7QfedzwFp9\nCiYyDm2o8pAfaX/DJyNv1SKvqpfK7MtAnvIv981q6xtCHeUs+sNsEPaDlXL6\n6hEkf35pN6CqnXK4lxRRE4zPI8xG+6qbD6hX4IpagniHVrH9jjBAJmhfNTIL\nVA1fASNfnvVv8xMz8efpOiWNO9GWD8FzmlAgcsDTDP6+3R8cYlUz+R7V1J5j\nyOXJ6aKsUKrH65A0vFc8hgBUpv+6plNWaL4GeARWoTVk2GEwOa7eJ1S/S/cs\n3mjJedVrc10T+f39Wu50bDm5Q5ipT0fZU708inlbtbR/igoSiBABijkfrvwC\nfM1F\r\n=jvmO\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.3.0_1561470994609_0.7983274276419798" }, "_hasShrinkwrap": false }, "2.4.0": { "name": "ink", "version": "2.4.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true EXPERIMENTAL=true ava && FORCE_COLOR=true ava && tsd", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.21.0", "scheduler": "^0.15.0", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.9.0", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "tsd": "^0.8.0", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/no-unescaped-entities": "off" }, "overrides": [ { "files": [ "src/components/*.js", "src/hooks/*.js" ], "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "ad7160e0cbf5fb3fb00ac5fecc12fad10ef95214", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.4.0", "_nodeVersion": "10.15.3", "_npmVersion": "6.11.3", "dist": { "integrity": "sha512-dEEqRo2AgvJZy2o+ltQkHtS4BwPHPHfcNlt74R8gljH/KX265N6aIAAPhYpO3VJjnkoO4/y7MYAYeDDsLDlrNA==", "shasum": "991f8264d90b81b94fe963c96fccdf26afb6b436", "tarball": "https://registry.npmjs.org/ink/-/ink-2.4.0.tgz", "fileCount": 33, "unpackedSize": 111893, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjDj3CRA9TVsSAnZWagAA2hIP/1zyhTYtfL49mUoJf4BC\nTpqOwO361CojC+jeajiSPcGTABQS/4LDpYCK+Z/clJS40ZY6EDxOF9VwYkqq\nqNS661h4i2ndtGUbxYdeF0AKMWv6XAW77OdX/Ze892qeTcmmmBinshD+gvA0\n//qst6VVvS4AXuHvnMBWLIBlpUmQoE//EEGosVGyA4q7B6gdjTqgRh/Ms8/z\n7koqI49om8UY84GU0fPsgv8ECMV/lOoMrj/UoE5gNs2IO4MDsPjeFIVDDRHS\nuOEdXFbJ6kTaep4Tjq7C1Z2wj4zxyApECrtQPqvOhAR66jyQD2AuvxMztpJE\nCwBhMYRfhhlsanpdCSZ5aFpiS8HwMMmn5RtyVEqJlqI2Lgz40Ps/VSwPxLtn\nuoibP/CLiZznZs2egOLI3FkLNbiDfpQR9OdeJk3rWetHKGIqXnwXC7iLE/qU\nXNwburkUYkijwtLSREVd1JUj6T5RtsuLLBQ6jR3AkwK74HRwuRjCJnH2iA4o\nOb1gVoHTJo7rSP9mLNXbjEGFTajISvrw69avxg2BSk6+kJ/tRINhX9wH+HK8\nBvfdC30NiWxOJbdQYW1QpNECaD2I+LgwFEjwX5tCPQaMvReLLpsY7QlgNN7x\nlxwC2Z78sRj37odOVmM51S4nTwmc6h3cXYLVNwExWUQ2Q7Mkj4xGcnSja4T9\nt2um\r\n=gCD7\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.4.0_1569470710548_0.0906888572249187" }, "_hasShrinkwrap": false }, "2.5.0": { "name": "ink", "version": "2.5.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true EXPERIMENTAL=true ava && FORCE_COLOR=true ava && tsd", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/react": "^16.8.6", "ansi-escapes": "^4.2.1", "arrify": "^1.0.1", "auto-bind": "^2.0.0", "chalk": "^2.4.1", "cli-cursor": "^2.1.0", "cli-truncate": "^1.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.21.0", "scheduler": "^0.15.0", "signal-exit": "^3.0.2", "slice-ansi": "^1.0.0", "string-length": "^2.0.0", "widest-line": "^2.0.0", "wrap-ansi": "^5.0.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "ava": "^1.3.1", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.19.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^1.4.0", "import-jsx": "^1.3.0", "ms": "^2.1.1", "node-pty": "^0.8.1", "p-queue": "^3.0.0", "react": "^16.9.0", "sinon": "^7.2.7", "strip-ansi": "^5.2.0", "svg-term-cli": "^2.1.1", "tsd": "^0.8.0", "xo": "^0.24.0" }, "peerDependencies": { "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } } }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/no-unescaped-entities": "off" }, "overrides": [ { "files": [ "src/components/*.js", "src/hooks/*.js" ], "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warning" } } ] }, "gitHead": "9d4b35126bc6a21b4b7b9921ae17ed566c51493f", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.5.0", "_nodeVersion": "10.16.3", "_npmVersion": "6.9.0", "dist": { "integrity": "sha512-HUkVglJ11cXK+W1a5cKNoOCxLkDi5hbDMAWSFDcwF2kpNd0eoX+2/cpaTP9BTFaQ8RJk7O59NxKMmyPXkmxo7w==", "shasum": "66cf988b65ca06d14f00f385eb531fde29f95819", "tarball": "https://registry.npmjs.org/ink/-/ink-2.5.0.tgz", "fileCount": 36, "unpackedSize": 118541, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdmSb2CRA9TVsSAnZWagAAyd0P/0MpIEywviVWoxfh/kEW\nUYu1tnFYBBtN2cIHgoGjJIn9Kp1YAS3qpkKQew1oQPfOxVcI/n2bhb6/oEop\n1Zg36SFwuZDm2mxN/O2DGMoAJ/IDuyplEdP8IySEM3TQNg3mn9Evj862+kVy\nzh4+Mvue9/ut73E5menyZdahNp5xv8oB67Sxcm/Bxzw9uwY8dXDt+caY4jXg\nItSyDgThqMPryS85ox2nMWkabot8KxZEXyRtMiDe+hdz26IGk5d+RFPV0kM0\nbcKflEcS9tA07OiiRFm/TEQLD1ZPQG3lw+iHRumgKIeGwMWYw6vF6qJIC3oB\n5yI7tkiMw4IJRQHcmwvHr4HtpfdDGZHITN+T996n1hC+DKYAw6IQqWAEenws\n/xl+2wmUI0dcKorHUFSwe7GzlzMd/XBEmEse5a8t4P9jIKbMWbg3+EWX/wRe\neDTwTTTy4KxGDEGdbGCLsEgtw8Np3Kz4qQXg1Qi0l2Jaq4/GD3iS8I3sEAA0\nrTMIkKV0vJV6dAUHmkruzz8tMMH2utvhvrTiAzaAa0iphfpNzd75t38jysbQ\n/yzd8JIwtZy54NcjnPDbaphVjygqjk1NgtD1eM2kq1HIlZGZtUeRRWfakt9p\nwaZBMLBRLzLzabNLVPJQGmWgcsRcVJJDbWBZS26W71k+Y1+ME8wLJwkmPKdc\nGo4U\r\n=jkxs\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.5.0_1570318070104_0.6719635987940984" }, "_hasShrinkwrap": false }, "2.6.0": { "name": "ink", "version": "2.6.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true EXPERIMENTAL=true ava && FORCE_COLOR=true ava && tsd", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "arrify": "^2.0.1", "auto-bind": "^3.0.0", "chalk": "^3.0.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "string-length": "^3.1.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/preset-react": "^7.0.0", "@types/react": "^16.8.6", "ava": "^2.4.0", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.20.0", "eslint-plugin-react": "^7.11.1", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "^3.0.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "react": "^16.9.0", "sinon": "^7.2.7", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "tsd": "^0.11.0", "xo": "^0.25.3" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } }, "files": [ "test/*.js" ], "helpers": [ "test/helpers/*.js" ] }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off" }, "overrides": [ { "files": [ "src/components/*.js", "src/hooks/*.js" ], "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warn" } } ] }, "gitHead": "f32d726a056762ecc0cfa715bd3372b941ff94b1", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.6.0", "_nodeVersion": "12.13.1", "_npmVersion": "6.12.1", "dist": { "integrity": "sha512-nD/wlSuB6WnFsFB0nUcOJdy28YvvDer3eo+gezjvZqojGA4Rx5sQpacvN//Aai83DRgwrRTyKBl5aciOcfP3zQ==", "shasum": "04acefbed32f6ef9ed20512c51ec8b8e09a890c5", "tarball": "https://registry.npmjs.org/ink/-/ink-2.6.0.tgz", "fileCount": 36, "unpackedSize": 119100, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3z4hCRA9TVsSAnZWagAAyoYP/2PM9mE5mwJo68mgwpAP\nOyfQLfXRGfsOgr8BnjPGJycqAF+KdCU5Bz3CiH3vCTijhK1SGcRQIvrE8TuF\nzH3qK7njBR3HujylGZO/Gr9FP8FudOdPUJtd7x1f0yPsc3JqIuW5TTgHFiJP\nkQeAApZK+DKD+ZQ+3xm4YEkHM4Q0gef3syPVWiiQlF1KhtEuPhimLlgLSnmp\nMLdeA0ezV4mvOoUbbOCgASGdLuXybDfJ5BWxr7laLoKLkJLGwoDdCS0Urg/T\n6/kYChmvPYIpaEW5zG9V0gxHsFrkgHzaWw8KEMtYLezc4EtY7A2pZyNtCko4\njjbUQ/QKXKPZcSClg1UOyJMuUpUaoqDjYoeRsbqmeMLPmta7by6S981IVpvk\nvkMSilcpdI9K4jikOHgBqnVDAfS9gH5zBMXGzTONEGdLE3ABDsiW7mbkTd1Z\nCWY8fjG+xc+WmpHp5JR06LMfbxPT3o9Q6yWLqMmk5lpHab42YVE2s/mR6W3P\nAGC0+d5Oj+C/AXVqoUks6pdyikB8i1+N13qOGxh/HG+RFW0zmy41BlpKVvTd\nEai1e3/pJ4HTUnOdzxX0O3d3THYM7hTpz67vV6NBB+F9j1vTsebbnaE27t6I\nDlhMROMuAtvK3P92zkb1QfdpNhZD8hegexCkIhNoHu58NBoSxLuAYbICbeW6\nbdr4\r\n=A5mA\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.6.0_1574911521211_0.6725280480007476" }, "_hasShrinkwrap": false }, "2.7.0": { "name": "ink", "version": "2.7.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true EXPERIMENTAL=true ava && FORCE_COLOR=true ava && tsd", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "arrify": "^2.0.1", "auto-bind": "^4.0.0", "chalk": "^3.0.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "string-length": "^3.1.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.8.3", "@babel/core": "^7.8.3", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-object-rest-spread": "^7.8.3", "@babel/preset-react": "^7.8.3", "@types/react": "^16.9.19", "ava": "^2.4.0", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "^3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "tsd": "^0.11.0", "xo": "^0.25.3" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } }, "files": [ "test/*.js" ], "helpers": [ "test/helpers/*.js" ] }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/components/*.js", "src/hooks/*.js" ], "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warn" } } ] }, "gitHead": "fa1b46bb21c7b684d302b11da98a8a5ba93746fc", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.7.0", "_nodeVersion": "10.18.1", "_npmVersion": "6.13.4", "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "dist": { "integrity": "sha512-O89Ie8Bp5N4kC2OGOAPb0EOo1IE42hBiFFV+Ir3e9iEc6tB6aGQYWNHBLdxJvyP2Q7cQQ74/aJ3QwsPpQrKLyQ==", "shasum": "ea29aad91e60cf8cb7c9b85fc78d5d098a0856d3", "tarball": "https://registry.npmjs.org/ink/-/ink-2.7.0.tgz", "fileCount": 37, "unpackedSize": 120577, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeN8alCRA9TVsSAnZWagAAzeIP/jw2ynM247rGovU3/+kn\nbZPsGAJRUzSRMxAuuSIOx+5I/RebfyXZmlTvYGTlNfnfc6GDBXV9cQEH/Wdi\ns72ixyhTMCHPaA5aI8EUnDP+kp+P6oy5gff/sapkKevKHdGXf1yB+ZMMzZJV\nI3DfJbsvCGqj0iY7uRTpG+QbmB08EP8TXn/0nuShM5WgRkE/UOiTZLi+yZO0\nFtioWyAqNnhqlRO/OCuFBc7nXtNizJ1VDPVPgg20Om5qjWdOOYBXxHOHH+UK\nsXzRqsdLUia7ZcMVls34OGGBbwJXSF2TlbYUwZSE9VfHUKeEibSHKUA/VifJ\nVmDuUtLyXKTQ0G+vchYZvS2AYJJ3sCNEsV90dzTPzU5mRVvMGiNm9gwkL7gx\n6pVGhvkzCidXpaCTrhKF2yfifpsej56rOteQ70W8hV1S0BJqiyYYMjoT1cwG\naOBiAvaMQe/GQ0oqJSNqnAvCcqAGIZSICpOLi1BWpu+tXgJDxuL6hgeBHdVf\nw+HIGsEZVbE8qKenKApqLi+64X0t7RO49rFoI7a5aq6avsICw1rRoc6poPAS\nGSmD0hkN2X98FLP4JxPEd/LzJV9hYHEvrgMAx9ShYwizUhLAT+J/XJ2WjUOr\n2HAc4696ilUNCjCLM8Lwheo/scXYimA40rY//ozpgEDBojfTX6nJIjD8TnfD\nPRY7\r\n=7lF4\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.7.0_1580713636623_0.7232840728392083" }, "_hasShrinkwrap": false }, "2.7.1": { "name": "ink", "version": "2.7.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "github.com/vadimdemedes" }, "main": "build", "engines": { "node": ">=8" }, "scripts": { "build": "babel src --out-dir=build", "prepare": "npm run build", "test": "xo && FORCE_COLOR=true EXPERIMENTAL=true ava && FORCE_COLOR=true ava && tsd", "pretest": "npm run build", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "types": "index.d.ts", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "arrify": "^2.0.1", "auto-bind": "^4.0.0", "chalk": "^3.0.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "log-update": "^3.0.0", "prop-types": "^15.6.2", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "string-length": "^3.1.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "yoga-layout-prebuilt": "^1.9.3" }, "devDependencies": { "@babel/cli": "^7.8.3", "@babel/core": "^7.8.3", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-object-rest-spread": "^7.8.3", "@babel/preset-react": "^7.8.3", "@types/react": "^16.9.19", "ava": "^2.4.0", "babel-eslint": "^10.0.1", "delay": "^4.1.0", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "^3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "tsd": "^0.11.0", "xo": "^0.25.3" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "babel": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] }, "ava": { "babel": { "testOptions": { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-modules-commonjs" ], "presets": [ "@babel/preset-react" ] } }, "files": [ "test/*.js" ], "helpers": [ "test/helpers/*.js" ] }, "xo": { "parser": "babel-eslint", "extends": [ "xo-react" ], "plugins": [ "react" ], "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/components/*.js", "src/hooks/*.js" ], "rules": { "unicorn/filename-case": "off", "react/require-default-props": "warn" } } ] }, "gitHead": "fc1f0c2320e66598c7c5cf72e172070722aab4ef", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@2.7.1", "_nodeVersion": "12.13.1", "_npmVersion": "6.12.1", "dist": { "integrity": "sha512-s7lJuQDJEdjqtaIWhp3KYHl6WV3J04U9zoQ6wVc+Xoa06XM27SXUY57qC5DO46xkF0CfgXMKkKNcgvSu/SAEpA==", "shasum": "ff1c75b4b022924e2993af62297fa0e48e85618b", "tarball": "https://registry.npmjs.org/ink/-/ink-2.7.1.tgz", "fileCount": 36, "unpackedSize": 119780, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSTbsCRA9TVsSAnZWagAAggAP/jfYS+2wmN0X3/kluVuX\neg01lFSbOC82zgUc9NvG06bqlcoybQ3FRtC30HBnJlt1Ha1FzbK7HvAKMHGe\nWtTZ1ph79ZVKnYWlESNLfTGnPbNEEY3AncCqrES3HA2c7Wss/kd4XlOy920b\no1jeS/0Bj3aS1OPFsWI5sUEzKdKWCZ1eRCsAq0A3pEsy+2frovYin77DPUSZ\nywVzOIre/N+NoXAPoFipjvd7ultwBkNIwCP7iDJcdAnv51PDlysjhXnQXpTP\nX4tEs4P/VMDmOIWsrz0loX1BVToOwxVQsV9TNJqMw8esSfYcdtA/qCMNYkrX\nIkvYofPuuwZANBjjR8OheLPQa4xN71RSZYUbIygNfdjpkCQRV0em8RLCMjmh\nzB0koLX7qCsaHN1/ttlK3Fw+rjQH51qnofUAty8EJ8+omXQA1L9vUjvbRmuL\nsWNLlOsTO9okHPk1StCrLhjMr8lcsoN/mTHVUcD1ppWzQuyYqDsiMA+V4axV\ndTF6nd99RjRJ5DuWLTEnEi7DhBfyrvQutj/1ITkbMsRFsBtx0V6tiXOggkC8\nX8Yoelp2k8AJfPRp0DWoz9Bvy3bx0YeuoTlwmLY2k7hWPdeNFp/xqMzjQxFF\nbAqCtAfKqoGNKB0Qu0/Ykx112UhInZNoPOvSZupy5C6D2zQZ+QMmLrXuQWeD\n3GKO\r\n=TxQS\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_2.7.1_1581856491379_0.8184104193600414" }, "_hasShrinkwrap": false }, "3.0.0-0": { "name": "ink", "version": "3.0.0-0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^3.0.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": { "useTabs": true, "singleQuote": true, "quoteProps": "as-needed", "trailingComma": "none", "bracketSpacing": false, "arrowParens": "avoid" }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Styled box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspenes.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "0efbf248d98e680c266d96b624c56490ae280936", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-0", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-XWOEoBmw34wPnheXuwcKj7MHkT1/ZwcfU8hBUu04m9fujasbUx64H+2CrI0Azi4MgjXyw37QbxbZKrZqJuCg0g==", "shasum": "b57d18e6067518176b678c75e7404fdc5ba47cce", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-0.tgz", "fileCount": 147, "unpackedSize": 276858, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7jv1CRA9TVsSAnZWagAAjdEQAItxXmaFyCJFmT8ZQ6Bh\nYJfkIG40nBfaHtURqnHpibVXB6TKmE4UlHWi4F6Gl3mX8NJvCmGYjo7nnL6D\n5rn5YyHSF7v+uLmYecjIisvhOb10CWIz1yhnETmTEypy2gQAewe1k/IwEu3b\nOZSfn6DD8LuBW1fWk1Vyl4RILchYpY/vs7lckAxaQdoCSvs/MGNFx9dq/bUi\naaDoizYd6lqyOXrzM3xIZO1iPk1oxxVvKGREv0VuWXjBrgQ11byQ4LPWycXS\nKpQBncKCliv9UTuhY3iKQrqwxE9nMmLnQv8XsXUWGP0/bDTUlcWt/mqrzWp2\nmt4MnoQl5Iz6V9VK9qxAD0m1SBCDyz20NUOj6RKjJ7omP+uxPzqN7di6wqGN\nakRp85q2zpeJlw+R+qb+wBYecfmh2l0Nwv+waMYgIcUuJj/TiIjRKDY6KQym\nkAyHbOLAX95KAa241UUGbptOe3VcPcf4wcX1RPt3nE6pmCbVB+K/pqNqJ7oR\ng/kgKIxg4W8k1MJ7NRubhgwbh3qySCYtkjqwQywwk8mhfLdsnIbD/1zrWD5V\nYG2ZFZRmFOefbUTmpw1eEGjiyr4/MqcuQDgWBHf50maHB4QK2hmlKvaaS/ax\nFH1VXDdrMNe3Y1on1aj8ErPoCxhjSoanBJMP7uzj15R7bIiH3oMF+UbOS6xU\nydZ0\r\n=nQO6\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-0_1592671221491_0.8961136678730648" }, "_hasShrinkwrap": false }, "3.0.0-1": { "name": "ink", "version": "3.0.0-1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^3.0.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": { "useTabs": true, "singleQuote": true, "quoteProps": "as-needed", "trailingComma": "none", "bracketSpacing": false, "arrowParens": "avoid" }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Styled box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspenes.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "91230cc118415722ec555edee23ea524f969d909", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-1", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-+2hTm1tBlCsmP/caJlsoZcpZGxKqh7BkVcemExJTNXLno6bXvr3lhucWt8x9TSe0F5GM4u0lvtCpRyOI3Ntu/Q==", "shasum": "ac28d55f7ba1856e2293d4c8f0cc69cda784eb52", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-1.tgz", "fileCount": 147, "unpackedSize": 276894, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7zBCCRA9TVsSAnZWagAAa1wP/39FfIz2+HqY7J33EFKf\n2GfT1vU/oV2Xq4D+OF3Qc2Lmi9s7ZPUIqK242s/zqEYefbeu4nB7V1o9UdKZ\nSOjMOP7jZaWTWp0fLe5Az2PavaFTWpXA+x5roelyZYI7pF7muP3dHceSk8tG\nlSlg3LJmjF2axJwS1R40I/h6gfMNJjLpe9UmTrO6xOJKoZV2AfjKnXUO4zHW\ndliYy9tlZA/wVxf7FWdWVo38xr+8moc9ic6PFAXSC4Abw1UozVP3IL9AUU5M\nHWCcAsfF2UDBsDJDURnBCQNv6kPJAtsqHEQBX4P7gEzJPY0yqCopOdtwR6Fy\njX4LpKMrYL9wbOMR3ELQ81JKvBthJbsjCMYvAdRytC2i+X55t7VAsKInMW0S\n+zzvuQAqgfLku1wgCtM1S7x8pH+uNx/Zgk/06d8mD5zuMOlfRZ/xX2CoNZBD\nuHIJGHN7V/psiW40qXd68j0efFyIGP2WatdaTG/U7NAUmIAXg2a+eQrDKaem\nmV/Nm4AgaRLVthT6D6eNIM0n5DAaBiUYy0+VhgnlnmeEq4R5iX9p0RCRu8Pd\nbHzfysFXctp28VWWE7L1LK+l3Hs2o1i32xyV+rmXgV2CH33oENH1sizhGl+J\naan2xH7W/+TnMrXNEA1/kqoNu9IFtRoCUFR/8/f7zA9D0/TLXzno8ZW6FXBV\n+xuP\r\n=TATq\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-1_1592733761731_0.046101636220368336" }, "_hasShrinkwrap": false }, "3.0.0-2": { "name": "ink", "version": "3.0.0-2", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^3.0.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": { "useTabs": true, "singleQuote": true, "quoteProps": "as-needed", "trailingComma": "none", "bracketSpacing": false, "arrowParens": "avoid" }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Styled box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspenes.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "ec9e449a5ffd4bef4753409702ab0a7b65cc0b57", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-2", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-Yjdu1FpLKd44dyVltg38a26HL35fRFyuSxCt9Db3BxRgJ0J1hNn0Nk6CqcUDc+ZNJZOUdKVESSYKVZxt8QS7dA==", "shasum": "e6e5cc5da95b2997db73ee13c692acf1648ce42b", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-2.tgz", "fileCount": 147, "unpackedSize": 277844, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8iAPCRA9TVsSAnZWagAA73sP+gJ5KmlSM1koK2fQNRuX\nlpwddU0k0jNXbKuWYb0bGXEjlWMcGAtMNFT1G0gwyoR9A6nxbEVVLpSdQL/C\n2RF/q5L0nW9HDuPopooNoU14rirV2Iwnz/zG8b2EIIq9i6eTHrNzR6OCUvqc\nqqQbe+8lUpL+t5bStmbfVViIJpjwqK6yODLRRiuBA8AI2Fu0q5zGdsFN7QMs\nvDyL4hwE60b+VJZC1ad4WHEFywJLhEhdX1icf/dw061O6UZItyOZosAg45jN\nw6TV4OsLYShcmkn7B5vhgJZjCCtJ9VbFs8S+Zoi6ba3Uwn1WGRJeDbbPMP6I\no+bqdFoS+9TupBib9IBKpkuu+knoxENBlUhlJrJA9Suv+oSPALitO9JAU3lt\na6SCTdhb4JRCIqyEm6B95GlwaO3SVNeeAnkyY+ghCcclRFmADsjDXcGWz+4C\nn7JF8gD/Dr/BBnsXu6+HIE+SYXYRMlvoWi9ZXlij1rYP00s7EDXay6oOE4NF\nGsSFilLquA/aNnnBl2+rG7GvypmMFHssQ33xk5w91KTYEQbZIZUdH4Hhv/Y+\nXGNY81rk8mlZS7doppfKuIIH17DALZpWvGRS0opErsarQpbUDkPOlyLdGuWf\nBgNtz+uEBggMIh2JmLpiffhxAzJ9w2GYIjs3FHgtP0rcPoXcIy7poHYupcXP\nEpdQ\r\n=gjCN\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-2_1592926222686_0.18790154893499134" }, "_hasShrinkwrap": false }, "3.0.0-3": { "name": "ink", "version": "3.0.0-3", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^3.0.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": { "useTabs": true, "singleQuote": true, "quoteProps": "as-needed", "trailingComma": "none", "bracketSpacing": false, "arrowParens": "avoid" }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Styled box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspenes.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "ee2c24249988da43866cc1452601670d0cb8d154", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-3", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-CfoHpbwvc8RyFTtQ2VGaMdr4XIWVATPq3asypcmwETUPtpB3jo3FbJACw3snuLxlwzYAR8XXiAyqudqesz9DHA==", "shasum": "46924de69c83c632b8f1d8ce0ecfff0dacd59d9d", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-3.tgz", "fileCount": 147, "unpackedSize": 278101, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8iU1CRA9TVsSAnZWagAA0TAP/jzkRw4bODYhmf75db5A\nonNMYnFPnoLBfId5iJuVRS1s8vkJdVMylmbxLRalIkNU4gH1Rs36VIAU7Zyq\nw2mxe3328iSc5cWdu0d8R450FI5mP2jmiEhwfEshR9bC6CbAHAMhabZ9anIz\nI7OkM0ANBybsI3TbaI7ZdI2kc55z+SHotSw9ydrqpa0P6Iv1qyVcSrqtZHgf\nNFtrNGRdLyhU7DCOS0vx2eEunYbaNSr9JEH83YBGuTZcdiRYUV4dQY0BCCBs\nVK1NbSsePCnhrFRKwY3df7UJiF6ky01lBM7hRUridD1TVsJYDN+l7YUMxKTh\nt6/hdGKF9XXAlwWGX7tyvWC+AzqN9I0g1Lc4hfaC9W8tD2QYS31sKx0JAChm\nFjBMHjjwUSowFjZ/f5zyfQFBeIs5b85hSron5tXLMR2qB18m8+t5tqLFzwJb\nbxh9lafVUGLW1iLxkrB7Gwm9VdvTU/SV7/RMeiZ5fWNhFA1bv+n/dzkj32j9\nTX+s7bTi1c1SqZu+RgO1MPXoE+/EYchnrOxlNJjA472+9HGOvodiFULdBjC9\nUQ8CkR9/cddaOtjCwRG1ruCK20GHVe4D+FBE5gaWPbDmJkXXpBsNAuGft6Vc\n8o8TJbQa6V3KKDFyRVMBvdK9bB29Nlcb/J7pFFkItYLiu7qICh/kj+7oEudP\n3JN/\r\n=Ra6i\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-3_1592927540850_0.13459965169628552" }, "_hasShrinkwrap": false }, "3.0.0-4": { "name": "ink", "version": "3.0.0-4", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": { "useTabs": true, "singleQuote": true, "quoteProps": "as-needed", "trailingComma": "none", "bracketSpacing": false, "arrowParens": "avoid" }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-box](https://github.com/sindresorhus/ink-box) - Styled box component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspenes.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "7c666931a8200c4948fc3f0875516f3b07da9843", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-4", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-a7C9HP4vZzAz6EgBHrPbKyHE25sZKJF5d3gHPT8oEq3WC5mcIjV5E3fAlwH1zHiBDWjucWXzzmM3c4ylF0KE8A==", "shasum": "fbb7b2ef534e1fbbfe5985f04fd303fe62a7ec33", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-4.tgz", "fileCount": 147, "unpackedSize": 278455, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8kRqCRA9TVsSAnZWagAA43wQAIC1bPCvqevbUq8zaW3X\nnBoTmqL5j2K65PJasjQWyLAQPmhuYs/vIgdeaH0/ubK1S2GqbfqLs7etm30L\n0PwLM6aOBbmAen8r1rbtxey+F2pLYsUnz2dWIc1xnmz+vPt/5LP17QRpuYei\nqKqDgDEhAv2PqeiRLc9oo99OVD0YWxMFgqa7xCePHgRF98nXWXeP43/d1bIr\nk0omSYKhcjdzTBKS/Oqcmz8bUQ9ExMblmt5cOUrADMS5aYIsf9EQYtPO1GnR\nh0gm8PE6TX/yaTeEbLAjUeJtrnQSi7nAXZJ9dqK8IfRlimC+92RoN0hz9KpH\nEVygcX8p0xZdR7GrRb+fZkqN4cbqjjmySnvoeM7qUt1I0P25IkzGGIYuXXYw\nwmaMXSRM3QTJtmvg+u9oECYWaYnbCCSw8FTNzrtX9s1SYG99Gh5wdN2VJBGL\naVUUHqMCy3QAKQagmq7W2T2DGCMEbDLafDF9pi2TItkMZXquwGD+LPTJ2Xfn\ngQVkO82cwuEY4W88GJWgfKZriVWXiirc1UVpLLiZx8ON5aGw4+0UL51MIo6D\nB+2qXAiK8wXsfRQ1//PDH7A/SHuZUlIv3c8It+MvJjG0HqRjEOAi7GUus3Wz\nxyn0i+pclqMtqOMm0ljaNwmOrUozjHmZ4QNYPmLBne8rUzWaDtMIBrJFSrQs\nhO+O\r\n=mwZv\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-4_1592935530153_0.1614628734096355" }, "_hasShrinkwrap": false }, "3.0.0-5": { "name": "ink", "version": "3.0.0-5", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n![Build Status](https://github.com/vadimdemedes/ink/workflows/tests/badge.svg)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, go to https://github.com/vadimdemedes/ink/tree/v2.7.1.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspense.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "6eaca9fae6570bc53e9663db4bd821c8f769422c", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-5", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-cDoN2AeMCSAohuMip3E/azVqgHbjnVD+eWlfo7tH5/ZW4rrVEBnSytUH8mGWyztMO731ru70TJqysYOQiSimpw==", "shasum": "8f7bef4797a6a32e937d6e6a7c4f6c7e8ec5fec6", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-5.tgz", "fileCount": 147, "unpackedSize": 279423, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfAYhkCRA9TVsSAnZWagAAGDQP/2HyUwyJWzuptx04rNLs\nmcWlFAcFpMalIpZ09bkjhggYfIkiiXgQ93DjIQvnQOkH5t+uzlNyFAH/qX+O\n1ForXhDWMMV5oXBkK8RArclCUAHKaj96u/OhI9bGQvco6JtP9nLlB4ZkCu9q\nBigPZMgEcBC28sIy7wLNYWmH2wo9DO3qDLMQ7obPcjfj3qHMLkcRA/dSR4ox\n2SJdH26SwMmuVc+qEjEj5FDH50/ZhGnKDLEqGOomMJLj6eEFGQ2PQZKOX6Xp\nsVO2S7DUjsW4h7um0o4h+jUh70VdfDQD4kxuOTivDN0+3tbmZVGfW5pfNdAw\nHbNgsLkYxG6Gl+usFB45Ez5FaJHvnEBTwZHs6OdnBn+C6MdVjdA+mVbVRdWt\nlqy+BIsuzpMovOi14BoBbQcmhgKgigSxyAW/wP1V9mN0ZkVIF/9d/IQjc5/1\nImWOSvRLL8TTDV4WCtJVQNkP2LbpYvrAWGtizNqe8niHOIKTy3Nf3qeGyK3C\ntNgimUD1gcrPWVvpcjvQjRHiAu6N+dxAsb2Fupl4qGuh+W5D4fYNlHMBVsqb\nFNAnrLALM4aK/ncZueNHKQoYlCxuKg0OEjdy6Dal4GHHFcVO2g3gerqqTD/9\nNRknMlqe8GWMmkASK7R31qCvvv7bAl8YyRzwMTPSxZMnkkhn/lyw2t2LT/iU\nuygy\r\n=b6sh\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-5_1593935971878_0.3136900200366104" }, "_hasShrinkwrap": false }, "3.0.0-6": { "name": "ink", "version": "3.0.0-6", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "^13.9.1", "@types/react": "^16.9.19", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^7.5.2", "@types/slice-ansi": "^2.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://github.com/vadimdemedes/ink/workflows/test/badge.svg)](https://github.com/vadimdemedes/ink/actions)\n[![npm](https://img.shields.io/npm/dm/ink?logo=npm)](https://npmjs.com/package/ink)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, check out [this release](https://github.com/vadimdemedes/ink/tree/v2.7.1). There's also a [migration guide](migrate.md) from Ink 2 available.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Yarn 2](https://yarnpkg.com) - Fast, reliable, and secure dependency management for JavaScript.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [Blitz](https://blitzjs.com) - The Fullstack React Framework.\n- [New York Times](https://github.com/nytimes/kyt) - NYT uses Ink `kyt` - a toolkit that encapsulates and manages the configuration for web apps.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [loki](https://github.com/oblador/loki) - Visual Regression Testing for Storybook.\n- [Bit](https://github.com/teambit/bit) - Build, distribute and collaborate on components.\n- [Remirror](https://github.com/remirror/remirror) - Your friendly, world-class editor toolkit.\n- [Prime CSS](https://github.com/birkir/prime) - Open Source GraphQL CMS.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/border.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspense.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "b8c26099dec8de13b05468f6ddbd970f1740a7f1", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-6", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-DhLTErRxGlsV1dVmooFu5DGHSA2b52QwssrWB76CPGm7jV3PGTNzxDhMW/NatkE70JQJ38kRhKW8PePenPqsig==", "shasum": "881fa3331bb6b7b9a39b97cc737614ae24925fa9", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-6.tgz", "fileCount": 147, "unpackedSize": 281147, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfBMADCRA9TVsSAnZWagAAvBYP/3j2P53mv5aMp/pwGpGd\nVHrDHJxfKxklHErxkhz65WDH2ItE66QwlMlSZZy9KTCAGTPIPY+e5QSQOAh7\nDxU0ptxEfuXNU8wBzKZNja1Ye/2cXC+9JOmz2N1TzjzomuO4OkmXlf4W/5do\nDZuqZv8FcqtR2f8fM3CSeELviAs8kN2wCS4ffuJHahI6tVInobUW7VBlFZA5\nFDtGsY2OEpOM7pOK2H3jRnW/vQPMjuUnNfi5AiU0LzmnlJwronu4EuqHnZ91\nuLDVWXn8mwFj/nPAoQGyoBIGkVDMTjOj0L9BYWHpdqrXsyl4AZjRmYvHi6hz\nvbiaJRqGP5Phvg+dCcpT39IZK5ug086vBXl6YVatxFX5oWjtpaJ8UQf+3niI\nYDBjUQboXUjvohH8Hn7H0Qaq9LHuqN9Y5dsbrAyhWdfyeKFdhbGvgFIRmuEW\nsasVkXbyybjUoGx/YFxcivKAT60JXRy1Nobuh3J9zJP46Huz/d/frzDaWPKt\nEO/PAXrwQOxXhbmEjVl/dkkARyG1MfKAtte2/4pMbaoEzdtgU1xDrAQg6lZb\n0eyIWI7iAl1kzjUDtsI86BixEMkrdnpvydNrrP3GXV5g0b2ALGNMXdp5yHst\nHfipydLebT7u89yARebI4NK2pJpVkitDe8FEHDbV8NzFMhUX1qzdfstZbylV\ndSZy\r\n=pxq5\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-6_1594146819226_0.9056060749006689" }, "_hasShrinkwrap": false }, "3.0.0-7": { "name": "ink", "version": "3.0.0-7", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://github.com/vadimdemedes/ink/workflows/test/badge.svg)](https://github.com/vadimdemedes/ink/actions)\n[![npm](https://img.shields.io/npm/dm/ink?logo=npm)](https://npmjs.com/package/ink)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, check out [this release](https://github.com/vadimdemedes/ink/tree/v2.7.1). There's also a [migration guide](migrate.md) from Ink 2 available.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Yarn 2](https://yarnpkg.com) - Fast, reliable, and secure dependency management for JavaScript.\n- [Terraform CDK](https://github.com/hashicorp/terraform-cdk) - CDK (Cloud Development Kit) for HashiCorp Terraform.\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [Blitz](https://blitzjs.com) - The Fullstack React Framework.\n- [New York Times](https://github.com/nytimes/kyt) - NYT uses Ink `kyt` - a toolkit that encapsulates and manages the configuration for web apps.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [loki](https://github.com/oblador/loki) - Visual Regression Testing for Storybook.\n- [Bit](https://github.com/teambit/bit) - Build, distribute and collaborate on components.\n- [Remirror](https://github.com/remirror/remirror) - Your friendly, world-class editor toolkit.\n- [Prime CSS](https://github.com/birkir/prime) - Open Source GraphQL CMS.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [sindresorhus](https://github.com/sindresorhus/sindresorhus) - The Sindre Sorhus CLI.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [gomoku-terminal](https://github.com/acrazing/gomoku-terminal) - Play online Gomoku in the terminal.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\n);\n\nrender();\n```\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/borders.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspense.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "readmeFilename": "readme.md", "gitHead": "a773ed596ef54c0e7a942669fee0cb625d7170f6", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0-7", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-Faw3KSntkySygliO5auyn6F1QfuT4lxc77zssuTNcW4I7AL1w1UxZJrhAE6NwaRFLxdHG8eEcvRXjr7V/ZmHmg==", "shasum": "e64a7f8ca462f1d07bc371906871c3c2b24c141c", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0-7.tgz", "fileCount": 147, "unpackedSize": 282803, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGHd1CRA9TVsSAnZWagAA8GoP/RBu+6yvoocmA+UDzy7e\n30nKB8H2tshO7e7IkO643VSEjfHdB4TBDxqFdaJ+tCCtNAdU4lFYyzLMqwg/\n0cMgCakMR3lMwnwtzVYuISCA+YGL9x9RpSiSl8fSgiiBzpvj6GHD+KwcDix1\nSQ2/CeA7Tr5ChRWuMRzhR9P2r4kRYHrw0R0EKZT5465SYj7cSi6LrtwGRPPN\nCq4A0U9o98gw/p4NEy1qr/QoMLHE3q933tYV6lsy27syg+uqUTjBElaI47KE\nXd79kSsFA32gNKeUkiB9yDyF6bYAUr1FOYMqRaUA5V7xkAIHHhYwxC5vGlSc\np7nPX3n6gDLFgpiVAQX3yPqpyyBlsUBz2CKR3Z51w1Cn0U0fpR2Kf9HrSsl/\ns6iY5SVNlmixQOlHKJRmiMbbKM/j7+vrQsJvbL4bEIOlBU0CSP7nUw6kx71a\n2sHiyKHV2laZMZ/wv/I+nDn5cxEpkLk3qE2Ob2AOviqCMi4Qv7W3g9wVWUYK\nG1q762zlB8UF7fsrkrGHXOsDZ58yHFIJuqbZXfhIXLPvoAGZvuFwfRuTQ4iC\n+EwpMlHRdu44Ey1Hh7ra6GuaVoXJLl9cLUf5ny9nT6GIUl1Ggz3yCyr6FsDT\n2+BgxiJiSVqcmCcqZHI3U52QCxjoPT/WMdvhKbxR3+tucA/8ku3icXr+Lwa/\nAIm1\r\n=r9VK\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0-7_1595438964646_0.9004037923601722" }, "_hasShrinkwrap": false }, "3.0.0": { "name": "ink", "version": "3.0.0", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "db5e9bcb83bce980b6b68ee431084b288f90571f", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.0", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-x7V3QeANuPFa+regIY0IftaWTmc6uc7XiDkPIBx/QfHkhUbx26vNACZlglTmDFXj/w/9R9u1dSFb+K59AN+gmQ==", "shasum": "6a6785049c46f4e01259c45cbc1a9f32b6e4ab7b", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.0.tgz", "fileCount": 147, "unpackedSize": 282801, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfHxBtCRA9TVsSAnZWagAAgZUP/2GRe00lLBO75ispKqoQ\n9A6qupulWywS14ntiX2LomNK0bWEpPlAnIFMdMt8INFF0mS6JHQ1R8ZizgiP\ndpE+mfNubGPdrc/q+qVYjldtBLa1Rlo7L+kt16q09FNKhYXx+mDPntfDx7oN\nQaM5KnTUu9at6Fmq+xrr6OW+AncvG7a+ZKVsqPgWtEnxchJauEcMDQn1nFNX\nwD1PFJTQ1/X+6HFGRdQ5NDjexaHu1St8GOVhxy9I5zOu6olikgwRqYCpJI40\nAShRBQwQm7V9Pez0kxnaUN9Qp5axxR59jvtYZ6/7A0TiZCJTGGkWf2qry8q4\nZVp/8tvjooPMQIoZLzS/8YjG2juc9HaRtoyBnMurOW2qzNxkSO7NVjukH18z\nTft+wylo2uDUHOIpTQEaaCl7QhI/IYGKw70458FRTVc2Dr/h5YHexfJEqDGv\n8LTTG7Ug4M0j8nE0O1YdRqfwaBw/lfCqIj+sxqyLQ2HxGWEHlYINKxoBHLuB\n4VOoGG6e3RMGDCioSYDC94V6AEJ8xmSZl65OCufKjVJyuTbAQ/kIUA6rpul1\nElibj531eI+WlsmWu8f+sq81nOVeSJXrcZonHaAODbA3ABM+H5uEIq6i6wnj\n7GOU6pl+vY1MPMax7uVZHUAyVu9n95JTRdvcwXFuTtxCWXDp4+YSBZjAmWXH\niLbA\r\n=SwHc\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.0_1595871340657_0.012737559396742704" }, "_hasShrinkwrap": false }, "3.0.1": { "name": "ink", "version": "3.0.1", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "539a624a7f8089bf3df589a29a91d8fdced36732", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.1", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-s6yVxF7b8UOteI4mkFA5zIQID+az4Re6OZxu7uC9vYONFL1E4h6WmSJKUJNYFZaTBXqN2Xjj87yeFCPcBWbskA==", "shasum": "e23100a841fa840ecf9f25837275bed57ed2d90d", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.1.tgz", "fileCount": 147, "unpackedSize": 285079, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJHu+CRA9TVsSAnZWagAAyTMP/A+dOkxrMRbIyPR9UFr7\ntIvf72l3qQNxSz4A1ARl6J8h+cr9ByQj0Wf6C++bwKKAPcWSodm5EaPgNhzD\nFyt+/IkWQsdkReVP4U0OJUamjKPvQMEx5C3mKZhVCZTsUTUp9OnDguxodhWR\n9zWSoFsjwL3CI426PanYCfwyDYNmilbakBWWDDzDKGpnmqntY4R1uGkLzfQS\nakqNOTwvtXLq5af79FtG0YVT4aqqEJXV2GzrOg+ATu3E6wmKAoskTH5WXh2o\nIcG0BGe4F1Dt5Klq84088ywaOjGmiJI4u5IUIpLVbq04QN28f5SiaZmfo+uR\nk9JQ5QsrNSOcVvkD8vx2Nlh9t8SxJUR9V0O0hukTvHf0g6ISTY+15Wa+wGFr\neGZW3EfnaCD8J/6U/Fy3okarsTKKwm5cRWINmPrvNdnOw1HCP4O30jn/3ups\n2439zpdshWJov8u76Q2LonGn2xCY+yYmzJuTeAKKhUvP3rL9mvltxhxZ1O+I\n2Uulwmy0xxEjAov+A6b4o3vmFITwIJCIjwXKmJJX2ir9isc/x4bgP7NSgAoy\n7r4/Jp5I7pSHKdOycMQPiCkkMdqdlNrdAMcLSniOLE4u6PUDXFHezeXb4q8j\nNpXaqunek63+h1EeTq94yus1AccQBYz1g3zQ1ziw/lPJT55EjyVjOZlNCEWb\nzGS+\r\n=bsUM\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.1_1596226493708_0.5539683547235217" }, "_hasShrinkwrap": false }, "3.0.2": { "name": "ink", "version": "3.0.2", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "373db19bdbbbab0e7fedf11dc2285cbe6cd3bd45", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.2", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-Tjz5uZkKtXZNUC3oq8y6n3b9QZBsUhIi4aCsJCBDXa0ovyUEN7U5Hl7uRkJVDGRk0Jnr5mbgnnVDczJg1fxEcA==", "shasum": "92cf8b0e0e1dacba95d6baa577bb088dafc76a02", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.2.tgz", "fileCount": 147, "unpackedSize": 285115, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJx0yCRA9TVsSAnZWagAANpUQAJaE450ia7HRFG1XfiOQ\niFvwP1fVY60swMHBYghWgRTazN6D9dPMHLf/nRkdXYfJlFAhJtubeSxb7hNa\nWhUVgLL2YzoItmbx1u1PwJCTSstgXe6p55MtZHuchiSzPcInReVPFy5P2zSR\nqemZIsz3JfrBeeLQgUCHPJ4Xz/LdbcFGveFtQXGtHY/WXeaC8y/XArnzxeGC\nDGt0jf0QflO6hWmnbpUzZT5mc5dmyvhFRfivIpwhv6Z7/Q5Q3eJLpt1qNriV\n6eLGuhBO2AU8sW6nTz8J7tbT/FE7EeRw+Jov3RbMxRrOnWsRjTteUnftXhat\nyzyRNZK2n7RoZNp4BSAYUh+CgSFhz5PA8xWZ94gy8TQ/d5fgxjy+LZkaonut\nIj241riFDTonlWECu+4wVp7fvZ75GWyL38SZ11U2bbDvY7keGj3BiyxN0Ty5\nWxNE3rsgXMdj+Vy6ATjEU+vof/czWYrTTfm4K+rBj8Y3CC28uYXE2hODffBp\nQF84SsDJhSn2gNy/vhsPKo6BLE0WXEKYJgY8Vn0OsFBKA4oOqr3hSD/5dckd\nbR4nz86ACG/2vF65Qjc+pjuOyZ9kZQwl42GhTiB0kiFF3bGuv9v+R4R0DEp1\npQH4Hhfea9wWMSgOFWj9JlwNJuWw52pxlRQqSkb3onzj/4puFtUrmT0gQXR+\n+BOH\r\n=3WuD\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.2_1596398897721_0.05593252381070535" }, "_hasShrinkwrap": false }, "3.0.3": { "name": "ink", "version": "3.0.3", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "71edeefd0fd227dc5c5ba3837d8340c197bcd632", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.3", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-lddjjoxYMU6Ldy5fhwKwPJDuhm62F0TwvNnI3DDQ6czZxgW94kyTb4AUX3qSFU7cnoid4yg/uIktr00fI2VRvw==", "shasum": "8540a6c7874bcadaebe8017164c35c5a2150bbe2", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.3.tgz", "fileCount": 147, "unpackedSize": 286065, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJyZWCRA9TVsSAnZWagAAMOIP/Rp7NVfOxAqD+Onl8VAK\nRBMFqfxDMxEt5m24deTXkTNQoNh0RfogE77N7bsC0S3GQPznrOcDUVw0e+pZ\nMPYuV8VA5a61KkXV0zhYsS1Rr8CSZ0InNpUNAnPBBPu6+Nbh4MF9812i/ueT\n3GXyi+nYiTDjX3gzBSGew37RBNfo+GU8eXVGKacRDO6rhxk8o1+WHICUw4vP\nDQwtWYgvkgj1JMOSF8qQnP4SCLUdAdAcCYb86PGxUFDYD8mUX0gtjiKDLUey\nenGQE+kUV5Zmd/MfgsnoU0c/Q+dQeiMSu1Bd9JRaC2SfFu2YZaAOZyqUJwzn\nw7whh0wQYu7N73v8NXsuJxRQn7tQE5AsVi2n2V96hCJiQHkDkJm2VMCrVcMU\nZDUunCPPsWOp4GxVLpwaJJv0Qd11Jj8MGG62BTdpvSFAbw121RIDoJIBYS3N\niMRcb6RFirXx/9cw0od3TM6smUzfYdjpCTxz6pGb/2lnjsjhfjPJO0FBq+r0\nZYQCJCC3nvl7ACCJGt2JyIF0xBAfg1hg1YoU5sJIJjlHO7/20Kc+qUZb1Jh9\nJTH+TxVq4FDeDVg9nfa5/5MUlkZUikMih3EKTwEtuyOxPmTYQruE0IqPKZ1g\nnvv4Ub7OaZCpPR8fmktIdF43BLgGFmQZ6KpIZZbSusBbQE8A3Emf+XKFs8JU\nnN4I\r\n=0kTj\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.3_1596401238282_0.5588384385723271" }, "_hasShrinkwrap": false }, "3.0.4": { "name": "ink", "version": "3.0.4", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "5c9eae4c104bc5c246b5014821f09dd9f88fb364", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.4", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-WURr4mZoIZNaIqrgRHS1QKJsZdhs4UEeZ7IFvQgGCE7xCgtC+Svu7f7MoEuVz2hexCsmOdBKrkhMCRwFncSe1A==", "shasum": "e8f40f260c34d27431be6b7db9b963c0104058b0", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.4.tgz", "fileCount": 147, "unpackedSize": 286068, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPBawCRA9TVsSAnZWagAACIAP/05+uZgjDNIs8X9x/dHX\nQ8q9nEvhdB40D/zxh/1aOdrdN5pTTSCjM/NGseDD1ijqZ/qZs6HaPXCnZxkF\n0+9cyjOIBQnC2eDxYQA74JFSjOT3ctceFoghyVrF9mJZZZSswdt/d1/d1gee\n9uTyBkXndVBVax8GaXm5CxrMawIoHlbbH6wLnsqIkcVR3QF9QHPRe2hUJMwF\n5+RwFDv654RPk2VnSbxuVc+adOYKVZmx6rILq/6/JhDDab3RVukPKc13DoK1\nO3KzuOqLjNldCbPJNrDIzboiUgs4vvvAFf1J4g95DGYx3wvTaozBO0W6FVk9\nvphrcSUG8/z+vxgzCQxy7odMe51qF/vuBbXUKCki5BgsKc5PP5Tvcb9d5FCy\n18UESvgQfI13uBN745lYJCchXxFv6kuYjqaz6PjPv0zOCEG1ox6jjdnca9Pz\nIazTm8hcqrWmLk1/EpgR6IxRPtdbFn32rmb/NGbkC7EdWvmWM6JDpnDNh8B1\npaXXG5x80Y1BEX+gF9K+pV5I3bad4D6S609rvuNjD8YxNMYTw1Z7y3b1FFYS\n+GDkhuS7ryANHwgKebKkEqUqzcRjARXZuCBTZUEt3eXS/cJQef0oPXq2JsjP\nwXc+a432oKFcE4E3gCk5xKpKl4rSdLfyIdCzS87NRB+8IZGv9eV5S7t3RjkR\nJO55\r\n=TVFa\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.4_1597773487485_0.2673956148069654" }, "_hasShrinkwrap": false }, "3.0.5": { "name": "ink", "version": "3.0.5", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "e1a108008fbf33056206115a8953e7eef8203500", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.5", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-Zc/Yoi3P0cY0DC9ryb3HTwmi4Qgke9332ebOhDRaK9Cw6D+ABAOQPeHG8IdmI1GOkMKRMZwTP/1jRs/b1D1n9Q==", "shasum": "9397b21111a7c6c5f5e00cfeb7420f9c09ba044d", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.5.tgz", "fileCount": 147, "unpackedSize": 286148, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTpCUCRA9TVsSAnZWagAA+NYP/1goYSwa1t9/iqT1+iP/\naPz9MXLJX8Ikg4XrcAoDNzHxqY9+Ynx39y+ekNpWI9DIu7I6+NMENXwaYgHT\nVTW9ooprcetEvFAtdeyIuFi9ZKkzCd65BZV9yyTfYUeIwARZ6LxA/aO3nM/A\nAh4mlQndphNgmjMc8lsDda2pnBmphoouqHbstT83Xs5oWJ94VkaTxoqyl4ji\n8wbjS8OI1mB2hv7Ds9wY4abD2g8yYBdya9HQtSTIeosWaxVWZBCy/GvoJgHM\ncHCSusFATijrRKf4cF2YeAtrK74Tn/ckxwVXdhgDrD8i+kuruLpRcRatLOAy\nEoVN3LTv4cih6nSa7Ozd6fs8hIdd2PP5POzpJUKgiiUDtmNj/0TcVIRoagbh\n/Xh1hw/35phMobOfr2ehUjDL2AD3wyzraaEe0jdGJx8/X9y/vGK87hBm+3lb\n1bPh+5dfr6YpcvoG0SuhSX6hhDGsCBxkvWMXCavmzbzNm8hLH7fS3w0yEaK5\n3MD2TMKuOppLpSAW2KVnVdmiLsfgGVVn1QscXoCeLE5+XWTaevIdP5x5dGag\nrB0YJObtMSO/8t0IGC1ihacF+p/qQfj2q2Ntf69Z8Hbb3rcZInkD0y+16BbW\ndiDrtKGKLMhlTDFnDA53REpmrB0D+80gAInzQ+YFrwD5IeXoC4DJJf6slGPU\nzD++\r\n=25IV\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, { "email": "vdemedes@gmail.com", "name": "vdemedes" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.5_1598984339736_0.02189971626081122" }, "_hasShrinkwrap": false }, "3.0.6": { "name": "ink", "version": "3.0.6", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash.throttle": "^4.1.1", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash.throttle": "^4.1.6", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "c23f01902943ca941efe4044fd449285b09d5da0", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.6", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-MOaRUKlDdyzBr6IhiBpBA5+9tv+OlVvQrEErQlN2dfofJ0Q52Xc3gZ5YtgGj0UVD24Ex79WL2QZGJh0emz+jDQ==", "shasum": "d40d7a3b84b4521c1a05944a936c284170299ffc", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.6.tgz", "fileCount": 147, "unpackedSize": 286182, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZd8FCRA9TVsSAnZWagAATM0QAJsrl+FhMFFNSxoghf+R\nVjDZvTqxFGgXqADJLcxpQTEcNHKMym/pdnlbE2npL4a3vKEmWMZ1MorZ2lfE\nZ6mYJm0HrIJVi9zctBgMatAJJftBA48O9H5URvBCWEw5CtxlNOLeIh4XdjbO\nd2B0Er8zGIZnInnv2YYUj7Bi9Pj/l0wy4GufNy8V8Wixbs3lz/0sp4jn/tJz\n+E0B/KjLZMhEg5R4tfA4N2BputFn4fMfv2BmDRCytquDbgxwgNrsjJYep9cK\neiCsU4zjvbnC06gt1RVdK2yDwJUQxz5PZISA6wtfhVUPP5II71Sy+dmt5sBK\nRKhf5P7EBC+y09FRit+Ajduf71dE4aX7JlORFU+Z7v91YkO8BdnlcCPhtyNb\ndC1ydpnqcX9S4md1ieZ78PbsH3GSol/cmqnYVZqd7S11NYUczWTHHCaQuCq6\nf8BDFbZKQLTxvV9KrUCUH9l1EYBcYZYcqTihP7+EP6dlo/nkarAPKqkDfeP7\npYo1x6025/VB83v76d8AvDa6gYO7VADRYbyO1JicldJJ95pPfaR5jWyQJKNg\n+fuiJHayuoMD3dMKKer/BDApqymSzdqTNBLSoFoRALsvWrp+R2FvDtTvk+pV\nopcsgbNZHtSk/uMjq2ebcXdw0iL/V3AcOu6+P65o2LY15ZCkajgk6tZtPiir\nBBpB\r\n=um5M\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "name": "vdemedes", "email": "vdemedes@gmail.com" }, { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.6_1600511749015_0.04327981971767891" }, "_hasShrinkwrap": false }, "3.0.7": { "name": "ink", "version": "3.0.7", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash": "^4.17.20", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash": "^4.14.161", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "8ecab354134e4dbbfa7c6395312a4fe89e67ee40", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.7", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-DF/Ena9E8af4+dYu4rrk60WwWB54CPL4s4OspDnBk0uZqntmNZLfc4PftreHeW3sUeQJK+2MdQvPLORro7mDQQ==", "shasum": "acf8f3da628f3fff6d0e48642a57d82a6720bb5d", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.7.tgz", "fileCount": 147, "unpackedSize": 286203, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfdY2WCRA9TVsSAnZWagAApqsP/ihlato5YWQgbWErOeQf\nFKX/mbd8DwAfYVrYdP1BpzCuQrZrKtOdxSHVouz5D9NSIWo3rDSDSl9/wldo\nlJdDjavfTsJPQ9p59u7Mgo8Q/XoklsWHzNaXq/2C36PNMeWqaowEeaRomZ3+\ny1UFGotHspRLQ5lLo3sScHwMs4OfRt036ibB7a+Pi5IhFvJIOjLqxeVinEbx\nGqqwXg5pWyi2qmJXruEwGLQyul6CsQwSBawuQwWRT0E2c8aY5hK45e+ZcBwC\nDYEtv+QU+f9S9nLdOCtCzFC3wSDN7I5a3P/wjAkmvEqWQg+9jPEa3XKeNCpD\ndbu7PK7QmqP7uPnNmgQSj6/qQLtqO/dTojzT5lt90ba1qjezfetsvJi9z7JK\nqg3AJ5+V/cfOrXBJDw+EXHpfHGYJRRlg9kl91PODI2n0U+GtfAtOuzyQxkX5\nL76EDMiKZnyLdgo2yUGoP+2ezT25CMRq2bVCPtVjRT10Hf8d9eR2MB8Pwpdt\nc+dTPv78rt0TucCS/dcllOfA7B0gAJoQdhPsRB4kF9aNEpRtDrcxpMQU/Vt9\n5Byj6YSxmeJ/diMHB8f6Cm0IqNhS3iA6V6XI1tLuoBVG62BofQVB6NNr55c3\nAwBE9y4+UGoG2Q7OaEHHZbz7vbMx9PGogUPw3Akyq9DnOV4M3krukowSYDBf\n9qTd\r\n=FVae\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "name": "vdemedes", "email": "vdemedes@gmail.com" }, { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.7_1601539478316_0.7955699020509639" }, "_hasShrinkwrap": false }, "3.0.8": { "name": "ink", "version": "3.0.8", "description": "React for CLI", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "main": "build", "types": "build/index.d.ts", "engines": { "node": ">=10" }, "scripts": { "build": "tsc", "prepare": "npm run build", "test": "tsc --noEmit && xo && FORCE_COLOR=true ava", "cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy" }, "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "dependencies": { "ansi-escapes": "^4.2.1", "auto-bind": "4.0.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "indent-string": "^4.0.0", "is-ci": "^2.0.0", "lodash": "^4.17.20", "patch-console": "^1.0.0", "react-devtools-core": "^4.6.0", "react-reconciler": "^0.24.0", "scheduler": "^0.18.0", "signal-exit": "^3.0.2", "slice-ansi": "^3.0.0", "stack-utils": "^2.0.2", "string-length": "^3.1.0", "type-fest": "^0.12.0", "widest-line": "^3.1.0", "wrap-ansi": "^6.2.0", "ws": "^7.2.5", "yoga-layout-prebuilt": "^1.9.6" }, "devDependencies": { "@sindresorhus/tsconfig": "0.7.0", "@types/is-ci": "^2.0.0", "@types/lodash": "^4.14.161", "@types/node": "*", "@types/react": "^16.9.41", "@types/react-reconciler": "^0.18.0", "@types/scheduler": "^0.16.1", "@types/signal-exit": "^3.0.0", "@types/sinon": "^9.0.4", "@types/slice-ansi": "^4.0.0", "@types/stack-utils": "^1.0.1", "@types/wrap-ansi": "^3.0.0", "@vdemedes/prettier-config": "^1.0.1", "ava": "^3.5.0", "babel-eslint": "^10.0.1", "benchmark": "^2.1.4", "boxen": "^4.2.0", "chance": "^1.1.6", "delay": "^4.1.0", "eslint-config-xo": "0.29.1", "eslint-config-xo-react": "^0.22.0", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "import-jsx": "3.1.0", "ms": "^2.1.1", "node-pty": "^0.9.0", "p-queue": "^6.2.1", "prettier": "^2.0.4", "react": "^16.9.0", "sinon": "^8.1.1", "strip-ansi": "^6.0.0", "svg-term-cli": "^2.1.1", "ts-node": "7.0.0", "typescript": "^3.8.3", "xo": "^0.28.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true } }, "ava": { "extensions": [ "ts", "tsx" ], "require": [ "ts-node/register/transpile-only" ] }, "xo": { "extends": [ "xo-react" ], "plugins": [ "react" ], "prettier": true, "rules": { "react/no-unescaped-entities": "off", "react/state-in-constructor": "off", "react/jsx-indent": "off" }, "overrides": [ { "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}" ], "rules": { "no-unused-expressions": "off", "camelcase": [ "error", { "allow": [ "^unstable__", "^internal_" ] } ], "unicorn/filename-case": "off", "react/prop-types": "off", "unicorn/prevent-abbreviations": "off", "react/require-default-props": "warn", "react/jsx-curly-brace-presence": "off", "@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/explicit-function-return": "off", "@typescript-eslint/explicit-function-return-type": "off" } }, { "files": [ "examples/**/*.js" ], "rules": { "react/prop-types": "off" } } ] }, "prettier": "@vdemedes/prettier-config", "gitHead": "c83a5d0ab3e95a8d30d70bc466808e567727eb97", "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "homepage": "https://github.com/vadimdemedes/ink#readme", "_id": "ink@3.0.8", "_nodeVersion": "12.18.1", "_npmVersion": "6.14.5", "dist": { "integrity": "sha512-ubMFylXYaG4IkXQVhPautbhV/p6Lo0GlvAMI/jh8cGJQ39yeznJbaTTJP2CqZXezA4GOHzalpwCWqux/NEY38w==", "shasum": "c527957c8fa4efcc139b67a4cbba7bb8a62b18b0", "tarball": "https://registry.npmjs.org/ink/-/ink-3.0.8.tgz", "fileCount": 150, "unpackedSize": 286719, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjx2oCRA9TVsSAnZWagAAMvkQAIclmpYF2p78Gt7t4uGr\ncwaIwu4KkpvADbr/0pcQX3x3SGDvZffJB/Nep8gdg5Bcc/teIjE66oeM4dIq\nDi3Sz/kOLg59UE//KyAqS+duhN35cZi29ssrW2eVgeWGWlvSDMWsdqy0ukRq\nvEIdrw3TaG30QAMO3PiuaN3cgc2o+dfqEBIjWfxfHXOlsiBOB/bGUGd8YupK\nOoIdc9238BS5xROaCN8um45VzdeAhLNxlFAdQSn4v3YhPAdp41KxkrWqCyvh\ndPEMcvmvgn43Je1aNQBcyesUrr/XEUt8C2DZ735ENjn/nxOYWAOkIC9T0jYT\nPdaIgKoHr5R/qEip5gSg1QrntdwhE2do7QwR8wYw5Q0LPPffnyz2cW/X498k\n8C8TK10ChLtb5x6V206WuGBvrJ3fnXxyk/dX5taJj1PVrg7cpW1CLk9B7nva\nQpKvdil4HQz7lC8Sh6rylqTn3pmqCyrQLX04jp+4bnGaDB4LmSzcnAzGi30v\nYl8sEgU/tv+EpBbndhJ4iIS8p3NS9VOxiRWlyJzNrJO61uM+T5mn7/MF5/2K\nzvckBKk+6ctnT5z0II44mLr1u88avJIgqOrVVh+6v663NZDiBQkvPPDNLS3N\nMR34qlqdOwrvtUh2Z94Sd8CRoCXNVfyEfHynvewBg1mEB/h8kudNiPFMn0sv\n3ko1\r\n=G48D\r\n-----END PGP SIGNATURE-----\r\n" }, "maintainers": [ { "name": "vdemedes", "email": "vdemedes@gmail.com" }, { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "_npmUser": { "name": "vdemedes", "email": "vdemedes@gmail.com" }, "directories": {}, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ink_3.0.8_1603214759760_0.7101840970891995" }, "_hasShrinkwrap": false } }, "readme": "

\n\t
\n\t
\n\t\"Ink\"\n\t
\n\t
\n\t
\n

\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https://github.com/vadimdemedes/ink/workflows/test/badge.svg)](https://github.com/vadimdemedes/ink/actions)\n[![npm](https://img.shields.io/npm/dm/ink?logo=npm)](https://npmjs.com/package/ink)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https://github.com/facebook/yoga) to build Flexbox layouts in the terminal, so most CSS-like props are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, it means that all features of React are supported.\nHead over to [React](https://reactjs.org) website for documentation on how to use it.\nOnly Ink's methods will be documented in this readme.\n\n**Note:** This is documentation for Ink 3. If you're looking for docs on Ink 2, check out [this release](https://github.com/vadimdemedes/ink/tree/v2.7.1). There's also a [migration guide](migrate.md) from Ink 2 available.\n\n## Install\n\n```\n$ npm install ink react\n```\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn {counter} tests passed;\n};\n\nrender();\n```\n\n\n\nYou can also check it out live on [repl.it sandbox](https://ink-counter-demo.vadimdemedes.repl.run/).\nFeel free to play around with the code and fork this repl at [https://repl.it/@vadimdemedes/ink-counter-demo](https://repl.it/@vadimdemedes/ink-counter-demo).\n\n## Who's Using Ink?\n\n- [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.\n- [Parcel](https://parceljs.org) - Blazing fast, zero configuration web application bundler.\n- [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Yarn 2](https://yarnpkg.com) - Fast, reliable, and secure dependency management for JavaScript.\n- [Terraform CDK](https://github.com/hashicorp/terraform-cdk) - CDK (Cloud Development Kit) for HashiCorp Terraform.\n- [Twilio's SIGNAL](https://github.com/twilio-labs/plugin-signal2020) - CLI for Twilio's SIGNAL conference. [Blog post](https://www.twilio.com/blog/building-conference-cli-in-react).\n- [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https://www.prisma.io) - The unified data layer for modern applications.\n- [Wallace](https://www.projectwallace.com) - Pretty CSS analytics on the CLI.\n- [Blitz](https://blitzjs.com) - The Fullstack React Framework.\n- [New York Times](https://github.com/nytimes/kyt) - NYT uses Ink `kyt` - a toolkit that encapsulates and manages the configuration for web apps.\n- [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.\n- [loki](https://github.com/oblador/loki) - Visual Regression Testing for Storybook.\n- [Bit](https://github.com/teambit/bit) - Build, distribute and collaborate on components.\n- [Remirror](https://github.com/remirror/remirror) - Your friendly, world-class editor toolkit.\n- [Prime](https://github.com/birkir/prime) - Open source GraphQL CMS.\n- [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.\n- [emoj](https://github.com/sindresorhus/emoj) - Find relevant emoji on the command-line.\n- [emma](https://github.com/maticzav/emma-cli) - Terminal assistant to find and install npm packages.\n- [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.\n- [share](https://github.com/marionebl/share-cli) - Quickly share files from your command line.\n- [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.\n- [changelog-view](https://github.com/jdeniau/changelog-view) - Tool view changelog in console.\n- [cfpush](https://github.com/mamachanko/cfpush) - An interactive Cloud Foundry tutorial in your terminal.\n- [startd](https://github.com/mgrip/startd) - Turn your React component into a web app from the command-line.\n- [wiki-cli](https://github.com/hexrcs/wiki-cli) - Search Wikipedia and read summaries directly in your terminal.\n- [garson](https://github.com/goliney/garson) - Build interactive config-based command-line interfaces.\n- [git-contrib-calendar](https://github.com/giannisp/git-contrib-calendar) - Display a contributions calendar for any git repository.\n- [gitgud](https://github.com/GitGud-org/GitGud) - An interactive command-line GUI for Git.\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [Components](#components)\n - [``](#text)\n - [``](#box)\n - [``](#newline)\n - [``](#spacer)\n - [``](#static)\n - [``](#transform)\n- [Hooks](#hooks)\n - [`useInput`](#useinputinputhandler-options)\n - [`useApp`](#useapp)\n - [`useStdin`](#usestdin)\n - [`useStdout`](#usestdout)\n - [`useStderr`](#usestderr)\n - [`useFocus`](#usefocusoptions)\n - [`useFocusManager`](#usefocusmanager)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Examples](#examples)\n\n## Getting Started\n\nUse [create-ink-app](https://github.com/vadimdemedes/create-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```\n$ mkdir my-ink-cli\n$ cd my-ink-cli\n$ npx create-ink-app\n```\n\nAlternatively, create a TypeScript project:\n\n```\n$ npx create-ink-app --typescript\n```\n\n
Manual setup\n

\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https://babeljs.io/docs/en/usage), install `@babel/preset-react` and insert the following configuration in `babel.config.json`:\n\n```\n$ npm install --save-dev @babel/preset-react\n```\n\n```json\n{\n\t\"presets\": [\n\t\t\"@babel/preset-react\",\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"targets\": {\n\t\t\t\t\t\"node\": true\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => Hello World;\n\nrender();\n```\n\nThen, transpile this file with Babel:\n\n```\n$ npx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```\n$ node cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https://github.com/vadimdemedes/import-jsx) to `require()` a JSX file and transpile it on the fly.\n\n

\n
\n\nInk uses [Yoga](https://github.com/facebook/yoga) - a Flexbox layout engine to build great user interfaces for your CLIs using familiar CSS-like props you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if each `
` in the browser had `display: flex`.\nSee [``](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [``](#text) component.\n\n## Components\n\n### ``\n\nThis component can display text, and change its style to make it bold, underline, italic or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t<>\n\t\tI am green\n\t\t\n\t\t\tI am black on white\n\t\t\n\t\tI am white\n\t\tI am bold\n\t\tI am italic\n\t\tI am underline\n\t\tI am strikethrough\n\t\tI am inversed\n\t\n);\n\nrender();\n```\n\n**Note:** `` allows only text nodes and nested `` components inside of it. For example, `` component can't be used inside ``.\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https://github.com/chalk/chalk) under the hood, so all its functionality is supported.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\nGreen\nBlue\nRed\n```\n\n\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (emit a small amount of light).\n\n```jsx\n\n\tDimmed Red\n\n```\n\n\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### inverse\n\nType: `boolean`\\\nDefault: `false`\n\nInverse background and foreground colors.\n\n```jsx\n\n\tInversed Yellow\n\n```\n\n\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than container.\nIf `wrap` is passed (by default), Ink will wrap text and split it into multiple lines.\nIf `truncate-*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off.\n\n```jsx\n\n\tHello World\n\n//=> 'Hello\\nWorld'\n\n// `truncate` is an alias to `truncate-end`\n\n\tHello World\n\n//=> 'Hello…'\n\n\n\tHello World\n\n//=> 'He…ld'\n\n\n\tHello World\n\n//=> '…World'\n```\n\n### ``\n\n`` is an essential Ink component to build your layout.\nIt's like `
` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => {\n\t\n\t\tThis is a box with margin\n\t;\n};\n\nrender();\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it in percent, which will calculate the width based on the width of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X '\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it in percent, which will calculate the height based on the height of parent element.\n\n```jsx\n\n\tX\n\n//=> 'X\\n\\n\\n'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n##### minHeight\n\nType: `number`\n\nSets a minimum height of the element.\nPercentages aren't supported yet, see https://github.com/facebook/yoga/issues/872.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\nTop\nBottom\nLeft\nRight\nLeft and right\nTop and bottom\nTop, bottom, left and right\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).\n\n```jsx\n\n\tLabel:\n\t\n\t\tFills all remaining space\n\t\n\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).\n\n```jsx\n\n\t\n\t\tWill be 1/4\n\t\n\t\n\t\tWill be 3/4\n\t\n\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n//=> 'X Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\tY\n\n// X Y\n\n\n\tX\n\t\n\t\tY\n\t\n\n// Y X\n\n\n\tX\n\tY\n\n// X\n// Y\n\n\n\tX\n\tY\n\n// Y\n// X\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end`\n\nSee [align-items](https://css-tricks.com/almanac/properties/a/align-items/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// X A\n// B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// X B\n// C\n\n\n\t\n\t\tX\n\t\n\t\n\t\tA\n\t\t\n\t\tB\n\t\t\n\t\tC\n\t\n\n// A\n// B\n// X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed vales: `auto` `flex-start` `center` `flex-end`\n\nSee [align-self](https://css-tricks.com/almanac/properties/a/align-self/).\n\n```jsx\n\n\t\n\t\tX\n\t\n\n// X\n//\n//\n\n\n\t\n\t\tX\n\t\n\n//\n// X\n//\n\n\n\t\n\t\tX\n\t\n\n//\n//\n// X\n```\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around`\n\nSee [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).\n\n```jsx\n\n\tX\n\n// [X ]\n\n\n\tX\n\n// [ X ]\n\n\n\tX\n\n// [ X]\n\n\n\tX\n\tY\n\n// [X Y]\n\n\n\tX\n\tY\n\n// [ X Y ]\n```\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (which it is by default), no border will be added.\nInk uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes) module.\n\n```jsx\n\n\t\n\t\t\n\t\t\tsingle\n\t\t\n\n\t\t\n\t\t\tdouble\n\t\t\n\n\t\t\n\t\t\tround\n\t\t\n\n\t\t\n\t\t\tbold\n\t\t\n\t\n\n\t\n\t\t\n\t\t\tsingleDouble\n\t\t\n\n\t\t\n\t\t\tdoubleSingle\n\t\t\n\n\t\t\n\t\t\tclassic\n\t\t\n\t\n\n```\n\n\n\nSee example in [examples/borders](examples/borders/borders.js).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nAccepts the same values as [`color`](#color) in `` component.\n\n```jsx\n\n\tGreen Rounded Box\n\n```\n\n\n\n### ``\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\n\t\tHello\n\t\t\n\t\tWorld\n\t\n);\n\nrender();\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### ``\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available spaces between elements.\n\nFor example, using `` in a `` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tLeft\n\t\t\n\t\tRight\n\t\n);\n\nrender();\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" to the top of the container and push \"Bottom\" to the bottom of it.\nNote, that container needs to be tall to enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\n\t\tTop\n\t\t\n\t\tBottom\n\t\n);\n\nrender();\n```\n\n### ``\n\n`` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\nare not changing after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `` for use cases like these, when you can't know\nor control the amount of items that need to be rendered.\n\nFor example, [Tap](https://github.com/tapjs/node-tap) uses `` to display\na list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it\nto display a list of generated pages, while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t// Fake 10 completed tests\n\t\t\tif (completedTests++ < 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`\n\t\t\t\t\t}\n\t\t\t\t]);\n\n\t\t\t\tsetTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t{/* This part will be rendered once to the terminal */}\n\t\t\t\n\t\t\t\t{test => (\n\t\t\t\t\t\n\t\t\t\t\t\t✔ {test.title}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t{/* This part keeps updating as state changes */}\n\t\t\t\n\t\t\t\tCompleted tests: {tests.length}\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n**Note:** `` only renders new items in `items` prop and ignores items\nthat were previously rendered. This means that when you add new items to `items`\narray, changes you make to previous items will not trigger a rerender.\n\nSee [examples/static](examples/static/static.js) for an example usage of `` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using a function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [``](#box) for supported properties.\n\n```jsx\n\n\t{...}\n\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in `items` array.\nFirst argument is an item itself and second argument is index of that item in\n`items` array.\n\nNote that `key` must be assigned to the root component.\n\n```jsx\n\n\t{(item, index) => {\n\t\t// This function is called for every item in ['a', 'b', 'c']\n\t\t// `item` is 'a', 'b', 'c'\n\t\t// `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\n\t\t\t\tItem: {item}\n\t\t\t\n\t\t);\n\t}}\n\n```\n\n### ``\n\nTransform a string representation of React components before they are written to output.\nFor example, you might want to apply a [gradient to text](https://github.com/sindresorhus/ink-gradient), [add a clickable link](https://github.com/sindresorhus/ink-link) or [create some text effects](https://github.com/sindresorhus/ink-big-text).\nThese use cases can't accept React nodes as input, they are expecting a string.\nThat's what `` component does, it gives you an output string of its child components and lets you transform it in any way.\n\n**Note:** `` must be applied only to `` children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t output.toUpperCase()}>\n\t\tHello World\n\t\n);\n\nrender();\n```\n\nSince `transform` function converts all characters to upper case, final output that's rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\n#### transform(children)\n\nType: `Function`\n\nFunction which transforms children output.\nIt accepts children and must return transformed children too.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nThis hook is used for handling user input.\nIt's a more convienient alternative to using `useStdin` and listening to `data` events.\nThe callback you pass to `useInput` is called for each character when user enters any input.\nHowever, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t// Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t// Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if user presses left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.pageDown\n\n###### key.pageUp\n\nType: `boolean`\\\nDefault: `false`\n\nIf Page Up or Page Down key was pressed, the corresponding property will be `true`.\nFor example, if user presses Page Down, `key.pageDown` equals `true`.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### useApp()\n\n`useApp` is a React hook, which exposes a method to manually exit the app (unmount).\n\n#### exit(error?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### error\n\nType: `Error`\n\nOptional error. If passed, [`waitUntilExit`](waituntilexit) will reject with that error.\n\n```js\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t// Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, []);\n\n\treturn …\n};\n```\n\n### useStdin()\n\n`useStdin` is a React hook, which exposes stdin stream.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nStdin stream passed to `render()` in `options.stdin` or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\n\t) : (\n\t\t\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\n`useStdout` is a React hook, which exposes stdout stream, where Ink renders your app.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout;\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout, while preserving Ink's output.\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).\n\n### useStderr()\n\n`useStderr` is a React hook, which exposes stderr stream.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr, while preserving Ink's output.\n\nIt's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to ``, except it can't accept components, it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t// Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useFocus(options?)\n\nComponent that uses `useFocus` hook becomes \"focusable\" to Ink, so when user presses Tab, Ink will switch focus to this component.\nIf there are multiple components that execute `useFocus` hook, focus will be given to them in the order that these components are rendered in.\nThis hook returns an object with `isFocused` boolean property, which determines if this component is focused or not.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto focus this component, if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn {isFocused ? 'I am focused' : 'I am not focused'};\n};\n\nrender();\n```\n\nSee example in [examples/use-focus](examples/use-focus/use-focus.js).\n\n### useFocusManager()\n\nThis hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n**Note:** You don't need to call this method manually, unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nCurrently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the last in the list of focusable components, focus will be switched to the first component.\n\n**Note:** Ink calls this method when user presses Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf active component is the first in the list of focusable components, focus will be switched to the last component.\n\n**Note:** Ink calls this method when user presses Shift+Tab.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactElement`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen to Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink output.\nWhen any of `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears main output, renders output from the console method and then rerenders main output again.\nThat way both are visible and are not overlapping each other.\n\nThis functionality is powered by [patch-console](https://github.com/vadimdemedes/patch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use it.\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as a separate output, without replacing the previous one.\n\n#### Instance\n\nThis is the object that `render()` returns.\n\n##### rerender(tree)\n\nReplace previous root node with a new one or update props of the current root node.\n\n###### tree\n\nType: `ReactElement`\n\n```jsx\n// Update props of the root node\nconst {rerender} = render();\nrerender();\n\n// Replace root node\nconst {rerender} = render();\nrerender();\n```\n\n##### unmount()\n\nManually unmount the whole Ink app.\n\n```jsx\nconst {unmount} = render();\nunmount();\n```\n\n##### waitUntilExit()\n\nReturns a promise, which resolves when app is unmounted.\n\n```jsx\nconst {unmount, waitUntilExit} = render();\n\nsetTimeout(unmount, 1000);\n\nawait waitUntilExit(); // resolves after `unmount()` is called\n```\n\n##### clear()\n\nClear output.\n\n```jsx\nconst {clear} = render();\nclear();\n```\n\n#### measureElement(ref)\n\nMeasure the dimensions of a particular `` element.\nIt returns an object with `width` and `height` properties.\nThis function is useful when your component needs to know the amount of available space it has. You could use it when you need to change the layout based on the length of its content.\n\n**Note:** `measureElement()` returns correct results only after the initial render, when layout has been calculated. Until then, `width` and `height` equal to zero. It's recommended to call `measureElement()` in a `useEffect` hook, which fires after the component has rendered.\n\n##### ref\n\nType: `MutableRef`\n\nA reference to a `` element captured with a `ref` property.\nSee [Refs](https://reactjs.org/docs/refs-and-the-dom.html) for more information on how to capture references.\n\n```jsx\nimport {render, measureElement, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef();\n\n\tuseEffect(() => {\n\t\tconst {width, height} = measureElement(ref.current);\n\t\t// width = 100, height = 1\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\tThis box will stretch to 100 width\n\t\t\t\n\t\t\n\t);\n};\n\nrender();\n```\n\n## Testing\n\nInk components are simple to test with [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library).\nHere's a simple example that checks how component is rendered:\n\n```jsx\nimport React from 'react';\nimport {Text} from 'ink';\nimport {render} from 'ink-testing-library';\n\nconst Test = () => Hello World;\nconst {lastFrame} = render();\n\nlastFrame() === 'Hello World'; //=> true\n```\n\nCheck out [ink-testing-library](https://github.com/vadimdemedes/ink-testing-library) for more examples and full documentation.\n\n## Using React Devtools\n\n![](media/devtools.jpg)\n\nInk supports [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) out-of-the-box.\nTo enable integration with React Devtools in your Ink-based CLI, run it with `DEV=true` environment variable:\n\n```\n$ DEV=true my-cli\n```\n\nThen, start React Devtools itself:\n\n```\n$ npx react-devtools\n```\n\nAfter it starts up, you should see the component tree of your CLI.\nYou can even inspect and change the props of components, and see the results immediatelly in the CLI, without restarting it.\n\n**Note**: You must manually quit your CLI via Ctrl+C after you're done testing.\n\n## Useful Components\n\n- [ink-text-input](https://github.com/vadimdemedes/ink-text-input) - Text input.\n- [ink-spinner](https://github.com/vadimdemedes/ink-spinner) - Spinner.\n- [ink-select-input](https://github.com/vadimdemedes/ink-select-input) - Select (dropdown) input.\n- [ink-link](https://github.com/sindresorhus/ink-link) - Link component.\n- [ink-gradient](https://github.com/sindresorhus/ink-gradient) - Gradient color component.\n- [ink-big-text](https://github.com/sindresorhus/ink-big-text) - Awesome text component.\n- [ink-image](https://github.com/kevva/ink-image) - Display images inside the terminal.\n- [ink-tab](https://github.com/jdeniau/ink-tab) - Tab component.\n- [ink-color-pipe](https://github.com/LitoMore/ink-color-pipe) - Create color text with simpler style strings in Ink.\n- [ink-multi-select](https://github.com/karaggeorge/ink-multi-select) - Select one or more values from a list\n- [ink-divider](https://github.com/JureSotosek/ink-divider) - A divider component.\n- [ink-progress-bar](https://github.com/brigand/ink-progress-bar) - Configurable component for rendering progress bars.\n- [ink-table](https://github.com/maticzav/ink-table) - Table component.\n- [ink-ascii](https://github.com/hexrcs/ink-ascii) - Awesome text component with more font choices, based on Figlet.\n- [ink-markdown](https://github.com/cameronhunter/ink-markdown) - Render syntax highlighted Markdown.\n- [ink-quicksearch-input](https://github.com/Eximchain/ink-quicksearch-input) - Select component with fast quicksearch-like navigation.\n- [ink-confirm-input](https://github.com/kevva/ink-confirm-input) - Yes/No confirmation input.\n\n## Useful Hooks\n\n- [ink-use-stdout-dimensions](https://github.com/cameronhunter/ink-monorepo/tree/master/packages/ink-use-stdout-dimensions) - Subscribe to stdout dimensions.\n\n## Examples\n\n- [Jest](examples/jest/jest.js) - Implementation of basic Jest UI [(live demo)](https://ink-jest-demo.vadimdemedes.repl.run/).\n- [Counter](examples/counter/counter.js) - Simple counter that increments every 100ms [(live demo)](https://ink-counter-demo.vadimdemedes.repl.run/).\n- [Form with Validation](https://github.com/final-form/rff-cli-example) - Manage form state using [Final Form](https://github.com/final-form/final-form#-final-form).\n- [Borders](examples/borders/borders.js) - Add borders to `` component.\n- [Suspense](examples/suspense/suspense.js) - Use React Suspense.\n- [Table](examples/table/table.js) - Render a table with multiple columns and rows.\n- [Focus Management](examples/use-focus/use-focus.js) - Use `useFocus` hook to manage focus between components.\n- [User Input](examples/use-input/use-input.js) - Listen to user input.\n- [Write to stdout](examples/use-stdout/use-stdout.js) - Write to stdout bypassing main Ink output.\n- [Write to stderr](examples/use-stderr/use-stderr.js) - Write to stderr bypassing main Ink output.\n- [Static](examples/static/static.js) - Use `` to render permanent output.\n\n## Maintainers\n\n- [Vadim Demedes](https://github.com/vadimdemedes)\n- [Sindre Sorhus](https://github.com/sindresorhus)\n", "maintainers": [ { "name": "vdemedes", "email": "vdemedes@gmail.com" }, { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "time": { "modified": "2020-10-20T17:26:02.348Z", "created": "2013-07-22T19:06:25.295Z", "0.0.1": "2013-07-22T19:06:28.507Z", "0.0.2": "2013-07-22T19:12:19.106Z", "0.1.0": "2017-07-05T17:28:01.550Z", "0.1.1": "2017-07-05T17:32:05.079Z", "0.1.2": "2017-07-09T18:13:44.650Z", "0.2.0": "2017-07-14T17:10:08.268Z", "0.2.1": "2017-07-15T14:52:34.065Z", "0.3.0": "2017-07-16T16:25:10.957Z", "0.3.1": "2017-08-07T18:08:55.025Z", "0.4.0": "2018-01-22T21:28:17.312Z", "0.4.1": "2018-01-22T21:41:48.394Z", "0.5.0": "2018-04-29T12:18:17.540Z", "0.5.1": "2018-07-09T05:26:43.845Z", "2.0.0-0": "2018-10-01T04:37:05.022Z", "2.0.0-1": "2018-10-01T07:00:27.682Z", "2.0.0-2": "2018-10-07T02:04:07.049Z", "2.0.0-3": "2018-10-22T03:45:06.819Z", "2.0.0-4": "2018-11-07T02:54:05.396Z", "2.0.0-5": "2018-11-08T06:08:45.811Z", "2.0.0-6": "2018-11-10T05:16:22.343Z", "2.0.0-7": "2018-11-11T22:51:26.886Z", "2.0.0-8": "2018-11-13T04:50:12.215Z", "2.0.0-9": "2018-11-19T14:19:22.990Z", "2.0.0-10": "2018-11-26T03:00:10.427Z", "2.0.0-11": "2019-01-27T16:15:39.869Z", "2.0.0-12": "2019-02-17T00:53:35.667Z", "2.0.0-13": "2019-02-19T00:31:39.472Z", "2.0.0-14": "2019-02-19T04:47:05.522Z", "2.0.0-15": "2019-02-19T06:00:35.595Z", "2.0.0-16": "2019-02-20T04:56:11.582Z", "2.0.0-17": "2019-03-04T07:25:27.959Z", "2.0.0": "2019-03-04T07:40:19.067Z", "2.0.1": "2019-03-05T06:23:12.057Z", "2.0.2": "2019-03-05T06:31:54.513Z", "2.0.3": "2019-03-05T07:29:51.951Z", "2.0.4": "2019-03-08T05:50:06.388Z", "2.0.5": "2019-03-09T07:24:24.102Z", "2.0.6": "2019-03-18T03:06:24.540Z", "2.1.0": "2019-03-31T04:46:16.336Z", "2.1.1": "2019-04-02T02:53:28.192Z", "2.2.0": "2019-05-23T04:06:08.095Z", "2.3.0": "2019-06-25T13:56:34.914Z", "2.4.0": "2019-09-26T04:05:10.652Z", "2.5.0": "2019-10-05T23:27:50.281Z", "2.6.0": "2019-11-28T03:25:21.327Z", "2.7.0": "2020-02-03T07:07:16.802Z", "2.7.1": "2020-02-16T12:34:51.544Z", "3.0.0-0": "2020-06-20T16:40:21.634Z", "3.0.0-1": "2020-06-21T10:02:41.911Z", "3.0.0-2": "2020-06-23T15:30:22.921Z", "3.0.0-3": "2020-06-23T15:52:21.046Z", "3.0.0-4": "2020-06-23T18:05:30.600Z", "3.0.0-5": "2020-07-05T07:59:32.065Z", "3.0.0-6": "2020-07-07T18:33:39.444Z", "3.0.0-7": "2020-07-22T17:29:24.796Z", "3.0.0": "2020-07-27T17:35:40.906Z", "3.0.1": "2020-07-31T20:14:54.151Z", "3.0.2": "2020-08-02T20:08:17.914Z", "3.0.3": "2020-08-02T20:47:18.482Z", "3.0.4": "2020-08-18T17:58:07.756Z", "3.0.5": "2020-09-01T18:18:59.934Z", "3.0.6": "2020-09-19T10:35:49.199Z", "3.0.7": "2020-10-01T08:04:38.474Z", "3.0.8": "2020-10-20T17:26:00.019Z" }, "author": { "name": "vdemedes", "email": "vdemedes@gmail.com", "url": "https://github.com/vadimdemedes" }, "repository": { "type": "git", "url": "git+https://github.com/vadimdemedes/ink.git" }, "bugs": { "url": "https://github.com/vadimdemedes/ink/issues" }, "license": "MIT", "readmeFilename": "readme.md", "homepage": "https://github.com/vadimdemedes/ink#readme", "keywords": [ "react", "cli", "jsx", "stdout", "components", "command-line", "preact", "redux", "print", "render", "colors", "text" ], "users": { "rexpan": true, "marushkevych": true, "netweb": true, "otakustay": true, "professorcoal": true, "hal9zillion": true, "lestad": true, "ishanmarikar": true, "yanghcc": true } }