New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blessed-contrib

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blessed-contrib - npm Package Compare versions

Comparing version 0.0.9 to 1.0.9

28

examples/dashboard.js

@@ -11,7 +11,7 @@ var blessed = require('blessed')

var grid1 = new contrib.grid({rows: 1, cols: 3})
grid1.set(0, 0, contrib.log,
grid1.set(0, 0, 1, 1, contrib.log,
{ fg: "green"
, selectedFg: "green"
, label: 'Server Log'})
grid1.set(0, 1, contrib.line,
grid1.set(0, 1, 1, 1, contrib.line,
{ style:

@@ -26,4 +26,4 @@ { line: "yellow"

var grid2 = new contrib.grid({rows: 2, cols: 1})
grid2.set(0, 0, contrib.gauge, {label: 'Deployment Progress'})
grid2.set(1, 0, contrib.sparkline,
grid2.set(0, 0, 1, 1, contrib.gauge, {label: 'Deployment Progress'})
grid2.set(1, 0, 1, 1, contrib.sparkline,
{ label: 'Throughput (bits/sec)'

@@ -33,6 +33,6 @@ , tags: true

grid1.set(0, 2, grid2)
grid1.set(0, 2, 1, 1, grid2)
var grid3 = new contrib.grid({rows: 1, cols: 2})
grid3.set(0, 0, contrib.bar,
grid3.set(0, 0, 1, 1, contrib.bar,
{ label: 'Server Utilization (%)'

@@ -43,3 +43,3 @@ , barWidth: 4

, maxHeight: 9})
grid3.set(0, 1, contrib.table,
grid3.set(0, 1, 1, 1, contrib.table,
{ keys: true

@@ -51,3 +51,3 @@ , fg: 'green'

var grid4 = new contrib.grid({rows: 3, cols: 1})
grid4.set(0, 0, contrib.line,
grid4.set(0, 0, 1, 1, contrib.line,
{ style:

@@ -59,13 +59,13 @@ { line: "red"

, maxY: 60})
grid4.set(1, 0, grid3)
grid4.set(2, 0, grid1)
grid4.set(1, 0, 1, 1, grid3)
grid4.set(2, 0, 1, 1, grid1)
var grid5 = new contrib.grid({rows: 2, cols: 1})
grid5.set(0, 0, contrib.line,
grid5.set(0, 0, 1, 1, contrib.line,
{ showNthLabel: 5
, maxY: 100
, label: 'Total Transactions'})
grid5.set(1, 0, contrib.map, {label: 'Servers Location'})
grid.set(0, 0, grid5)
grid.set(0, 1, grid4)
grid5.set(1, 0, 1, 1, contrib.map, {label: 'Servers Location'})
grid.set(0, 0, 1, 1, grid5)
grid.set(0, 1, 1, 1, grid4)

@@ -72,0 +72,0 @@ grid.applyLayout(screen)

@@ -1,39 +0,104 @@

var blessed = require('blessed')
var contrib = require('../../index')
var blessed = require('blessed');
var contrib = require('../../index');
var screen = blessed.screen()
var screen = blessed.screen();
var rows = 3, cols = 3
var grid = new contrib.grid({rows: rows, cols: cols})
for (var i=0; i<rows; i++) {
for (var j=0; j<cols; j++)
{
var opts = {
top: 'center',
left: 'center',
width: '50%',
height: '50%',
content: 'Hello {bold}world{/bold} (' + i + "," + j +') !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
}
var rows = 4, cols = 4;
var grid = new contrib.grid({rows: rows, cols: cols});
grid.set(i, j, blessed.box, opts)
}
}
grid.set(0, 0, 2, 2, blessed.box, {
content: 'Hello {bold}world{/bold} (0,0), Size (2,2) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
grid.set(2, 0, 2, 1, blessed.box, {
content: 'Hello {bold}world{/bold} (2,0), Size (2,1) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
grid.set(0, 2, 1, 2, blessed.box, {
content: 'Hello {bold}world{/bold} (0,2), Size (1,2) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
grid.set(2, 2, 1, 1, blessed.box, {
content: 'Hello {bold}world{/bold} (2,2), Size (1,1) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
grid.set(0, 3, 1, 3, blessed.box, {
content: 'Hello {bold}world{/bold} (0,3), Size (1,3) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
grid.set(3, 0, 4, 1, blessed.box, {
content: 'Hello {bold}world{/bold} (3,0), Size (4,1) !',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
}
});
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
return process.exit(0);
});
grid.applyLayout(screen)
screen.render()
grid.applyLayout(screen);
screen.render();

@@ -0,1 +1,2 @@

var utils = require('../utils')

@@ -14,4 +15,11 @@ function Grid(options) {

Grid.prototype.set = function(row, col, obj, opts) {
this.matrix[row][col] = {obj: obj, opts: opts || {}}
Grid.prototype.set = function(row, col, rowSpan, colSpan, obj, opts) {
//warn users about breaking changes in version 1.0
if (utils.getTypeName(rowSpan)!='[object Number]') {
throw 'Error: As of blessed-contrib 1.0, grid.set signature is function(row, col, rowSpan, colSpan, obj, opts). ' +
'Use rowSpan=1, colSpan=1 to imitiate the previous API.'
}
this.matrix[row][col] = {obj: obj, rowSpan: rowSpan, colSpan: colSpan, opts: opts || {}}
}

@@ -28,5 +36,4 @@

var dashboardMargin = 2
var dashboardMargin = 0
offsetPct = offsetPct || {x: dashboardMargin, y: dashboardMargin, width: 100-dashboardMargin, height: 100-dashboardMargin}

@@ -39,3 +46,6 @@ var widgetSpacing = 0

for (var j=0; j<this.options.cols; j++) {
if(this.matrix[i][j].obj == null)
continue;
var top = offsetPct.y + i * (height + widgetSpacing)

@@ -46,10 +56,9 @@ var left = offsetPct.x + j * (width + widgetSpacing)

var grid = this.matrix[i][j].obj
grid.applyLayout(screen, {x: left, y: top, width: width, height: height})
grid.applyLayout(screen, {x: left, y: top, width: (width * this.matrix[i][j].rowSpan), height: (height * this.matrix[i][j].colSpan)})
}
else {
this.matrix[i][j].opts.top = top + "%"
this.matrix[i][j].opts.left = left + "%"
this.matrix[i][j].opts.width = width + "%"
this.matrix[i][j].opts.height = height + "%"
this.matrix[i][j].opts.width = (width * this.matrix[i][j].rowSpan) + "%"
this.matrix[i][j].opts.height = (height * this.matrix[i][j].colSpan) + "%"

@@ -56,0 +65,0 @@ this.matrix[i][j].opts.border = {type: "line", fg: "cyan"}

{
"name": "blessed-contrib",
"version": "0.0.9",
"version": "1.0.9",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -205,4 +205,5 @@ ## blessed-contrib

grid.set(0, 1, contrib.map, {label: 'World Map'})
grid.set(0, 1, blessed.box, {content: 'My Box'})
//grid.set(row, col, rowSpan, colSpan, obj, opts)
grid.set(0, 1, 1, 1, contrib.map, {label: 'World Map'})
grid.set(0, 1, 1, 1, blessed.box, {content: 'My Box'})

@@ -220,7 +221,7 @@ grid.applyLayout(screen)

grid.set(0, 0, contrib.map, {label: 'World Map'})
grid1.set(0, 0, blessed.box, {content: 'My Box'})
grid1.set(0, 1, blessed.box, {content: 'My Box'})
grid.set(0, 0, 1, 1, contrib.map, {label: 'World Map'})
grid1.set(0, 0, 1, 1, blessed.box, {content: 'My Box'})
grid1.set(0, 1, 1, 1, blessed.box, {content: 'My Box'})
grid.set(0, 1, grid1)
grid.set(0, 1, 1, 1, grid1)
`````

@@ -257,3 +258,3 @@

grid.set(0, 0, contrib.line,
grid.set(0, 0, 1, 1, contrib.line,
{ style:

@@ -267,3 +268,3 @@ { line: "yellow"

grid.set(0, 1, contrib.map, {label: 'Servers Location'})
grid.set(0, 1, 1, 1, contrib.map, {label: 'Servers Location'})

@@ -270,0 +271,0 @@ grid.applyLayout(screen)

@@ -30,2 +30,9 @@ /*

exports.MergeRecursive = MergeRecursive
function getTypeName(thing){
if(thing===null)return "[object Null]"; // special case
return Object.prototype.toString.call(thing);
}
exports.MergeRecursive = MergeRecursive
exports.getTypeName = getTypeName
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