Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terminal-kit

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminal-kit - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

19

doc/Element.md

@@ -23,2 +23,4 @@

* Methods:
* [.destroy()](#ref.Element.destroy)
* [.destroyNoRedraw()](#ref.Element.destroyNoRedraw)
* [.updateZ() / .updateZIndex()](#ref.Element.updateZ)

@@ -92,2 +94,19 @@ * [.topZ()](#ref.Element.topZ)

<a name="ref.Element.destroy"></a>
### .destroy()
It destroys the *element* immediately, and triggers all draw/redraw necessary to remove it from the screen now.
<a name="ref.Element.destroyNoRedraw"></a>
### .destroyNoRedraw()
It destroys the *element* immediately, but nothing is redrawn, so the *element* is still visible until the next redraw.
It is usually done when there is a lot of *elements* to remove at once, to avoid redrawing the screen for each one, which would dramatically slow down the app.
Instead of `.destroy()`, it's best to use `.destroyNoRedraw()` each *element*, and then to call `document.draw()` once done.
<a name="ref.Element.updateZ"></a>

@@ -94,0 +113,0 @@ ### .updateZ( z ) / .updateZIndex( z )

52

lib/document/BaseMenu.js

@@ -157,5 +157,19 @@ /*

BaseMenu.prototype.focusFirstPageItem = function( focusType ) {
this.focusChild = this.children[ this.page ? 1 : 0 ] ;
var focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
if ( ! focusAware ) { this.document.focusNext() ; }
} ;
BaseMenu.prototype.focusLastPageItem = function( focusType ) {
this.focusChild = this.children[ this.page === this.maxPage ? this.children.length - 1 : this.children.length - 2 ] ;
var focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
if ( ! focusAware ) { this.document.focusNext() ; }
} ;
BaseMenu.prototype.previousPage = function( focusType ) {
var focusAware ;
if ( this.maxPage && this.page > 0 ) {

@@ -165,5 +179,6 @@ this.page -- ;

this.focusChild = this.children[ this.children.length - 2 ] ;
focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
let focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
if ( ! focusAware ) { this.document.focusPrevious() ; }
this.updateDraw() ;
this.emit( 'previousPage' , this.page , this ) ;
}

@@ -175,4 +190,2 @@ } ;

BaseMenu.prototype.nextPage = function( focusType ) {
var focusAware ;
if ( this.maxPage && this.page < this.maxPage ) {

@@ -182,5 +195,6 @@ this.page ++ ;

this.focusChild = this.children[ 1 ] ;
focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
let focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
if ( ! focusAware ) { this.document.focusNext() ; }
this.updateDraw() ;
this.emit( 'nextPage' , this.page , this ) ;
}

@@ -192,9 +206,7 @@ } ;

BaseMenu.prototype.toPage = function( page , focusType ) {
var focusAware ;
if ( this.maxPage && page !== this.page ) {
this.page = page ;
this.initPage() ;
this.focusChild = this.children[ 1 ] ;
focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
this.focusChild = this.children[ this.page ? 1 : 0 ] ;
let focusAware = this.document.giveFocusTo_( this.focusChild , focusType ) ;
if ( ! focusAware ) { this.document.focusNext() ; }

@@ -483,2 +495,5 @@ this.updateDraw() ;

}
else {
this.focusFirstPageItem( 'backCycle' ) ;
}
} ;

@@ -490,2 +505,5 @@

}
else {
this.focusLastPageItem( 'cycle' ) ;
}
} ;

@@ -497,2 +515,5 @@

}
else {
this.focusFirstPageItem( 'backCycle' ) ;
}
} ;

@@ -504,4 +525,15 @@

}
else {
this.focusLastPageItem( 'cycle' ) ;
}
} ;
userActions.firstPageItem = function() {
this.focusFirstPageItem( 'backCycle' ) ;
} ;
userActions.lastPageItem = function() {
this.focusLastPageItem( 'cycle' ) ;
} ;
userActions.parentMenu = function() {

@@ -508,0 +540,0 @@ if ( this.isSubmenu ) {

@@ -320,2 +320,3 @@ /*

this.buttons.length = 0 ;
this.hotkeyToButtonIndex.clear() ;

@@ -411,2 +412,11 @@ this.pageItemsDef[ page ].forEach( ( def , index ) => {

if ( def.hotkey ) {
if ( Array.isArray( def.hotkey ) ) {
def.hotkey.forEach( hotkey => this.hotkeyToButtonIndex.set( hotkey , index ) ) ;
}
else {
this.hotkeyToButtonIndex.set( def.hotkey , index ) ;
}
}
if ( isToggle ) {

@@ -413,0 +423,0 @@ this.buttons[ index ].on( 'toggle' , this.onButtonToggle ) ;

@@ -173,4 +173,7 @@ /*

// User API
Element.prototype.destroyNoRedraw = function() { return this.destroy( undefined , true ) ; } ;
Element.inherit = function( Class , FromClass = Element ) {

@@ -177,0 +180,0 @@ Class.prototype = Object.create( FromClass.prototype ) ;

2

lib/Palette.js

@@ -372,3 +372,3 @@ /*

sortedChannels = [ ... rgb ].sort() ;
sortedChannels = [ ... rgb ].sort( ( a , b ) => a - b ) ;

@@ -375,0 +375,0 @@ //console.log( "Clipped!" , rgb , chromaColor.rgb() ) ;

{
"name": "terminal-kit",
"version": "3.0.1",
"version": "3.0.2",
"description": "256 colors, keys and mouse, input field, progress bars, screen buffer (including 32-bit composition and image loading), text buffer, and many more... Whether you just need colors and styles, build a simple interactive command line tool or a complexe terminal app: this is the absolute terminal lib for Node.js!",

@@ -19,4 +19,4 @@ "main": "lib/termkit.js",

"seventh": "^0.9.2",
"string-kit": "^0.17.10",
"tree-kit": "^0.8.1"
"string-kit": "^0.18.1",
"tree-kit": "^0.8.7"
},

@@ -23,0 +23,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc