Comparing version 1.3.0 to 1.4.0
@@ -5,10 +5,16 @@ "use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _createClass2 = require("babel-runtime/helpers/createClass"); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var ANSI_COLORS = [[{ color: "0, 0, 0", "class": "ansi-black" }, { color: "187, 0, 0", "class": "ansi-red" }, { color: "0, 187, 0", "class": "ansi-green" }, { color: "187, 187, 0", "class": "ansi-yellow" }, { color: "0, 0, 187", "class": "ansi-blue" }, { color: "187, 0, 187", "class": "ansi-magenta" }, { color: "0, 187, 187", "class": "ansi-cyan" }, { color: "255,255,255", "class": "ansi-white" }], [{ color: "85, 85, 85", "class": "ansi-bright-black" }, { color: "255, 85, 85", "class": "ansi-bright-red" }, { color: "0, 255, 0", "class": "ansi-bright-green" }, { color: "255, 255, 85", "class": "ansi-bright-yellow" }, { color: "85, 85, 255", "class": "ansi-bright-blue" }, { color: "255, 85, 255", "class": "ansi-bright-magenta" }, { color: "85, 255, 255", "class": "ansi-bright-cyan" }, { color: "255, 255, 255", "class": "ansi-bright-white" }]]; | ||
var Anser = function () { | ||
_createClass(Anser, null, [{ | ||
(0, _createClass3.default)(Anser, null, [{ | ||
key: "escapeForHtml", | ||
@@ -131,3 +137,3 @@ | ||
function Anser() { | ||
_classCallCheck(this, Anser); | ||
(0, _classCallCheck3.default)(this, Anser); | ||
@@ -147,3 +153,3 @@ this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null; | ||
_createClass(Anser, [{ | ||
(0, _createClass3.default)(Anser, [{ | ||
key: "setupPalette", | ||
@@ -418,2 +424,5 @@ value: function setupPalette() { | ||
self.decoration = "dim"; | ||
// Enable code 2 to get string | ||
} else if (num == 3) { | ||
self.decoration = "italic"; | ||
} else if (num == 4) { | ||
@@ -427,2 +436,5 @@ self.decoration = "underline"; | ||
self.decoration = "hidden"; | ||
// Enable code 9 to get strikethrough | ||
} else if (num === 9) { | ||
self.decoration = "strikethrough"; | ||
} else if (num == 39) { | ||
@@ -434,3 +446,6 @@ self.fg = null; | ||
self.fg = ANSI_COLORS[self.bright][num % 10][key]; | ||
} else if (num >= 90 && num < 98) { | ||
// Enable code 90 to get grey | ||
} else if (num == 90) { | ||
self.fg = "grey"; | ||
} else if (num > 90 && num < 98) { | ||
self.fg = ANSI_COLORS[1][num % 10][key]; | ||
@@ -573,3 +588,10 @@ } else if (num >= 40 && num < 48) { | ||
} else { | ||
styles.push("color:rgb(" + jsonChunk.fg + ")"); | ||
// Split fg color on array | ||
var colors = jsonChunk.fg.split(",").map(String); | ||
// Color has one field | ||
if (colors.length == 1) { | ||
styles.push("color:" + jsonChunk.fg + ""); | ||
} else { | ||
styles.push("color:rgb(" + jsonChunk.fg + ")"); | ||
} | ||
} | ||
@@ -586,3 +608,8 @@ } | ||
} else { | ||
styles.push("background-color:rgb(" + jsonChunk.bg + ")"); | ||
var _colors = jsonChunk.bg.split(",").map(String); | ||
if (_colors.length == 1) { | ||
styles.push("color:" + jsonChunk.bg + ""); | ||
} else { | ||
styles.push("background-color:rgb(" + jsonChunk.bg + ")"); | ||
} | ||
} | ||
@@ -594,4 +621,16 @@ } | ||
classes.push("ansi-" + jsonChunk.decoration); | ||
} else if (jsonChunk.decoration === "underline" || jsonChunk.decoration === "blink") { | ||
styles.push("text-decoration:" + jsonChunk.decoration); | ||
} else if (jsonChunk.decoration === "bright" || jsonChunk.decoration === "underline" || jsonChunk.decoration === "blink" || jsonChunk.decoration === "italic" || jsonChunk.decoration === "hidden" || jsonChunk.decoration === "dim" || jsonChunk.decoration === "reverse" || jsonChunk.decoration === "strikethrough") { | ||
if (jsonChunk.decoration === "hidden") { | ||
styles.push("visibility:hidden"); | ||
} else if (jsonChunk.decoration === "dim") { | ||
styles.push("opacity:0.5"); | ||
} else if (jsonChunk.decoration === "reverse") { | ||
styles.push("filter:invert(100%)"); | ||
} else if (jsonChunk.decoration === "bright") { | ||
styles.push("text-decoration:bold"); | ||
} else if (jsonChunk.decoration === "strikethrough") { | ||
styles.push("text-decoration:line-through"); | ||
} else { | ||
styles.push("text-decoration:" + jsonChunk.decoration); | ||
} | ||
} | ||
@@ -607,3 +646,2 @@ } | ||
}]); | ||
return Anser; | ||
@@ -610,0 +648,0 @@ }(); |
{ | ||
"name": "anser", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A low level parser for ANSI sequences.", | ||
@@ -78,2 +78,2 @@ "keywords": [ | ||
] | ||
} | ||
} |
@@ -103,3 +103,3 @@ | ||
2. For bug reports and feature requests, open issues. :bug: | ||
3. For direct and quick help from me, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
@@ -318,4 +318,6 @@ | ||
- [`nterm`](https://github.com/dariushuntly/nterm/issues) (by Darius Huntly)—A Node Terminal | ||
- [`react-dev-utils`](https://github.com/facebookincubator/create-react-app#readme)—Webpack utilities used by Create React App | ||
- [`react-dev-utils-extra`](https://github.com/facebookincubator/create-react-app-extra#readme)—Webpack utilities used by Create React App | ||
- [`react-dev-utils-sebfl-update`](https://github.com/facebookincubator/create-react-app#readme)—Webpack utilities used by Create React App | ||
- [`react-error-overlay`](https://github.com/facebookincubator/create-react-app#readme) (by Joe Haddad)—An overlay for displaying stack frames. | ||
- [`singularityui-tailer`](https://github.com/HubSpot/Singularity#readme) (by Danny Wolf)—A robust log tailer | ||
@@ -326,2 +328,3 @@ - [`stack-frame-overlay`](https://npmjs.com/package/stack-frame-overlay) (by Joe Haddad)—An overlay for displaying stack frames. | ||
- [`uyun-react-dev-utils`](https://github.com/facebookincubator/create-react-app#readme)—Webpack utilities used by Create React App | ||
- [`webpack-isomorphic-dev-middleware`](https://github.com/moxystudio/webpack-isomorphic-dev-middleware) (by André Cruz)—The webpack-dev-middleware, but for isomorphic applications. | ||
@@ -328,0 +331,0 @@ ## :scroll: License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41511
594
345