Skip to content

Commit

Permalink
Fix a circular require error (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
cronvel committed Jul 14, 2021
1 parent a34beb3 commit 88b3d83
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,4 +1,10 @@

v2.1.6
------

Fix a circular require error (#181)


v2.1.5
------

Expand Down
25 changes: 17 additions & 8 deletions browser/termkit.js
Expand Up @@ -10171,9 +10171,11 @@ ColumnMenuMulti.prototype.onButtonToggle = function( buttonValue , action , butt


const Element = require( './Element.js' ) ;
const Slider = require( './Slider.js' ) ;
const ScreenBuffer = require( '../ScreenBuffer.js' ) ;

// Avoid requiring Slider at top-level, it could cause circular require troubles
//const Slider = require( './Slider.js' ) ;



function Container( options ) {
Expand Down Expand Up @@ -10246,6 +10248,8 @@ Container.prototype.elementType = 'Container' ;
Container.prototype.isContainer = true ;
Container.prototype.containerBorderSize = 0 ;

const termkit = require( '../termkit.js' ) ;



Container.prototype.destroy = function( isSubDestroy , noDraw = false ) {
Expand Down Expand Up @@ -10276,8 +10280,10 @@ Container.prototype.keyBindings = {


Container.prototype.initChildren = function() {
// Avoid requiring Slider at top-level, it could cause circular require troubles

if ( this.hasVScrollBar ) {
this.vScrollBarSlider = new Slider( {
this.vScrollBarSlider = new termkit.Slider( {
internal: true ,
parent: this ,
x: this.viewportWidth - 1 ,
Expand All @@ -10294,7 +10300,7 @@ Container.prototype.initChildren = function() {
}

if ( this.hasHScrollBar ) {
this.hScrollBarSlider = new Slider( {
this.hScrollBarSlider = new termkit.Slider( {
internal: true ,
parent: this ,
x: 0 ,
Expand Down Expand Up @@ -10525,7 +10531,7 @@ Container.prototype.onDrag = function( data ) {
} ;


},{"../ScreenBuffer.js":3,"./Element.js":23,"./Slider.js":31}],20:[function(require,module,exports){
},{"../ScreenBuffer.js":3,"../termkit.js":50,"./Element.js":23}],20:[function(require,module,exports){
/*
Terminal Kit

Expand Down Expand Up @@ -11787,6 +11793,9 @@ const misc = require( '../misc.js' ) ;
const string = require( 'string-kit' ) ;
const NextGenEvents = require( 'nextgen-events' ) ;

// Avoid requiring Document at top-level, it could cause circular require troubles
//const Document = require( './Document.js' ) ;



function Element( options = {} ) {
Expand Down Expand Up @@ -11878,6 +11887,8 @@ Element.prototype = Object.create( NextGenEvents.prototype ) ;
Element.prototype.constructor = Element ;
Element.prototype.elementType = 'Element' ;

const termkit = require( '../termkit.js' ) ;



// Destroy the element and all its children, detaching them and removing listeners
Expand Down Expand Up @@ -12565,7 +12576,7 @@ Element.createInline = async function( term , Type , options ) {
noDraw: true
} ;

var document = new Document( documentOptions ) ;
var document = new termkit.Document( documentOptions ) ;

document.attach( element ) ;

Expand Down Expand Up @@ -12598,10 +12609,8 @@ Element.prototype.staticInline = false ; // boolean, true if the inline version
Element.prototype.inlineCursorRestoreAfterDraw = false ; // when set, save/restore cursor in inline mode (forced when strictInline is true)
Element.prototype.needInput = false ; // no need for input by default (used to configure inline mode)

const Document = require( './Document.js' ) ;


},{"../misc.js":42,"./Document.js":20,"nextgen-events":72,"string-kit":123}],24:[function(require,module,exports){
},{"../misc.js":42,"../termkit.js":50,"nextgen-events":72,"string-kit":123}],24:[function(require,module,exports){
(function (process){(function (){
/*
Terminal Kit
Expand Down
2 changes: 1 addition & 1 deletion browser/termkit.min.js

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions lib/document/Container.js
Expand Up @@ -33,9 +33,11 @@


const Element = require( './Element.js' ) ;
const Slider = require( './Slider.js' ) ;
const ScreenBuffer = require( '../ScreenBuffer.js' ) ;

// Avoid requiring Slider at top-level, it could cause circular require troubles
//const Slider = require( './Slider.js' ) ;



function Container( options ) {
Expand Down Expand Up @@ -108,6 +110,8 @@ Container.prototype.elementType = 'Container' ;
Container.prototype.isContainer = true ;
Container.prototype.containerBorderSize = 0 ;

const termkit = require( '../termkit.js' ) ;



Container.prototype.destroy = function( isSubDestroy , noDraw = false ) {
Expand Down Expand Up @@ -138,8 +142,10 @@ Container.prototype.keyBindings = {


Container.prototype.initChildren = function() {
// Avoid requiring Slider at top-level, it could cause circular require troubles

if ( this.hasVScrollBar ) {
this.vScrollBarSlider = new Slider( {
this.vScrollBarSlider = new termkit.Slider( {
internal: true ,
parent: this ,
x: this.viewportWidth - 1 ,
Expand All @@ -156,7 +162,7 @@ Container.prototype.initChildren = function() {
}

if ( this.hasHScrollBar ) {
this.hScrollBarSlider = new Slider( {
this.hScrollBarSlider = new termkit.Slider( {
internal: true ,
parent: this ,
x: 0 ,
Expand Down
9 changes: 6 additions & 3 deletions lib/document/Element.js
Expand Up @@ -32,6 +32,9 @@ const misc = require( '../misc.js' ) ;
const string = require( 'string-kit' ) ;
const NextGenEvents = require( 'nextgen-events' ) ;

// Avoid requiring Document at top-level, it could cause circular require troubles
//const Document = require( './Document.js' ) ;



function Element( options = {} ) {
Expand Down Expand Up @@ -123,6 +126,8 @@ Element.prototype = Object.create( NextGenEvents.prototype ) ;
Element.prototype.constructor = Element ;
Element.prototype.elementType = 'Element' ;

const termkit = require( '../termkit.js' ) ;



// Destroy the element and all its children, detaching them and removing listeners
Expand Down Expand Up @@ -810,7 +815,7 @@ Element.createInline = async function( term , Type , options ) {
noDraw: true
} ;

var document = new Document( documentOptions ) ;
var document = new termkit.Document( documentOptions ) ;

document.attach( element ) ;

Expand Down Expand Up @@ -843,5 +848,3 @@ Element.prototype.staticInline = false ; // boolean, true if the inline version
Element.prototype.inlineCursorRestoreAfterDraw = false ; // when set, save/restore cursor in inline mode (forced when strictInline is true)
Element.prototype.needInput = false ; // no need for input by default (used to configure inline mode)

const Document = require( './Document.js' ) ;

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "terminal-kit",
"version": "2.1.5",
"version": "2.1.6",
"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!",
"main": "lib/termkit.js",
"directories": {
Expand Down

0 comments on commit 88b3d83

Please sign in to comment.