Skip to content

Commit

Permalink
misc - add a blessed.js file.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Jul 24, 2013
1 parent 1b5155c commit 5e2f106
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 21 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./lib/program');
module.exports = require('./lib/blessed');
3 changes: 2 additions & 1 deletion lib/alias.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions lib/blessed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Blessed
* A curses-like library for node.js.
* Copyright (c) 2013, Christopher Jeffrey (MIT License).
* https://github.com/chjj/blessed
*/

/**
* Modules
*/

var program = require('./program')
, tput = require('./tput')
, widget = require('./widget')
, colors = require('./colors');

/**
* Blessed
*/

function blessed() {
return program.apply(null, arguments);
}

blessed.program = blessed.Program = program;
blessed.tput = blessed.Tput = tput;
blessed.colors = colors;
blessed.widget = widget;

Object.keys(blessed.widget).forEach(function(name) {
blessed[name] = blessed.widget[name];
});

blessed.helpers = {
sprintf: blessed.tput.sprintf,
merge: blessed.tput.merge,
tryRead: blessed.tput.tryRead
};

/**
* Expose
*/

module.exports = blessed;
4 changes: 3 additions & 1 deletion lib/colors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Colors
* colors.js - color-related functions for blessed.
* Copyright (c) 2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/blessed
*/

exports.match = function(r1, g1, b1) {
Expand Down
15 changes: 3 additions & 12 deletions lib/program.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Blessed
* A curses-like library for node.js.
* program.js - basic curses-like functionality for blessed.
* Copyright (c) 2013, Christopher Jeffrey (MIT License).
* https://github.com/chjj/blessed
*/

/**
Expand Down Expand Up @@ -3384,13 +3384,4 @@ Program.prototype.resume = function(callback) {
* Expose
*/

exports = Program;
exports.Program = exports.program = Program;
exports.Tput = exports.tput = Tput;

exports.widget = require('./widget');
Object.keys(exports.widget).forEach(function(name) {
exports[name] = exports.widget[name];
});

module.exports = exports;
module.exports = Program;
4 changes: 3 additions & 1 deletion lib/tput.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Tput for node.js
* tput.js - parse and compile terminfo caps to javascript.
* Copyright (c) 2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/blessed
*/
Expand Down Expand Up @@ -2803,5 +2803,7 @@ Tput.utoa = Tput.prototype.utoa = {

exports = Tput;
exports.sprintf = sprintf;
exports.merge = merge;
exports.tryRead = tryRead;

module.exports = exports;
7 changes: 3 additions & 4 deletions lib/widget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Blessed high-level interface
* widget.js - high-level interface for blessed
* Copyright (c) 2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/blessed
* Still under heavy development.
*/

Expand Down Expand Up @@ -1107,7 +1108,7 @@ Screen.prototype.draw = function(start, end) {
: '\x1b[?25h';
}

this.program.write(pre + main + post);
this.output.write(pre + main + post);
}
};

Expand Down Expand Up @@ -5470,8 +5471,6 @@ function hsort(obj) {
* Expose
*/

exports.colors = colors;

exports.Screen = exports.screen = Screen;
exports.Box = exports.box = Box;
exports.Text = exports.text = Text;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A curses-like library for node.js.",
"author": "Christopher Jeffrey",
"version": "0.0.18",
"main": "./lib/program.js",
"main": "./lib/blessed.js",
"bin": "./bin/tput.js",
"preferGlobal": false,
"repository": "git://github.com/chjj/blessed.git",
Expand Down

0 comments on commit 5e2f106

Please sign in to comment.