@socketsecurity/cli-with-sentry 0.14.136 → 0.14.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blessed/LICENSE +20 -0
- package/dist/blessed/lib/alias.js +519 -0
- package/dist/blessed/lib/blessed.js +32 -0
- package/dist/blessed/lib/colors.js +490 -0
- package/dist/blessed/lib/events.js +195 -0
- package/dist/blessed/lib/gpmclient.js +245 -0
- package/dist/blessed/lib/helpers.js +170 -0
- package/dist/blessed/lib/keys.js +512 -0
- package/dist/blessed/lib/program.js +4530 -0
- package/dist/blessed/lib/tput.js +3111 -0
- package/dist/blessed/lib/unicode.js +912 -0
- package/dist/blessed/lib/widget.js +60 -0
- package/dist/blessed/lib/widgets/ansiimage.js +173 -0
- package/dist/blessed/lib/widgets/bigtext.js +170 -0
- package/dist/blessed/lib/widgets/box.js +34 -0
- package/dist/blessed/lib/widgets/button.js +62 -0
- package/dist/blessed/lib/widgets/checkbox.js +95 -0
- package/dist/blessed/lib/widgets/element.js +2871 -0
- package/dist/blessed/lib/widgets/filemanager.js +223 -0
- package/dist/blessed/lib/widgets/form.js +301 -0
- package/dist/blessed/lib/widgets/image.js +71 -0
- package/dist/blessed/lib/widgets/input.js +34 -0
- package/dist/blessed/lib/widgets/layout.js +249 -0
- package/dist/blessed/lib/widgets/line.js +59 -0
- package/dist/blessed/lib/widgets/list.js +652 -0
- package/dist/blessed/lib/widgets/listbar.js +452 -0
- package/dist/blessed/lib/widgets/listtable.js +265 -0
- package/dist/blessed/lib/widgets/loading.js +88 -0
- package/dist/blessed/lib/widgets/log.js +82 -0
- package/dist/blessed/lib/widgets/message.js +145 -0
- package/dist/blessed/lib/widgets/node.js +314 -0
- package/dist/blessed/lib/widgets/overlayimage.js +794 -0
- package/dist/blessed/lib/widgets/progressbar.js +166 -0
- package/dist/blessed/lib/widgets/prompt.js +127 -0
- package/dist/blessed/lib/widgets/question.js +129 -0
- package/dist/blessed/lib/widgets/radiobutton.js +62 -0
- package/dist/blessed/lib/widgets/radioset.js +36 -0
- package/dist/blessed/lib/widgets/screen.js +2485 -0
- package/dist/blessed/lib/widgets/scrollablebox.js +415 -0
- package/dist/blessed/lib/widgets/scrollabletext.js +35 -0
- package/dist/blessed/lib/widgets/table.js +383 -0
- package/dist/blessed/lib/widgets/terminal.js +452 -0
- package/dist/blessed/lib/widgets/text.js +35 -0
- package/dist/blessed/lib/widgets/textarea.js +376 -0
- package/dist/blessed/lib/widgets/textbox.js +79 -0
- package/dist/blessed/lib/widgets/video.js +130 -0
- package/dist/blessed/usr/fonts/AUTHORS +1 -0
- package/dist/blessed/usr/fonts/LICENSE +94 -0
- package/dist/blessed/usr/fonts/README +340 -0
- package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
- package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
- package/dist/blessed/usr/linux +0 -0
- package/dist/blessed/usr/windows-ansi +0 -0
- package/dist/blessed/usr/xterm +0 -0
- package/dist/blessed/usr/xterm-256color +0 -0
- package/dist/blessed/usr/xterm.termcap +243 -0
- package/dist/blessed/usr/xterm.terminfo +1977 -0
- package/dist/blessed/vendor/tng.js +1876 -0
- package/dist/blessed-contrib/LICENSE.md +21 -0
- package/dist/blessed-contrib/lib/layout/carousel.js +82 -0
- package/dist/blessed-contrib/lib/layout/grid.js +46 -0
- package/dist/blessed-contrib/lib/server-utils.js +83 -0
- package/dist/blessed-contrib/lib/utils.js +73 -0
- package/dist/blessed-contrib/lib/widget/canvas.js +52 -0
- package/dist/blessed-contrib/lib/widget/charts/bar.js +99 -0
- package/dist/blessed-contrib/lib/widget/charts/line.js +311 -0
- package/dist/blessed-contrib/lib/widget/charts/stacked-bar.js +245 -0
- package/dist/blessed-contrib/lib/widget/donut.js +183 -0
- package/dist/blessed-contrib/lib/widget/gauge-list.js +111 -0
- package/dist/blessed-contrib/lib/widget/gauge.js +127 -0
- package/dist/blessed-contrib/lib/widget/lcd.js +497 -0
- package/dist/blessed-contrib/lib/widget/log.js +32 -0
- package/dist/blessed-contrib/lib/widget/map.js +97 -0
- package/dist/blessed-contrib/lib/widget/markdown.js +68 -0
- package/dist/blessed-contrib/lib/widget/picture.js +61 -0
- package/dist/blessed-contrib/lib/widget/sparkline.js +66 -0
- package/dist/blessed-contrib/lib/widget/table.js +141 -0
- package/dist/blessed-contrib/lib/widget/tree.js +179 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/index.js +6 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/package.json +64 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/readme.md +39 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/index.js +67 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/package.json +50 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/readme.md +86 -0
- package/dist/blessed-contrib/node_modules/chalk/index.js +118 -0
- package/dist/blessed-contrib/node_modules/chalk/license +21 -0
- package/dist/blessed-contrib/node_modules/chalk/package.json +70 -0
- package/dist/blessed-contrib/node_modules/chalk/readme.md +213 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/index.js +13 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/license +21 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/package.json +41 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/readme.md +27 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/index.js +8 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/license +21 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/package.json +57 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/readme.md +33 -0
- package/dist/blessed-contrib/node_modules/supports-color/index.js +52 -0
- package/dist/blessed-contrib/node_modules/supports-color/license +21 -0
- package/dist/blessed-contrib/node_modules/supports-color/package.json +49 -0
- package/dist/blessed-contrib/node_modules/supports-color/readme.md +36 -0
- package/dist/cli.js +9 -8
- package/dist/cli.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/shadow-npm-inject.js +2 -2
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/vendor.js +19 -5
- package/dist/vendor.js.map +1 -1
- package/package.json +7 -8
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* widget.js - high-level interface for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const widget = exports
|
|
8
|
+
|
|
9
|
+
widget.classes = [
|
|
10
|
+
'Node',
|
|
11
|
+
'Screen',
|
|
12
|
+
'Element',
|
|
13
|
+
'Box',
|
|
14
|
+
'Text',
|
|
15
|
+
'Line',
|
|
16
|
+
'ScrollableBox',
|
|
17
|
+
'ScrollableText',
|
|
18
|
+
'BigText',
|
|
19
|
+
'List',
|
|
20
|
+
'Form',
|
|
21
|
+
'Input',
|
|
22
|
+
'Textarea',
|
|
23
|
+
'Textbox',
|
|
24
|
+
'Button',
|
|
25
|
+
'ProgressBar',
|
|
26
|
+
'FileManager',
|
|
27
|
+
'Checkbox',
|
|
28
|
+
'RadioSet',
|
|
29
|
+
'RadioButton',
|
|
30
|
+
'Prompt',
|
|
31
|
+
'Question',
|
|
32
|
+
'Message',
|
|
33
|
+
'Loading',
|
|
34
|
+
'Listbar',
|
|
35
|
+
'Log',
|
|
36
|
+
'Table',
|
|
37
|
+
'ListTable',
|
|
38
|
+
'Terminal',
|
|
39
|
+
'Image',
|
|
40
|
+
'ANSIImage',
|
|
41
|
+
'OverlayImage',
|
|
42
|
+
'Video',
|
|
43
|
+
'Layout'
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
widget.classes.forEach(function (name) {
|
|
47
|
+
const file = name.toLowerCase()
|
|
48
|
+
widget[name] = widget[file] = require('./widgets/' + file)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
widget.aliases = {
|
|
52
|
+
ListBar: 'Listbar',
|
|
53
|
+
PNG: 'ANSIImage'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Object.keys(widget.aliases).forEach(function (key) {
|
|
57
|
+
const name = widget.aliases[key]
|
|
58
|
+
widget[key] = widget[name]
|
|
59
|
+
widget[key.toLowerCase()] = widget[name]
|
|
60
|
+
})
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ansiimage.js - render PNGS/GIFS as ANSI
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const cp = require('node:child_process')
|
|
12
|
+
|
|
13
|
+
const colors = require('../colors')
|
|
14
|
+
|
|
15
|
+
const Node = require('./node')
|
|
16
|
+
const Box = require('./box')
|
|
17
|
+
|
|
18
|
+
const tng = require('../../vendor/tng')
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* ANSIImage
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function ANSIImage(options) {
|
|
25
|
+
const self = this
|
|
26
|
+
|
|
27
|
+
if (!(this instanceof Node)) {
|
|
28
|
+
return new ANSIImage(options)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
options = options || {}
|
|
32
|
+
options.shrink = true
|
|
33
|
+
|
|
34
|
+
Box.call(this, options)
|
|
35
|
+
|
|
36
|
+
this.scale = this.options.scale || 1.0
|
|
37
|
+
this.options.animate = this.options.animate !== false
|
|
38
|
+
this._noFill = true
|
|
39
|
+
|
|
40
|
+
if (this.options.file) {
|
|
41
|
+
this.setImage(this.options.file)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.screen.on('prerender', function () {
|
|
45
|
+
const lpos = self.lpos
|
|
46
|
+
if (!lpos) {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
// prevent image from blending with itself if there are alpha channels
|
|
50
|
+
self.screen.clearRegion(lpos.xi, lpos.xl, lpos.yi, lpos.yl)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
this.on('destroy', function () {
|
|
54
|
+
self.stop()
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Object.setPrototypeOf(ANSIImage.prototype, Box.prototype)
|
|
59
|
+
|
|
60
|
+
ANSIImage.prototype.type = 'ansiimage'
|
|
61
|
+
|
|
62
|
+
ANSIImage.curl = function (url) {
|
|
63
|
+
try {
|
|
64
|
+
return cp.execFileSync('curl', ['-s', '-A', '', url], {
|
|
65
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
66
|
+
})
|
|
67
|
+
} catch (e) {}
|
|
68
|
+
try {
|
|
69
|
+
return cp.execFileSync('wget', ['-U', '', '-O', '-', url], {
|
|
70
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
71
|
+
})
|
|
72
|
+
} catch (e) {}
|
|
73
|
+
throw new Error('curl or wget failed.')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ANSIImage.prototype.setImage = function (file) {
|
|
77
|
+
this.file = typeof file === 'string' ? file : null
|
|
78
|
+
|
|
79
|
+
if (/^https?:/.test(file)) {
|
|
80
|
+
file = ANSIImage.curl(file)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let width = this.position.width
|
|
84
|
+
let height = this.position.height
|
|
85
|
+
|
|
86
|
+
if (width != null) {
|
|
87
|
+
width = this.width
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (height != null) {
|
|
91
|
+
height = this.height
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
this.setContent('')
|
|
96
|
+
|
|
97
|
+
this.img = tng(file, {
|
|
98
|
+
colors: colors,
|
|
99
|
+
width: width,
|
|
100
|
+
height: height,
|
|
101
|
+
scale: this.scale,
|
|
102
|
+
ascii: this.options.ascii,
|
|
103
|
+
speed: this.options.speed,
|
|
104
|
+
filename: this.file
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
if (width == null || height == null) {
|
|
108
|
+
this.width = this.img.cellmap[0].length
|
|
109
|
+
this.height = this.img.cellmap.length
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (this.img.frames && this.options.animate) {
|
|
113
|
+
this.play()
|
|
114
|
+
} else {
|
|
115
|
+
this.cellmap = this.img.cellmap
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
this.setContent('Image Error: ' + e.message)
|
|
119
|
+
this.img = null
|
|
120
|
+
this.cellmap = null
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ANSIImage.prototype.play = function () {
|
|
125
|
+
const self = this
|
|
126
|
+
if (!this.img) {
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
return this.img.play(function (bmp, cellmap) {
|
|
130
|
+
self.cellmap = cellmap
|
|
131
|
+
self.screen.render()
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
ANSIImage.prototype.pause = function () {
|
|
136
|
+
if (!this.img) {
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
return this.img.pause()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
ANSIImage.prototype.stop = function () {
|
|
143
|
+
if (!this.img) {
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
return this.img.stop()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
ANSIImage.prototype.clearImage = function () {
|
|
150
|
+
this.stop()
|
|
151
|
+
this.setContent('')
|
|
152
|
+
this.img = null
|
|
153
|
+
this.cellmap = null
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
ANSIImage.prototype.render = function () {
|
|
157
|
+
const coords = this._render()
|
|
158
|
+
if (!coords) {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (this.img && this.cellmap) {
|
|
163
|
+
this.img.renderElement(this.cellmap, this)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return coords
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Expose
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
module.exports = ANSIImage
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bigtext.js - bigtext element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('node:fs')
|
|
12
|
+
|
|
13
|
+
const Node = require('./node')
|
|
14
|
+
const Box = require('./box')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* BigText
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function BigText(options) {
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new BigText(options)
|
|
23
|
+
}
|
|
24
|
+
options = options || {}
|
|
25
|
+
options.font = options.font || __dirname + '/../../usr/fonts/ter-u14n.json'
|
|
26
|
+
options.fontBold =
|
|
27
|
+
options.font || __dirname + '/../../usr/fonts/ter-u14b.json'
|
|
28
|
+
this.fch = options.fch
|
|
29
|
+
this.ratio = {}
|
|
30
|
+
this.font = this.loadFont(options.font)
|
|
31
|
+
this.fontBold = this.loadFont(options.font)
|
|
32
|
+
Box.call(this, options)
|
|
33
|
+
if (this.style.bold) {
|
|
34
|
+
this.font = this.fontBold
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Object.setPrototypeOf(BigText.prototype, Box.prototype)
|
|
39
|
+
|
|
40
|
+
BigText.prototype.type = 'bigtext'
|
|
41
|
+
|
|
42
|
+
BigText.prototype.loadFont = function (filename) {
|
|
43
|
+
let self = this,
|
|
44
|
+
data,
|
|
45
|
+
font
|
|
46
|
+
|
|
47
|
+
data = JSON.parse(fs.readFileSync(filename, 'utf8'))
|
|
48
|
+
|
|
49
|
+
this.ratio.width = data.width
|
|
50
|
+
this.ratio.height = data.height
|
|
51
|
+
|
|
52
|
+
function convertLetter(ch, lines) {
|
|
53
|
+
let line, i
|
|
54
|
+
|
|
55
|
+
while (lines.length > self.ratio.height) {
|
|
56
|
+
lines.shift()
|
|
57
|
+
lines.pop()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
lines = lines.map(function (line) {
|
|
61
|
+
let chs = line.split('')
|
|
62
|
+
chs = chs.map(function (ch) {
|
|
63
|
+
return ch === ' ' ? 0 : 1
|
|
64
|
+
})
|
|
65
|
+
while (chs.length < self.ratio.width) {
|
|
66
|
+
chs.push(0)
|
|
67
|
+
}
|
|
68
|
+
return chs
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
while (lines.length < self.ratio.height) {
|
|
72
|
+
line = []
|
|
73
|
+
for (i = 0; i < self.ratio.width; i++) {
|
|
74
|
+
line.push(0)
|
|
75
|
+
}
|
|
76
|
+
lines.push(line)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return lines
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
font = Object.keys(data.glyphs).reduce(function (out, ch) {
|
|
83
|
+
const lines = data.glyphs[ch].map
|
|
84
|
+
out[ch] = convertLetter(ch, lines)
|
|
85
|
+
return out
|
|
86
|
+
}, {})
|
|
87
|
+
|
|
88
|
+
delete font[' ']
|
|
89
|
+
|
|
90
|
+
return font
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
BigText.prototype.setContent = function (content) {
|
|
94
|
+
this.content = ''
|
|
95
|
+
this.text = content || ''
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
BigText.prototype.render = function () {
|
|
99
|
+
if (this.position.width == null || this._shrinkWidth) {
|
|
100
|
+
// if (this.width - this.iwidth < this.ratio.width * this.text.length + 1) {
|
|
101
|
+
this.position.width = this.ratio.width * this.text.length + 1
|
|
102
|
+
this._shrinkWidth = true
|
|
103
|
+
// }
|
|
104
|
+
}
|
|
105
|
+
if (this.position.height == null || this._shrinkHeight) {
|
|
106
|
+
// if (this.height - this.iheight < this.ratio.height + 0) {
|
|
107
|
+
this.position.height = this.ratio.height + 0
|
|
108
|
+
this._shrinkHeight = true
|
|
109
|
+
// }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const coords = this._render()
|
|
113
|
+
if (!coords) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const lines = this.screen.lines,
|
|
118
|
+
left = coords.xi + this.ileft,
|
|
119
|
+
top = coords.yi + this.itop,
|
|
120
|
+
right = coords.xl - this.iright,
|
|
121
|
+
bottom = coords.yl - this.ibottom
|
|
122
|
+
|
|
123
|
+
const dattr = this.sattr(this.style),
|
|
124
|
+
bg = dattr & 0x1ff,
|
|
125
|
+
fg = (dattr >> 9) & 0x1ff,
|
|
126
|
+
flags = (dattr >> 18) & 0x1ff,
|
|
127
|
+
attr = (flags << 18) | (bg << 9) | fg
|
|
128
|
+
|
|
129
|
+
for (let x = left, i = 0; x < right; x += this.ratio.width, i++) {
|
|
130
|
+
const ch = this.text[i]
|
|
131
|
+
if (!ch) {
|
|
132
|
+
break
|
|
133
|
+
}
|
|
134
|
+
const map = this.font[ch]
|
|
135
|
+
if (!map) {
|
|
136
|
+
continue
|
|
137
|
+
}
|
|
138
|
+
for (let y = top; y < Math.min(bottom, top + this.ratio.height); y++) {
|
|
139
|
+
if (!lines[y]) {
|
|
140
|
+
continue
|
|
141
|
+
}
|
|
142
|
+
const mline = map[y - top]
|
|
143
|
+
if (!mline) {
|
|
144
|
+
continue
|
|
145
|
+
}
|
|
146
|
+
for (let mx = 0; mx < this.ratio.width; mx++) {
|
|
147
|
+
const mcell = mline[mx]
|
|
148
|
+
if (mcell == null) {
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
if (this.fch && this.fch !== ' ') {
|
|
152
|
+
lines[y][x + mx][0] = dattr
|
|
153
|
+
lines[y][x + mx][1] = mcell === 1 ? this.fch : this.ch
|
|
154
|
+
} else {
|
|
155
|
+
lines[y][x + mx][0] = mcell === 1 ? attr : dattr
|
|
156
|
+
lines[y][x + mx][1] = mcell === 1 ? ' ' : this.ch
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
lines[y].dirty = true
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return coords
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Expose
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
module.exports = BigText
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* box.js - box element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Element = require('./element')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Box
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function Box(options) {
|
|
19
|
+
if (!(this instanceof Node)) {
|
|
20
|
+
return new Box(options)
|
|
21
|
+
}
|
|
22
|
+
options = options || {}
|
|
23
|
+
Element.call(this, options)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Object.setPrototypeOf(Box.prototype, Element.prototype)
|
|
27
|
+
|
|
28
|
+
Box.prototype.type = 'box'
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Expose
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
module.exports = Box
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* button.js - button element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Input = require('./input')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Button
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function Button(options) {
|
|
19
|
+
const self = this
|
|
20
|
+
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new Button(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
|
|
27
|
+
if (options.autoFocus == null) {
|
|
28
|
+
options.autoFocus = false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Input.call(this, options)
|
|
32
|
+
|
|
33
|
+
this.on('keypress', function (ch, key) {
|
|
34
|
+
if (key.name === 'enter' || key.name === 'space') {
|
|
35
|
+
return self.press()
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
if (this.options.mouse) {
|
|
40
|
+
this.on('click', function () {
|
|
41
|
+
return self.press()
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Object.setPrototypeOf(Button.prototype, Input.prototype)
|
|
47
|
+
|
|
48
|
+
Button.prototype.type = 'button'
|
|
49
|
+
|
|
50
|
+
Button.prototype.press = function () {
|
|
51
|
+
this.focus()
|
|
52
|
+
this.value = true
|
|
53
|
+
const result = this.emit('press')
|
|
54
|
+
delete this.value
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Expose
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
module.exports = Button
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* checkbox.js - checkbox element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Input = require('./input')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Checkbox
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function Checkbox(options) {
|
|
19
|
+
const self = this
|
|
20
|
+
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new Checkbox(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
|
|
27
|
+
Input.call(this, options)
|
|
28
|
+
|
|
29
|
+
this.text = options.content || options.text || ''
|
|
30
|
+
this.checked = this.value = options.checked || false
|
|
31
|
+
|
|
32
|
+
this.on('keypress', function (ch, key) {
|
|
33
|
+
if (key.name === 'enter' || key.name === 'space') {
|
|
34
|
+
self.toggle()
|
|
35
|
+
self.screen.render()
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
if (options.mouse) {
|
|
40
|
+
this.on('click', function () {
|
|
41
|
+
self.toggle()
|
|
42
|
+
self.screen.render()
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.on('focus', function () {
|
|
47
|
+
const lpos = self.lpos
|
|
48
|
+
if (!lpos) {
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
self.screen.program.lsaveCursor('checkbox')
|
|
52
|
+
self.screen.program.cup(lpos.yi, lpos.xi + 1)
|
|
53
|
+
self.screen.program.showCursor()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
this.on('blur', function () {
|
|
57
|
+
self.screen.program.lrestoreCursor('checkbox', true)
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Object.setPrototypeOf(Checkbox.prototype, Input.prototype)
|
|
62
|
+
|
|
63
|
+
Checkbox.prototype.type = 'checkbox'
|
|
64
|
+
|
|
65
|
+
Checkbox.prototype.render = function () {
|
|
66
|
+
this.clearPos(true)
|
|
67
|
+
this.setContent('[' + (this.checked ? 'x' : ' ') + '] ' + this.text, true)
|
|
68
|
+
return this._render()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Checkbox.prototype.check = function () {
|
|
72
|
+
if (this.checked) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
this.checked = this.value = true
|
|
76
|
+
this.emit('check')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Checkbox.prototype.uncheck = function () {
|
|
80
|
+
if (!this.checked) {
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
this.checked = this.value = false
|
|
84
|
+
this.emit('uncheck')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
Checkbox.prototype.toggle = function () {
|
|
88
|
+
return this.checked ? this.uncheck() : this.check()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Expose
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
module.exports = Checkbox
|