Socket
Socket
Sign inDemoInstall

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 2.11.1 to 2.11.2

20

doc/Element.md

@@ -30,3 +30,3 @@

* [.draw()](#ref.Element.draw)
* [.redraw()](#ref.Element.redraw)
* [.outerDraw()](#ref.Element.outerDraw)
* [.drawCursor()](#ref.Element.drawCursor)

@@ -122,3 +122,3 @@ * [.saveCursor()](#ref.Element.saveCursor)

default: false. **NOTE:** not all widget support markup or ansi!
* dontDraw `boolean` when set, the content's update does not trigger the *redraw* of the *element*
* dontDraw `boolean` when set, the content's update does not trigger the *draw*/*outerDraw* of the *element*

@@ -132,5 +132,5 @@ Set the content of this *element*.

* dontDraw `boolean` when set (default: false) the element is not redrawn (it will be made visible the next time something trigger a *redraw*)
* dontDraw `boolean` when set (default: false) the element is not drawn/outerDrawn (it will be made visible the next time something trigger a *outerDraw*)
Turn the element visibility **on** and redraw it immediately (unless the `dontDraw` option is on).
Turn the element visibility **on** and outerDraw it immediately (unless the `dontDraw` option is on).

@@ -142,5 +142,5 @@

* dontDraw `boolean` when set (default: false) the element is not redrawn (it will be hidden the next time something trigger a *redraw* on its parent)
* dontDraw `boolean` when set (default: false) the element is not drawn/outerDrawn (it will be hidden the next time something trigger a *outerDraw* on its parent)
Turn the element visibility **off** and redraw its parent immediately (unless the `dontDraw` option is on).
Turn the element visibility **off** and outerDraw its parent immediately (unless the `dontDraw` option is on).

@@ -158,6 +158,6 @@

<a name="ref.Element.redraw"></a>
### .redraw( [force] )
<a name="ref.Element.outerDraw"></a>
### .outerDraw( [force] )
* force `boolean` **INTERNAL** when set (default: false) the element is *redrawn* even if it is hidden: i.e. the parent is redrawn,
* force `boolean` **INTERNAL** when set (default: false) the element is *outerDrawn* even if it is hidden: i.e. the parent is outerDrawn,
it would effectively clear an hidden element from its parent

@@ -167,3 +167,3 @@

While `.draw()` is used when drawing the current *element* is enough (the *element* has not moved, and has not been resized),
`.redraw()` is used it is necessary to draw the closest ancestor which is a container.
`.outerDraw()` is used when it is necessary to draw the closest ancestor which is a container.

@@ -170,0 +170,0 @@ It is called internally/automatically, userland code should not be bothered with that, except in rare use-cases.

@@ -166,3 +166,3 @@

* content `string` the text-content to prepend
* dontDraw `boolean` if set, don't redraw the widget (default: false, redraw)
* dontDraw `boolean` if set, don't outerDraw the widget (default: false, outerDraw)

@@ -177,3 +177,3 @@ Prepend text-content at the begining of the current content. It supports markup or ansi if the textBox was instanciated with the `contentHasMarkup` options on.

* content `string` the text-content to append
* dontDraw `boolean` if set, don't redraw the widget (default: false, redraw)
* dontDraw `boolean` if set, don't outerDraw the widget (default: false, outerDraw)

@@ -188,3 +188,3 @@ Append text-content at the end of the current content. It supports markup or ansi if the textBox was instanciated with the `contentHasMarkup` options on.

* content `string` the text-content to append
* dontDraw `boolean` if set, don't redraw the widget (default: false, redraw)
* dontDraw `boolean` if set, don't outerDraw the widget (default: false, outerDraw)

@@ -213,3 +213,3 @@ This method is almost like [.appendContent()](ref.TextBox.appendContent), but more suitable for logging.

default: false.
* dontDraw `boolean` if set, don't redraw the widget (default: false, redraw)
* dontDraw `boolean` if set, don't outerDraw the widget (default: false, outerDraw)

@@ -216,0 +216,0 @@ It set the alternate text-content, work like its [.setContent()](#ref.Element.setContent) counterpart.

@@ -114,3 +114,3 @@

* content `string` the new content for this table cell
* dontDraw `boolean` when set, the cell content's update does not trigger the *redraw* of the *textTable* (or of the cell's *textBox*
* dontDraw `boolean` when set, the cell content's update does not trigger the *outerDraw* of the *textTable* (or of the cell's *textBox*
if *dontUpdateLayout* is set)

@@ -131,3 +131,3 @@ * dontUpdateLayout `boolean` when set, the table layout is not updated

* voidAttr `object` attributes for the area of the cell (*textBox*) without any text content, default to the *textAttr* argument
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the cell's *textBox*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the cell's *textBox*

@@ -142,3 +142,3 @@ This update an existing cell text attribute.

* x,y `number` the cell coordinate to reset
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the cell's *textBox*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the cell's *textBox*

@@ -155,3 +155,3 @@ This reset an existing cell text attribute to what it should be, based upon the constructor's parameters.

* voidAttr `object` attributes for the area of the cell (*textBox*) without any text content, default to the *textAttr* argument
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*

@@ -166,3 +166,3 @@ This update all cells' text attribute of a row.

* y `number` the row's index to reset
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*

@@ -179,3 +179,3 @@ This reset all cells' text attribute of a row to what it should be, based upon the constructor's parameters.

* voidAttr `object` attributes for the area of the cell (*textBox*) without any text content, default to the *textAttr* argument
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*

@@ -190,3 +190,3 @@ This update all cells's text attribute of a column.

* x `number` the column's index to reset
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*

@@ -202,3 +202,3 @@ This reset all cells' text attribute of a column to what it should be, based upon the constructor's parameters.

* voidAttr `object` attributes for the area of the cell (*textBox*) without any text content, default to the *textAttr* argument
* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*

@@ -212,5 +212,5 @@ This update all cells's text attribute.

* dontDraw `boolean` when set, the cell attr's update does not trigger the *redraw* of the *textTable*
* dontDraw `boolean` when set, the cell attr's update does not trigger the *outerDraw* of the *textTable*
This reset all cells's text attribute to what it should be, based upon the constructor's parameters.

@@ -405,3 +405,5 @@ /*

this.redraw() ;
// Draw instead of outerDraw?
//this.draw() ;
this.outerDraw() ;

@@ -408,0 +410,0 @@ if ( this.submenuOptions.focusOnOpen ) {

@@ -196,3 +196,3 @@ /*

if ( ! dontResize && this.resizeOnContent ) { this.resizeOnContent() ; }
if ( ! dontDraw ) { this.redraw() ; }
if ( ! dontDraw ) { this.outerDraw() ; }
} ;

@@ -199,0 +199,0 @@

@@ -418,3 +418,3 @@ /*

// Set outputHeight to the correct value
if ( buttonOffsetY < this.outputHeight ) { this.needRedraw = true ; }
if ( buttonOffsetY < this.outputHeight ) { this.needOuterDraw = true ; }
this.pageHeight = this.outputHeight = buttonOffsetY ;

@@ -421,0 +421,0 @@ } ;

@@ -219,3 +219,3 @@ /*

if ( ! noDraw ) { this.redraw() ; }
if ( ! noDraw ) { this.outerDraw() ; }
} ;

@@ -222,0 +222,0 @@

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

count ,
internal ,
startPosition: { x , y } ,

@@ -182,2 +183,3 @@ endPosition: { x: this.textBuffer.cx , y: this.textBuffer.cy }

count: deleted.count ,
internal ,
deletedString: deleted.string ,

@@ -210,2 +212,3 @@ startPosition: { x: xmin , y: ymin } ,

count: deleted.count ,
internal ,
deletedString: deleted.string ,

@@ -326,2 +329,3 @@ startPosition: { x: xmin , y: ymin } ,

count ,
internal: false ,
startPosition: { x , y } ,

@@ -356,2 +360,3 @@ endPosition: { x: this.textBuffer.cx , y: this.textBuffer.cy }

count ,
internal: false ,
startPosition: { x , y } ,

@@ -375,2 +380,3 @@ endPosition: { x: this.textBuffer.cx , y: this.textBuffer.cy }

count: 1 ,
internal: false ,
startPosition: { x , y } ,

@@ -402,2 +408,3 @@ endPosition: { x: this.textBuffer.cx , y: this.textBuffer.cy }

count: deleted.count ,
internal: false ,
deletedString: deleted.string ,

@@ -434,2 +441,3 @@ startPosition: { x , y } ,

count: deleted.count ,
internal: false ,
deletedString: deleted.string ,

@@ -455,2 +463,3 @@ startPosition: { x , y } ,

count: deleted.count ,
internal: false ,
deletedString: deleted.string ,

@@ -457,0 +466,0 @@ startPosition: { x: 0 , y } ,

@@ -108,3 +108,3 @@ /*

// Used by .updateDraw()
this.needRedraw = false ;
this.needOuterDraw = false ;

@@ -195,3 +195,3 @@ this.savedCursorX = 0 ;

this.hidden = false ;
if ( ! noDraw ) { this.redraw() ; }
if ( ! noDraw ) { this.outerDraw() ; }
return this ;

@@ -207,4 +207,4 @@ } ;

if ( ! noDraw ) {
// .redraw() with the 'force' option on, because .redraw() does nothing if the element is hidden, but here we want to clear it from its parent
this.redraw( true ) ;
// .outerDraw() with the 'force' option on, because .outerDraw() does nothing if the element is hidden, but here we want to clear it from its parent
this.outerDraw( true ) ;
}

@@ -444,6 +444,17 @@

this.contentHasMarkup = hasMarkup ;
var oldContentWidth = this.contentWidth ;
this.contentWidth = Element.computeContentWidth( content , this.contentHasMarkup ) ;
if ( ! dontResize && this.resizeOnContent ) { this.resizeOnContent() ; }
if ( ! dontDraw ) { this.redraw() ; }
if ( ! dontDraw ) {
// This condition is bad, and is only relevant for Text ATM,
// Should find a clean way to split outputWidth/outputHeight from a sort of wantedWidth/wantedHeight
if ( this.contentWidth !== oldContentWidth && ( this.contentWidth > this.outputWidth || this.resizeOnContent ) ) {
this.outerDraw() ;
}
else {
this.draw() ;
}
}
} ;

@@ -662,2 +673,3 @@

Element.prototype.draw = function( isInitialInlineDraw = false ) {
//console.error( "\n----------------------------\nCalling .draw() for" , this.debugId() , new Error( 'trace:' ) ) ;
if ( ! this.document || this.hidden ) { return this ; }

@@ -685,6 +697,6 @@

// If it has, then it is necessary to draw the closest ancestor which is a container.
// /!\ THIS METHOD IS WRONG: it should draw the parent container, but don't redraw any children of its children Container
// /!\ Maybe rename this .outerDraw() or .parentDraw()
// /!\ IS THIS METHOD WRONG? it should draw the parent container, but don't redraw any children of its children Container
// Option 'force' redraw even if the element is hidden, in fact it is used by the .hide() method to effectively hide the element on the parent container.
Element.prototype.redraw = function( force = false ) {
Element.prototype.redraw = // DEPRECATED name, use .outerDraw()
Element.prototype.outerDraw = function( force = false ) {
if ( ! this.document || ( this.hidden && ! force ) ) { return this ; }

@@ -702,7 +714,7 @@

// Hard to find a good name, .draw() or .redraw() depending on what have been updated
// Hard to find a good name, .draw() or .outerDraw() depending on what have been updated
Element.prototype.updateDraw = function() {
if ( this.needRedraw ) { this.redraw() ; }
if ( this.needOuterDraw ) { this.outerDraw() ; }
else { this.draw() ; }
this.needRedraw = false ;
this.needOuterDraw = false ;
} ;

@@ -709,0 +721,0 @@

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

this.useAutoCompleteHint = !! ( this.autoComplete && ( options.useAutoCompleteHint || options.autoCompleteHint ) ) ;
this.autoCompleteHintMinInput = options.autoCompleteHintMinInput || 1 ; // number of input chars before starting to hint
this.useAutoCompleteMenu = !! ( this.autoComplete && ( options.useAutoCompleteMenu || options.autoCompleteMenu ) ) ;

@@ -267,2 +268,9 @@ this.autoCompleteMenu = null ;

InlineInput.prototype.runAutoCompleteHint = async function( autoComplete ) {
if ( this.textBuffer.cy === 0 && this.textBuffer.cx < this.autoCompleteHintMinInput ) {
// Not enough input for starting to hint
this.altTextBuffer.setText( '' ) ;
this.autoResizeAndDraw() ;
return ;
}
var autoCompleted ;

@@ -269,0 +277,0 @@

@@ -336,3 +336,3 @@ /*

// Set outputWidth to the correct value
//if ( buttonOffsetX < this.outputWidth ) { this.needRedraw = true ; }
//if ( buttonOffsetX < this.outputWidth ) { this.needOuterDraw = true ; }
//this.pageWidth = buttonOffsetX ;

@@ -339,0 +339,0 @@ //this.outputWidth = buttonOffsetY ;

@@ -148,3 +148,3 @@ /*

this.redraw() ;
this.outerDraw() ;
} ;

@@ -151,0 +151,0 @@

@@ -131,3 +131,3 @@ /*

this.redraw() ;
this.outerDraw() ;
} ;

@@ -134,0 +134,0 @@

@@ -52,3 +52,3 @@ /*

// For width and height, we centralize here works for sub-class having animations
// For width and height, we centralize here the work for sub-class having animations
if ( ! options.width ) {

@@ -98,2 +98,3 @@ options.width = this.computeRequiredWidth() ;

Text.prototype.resizeOnContent = function() {
// /!\ .width and .height are unused ATM
this.width = this.computeRequiredWidth( this.content , this.contentHasMarkup ) ;

@@ -100,0 +101,0 @@ this.height = this.computeRequiredHeight( this.content , this.contentHasMarkup ) ;

@@ -421,3 +421,3 @@ /*

this.drawCursor() ;
this.redraw() ;
this.outerDraw() ;
}

@@ -456,3 +456,3 @@ } ;

this.drawCursor() ;
this.redraw() ;
this.outerDraw() ;
}

@@ -515,3 +515,3 @@ } ;

this.draw() ;
//this.redraw() ;
//this.outerDraw() ;
}

@@ -518,0 +518,0 @@ } ;

{
"name": "terminal-kit",
"version": "2.11.1",
"version": "2.11.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!",

@@ -5,0 +5,0 @@ "main": "lib/termkit.js",

@@ -64,2 +64,3 @@ #!/usr/bin/env node

autoCompleteHint: true ,
autoCompleteHintMinInput: 5 ,
} ) ;

@@ -66,0 +67,0 @@

@@ -51,4 +51,6 @@ #!/usr/bin/env node

contentHasMarkup: 'legacyAnsi' ,
attr: { bgColor: 'magenta' } ,
x: 10 ,
y: 10 ,
//width: 5
} ) ;

@@ -55,0 +57,0 @@

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