terminal-kit
Advanced tools
Comparing version 0.1.28 to 0.2.1
@@ -135,2 +135,6 @@ | ||
* .brightColor(register): choose between 8 bright colors using an 0..7 integer | ||
* .color256(register): if the terminal support 256 colors, it choose between them using an 0..255 integer | ||
* .color256rgb(r,g,b): if the terminal support 256 colors, set the color from RGB value in the 0..5 range | ||
* .color256gray(l): if the terminal support 256 colors, set the color from the grayscale where the lightness | ||
value is in the 0..25 range | ||
@@ -160,2 +164,6 @@ | ||
* .bgBrightColor(): choose between 8 bright colors using an 0..7 integer | ||
* .bgColor256(register): if the terminal support 256 colors, it choose between them using an 0..255 integer | ||
* .bgColor256rgb(r,g,b): if the terminal support 256 colors, set the color from RGB value in the 0..5 range | ||
* .bgColor256gray(l): if the terminal support 256 colors, set the color from the grayscale where the lightness | ||
value is in the 0..25 range | ||
@@ -162,0 +170,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = require( './xterm.js' ) ; | ||
module.exports = require( './xterm-256color.js' ) ; |
@@ -1,1 +0,42 @@ | ||
module.exports = require( './konsole.js' ) ; | ||
/* | ||
The Cedric's Swiss Knife (CSK) - CSK terminal toolbox | ||
Copyright (c) 2009 - 2014 Cédric Ronvel | ||
The MIT License (MIT) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
var tree = require( 'tree-kit' ) ; | ||
var xterm256 = require( './xterm-256color.js' ) ; | ||
var konsole = require( './konsole.js' ) ; | ||
// So far, we derivate from xterm-256color and then just add specific things (owned properties) | ||
// of konsole, thus we achieve a clean inheritance model without duplicated code. | ||
module.exports = { | ||
esc: tree.extend( { own: true } , Object.create( xterm256.esc ) , konsole.esc ) , | ||
keymap: tree.extend( { own: true } , Object.create( xterm256.keymap ) , konsole.keymap ) , | ||
handler: tree.extend( { own: true } , Object.create( xterm256.handler ) , konsole.handler ) | ||
} ; |
@@ -34,3 +34,3 @@ /* | ||
var esc = tree.extend( { preserve: true } , { | ||
var esc = tree.extend( null , Object.create( xterm.esc ) , { | ||
@@ -43,3 +43,3 @@ // Amazingly, those uber-standard and uber-common sequences are *NOT* supported by Konsole... | ||
} , xterm.esc ) ; | ||
} ) ; | ||
@@ -54,5 +54,3 @@ | ||
var keymap = tree.extend( { preserve: true } , { | ||
} , xterm.keymap ) ; | ||
var keymap = Object.create( xterm.keymap ) ; | ||
@@ -67,3 +65,3 @@ | ||
var handler = tree.extend( null , {} , xterm.handler ) ; | ||
var handler = Object.create( xterm.handler ) ; | ||
@@ -70,0 +68,0 @@ |
@@ -30,3 +30,3 @@ /* | ||
var tree = require( 'tree-kit' ) ; | ||
var xterm = require( './xterm.generic.js' ) ; | ||
var xterm = require( './xterm.js' ) ; | ||
@@ -45,3 +45,3 @@ | ||
var esc = tree.extend( { preserve: true } , { | ||
var esc = tree.extend( null , Object.create( xterm.esc ) , { | ||
@@ -85,3 +85,3 @@ // Clear screen | ||
} , xterm.esc ) ; | ||
} ) ; | ||
@@ -96,3 +96,3 @@ | ||
var keymap = tree.extend( { preserve: true } , { | ||
var keymap = tree.extend( null , Object.create( xterm.keymap ) , { | ||
@@ -124,3 +124,3 @@ F1: '\x1b[[A' , | ||
} , xterm.keymap ) ; | ||
} ) ; | ||
@@ -134,4 +134,4 @@ | ||
keymap: keymap , | ||
handler: {} | ||
handler: Object.create( xterm.handler ) | ||
} ; | ||
@@ -1,1 +0,44 @@ | ||
module.exports = require( './xterm.generic.js' ) ; | ||
/* | ||
The Cedric's Swiss Knife (CSK) - CSK terminal toolbox | ||
Copyright (c) 2009 - 2014 Cédric Ronvel | ||
The MIT License (MIT) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
var tree = require( 'tree-kit' ) ; | ||
var xterm256 = require( './xterm-256color.js' ) ; | ||
var xtermGeneric = require( './xterm.generic.js' ) ; | ||
// Fail-safe xterm-compatible. | ||
// So far, we derivate from xterm-256color and then just add specific things (owned properties) | ||
// of xterm.generic.js, thus we achieve a clean inheritance model without duplicated code. | ||
module.exports = { | ||
esc: tree.extend( { own: true } , Object.create( xterm256.esc ) , xtermGeneric.esc ) , | ||
keymap: tree.extend( { own: true } , Object.create( xterm256.keymap ) , xtermGeneric.keymap ) , | ||
handler: tree.extend( { own: true } , Object.create( xterm256.handler ) , xtermGeneric.handler ) | ||
} ; |
@@ -1,1 +0,74 @@ | ||
module.exports = require( './xterm.js' ) ; | ||
/* | ||
The Cedric's Swiss Knife (CSK) - CSK terminal toolbox | ||
Copyright (c) 2009 - 2014 Cédric Ronvel | ||
The MIT License (MIT) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
var tree = require( 'tree-kit' ) ; | ||
var xterm = require( './xterm.js' ) ; | ||
// Remove colors | ||
var defaultColor = '\x1b[39m' ; // back to the default color, most of time it is the same than .white | ||
var bgDefaultColor = '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack | ||
var esc = tree.extend( null , Object.create( xterm.esc ) , { | ||
color256: { on: '\x1b[38;5;%um' , off: defaultColor } , | ||
bgColor256: { on: '\x1b[48;5;%um' , off: bgDefaultColor } | ||
} ) ; | ||
/* Key Mapping */ | ||
var keymap = Object.create( xterm.keymap ) ; | ||
/* Handlers */ | ||
var handler = Object.create( xterm.handler ) ; | ||
module.exports = { | ||
esc: esc , | ||
keymap: keymap , | ||
handler: handler | ||
} ; |
@@ -36,3 +36,3 @@ /* | ||
var esc = tree.extend( { preserve: true } , { | ||
var esc = tree.extend( null , Object.create( xterm.esc ) , { | ||
@@ -43,3 +43,3 @@ // KDE Konsole does not support that. This workaround use up()/down() & column(1) | ||
} , xterm.esc ) ; | ||
} ) ; | ||
@@ -54,5 +54,3 @@ | ||
var keymap = tree.extend( { preserve: true } , { | ||
} , xterm.keymap ) ; | ||
var keymap = Object.create( xterm.keymap ) ; | ||
@@ -67,5 +65,3 @@ | ||
var handler = tree.extend( { preserve: true } , { | ||
} , xterm.handler ) ; | ||
var handler = Object.create( xterm.handler ) ; | ||
@@ -72,0 +68,0 @@ |
@@ -145,3 +145,4 @@ /* | ||
brightColor: { on: '\x1b[9%um' , off: defaultColor } , // should be called with a 0..7 integer | ||
color256: { on: '%D' , off: defaultColor } , // drop it silently | ||
// Background color | ||
@@ -167,2 +168,3 @@ bgDefaultColor: { on: bgDefaultColor } , | ||
bgBrightColor: { on: '\x1b[10%um' , off: bgDefaultColor } , // should be called with a 0..7 integer | ||
bgColor256: { on: '%D' , off: bgDefaultColor } , // drop it silently | ||
@@ -169,0 +171,0 @@ /* Input / Output sequences */ |
@@ -456,3 +456,82 @@ /* | ||
} | ||
} , | ||
// RGB: 0-5,0-5,0-5 | ||
color256rgb: { | ||
on: '%[color256rgb:%a%a%a]' , | ||
off: function() { return this.root.esc.defaultColor.on ; } , | ||
handler: function color256rgb( r , g , b ) | ||
{ | ||
if ( typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' ) { return '' ; } | ||
var c = Math.floor( 16 + r * 36 + g * 6 + b ) ; | ||
// min:16 max:231 | ||
if ( c < 16 || c > 231 ) { return '' ; } | ||
return string.format( this.root.esc.color256.on , c ) ; | ||
} | ||
} , | ||
// RGB: 0-5,0-5,0-5 | ||
bgColor256rgb: { | ||
on: '%[bgColor256rgb:%a%a%a]' , | ||
off: function() { return this.root.esc.bgDefaultColor.on ; } , | ||
handler: function bgColor256rgb( r , g , b ) | ||
{ | ||
if ( typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' ) { return '' ; } | ||
var c = Math.floor( 16 + r * 36 + g * 6 + b ) ; | ||
// min:16 max:231 | ||
if ( c < 16 || c > 231 ) { return '' ; } | ||
return string.format( this.root.esc.bgColor256.on , c ) ; | ||
} | ||
} , | ||
// 26 shades of gray: 0-25 | ||
color256gray: { | ||
on: '%[color256gray:%a]' , | ||
off: function() { return this.root.esc.defaultColor.on ; } , | ||
handler: function color256gray( g ) | ||
{ | ||
var c ; | ||
if ( typeof g !== 'number' ) { return '' ; } | ||
g = Math.floor( g ) ; | ||
if ( g < 0 || g > 25 ) { return '' ; } | ||
if ( g === 0 ) { c = 16 ; } | ||
else if ( g === 25 ) { c = 231 ; } | ||
else { c = g + 232 ; } | ||
return string.format( this.root.esc.color256.on , c ) ; | ||
} | ||
} , | ||
// 26 shades of gray: 0-25 | ||
bgColor256gray: { | ||
on: '%[bgColor256gray:%a]' , | ||
off: function() { return this.root.esc.bgDefaultColor.on ; } , | ||
handler: function bgColor256gray( g ) | ||
{ | ||
var c ; | ||
if ( typeof g !== 'number' ) { return '' ; } | ||
g = Math.floor( g ) ; | ||
if ( g < 0 || g > 25 ) { return '' ; } | ||
if ( g === 0 ) { c = 16 ; } | ||
else if ( g === 25 ) { c = 231 ; } | ||
else { c = g + 231 ; } | ||
return string.format( this.root.esc.bgColor256.on , c ) ; | ||
} | ||
} | ||
} ; | ||
@@ -459,0 +538,0 @@ |
{ | ||
"name": "terminal-kit", | ||
"version": "0.1.28", | ||
"description": "Terminal utilities with supports for colors, styles, inputs, mouse and many more...", | ||
"version": "0.2.1", | ||
"description": "Terminal utilities with supports for colors (even 256 colors), styles, inputs, mouse and many more...", | ||
"main": "lib/terminal.js", | ||
@@ -10,4 +10,4 @@ "directories": { | ||
"dependencies": { | ||
"async-kit": "^0.4.12", | ||
"string-kit": "0.0.3", | ||
"async-kit": "^0.5.2", | ||
"string-kit": "0.0.14", | ||
"tree-kit": "^0.2.4" | ||
@@ -31,2 +31,3 @@ }, | ||
"color", | ||
"256 colors", | ||
"style", | ||
@@ -33,0 +34,0 @@ "input", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
363299
48
1932
+ Addedasync-kit@0.5.10(transitive)
+ Addedstring-kit@0.0.14(transitive)
+ Addedterminal-kit@0.1.28(transitive)
+ Addedtree-kit@0.5.27(transitive)
Updatedasync-kit@^0.5.2
Updatedstring-kit@0.0.14