diff --git a/index.js b/index.js index 1d6da98..83a050d 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -module.exports = require('./lib/program'); +module.exports = require('./lib/blessed'); diff --git a/lib/alias.js b/lib/alias.js index 81fa42e..528796a 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -1,5 +1,6 @@ /** - * Aliases + * alias.js - terminfo/cap aliases for blessed. + * https://github.com/chjj/blessed * Taken from terminfo(5) man page. */ diff --git a/lib/blessed.js b/lib/blessed.js new file mode 100644 index 0000000..59ef82f --- /dev/null +++ b/lib/blessed.js @@ -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; diff --git a/lib/colors.js b/lib/colors.js index 4d98a0d..2e2ef63 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -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) { diff --git a/lib/program.js b/lib/program.js index 6d9aafc..013effc 100644 --- a/lib/program.js +++ b/lib/program.js @@ -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 */ /** @@ -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; diff --git a/lib/tput.js b/lib/tput.js index 4cec116..6298ee7 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -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 */ @@ -2803,5 +2803,7 @@ Tput.utoa = Tput.prototype.utoa = { exports = Tput; exports.sprintf = sprintf; +exports.merge = merge; +exports.tryRead = tryRead; module.exports = exports; diff --git a/lib/widget.js b/lib/widget.js index 823416f..40157ed 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -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. */ @@ -1107,7 +1108,7 @@ Screen.prototype.draw = function(start, end) { : '\x1b[?25h'; } - this.program.write(pre + main + post); + this.output.write(pre + main + post); } }; @@ -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; diff --git a/package.json b/package.json index a6ccad5..6517f87 100644 --- a/package.json +++ b/package.json @@ -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",