Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function BaseModal (opts) {
var self = this;
if (!(self instanceof blessed.Node)) return new BaseModal(opts);
blessed.Box.call(self, _({hidden: true}).merge(opts || {}).toObject());
self.otherModals = _(self.parent.children)
.filter(function (child) { return child instanceof BaseModal; })
.without(self);
self.on('element blur', function () {
if (!self.screen.focused.hasAncestor(self) && self.screen.focused !== self) self.hide();
});
self.on('click', function () {
process.nextTick(function () {
// TODO: don't change focus if contained element has focus already
var firstChild = self.children[0];
if (firstChild) firstChild.focus();
});
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('./canvas');
function LCD(options) {
if (!(this instanceof Node)) {
return new LCD(options);
}
var self = this;
options = options || {};
self.options = options;
//these options need to be modified epending on the resulting positioning/size
self.options.segmentWidth = options.segmentWidth || 0.06; // how wide are the segments in % so 50% = 0.5
self.options.segmentInterval = options.segmentInterval || 0.11; // spacing between the segments in % so 50% = 0.5
self.options.strokeWidth = options.strokeWidth || 0.11; // spacing between the segments in % so 50% = 0.5
function Field (opts) {
var self = this;
if (!(self instanceof blessed.Node)) return new Field(opts);
Editor.call(self, _({height: 1}).merge(opts).toObject());
self.language(false);
self.on('keypress', function (ch, key) {
var binding = util.getBinding(self.options.bindings, key);
switch (binding) {
case 'submit':
self.submit(self.text());
break;
case 'submit':
self.cancel();
break;
};
});
}
Field.prototype.__proto__ = Editor.prototype;
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('./canvas');
function GaugeList(options) {
if (!(this instanceof Node)) {
return new GaugeList(options);
}
var self = this;
options = options || {};
self.options = options;
self.options.stroke = options.stroke || 'magenta';
self.options.fill = options.fill || 'white';
self.options.data = options.data || [];
self.options.showLabel = options.showLabel !== false;
self.options.gaugeSpacing = options.gaugeSpacing || 0;
function Editor (opts) {
var self = this;
if (!(self instanceof blessed.Node)) return new Editor(opts);
BaseElement.call(self, _({
focusable: true,
multiLine: true
})
.merge(Slap.global.options.editor || {})
.merge(opts || {})
.toObject());
self.gutter = new BaseElement(_(Slap.global.options.editor.gutter)
.merge({
parent: self,
tags: true,
wrap: false,
style: {},
top: 0,
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('../canvas');
function Bar(options) {
if (!(this instanceof Node)) {
return new Bar(options);
}
var self = this;
Canvas.call(this, options, require('ansi-term'));
this.options.barWidth = this.options.barWidth || 6;
this.options.barSpacing = this.options.barSpacing || 9;
if ((this.options.barSpacing - this.options.barWidth) < 3) {
this.options.barSpacing = this.options.barWidth + 3;
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('./canvas');
function Donut(options) {
if (!(this instanceof Node)) {
return new Donut(options);
}
options = options || {};
this.options = options;
this.options.stroke = options.stroke || 'magenta';
this.options.fill = options.fill || 'white';
this.options.radius = options.radius || 14;
this.options.arcWidth = options.arcWidth || 4;
this.options.spacing = options.spacing || 2;
this.options.yPadding = options.yPadding || 2;
this.options.remainColor = options.remainColor || 'black';
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('./canvas')
, InnerMap = require('map-canvas');
function Map(options) {
var self = this;
if (!(this instanceof Node)) {
return new Map(options);
}
Canvas.call(this, options);
this.on('attach', function() {
options.style = options.style || {};
'use strict';
var blessed = require('blessed')
, Node = blessed.Node
, Canvas = require('./canvas');
function Gauge(options) {
if (!(this instanceof Node)) {
return new Gauge(options);
}
var self = this;
options = options || {};
self.options = options;
self.options.stroke = options.stroke || 'magenta';
self.options.fill = options.fill || 'white';
self.options.data = options.data || [];
self.options.showLabel = options.showLabel !== false;