@socketsecurity/cli-with-sentry 0.15.55 → 0.15.56
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/bin/cli.js +2 -2
- package/dist/cli.js +24 -24
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +49 -29
- package/dist/constants.js.map +1 -1
- package/dist/{shadow-bin.js → shadow-npm-bin.js} +6 -6
- package/dist/shadow-npm-bin.js.map +1 -0
- package/dist/{shadow-inject.js → shadow-npm-inject.js} +1 -1
- package/dist/shadow-npm-inject.js.map +1 -0
- package/dist/types/constants.d.mts +9 -5
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/utils.js +5 -5
- package/dist/utils.js.map +1 -1
- package/external/@coana-tech/cli/cli.mjs +122 -7
- package/external/blessed-contrib/lib/layout/grid.js +400 -32
- package/external/blessed-contrib/lib/widget/charts/bar.js +8338 -67
- package/external/blessed-contrib/lib/widget/charts/line.js +17861 -196
- package/external/blessed-contrib/lib/widget/table.js +140 -121
- package/package.json +12 -11
- package/dist/shadow-bin.js.map +0 -1
- package/dist/shadow-inject.js.map +0 -1
- package/external/blessed-contrib/index.js +0 -28
- package/external/blessed-contrib/lib/layout/carousel.js +0 -74
- package/external/blessed-contrib/lib/server-utils.js +0 -73
- package/external/blessed-contrib/lib/utils.js +0 -73
- package/external/blessed-contrib/lib/widget/canvas.js +0 -51
- package/external/blessed-contrib/lib/widget/charts/stacked-bar.js +0 -218
- package/external/blessed-contrib/lib/widget/donut.js +0 -149
- package/external/blessed-contrib/lib/widget/gauge-list.js +0 -106
- package/external/blessed-contrib/lib/widget/gauge.js +0 -125
- package/external/blessed-contrib/lib/widget/lcd.js +0 -451
- package/external/blessed-contrib/lib/widget/log.js +0 -33
- package/external/blessed-contrib/lib/widget/map.js +0 -86
- package/external/blessed-contrib/lib/widget/markdown.js +0 -64
- package/external/blessed-contrib/lib/widget/picture.js +0 -66
- package/external/blessed-contrib/lib/widget/sparkline.js +0 -58
- package/external/blessed-contrib/lib/widget/tree.js +0 -167
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var Node = require('../../../blessed/lib/widgets/node')
|
|
4
|
-
, Canvas = require('./canvas');
|
|
5
|
-
|
|
6
|
-
function Gauge(options) {
|
|
7
|
-
if (!(this instanceof Node)) {
|
|
8
|
-
return new Gauge(options);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var self = this;
|
|
12
|
-
|
|
13
|
-
options = options || {};
|
|
14
|
-
self.options = options;
|
|
15
|
-
self.options.stroke = options.stroke || 'magenta';
|
|
16
|
-
self.options.fill = options.fill || 'white';
|
|
17
|
-
self.options.data = options.data || [];
|
|
18
|
-
self.options.showLabel = options.showLabel !== false;
|
|
19
|
-
|
|
20
|
-
Canvas.call(this, options, require('ansi-term'));
|
|
21
|
-
|
|
22
|
-
this.on('attach', function() {
|
|
23
|
-
if (self.options.stack) {
|
|
24
|
-
var stack = this.stack = self.options.stack;
|
|
25
|
-
this.setStack(stack);
|
|
26
|
-
} else {
|
|
27
|
-
var percent = this.percent = self.options.percent || 0;
|
|
28
|
-
this.setData(percent);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Gauge.prototype = Object.create(Canvas.prototype);
|
|
34
|
-
|
|
35
|
-
Gauge.prototype.calcSize = function() {
|
|
36
|
-
this.canvasSize = {width: this.width-2, height: this.height};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Gauge.prototype.type = 'gauge';
|
|
40
|
-
|
|
41
|
-
Gauge.prototype.setData = function(data){
|
|
42
|
-
if (typeof(data) == typeof([]) && data.length > 0){
|
|
43
|
-
this.setStack(data);
|
|
44
|
-
} else if(typeof(data) == typeof(1)) {
|
|
45
|
-
this.setPercent(data);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
Gauge.prototype.setPercent = function(percent) {
|
|
50
|
-
|
|
51
|
-
if (!this.ctx) {
|
|
52
|
-
throw 'error: canvas context does not exist. setData() for gauges must be called after the gauge has been added to the screen via screen.append()';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var c = this.ctx;
|
|
56
|
-
|
|
57
|
-
c.strokeStyle = this.options.stroke;//'magenta'
|
|
58
|
-
c.fillStyle = this.options.fill;//'white'
|
|
59
|
-
|
|
60
|
-
c.clearRect(0, 0, this.canvasSize.width, this.canvasSize.height);
|
|
61
|
-
if (percent < 1.001){
|
|
62
|
-
percent = percent * 100;
|
|
63
|
-
}
|
|
64
|
-
var width = percent/100*(this.canvasSize.width-3);
|
|
65
|
-
c.fillRect(1, 2, width, 2);
|
|
66
|
-
|
|
67
|
-
var textX = 7;
|
|
68
|
-
if (width<textX) {
|
|
69
|
-
c.strokeStyle = 'normal';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (this.options.showLabel) c.fillText(Math.round(percent)+'%', textX, 3);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
Gauge.prototype.setStack = function(stack) {
|
|
76
|
-
var colors = ['green','magenta','cyan','red','blue'];
|
|
77
|
-
|
|
78
|
-
if (!this.ctx) {
|
|
79
|
-
throw 'error: canvas context does not exist. setData() for gauges must be called after the gauge has been added to the screen via screen.append()';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var c = this.ctx;
|
|
83
|
-
var leftStart = 1;
|
|
84
|
-
var textLeft = 5;
|
|
85
|
-
c.clearRect(0, 0, this.canvasSize.width, this.canvasSize.height);
|
|
86
|
-
|
|
87
|
-
for (var i = 0; i < stack.length; i++) {
|
|
88
|
-
var currentStack = stack[i];
|
|
89
|
-
|
|
90
|
-
let percent;
|
|
91
|
-
if (typeof(currentStack) == typeof({}))
|
|
92
|
-
percent = currentStack.percent;
|
|
93
|
-
else
|
|
94
|
-
percent = currentStack;
|
|
95
|
-
|
|
96
|
-
c.strokeStyle = currentStack.stroke || colors[(i%colors.length)]; // use specified or choose from the array of colors
|
|
97
|
-
c.fillStyle = this.options.fill;//'white'
|
|
98
|
-
|
|
99
|
-
textLeft = 5;
|
|
100
|
-
if (percent < 1.001){
|
|
101
|
-
percent = percent * 100;
|
|
102
|
-
}
|
|
103
|
-
var width = percent/100*(this.canvasSize.width-3);
|
|
104
|
-
|
|
105
|
-
c.fillRect(leftStart, 2, width, 2);
|
|
106
|
-
|
|
107
|
-
textLeft = (width / 2) - 1;
|
|
108
|
-
// if (textLeft)
|
|
109
|
-
var textX = leftStart+textLeft;
|
|
110
|
-
|
|
111
|
-
if ((leftStart+width)<textX) {
|
|
112
|
-
c.strokeStyle = 'normal';
|
|
113
|
-
}
|
|
114
|
-
if (this.options.showLabel) c.fillText(percent+'%', textX, 3);
|
|
115
|
-
|
|
116
|
-
leftStart += width;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
Gauge.prototype.getOptionsPrototype = function() {
|
|
121
|
-
return {percent: 10};
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
module.exports = Gauge;
|
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var Node = require('../../../blessed/lib/widgets/node')
|
|
4
|
-
, Canvas = require('./canvas');
|
|
5
|
-
|
|
6
|
-
function LCD(options) {
|
|
7
|
-
if (!(this instanceof Node)) {
|
|
8
|
-
return new LCD(options);
|
|
9
|
-
}
|
|
10
|
-
var self = this;
|
|
11
|
-
|
|
12
|
-
options = options || {};
|
|
13
|
-
self.options = options;
|
|
14
|
-
|
|
15
|
-
//these options need to be modified epending on the resulting positioning/size
|
|
16
|
-
self.options.segmentWidth = options.segmentWidth || 0.06; // how wide are the segments in % so 50% = 0.5
|
|
17
|
-
self.options.segmentInterval = options.segmentInterval || 0.11; // spacing between the segments in % so 50% = 0.5
|
|
18
|
-
self.options.strokeWidth = options.strokeWidth || 0.11; // spacing between the segments in % so 50% = 0.5
|
|
19
|
-
|
|
20
|
-
//default display settings
|
|
21
|
-
self.options.elements = options.elements || 3; // how many elements in the display. or how many characters can be displayed.
|
|
22
|
-
self.options.display = options.display || 321; // what should be displayed before anything is set
|
|
23
|
-
self.options.elementSpacing = options.spacing || 4; // spacing between each element
|
|
24
|
-
self.options.elementPadding = options.padding || 2; // how far away from the edges to put the elements
|
|
25
|
-
|
|
26
|
-
//coloring
|
|
27
|
-
self.options.color = options.color || 'white';
|
|
28
|
-
|
|
29
|
-
Canvas.call(this, options);
|
|
30
|
-
|
|
31
|
-
this.segment16 = null;
|
|
32
|
-
|
|
33
|
-
this.on('attach', function() {
|
|
34
|
-
var display = self.options.display || 1234;
|
|
35
|
-
if (!this.segment16)
|
|
36
|
-
this.segment16 = new SixteenSegment(this.options.elements, this.ctx, this.canvasSize.width, this.canvasSize.height, 0, 0, this.options);
|
|
37
|
-
|
|
38
|
-
this.setDisplay(display);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
LCD.prototype = Object.create(Canvas.prototype);
|
|
43
|
-
|
|
44
|
-
LCD.prototype.calcSize = function() {
|
|
45
|
-
this.canvasSize = {width: this.width*2-8, height: (this.height*4)-12};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
LCD.prototype.type = 'lcd';
|
|
49
|
-
LCD.prototype.increaseWidth = function(){
|
|
50
|
-
if (this.segment16){
|
|
51
|
-
this.segment16.SegmentWidth+=0.01;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
LCD.prototype.decreaseWidth = function(){
|
|
55
|
-
if (this.segment16){
|
|
56
|
-
this.segment16.SegmentWidth-=0.01;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
LCD.prototype.increaseInterval = function(){
|
|
60
|
-
if (this.segment16){
|
|
61
|
-
this.segment16.SegmentInterval+=0.01;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
LCD.prototype.decreaseInterval = function(){
|
|
65
|
-
if (this.segment16){
|
|
66
|
-
this.segment16.SegmentInterval-=0.01;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
LCD.prototype.increaseStroke = function(){
|
|
70
|
-
if (this.segment16){
|
|
71
|
-
this.segment16.StrokeWidth+=0.05;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
LCD.prototype.decreaseStroke = function(){
|
|
75
|
-
if (this.segment16){
|
|
76
|
-
this.segment16.StrokeWidth-=0.05;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
LCD.prototype.setOptions = function(options){
|
|
80
|
-
if (this.segment16){
|
|
81
|
-
this.segment16.setOptions(options);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
LCD.prototype.setData = function(data){
|
|
86
|
-
this.setDisplay(data.toString());
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
LCD.prototype.getOptionsPrototype = function() {
|
|
90
|
-
return {
|
|
91
|
-
label: 'LCD Test',
|
|
92
|
-
segmentWidth: 0.06,
|
|
93
|
-
segmentInterval: 0.11,
|
|
94
|
-
strokeWidth: 0.1,
|
|
95
|
-
elements: 5,
|
|
96
|
-
display: 3210,
|
|
97
|
-
elementSpacing: 4,
|
|
98
|
-
elementPadding: 2
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
LCD.prototype.setDisplay = function(display) {
|
|
103
|
-
|
|
104
|
-
if (!this.ctx) {
|
|
105
|
-
throw 'error: canvas context does not exist. setData() for line charts must be called after the chart has been added to the screen via screen.append()';
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
this.ctx.clearRect(0, 0, this.canvasSize.width, this.canvasSize.height);
|
|
109
|
-
|
|
110
|
-
this.segment16.DisplayText(display);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
function ElementArray(count) {
|
|
114
|
-
this.SetCount = SetCount;
|
|
115
|
-
this.SetText = SetText;
|
|
116
|
-
this.SetElementValue = SetElementValue;
|
|
117
|
-
this.NullMask = 0x10;
|
|
118
|
-
this.Elements = [];
|
|
119
|
-
this.SetCount(count || 0);
|
|
120
|
-
|
|
121
|
-
function SetCount(count) {
|
|
122
|
-
var c = parseInt(count, 10);
|
|
123
|
-
if (isNaN(c)) {
|
|
124
|
-
throw 'Invalid element count: ' + count;
|
|
125
|
-
}
|
|
126
|
-
this.Elements = [c];
|
|
127
|
-
for (var i = 0; i < c; i++) {
|
|
128
|
-
this.Elements[i] = 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function SetText(value, charMaps) {
|
|
133
|
-
// Get the string of the value passed in
|
|
134
|
-
if (value === null) {
|
|
135
|
-
value = '';
|
|
136
|
-
}
|
|
137
|
-
value = value.toString();
|
|
138
|
-
|
|
139
|
-
// Clear the elements
|
|
140
|
-
for (var i = 0; i < this.Elements.length; i++) {
|
|
141
|
-
this.SetElementValue(i, 0);
|
|
142
|
-
}
|
|
143
|
-
if (value.length === 0) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
// Set the bitmask to dispay the proper character for each element
|
|
147
|
-
for (var e = 0; e < this.Elements.length && e < value.length; e++){
|
|
148
|
-
var c = value[e];
|
|
149
|
-
var mask = charMaps[c];
|
|
150
|
-
// Use blank of there is no bitmask for this character
|
|
151
|
-
if (mask === null || mask === undefined) {
|
|
152
|
-
mask = this.NullMask;
|
|
153
|
-
}
|
|
154
|
-
this.SetElementValue(e, mask);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function SetElementValue(i, value) {
|
|
158
|
-
if (i >= 0 && i < this.Elements.length){
|
|
159
|
-
this.Elements[i] = parseInt(value, 10);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
//thx to https://github.com/Enderer/sixteensegment!!!
|
|
165
|
-
//although it needed HEAVY rework since it was already somewhat busted ;-(
|
|
166
|
-
function SixteenSegment(count, canvas, width, height, x, y, options){
|
|
167
|
-
this.ElementArray = new ElementArray(count);
|
|
168
|
-
|
|
169
|
-
this.SegmentWidth = options.segmentWidth;//(this.ElementWidth * 0.0015) * 5 //0.1; // Width of segments (% of Element Width)
|
|
170
|
-
this.SegmentInterval = options.segmentInterval;//(this.ElementWidth * 0.0015) * 10 // 0.20; // Spacing between segments (% of Element Width)
|
|
171
|
-
this.BevelWidth = 0.01; // Size of corner bevel (% of Element Width)
|
|
172
|
-
this.SideBevelEnabled = true; // Should the sides be beveled
|
|
173
|
-
this.StrokeLight = options.color; // Color of an on segment outline
|
|
174
|
-
|
|
175
|
-
this.StrokeWidth = options.strokeWidth; // Width of segment outline
|
|
176
|
-
this.Padding = options.elementPadding; // Padding around the display
|
|
177
|
-
this.Spacing = options.elementSpacing; // Spacing between elements
|
|
178
|
-
|
|
179
|
-
this.ElementWidth = (width - (this.Spacing*count))/count;
|
|
180
|
-
this.ElementHeight = height - (this.Padding*2);
|
|
181
|
-
|
|
182
|
-
// console.error("w %s h %s", this.ElementWidth, this.ElementHeight);
|
|
183
|
-
|
|
184
|
-
this.FillLight = 'red'; // Color of an on segment
|
|
185
|
-
this.FillDark = 'cyan'; // Color of an off segment
|
|
186
|
-
this.StrokeDark = 'black'; // Color of an off segment outline
|
|
187
|
-
|
|
188
|
-
this.X = 0;
|
|
189
|
-
this.Y = 0;
|
|
190
|
-
|
|
191
|
-
this.ElementCount = count;
|
|
192
|
-
|
|
193
|
-
this.CalcElementDimensions = CalcElementDimensions;
|
|
194
|
-
this.FlipVertical = FlipVertical;
|
|
195
|
-
this.FlipHorizontal = FlipHorizontal;
|
|
196
|
-
this.CalcPoints = CalcPoints;
|
|
197
|
-
this.DisplayText = DisplayText;
|
|
198
|
-
this.Draw = Draw;
|
|
199
|
-
this.setOptions = setOptions;
|
|
200
|
-
|
|
201
|
-
this.Width = width || canvas.width;
|
|
202
|
-
this.Height = height || canvas.height;
|
|
203
|
-
|
|
204
|
-
this.Canvas = canvas;
|
|
205
|
-
this.CalcPoints();
|
|
206
|
-
this.ElementArray.SetCount(count);
|
|
207
|
-
|
|
208
|
-
function setOptions(options){
|
|
209
|
-
if (options.elements)
|
|
210
|
-
this.ElementArray.SetCount(options.elements);
|
|
211
|
-
|
|
212
|
-
this.SegmentWidth = options.segmentWidth || this.SegmentWidth;
|
|
213
|
-
this.SegmentInterval = options.segmentInterval || this.SegmentInterval;
|
|
214
|
-
this.BevelWidth = 0.01;
|
|
215
|
-
this.SideBevelEnabled = true;
|
|
216
|
-
this.StrokeLight = options.color || this.StrokeLight;
|
|
217
|
-
|
|
218
|
-
this.StrokeWidth = options.strokeWidth || this.StrokeWidth;
|
|
219
|
-
this.Padding = options.elementPadding || this.Padding;
|
|
220
|
-
this.Spacing = options.elementSpacing || this.Spacing;
|
|
221
|
-
|
|
222
|
-
this.ElementWidth = (width - (this.Spacing*count))/count;
|
|
223
|
-
this.ElementHeight = height - (this.Padding*2);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function DisplayText(value) {
|
|
227
|
-
// Recalculate points in case any settings changed
|
|
228
|
-
// console.error("si: %s, sw: %s", this.SegmentInterval, this.SegmentWidth);
|
|
229
|
-
// console.error("st: %s", this.StrokeWidth);
|
|
230
|
-
// Set the display patterns and draw the canvas
|
|
231
|
-
this.ElementArray.SetText(value, CharacterMasks);
|
|
232
|
-
this.CalcPoints();
|
|
233
|
-
this.Draw(this.Canvas, this.ElementArray.Elements);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function CalcElementDimensions() {
|
|
237
|
-
var n = this.ElementCount;
|
|
238
|
-
var h = this.ElementHeight;
|
|
239
|
-
h -= this.Padding * 2;
|
|
240
|
-
|
|
241
|
-
var w = this.Width;
|
|
242
|
-
w -= this.Spacing * (n - 1);
|
|
243
|
-
w -= this.Padding * 2;
|
|
244
|
-
w /= n;
|
|
245
|
-
var output = { Width: w, Height: h };
|
|
246
|
-
// console.error(output);
|
|
247
|
-
return output;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function FlipVertical(points, height) {
|
|
251
|
-
var flipped = [];
|
|
252
|
-
for(var i=0;i<points.length;i++) {
|
|
253
|
-
flipped[i] = {};
|
|
254
|
-
flipped[i].x = points[i].x;
|
|
255
|
-
flipped[i].y = height - points[i].y;
|
|
256
|
-
}
|
|
257
|
-
return flipped;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function FlipHorizontal(points, width) {
|
|
261
|
-
var flipped = [];
|
|
262
|
-
for(var i=0;i<points.length;i++) {
|
|
263
|
-
flipped[i] = {};
|
|
264
|
-
flipped[i].x = width - points[i].x;
|
|
265
|
-
flipped[i].y = points[i].y;
|
|
266
|
-
}
|
|
267
|
-
return flipped;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function Draw(context, elements) {
|
|
271
|
-
// Get the context and clear the area
|
|
272
|
-
context.clearRect(this.X, this.Y, this.Width, this.Height);
|
|
273
|
-
context.save();
|
|
274
|
-
|
|
275
|
-
// Calculate the width and spacing of each element
|
|
276
|
-
var elementWidth = this.CalcElementDimensions().Width;
|
|
277
|
-
// console.error("width: %s", elementWidth);
|
|
278
|
-
// Offset to adjust for starting point and padding
|
|
279
|
-
context.translate(this.X, this.Y);
|
|
280
|
-
context.translate(this.Padding, this.Padding);
|
|
281
|
-
|
|
282
|
-
// Draw each segment of each element
|
|
283
|
-
for (var i = 0; i < elements.length; i++) {
|
|
284
|
-
var element = elements[i];
|
|
285
|
-
for (var s = 0; s < this.Points.length; s++) {
|
|
286
|
-
// Pick the on or off color based on the bitmask
|
|
287
|
-
var color = (element & 1 << s) ? this.FillLight : this.FillDark;
|
|
288
|
-
var stroke = (element & 1 << s) ? this.StrokeLight : this.StrokeDark;
|
|
289
|
-
if (stroke == this.StrokeDark) continue;
|
|
290
|
-
// console.error("c: %s, s: %s", color, stroke);
|
|
291
|
-
context.lineWidth = this.StrokeWidth;
|
|
292
|
-
context.strokeStyle = stroke;
|
|
293
|
-
context.fillStyle = color;
|
|
294
|
-
context.moveTo(0,0);
|
|
295
|
-
context.beginPath();
|
|
296
|
-
context.moveTo(this.Points[s][0].x, this.Points[s][0].y);
|
|
297
|
-
// Create the segment path
|
|
298
|
-
var maxX = 0;
|
|
299
|
-
for(var p = 1; p < this.Points[s].length; p++) {
|
|
300
|
-
if (this.Points[s][p].x > maxX)
|
|
301
|
-
maxX = this.Points[s][p].x;
|
|
302
|
-
context.lineTo(Math.round(this.Points[s][p].x), Math.round(this.Points[s][p].y));
|
|
303
|
-
}
|
|
304
|
-
context.closePath();
|
|
305
|
-
context.fill();
|
|
306
|
-
context.stroke();
|
|
307
|
-
if (this.StrokeWidth > 0) {
|
|
308
|
-
context.stroke();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
context.translate(elementWidth+this.Spacing, 0);
|
|
312
|
-
}
|
|
313
|
-
context.restore();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
function CalcPoints() {
|
|
317
|
-
var w = this.ElementWidth,
|
|
318
|
-
h = this.ElementHeight,
|
|
319
|
-
sw = this.SegmentWidth * w,
|
|
320
|
-
si = this.SegmentInterval * w,
|
|
321
|
-
bw = this.BevelWidth * sw,
|
|
322
|
-
ib = (this.SideBevelEnabled) ? 1 : 0,
|
|
323
|
-
sf = sw * 0.8,
|
|
324
|
-
slope = h / w,
|
|
325
|
-
sqrt2 = Math.SQRT2,
|
|
326
|
-
sqrt3 = Math.sqrt(3);
|
|
327
|
-
|
|
328
|
-
// Base position of points w/out bevel and interval
|
|
329
|
-
var w0 = w / 2 - sw / 2, h0 = 0,
|
|
330
|
-
w1 = w / 2, h1 = sw / 2,
|
|
331
|
-
w2 = w / 2 + sw / 2, h2 = sw,
|
|
332
|
-
w3 = w - sw, h3 = h / 2 - sw / 2,
|
|
333
|
-
w4 = w - sw / 2, h4 = h / 2,
|
|
334
|
-
w5 = w, h5 = h / 2 + sw / 2;
|
|
335
|
-
|
|
336
|
-
// Order of segments stored in Points[][]
|
|
337
|
-
var A1 = 0, A2 = 1, B = 2, C = 3, D1 = 4, D2 = 5, E = 6, F = 7,
|
|
338
|
-
G1 = 8, G2 = 9, H = 10, I = 11, J = 12, K = 13, L = 14, M = 15;
|
|
339
|
-
|
|
340
|
-
// Create the points array for all segments
|
|
341
|
-
var points = [];
|
|
342
|
-
points[A1] = [
|
|
343
|
-
{ x: bw * 2 + si / sqrt2, y: h0 },
|
|
344
|
-
{ x: w1 - si / 2 - sw / 2 * ib, y: h0 },
|
|
345
|
-
{ x: w1 - si / 2, y: h1 },
|
|
346
|
-
{ x: w0 - si / 2, y: h2 },
|
|
347
|
-
{ x: sw + si / sqrt2, y: h2 },
|
|
348
|
-
{ x: bw + si / sqrt2, y: h0 + bw }
|
|
349
|
-
];
|
|
350
|
-
points[G2] = [
|
|
351
|
-
{ x: w2 + si / sqrt2, y: h3 },
|
|
352
|
-
{ x: w3 - si / 2 * sqrt3, y: h3 },
|
|
353
|
-
{ x: w4 - si / 2 * sqrt3, y: h4 },
|
|
354
|
-
{ x: w3 - si / 2 * sqrt3, y: h5 },
|
|
355
|
-
{ x: w2 + si / sqrt2, y: h5 },
|
|
356
|
-
{ x: w1 + si / sqrt2, y: h4 }
|
|
357
|
-
];
|
|
358
|
-
points[B] = [
|
|
359
|
-
{ x: w5, y: h0 + bw * 2 + si / sqrt2 },
|
|
360
|
-
{ x: w5, y: h4 - si / 2 - sw / 2 * ib },
|
|
361
|
-
{ x: w4, y: h4 - si / 2 },
|
|
362
|
-
{ x: w3, y: h3 - si / 2 },
|
|
363
|
-
{ x: w3, y: h2 + si / sqrt2 },
|
|
364
|
-
{ x: w5 - bw, y: h0 + bw + si / sqrt2 }
|
|
365
|
-
];
|
|
366
|
-
points[I] = [
|
|
367
|
-
{ x: w2, y: h2 + si / 2 * sqrt3 },
|
|
368
|
-
{ x: w2, y: h3 - si / sqrt2 },
|
|
369
|
-
{ x: w1, y: h4 - si / sqrt2 },
|
|
370
|
-
{ x: w0, y: h3 - si / sqrt2 },
|
|
371
|
-
{ x: w0, y: h2 + si / 2 * sqrt3 },
|
|
372
|
-
{ x: w1, y: h1 + si / 2 * sqrt3 }
|
|
373
|
-
];
|
|
374
|
-
points[H] = [
|
|
375
|
-
{ x: (sw + sf) / slope + si, y: h2 + si },
|
|
376
|
-
{ x: w0 - si, y: w0 * slope - sf - si },
|
|
377
|
-
{ x: w0 - si, y: h3 - si },
|
|
378
|
-
{ x: (h3 - sf) / slope - si, y: h3 - si },
|
|
379
|
-
{ x: sw + si, y: h2 * slope + sf + si },
|
|
380
|
-
{ x: sw + si, y: h2 + si }
|
|
381
|
-
];
|
|
382
|
-
points[A2] = this.FlipHorizontal(points[A1], w); // A2
|
|
383
|
-
points[C] = this.FlipVertical(points[2], h); // C
|
|
384
|
-
points[D1] = this.FlipVertical(points[0], h); // D1
|
|
385
|
-
points[D2] = this.FlipHorizontal(points[4], w); // D2
|
|
386
|
-
points[E] = this.FlipHorizontal(points[3], w); // E
|
|
387
|
-
points[F] = this.FlipHorizontal(points[2], w); // F
|
|
388
|
-
points[G1] = this.FlipHorizontal(points[9], w); // G1
|
|
389
|
-
points[J] = this.FlipHorizontal(points[10], w); // J
|
|
390
|
-
points[K] = this.FlipVertical(points[12], h); // K
|
|
391
|
-
points[L] = this.FlipVertical(points[11], h); // L
|
|
392
|
-
points[M] = this.FlipVertical(points[10], h); // M
|
|
393
|
-
this.Points = points;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
var CharacterMasks = (function() {
|
|
397
|
-
// Segment Bitmasks for individual segments.
|
|
398
|
-
// Binary Or them together to create bitmasks
|
|
399
|
-
// a1|a2|b|c|d1|d2|e|f|g1|g2|h|i|j|k|l|m
|
|
400
|
-
var a1 = 1 << 0, a2 = 1 << 1, b = 1 << 2, c = 1 << 3,
|
|
401
|
-
d1 = 1 << 4, d2 = 1 << 5, e = 1 << 6, f = 1 << 7,
|
|
402
|
-
g1 = 1 << 8, g2 = 1 << 9, h = 1 << 10, i = 1 << 11,
|
|
403
|
-
j = 1 << 12, k = 1 << 13, l = 1 << 14, m = 1 << 15;
|
|
404
|
-
// Character map associates characters with a bit pattern
|
|
405
|
-
return {
|
|
406
|
-
' ' : 0,
|
|
407
|
-
'' : 0,
|
|
408
|
-
'0' : a1|a2|b|c|d1|d2|e|f|j|m,
|
|
409
|
-
'1' : b|c|j,
|
|
410
|
-
'2' : a1|a2|b|d1|d2|e|g1|g2,
|
|
411
|
-
'3' : a1|a2|b|c|d1|d2|g2,
|
|
412
|
-
'4' : b|c|f|g1|g2,
|
|
413
|
-
'5' : a1|a2|c|d1|d2|f|g1|g2,
|
|
414
|
-
'6' : a1|a2|c|d1|d2|e|f|g1|g2,
|
|
415
|
-
'7' : a1|a2|b|c,
|
|
416
|
-
'8' : a1|a2|b|c|d1|d2|e|f|g1|g2,
|
|
417
|
-
'9' : a1|a2|b|c|f|g1|g2,
|
|
418
|
-
'A' : e|f|a1|a2|b|c|g1|g2,
|
|
419
|
-
'B' : a1|a2|b|c|d1|d2|g2|i|l,
|
|
420
|
-
'C' : a1|a2|f|e|d1|d2,
|
|
421
|
-
'D' : a1|a2|b|c|d1|d2|i|l,
|
|
422
|
-
'E' : a1|a2|f|e|d1|d2|g1|g2,
|
|
423
|
-
'F' : a1|a2|e|f|g1 ,
|
|
424
|
-
'G' : a1|a2|c|d1|d2|e|f|g2,
|
|
425
|
-
'H' : b|c|e|f|g1|g2,
|
|
426
|
-
'I' : a1|a2|d1|d2|i|l,
|
|
427
|
-
'J' : b|c|d1|d2|e,
|
|
428
|
-
'K' : e|f|g1|j|k,
|
|
429
|
-
'L' : d1|d2|e|f,
|
|
430
|
-
'M' : b|c|e|f|h|j,
|
|
431
|
-
'N' : b|c|e|f|h|k,
|
|
432
|
-
'O' : a1|a2|b|c|d1|d2|e|f,
|
|
433
|
-
'P' : a1|a2|b|e|f|g1|g2,
|
|
434
|
-
'Q' : a1|a2|b|c|d1|d2|e|f|k,
|
|
435
|
-
'R' : a1|a2|b|e|f|g1|g2|k,
|
|
436
|
-
'S' : a1|a2|c|d1|d2|f|g1|g2,
|
|
437
|
-
'T' : a1|a2|i|l,
|
|
438
|
-
'U' : b|c|d1|d2|e|f,
|
|
439
|
-
'V' : e|f|j|m,
|
|
440
|
-
'W' : b|c|e|f|k|m,
|
|
441
|
-
'X' : h|j|k|m,
|
|
442
|
-
'Y' : b|f|g1|g2|l,
|
|
443
|
-
'Z' : a1|a2|d1|d2|j|m,
|
|
444
|
-
'-' : g1|g2,
|
|
445
|
-
'?' : a1|a2|b|g2|l,
|
|
446
|
-
'+' : g1|g2|i|l,
|
|
447
|
-
'*' : g1|g2|h|i|j|k|l|m
|
|
448
|
-
};
|
|
449
|
-
}());
|
|
450
|
-
|
|
451
|
-
module.exports = LCD;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var List = require('../../../blessed/lib/widgets/list')
|
|
4
|
-
, Node = require('../../../blessed/lib/widgets/node');
|
|
5
|
-
|
|
6
|
-
function Log(options) {
|
|
7
|
-
if (!(this instanceof Node)) {
|
|
8
|
-
return new Log(options);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
options = options || {};
|
|
12
|
-
options.bufferLength = options.bufferLength || 30;
|
|
13
|
-
this.options = options;
|
|
14
|
-
List.call(this, options);
|
|
15
|
-
|
|
16
|
-
this.logLines = [];
|
|
17
|
-
this.interactive = false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
Log.prototype = Object.create(List.prototype);
|
|
21
|
-
|
|
22
|
-
Log.prototype.log = function(str) {
|
|
23
|
-
this.logLines.push(str);
|
|
24
|
-
if (this.logLines.length>this.options.bufferLength) {
|
|
25
|
-
this.logLines.shift();
|
|
26
|
-
}
|
|
27
|
-
this.setItems(this.logLines);
|
|
28
|
-
this.scrollTo(this.logLines.length);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Log.prototype.type = 'log';
|
|
32
|
-
|
|
33
|
-
module.exports = Log;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var InnerMap = require('map-canvas')
|
|
4
|
-
, Node = require('../../../blessed/lib/widgets/node')
|
|
5
|
-
, Canvas = require('./canvas');
|
|
6
|
-
|
|
7
|
-
function Map(options) {
|
|
8
|
-
var self = this;
|
|
9
|
-
|
|
10
|
-
if (!(this instanceof Node)) {
|
|
11
|
-
return new Map(options);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
Canvas.call(this, options);
|
|
15
|
-
|
|
16
|
-
this.on('attach', function() {
|
|
17
|
-
|
|
18
|
-
options.style = options.style || {};
|
|
19
|
-
|
|
20
|
-
var opts = { excludeAntartica: (options.excludeAntarctica === undefined) ? true : options.excludeAntarctica
|
|
21
|
-
, disableBackground: (options.disableBackground === undefined) ? true : options.disableBackground
|
|
22
|
-
, disableMapBackground: (options.disableMapBackground === undefined) ? true : options.disableMapBackground
|
|
23
|
-
, disableGraticule: (options.disableGraticule === undefined) ? true : options.disableGraticule
|
|
24
|
-
, disableFill: (options.disableFill === undefined) ? true : options.disableFill
|
|
25
|
-
, width: self.ctx._canvas.width
|
|
26
|
-
, height: self.ctx._canvas.height
|
|
27
|
-
, shapeColor: options.style.shapeColor || 'green'};
|
|
28
|
-
|
|
29
|
-
opts.startLon = options.startLon || undefined;
|
|
30
|
-
opts.endLon = options.endLon || undefined;
|
|
31
|
-
opts.startLat = options.startLat || undefined;
|
|
32
|
-
opts.endLat = options.endLat || undefined;
|
|
33
|
-
opts.region = options.region || undefined;
|
|
34
|
-
opts.labelSpace = options.labelSpace || 5;
|
|
35
|
-
|
|
36
|
-
this.ctx.strokeStyle= options.style.stroke || 'green';
|
|
37
|
-
this.ctx.fillStyle=options.style.fill || 'green';
|
|
38
|
-
|
|
39
|
-
self.innerMap = new InnerMap(opts, this._canvas);
|
|
40
|
-
self.innerMap.draw();
|
|
41
|
-
|
|
42
|
-
if (self.options.markers) {
|
|
43
|
-
|
|
44
|
-
for (var m in self.options.markers) {
|
|
45
|
-
self.addMarker(self.options.markers[m]);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
Map.prototype = Object.create(Canvas.prototype);
|
|
53
|
-
|
|
54
|
-
Map.prototype.calcSize = function() {
|
|
55
|
-
this.canvasSize = {width: this.width*2-12, height: this.height*4};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Map.prototype.type = 'map';
|
|
59
|
-
|
|
60
|
-
Map.prototype.addMarker = function(options) {
|
|
61
|
-
if (!this.innerMap) {
|
|
62
|
-
throw 'error: canvas context does not exist. addMarker() for maps must be called after the map has been added to the screen via screen.append()';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
this.innerMap.addMarker(options);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Map.prototype.getOptionsPrototype = function() {
|
|
69
|
-
|
|
70
|
-
return { startLon: 10
|
|
71
|
-
, endLon: 10
|
|
72
|
-
, startLat: 10
|
|
73
|
-
, endLat: 10
|
|
74
|
-
, region: 'us'
|
|
75
|
-
, markers:
|
|
76
|
-
[ {'lon' : '-79.0000', 'lat' : '37.5000', color: 'red', char: 'X' }
|
|
77
|
-
,{'lon' : '79.0000', 'lat' : '37.5000', color: 'blue', char: 'O' }
|
|
78
|
-
]
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
Map.prototype.clearMarkers = function() {
|
|
83
|
-
this.innerMap.draw();
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
module.exports = Map;
|