+130
-88
@@ -0,119 +1,161 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var AnsiPainter, styles, tags, tools, | ||
| hasProp = {}.hasOwnProperty; | ||
| var AnsiPainter, | ||
| styles, | ||
| tags, | ||
| tools, | ||
| hasProp = {}.hasOwnProperty; | ||
| tools = require('./tools'); | ||
| tags = require('./ansiPainter/tags'); | ||
| styles = require('./ansiPainter/styles'); | ||
| module.exports = AnsiPainter = (function() { | ||
| module.exports = AnsiPainter = function () { | ||
| var self; | ||
| class AnsiPainter { | ||
| paint(s) { | ||
| return this._replaceSpecialStrings(this._renderDom(this._parse(s))); | ||
| var AnsiPainter = /*#__PURE__*/function () { | ||
| function AnsiPainter() { | ||
| _classCallCheck(this, AnsiPainter); | ||
| } | ||
| _replaceSpecialStrings(str) { | ||
| return str.replace(/&sp;/g, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&'); | ||
| } | ||
| _parse(string, injectFakeRoot = true) { | ||
| if (injectFakeRoot) { | ||
| string = '<none>' + string + '</none>'; | ||
| _createClass(AnsiPainter, [{ | ||
| key: "paint", | ||
| value: function paint(s) { | ||
| return this._replaceSpecialStrings(this._renderDom(this._parse(s))); | ||
| } | ||
| return tools.toDom(string); | ||
| } | ||
| }, { | ||
| key: "_replaceSpecialStrings", | ||
| value: function _replaceSpecialStrings(str) { | ||
| return str.replace(/&sp;/g, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&'); | ||
| } | ||
| }, { | ||
| key: "_parse", | ||
| value: function _parse(string) { | ||
| var injectFakeRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
| _renderDom(dom) { | ||
| var parentStyles; | ||
| parentStyles = { | ||
| bg: 'none', | ||
| color: 'none' | ||
| }; | ||
| return this._renderChildren(dom, parentStyles); | ||
| } | ||
| if (injectFakeRoot) { | ||
| string = '<none>' + string + '</none>'; | ||
| } | ||
| _renderChildren(children, parentStyles) { | ||
| var child, n, ret; | ||
| ret = ''; | ||
| for (n in children) { | ||
| if (!hasProp.call(children, n)) continue; | ||
| child = children[n]; | ||
| ret += this._renderNode(child, parentStyles); | ||
| return tools.toDom(string); | ||
| } | ||
| return ret; | ||
| } | ||
| }, { | ||
| key: "_renderDom", | ||
| value: function _renderDom(dom) { | ||
| var parentStyles; | ||
| parentStyles = { | ||
| bg: 'none', | ||
| color: 'none' | ||
| }; | ||
| return this._renderChildren(dom, parentStyles); | ||
| } | ||
| }, { | ||
| key: "_renderChildren", | ||
| value: function _renderChildren(children, parentStyles) { | ||
| var child, n, ret; | ||
| ret = ''; | ||
| _renderNode(node, parentStyles) { | ||
| if (node.type === 'text') { | ||
| return this._renderTextNode(node, parentStyles); | ||
| } else { | ||
| return this._renderTag(node, parentStyles); | ||
| for (n in children) { | ||
| if (!hasProp.call(children, n)) continue; | ||
| child = children[n]; | ||
| ret += this._renderNode(child, parentStyles); | ||
| } | ||
| return ret; | ||
| } | ||
| } | ||
| }, { | ||
| key: "_renderNode", | ||
| value: function _renderNode(node, parentStyles) { | ||
| if (node.type === 'text') { | ||
| return this._renderTextNode(node, parentStyles); | ||
| } else { | ||
| return this._renderTag(node, parentStyles); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_renderTextNode", | ||
| value: function _renderTextNode(node, parentStyles) { | ||
| return this._wrapInStyle(node.data, parentStyles); | ||
| } | ||
| }, { | ||
| key: "_wrapInStyle", | ||
| value: function _wrapInStyle(str, style) { | ||
| return styles.color(style.color) + styles.bg(style.bg) + str + styles.none(); | ||
| } | ||
| }, { | ||
| key: "_renderTag", | ||
| value: function _renderTag(node, parentStyles) { | ||
| var currentStyles, tagStyles; | ||
| tagStyles = this._getStylesForTagName(node.name); | ||
| currentStyles = this._mixStyles(parentStyles, tagStyles); | ||
| return this._renderChildren(node.children, currentStyles); | ||
| } | ||
| }, { | ||
| key: "_mixStyles", | ||
| value: function _mixStyles() { | ||
| var final, i, key, len, style, val; | ||
| final = {}; | ||
| _renderTextNode(node, parentStyles) { | ||
| return this._wrapInStyle(node.data, parentStyles); | ||
| } | ||
| for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) { | ||
| styles[_key] = arguments[_key]; | ||
| } | ||
| _wrapInStyle(str, style) { | ||
| return styles.color(style.color) + styles.bg(style.bg) + str + styles.none(); | ||
| } | ||
| for (i = 0, len = styles.length; i < len; i++) { | ||
| style = styles[i]; | ||
| _renderTag(node, parentStyles) { | ||
| var currentStyles, tagStyles; | ||
| tagStyles = this._getStylesForTagName(node.name); | ||
| currentStyles = this._mixStyles(parentStyles, tagStyles); | ||
| return this._renderChildren(node.children, currentStyles); | ||
| } | ||
| for (key in style) { | ||
| if (!hasProp.call(style, key)) continue; | ||
| val = style[key]; | ||
| _mixStyles(...styles) { | ||
| var final, i, key, len, style, val; | ||
| final = {}; | ||
| for (i = 0, len = styles.length; i < len; i++) { | ||
| style = styles[i]; | ||
| for (key in style) { | ||
| if (!hasProp.call(style, key)) continue; | ||
| val = style[key]; | ||
| if ((final[key] == null) || val !== 'inherit') { | ||
| final[key] = val; | ||
| if (final[key] == null || val !== 'inherit') { | ||
| final[key] = val; | ||
| } | ||
| } | ||
| } | ||
| return final; | ||
| } | ||
| return final; | ||
| } | ||
| }, { | ||
| key: "_getStylesForTagName", | ||
| value: function _getStylesForTagName(name) { | ||
| if (tags[name] == null) { | ||
| throw Error("Unknown tag name `".concat(name, "`")); | ||
| } | ||
| _getStylesForTagName(name) { | ||
| if (tags[name] == null) { | ||
| throw Error(`Unknown tag name \`${name}\``); | ||
| return tags[name]; | ||
| } | ||
| return tags[name]; | ||
| } | ||
| }], [{ | ||
| key: "getInstance", | ||
| value: function getInstance() { | ||
| if (self._instance == null) { | ||
| self._instance = new self(); | ||
| } | ||
| static getInstance() { | ||
| if (self._instance == null) { | ||
| self._instance = new self(); | ||
| return self._instance; | ||
| } | ||
| return self._instance; | ||
| } | ||
| }, { | ||
| key: "paint", | ||
| value: function paint(str) { | ||
| return self.getInstance().paint(str); | ||
| } | ||
| }, { | ||
| key: "strip", | ||
| value: function strip(s) { | ||
| return s.replace(/\x1b\[[0-9]+m/g, ''); | ||
| } | ||
| }]); | ||
| static paint(str) { | ||
| return self.getInstance().paint(str); | ||
| } | ||
| return AnsiPainter; | ||
| }(); | ||
| static strip(s) { | ||
| return s.replace(/\x1b\[[0-9]+m/g, ''); | ||
| } | ||
| }; | ||
| ; | ||
| AnsiPainter.tags = tags; | ||
| self = AnsiPainter; | ||
| return AnsiPainter; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,6 +1,6 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var codes, styles; | ||
| module.exports = styles = {}; | ||
| styles.codes = codes = { | ||
@@ -42,28 +42,36 @@ 'none': 0, | ||
| styles.color = function(str) { | ||
| styles.color = function (str) { | ||
| var code; | ||
| if (str === 'none') { | ||
| return ''; | ||
| } | ||
| code = codes[str]; | ||
| if (code == null) { | ||
| throw Error(`Unknown color \`${str}\``); | ||
| throw Error("Unknown color `".concat(str, "`")); | ||
| } | ||
| return "\x1b[" + code + "m"; | ||
| }; | ||
| styles.bg = function(str) { | ||
| styles.bg = function (str) { | ||
| var code; | ||
| if (str === 'none') { | ||
| return ''; | ||
| } | ||
| code = codes['bg-' + str]; | ||
| if (code == null) { | ||
| throw Error(`Unknown bg color \`${str}\``); | ||
| throw Error("Unknown bg color `".concat(str, "`")); | ||
| } | ||
| return "\x1B[" + code + "m"; | ||
| }; | ||
| styles.none = function(str) { | ||
| styles.none = function (str) { | ||
| return "\x1B[" + codes.none + "m"; | ||
| }; | ||
| }; |
@@ -0,4 +1,5 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var color, colors, i, len, tags; | ||
| module.exports = tags = { | ||
@@ -18,3 +19,2 @@ 'none': { | ||
| }; | ||
| colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'grey', 'bright-red', 'bright-green', 'bright-yellow', 'bright-blue', 'bright-magenta', 'bright-cyan', 'bright-white']; | ||
@@ -28,10 +28,10 @@ | ||
| }; | ||
| tags[`color-${color}`] = { | ||
| tags["color-".concat(color)] = { | ||
| color: color, | ||
| bg: 'inherit' | ||
| }; | ||
| tags[`bg-${color}`] = { | ||
| tags["bg-".concat(color)] = { | ||
| color: 'inherit', | ||
| bg: color | ||
| }; | ||
| } | ||
| } |
+71
-44
@@ -0,66 +1,94 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var Block, Layout, SpecialString, cloneAndMergeDeep, i, len, prop, ref, terminalWidth; | ||
| Block = require('./layout/Block'); | ||
| ({cloneAndMergeDeep} = require('./tools')); | ||
| var _require = require('./tools'); | ||
| cloneAndMergeDeep = _require.cloneAndMergeDeep; | ||
| SpecialString = require('./layout/SpecialString'); | ||
| terminalWidth = require('./tools').getCols(); | ||
| module.exports = Layout = (function() { | ||
| module.exports = Layout = function () { | ||
| var self; | ||
| class Layout { | ||
| constructor(config = {}, rootBlockConfig = {}) { | ||
| var Layout = /*#__PURE__*/function () { | ||
| function Layout() { | ||
| var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
| var rootBlockConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
| _classCallCheck(this, Layout); | ||
| var rootConfig; | ||
| this._written = []; | ||
| this._activeBlock = null; | ||
| this._config = cloneAndMergeDeep(self._defaultConfig, config); | ||
| // Every layout has a root block | ||
| this._config = cloneAndMergeDeep(self._defaultConfig, config); // Every layout has a root block | ||
| rootConfig = cloneAndMergeDeep(self._rootBlockDefaultConfig, rootBlockConfig); | ||
| this._root = new Block(this, null, rootConfig, '__root'); | ||
| this._root._open(); | ||
| } | ||
| getRootBlock() { | ||
| return this._root; | ||
| } | ||
| _createClass(Layout, [{ | ||
| key: "getRootBlock", | ||
| value: function getRootBlock() { | ||
| return this._root; | ||
| } | ||
| }, { | ||
| key: "_append", | ||
| value: function _append(text) { | ||
| return this._written.push(text); | ||
| } | ||
| }, { | ||
| key: "_appendLine", | ||
| value: function _appendLine(text) { | ||
| var s; | ||
| _append(text) { | ||
| return this._written.push(text); | ||
| } | ||
| this._append(text); | ||
| _appendLine(text) { | ||
| var s; | ||
| this._append(text); | ||
| s = new SpecialString(text); | ||
| if (s.length < this._config.terminalWidth) { | ||
| this._append('<none>\n</none>'); | ||
| s = new SpecialString(text); | ||
| if (s.length < this._config.terminalWidth) { | ||
| this._append('<none>\n</none>'); | ||
| } | ||
| return this; | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "get", | ||
| value: function get() { | ||
| this._ensureClosed(); | ||
| get() { | ||
| this._ensureClosed(); | ||
| if (this._written[this._written.length - 1] === '<none>\n</none>') { | ||
| this._written.pop(); | ||
| if (this._written[this._written.length - 1] === '<none>\n</none>') { | ||
| this._written.pop(); | ||
| } | ||
| return this._written.join(""); | ||
| } | ||
| return this._written.join(""); | ||
| } | ||
| }, { | ||
| key: "_ensureClosed", | ||
| value: function _ensureClosed() { | ||
| if (this._activeBlock !== this._root) { | ||
| throw Error("Not all the blocks have been closed. Please call block.close() on all open blocks."); | ||
| } | ||
| _ensureClosed() { | ||
| if (this._activeBlock !== this._root) { | ||
| throw Error("Not all the blocks have been closed. Please call block.close() on all open blocks."); | ||
| if (this._root.isOpen()) { | ||
| this._root.close(); | ||
| } | ||
| } | ||
| if (this._root.isOpen()) { | ||
| this._root.close(); | ||
| } | ||
| } | ||
| }]); | ||
| }; | ||
| return Layout; | ||
| }(); | ||
| ; | ||
| self = Layout; | ||
| Layout._rootBlockDefaultConfig = { | ||
@@ -88,21 +116,20 @@ linePrependor: { | ||
| }; | ||
| Layout._defaultConfig = { | ||
| terminalWidth: terminalWidth | ||
| }; | ||
| return Layout; | ||
| }.call(void 0); | ||
| }).call(this); | ||
| ref = ['openBlock', 'write']; | ||
| ref = ['openBlock', 'write']; | ||
| for (i = 0, len = ref.length; i < len; i++) { | ||
| prop = ref[i]; | ||
| (function() { | ||
| (function () { | ||
| var method; | ||
| method = prop; | ||
| return Layout.prototype[method] = function() { | ||
| return Layout.prototype[method] = function () { | ||
| return this._root[method].apply(this._root, arguments); | ||
| }; | ||
| })(); | ||
| } | ||
| } |
+253
-181
@@ -0,15 +1,29 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var Block, SpecialString, cloneAndMergeDeep, terminalWidth; | ||
| SpecialString = require('./SpecialString'); | ||
| terminalWidth = require('../tools').getCols(); | ||
| ({cloneAndMergeDeep} = require('../tools')); | ||
| var _require = require('../tools'); | ||
| module.exports = Block = (function() { | ||
| cloneAndMergeDeep = _require.cloneAndMergeDeep; | ||
| module.exports = Block = function () { | ||
| var self; | ||
| class Block { | ||
| constructor(_layout, _parent, config = {}, _name = '') { | ||
| var Block = /*#__PURE__*/function () { | ||
| function Block(_layout, _parent) { | ||
| var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
| var _name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
| _classCallCheck(this, Block); | ||
| this._layout = _layout; | ||
@@ -30,212 +44,272 @@ this._parent = _parent; | ||
| _activate(deactivateParent = true) { | ||
| if (this._active) { | ||
| throw Error("This block is already active. This is probably a bug in RenderKid itself"); | ||
| _createClass(Block, [{ | ||
| key: "_activate", | ||
| value: function _activate() { | ||
| var deactivateParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
| if (this._active) { | ||
| throw Error("This block is already active. This is probably a bug in RenderKid itself"); | ||
| } | ||
| if (this._closed) { | ||
| throw Error("This block is closed and cannot be activated. This is probably a bug in RenderKid itself"); | ||
| } | ||
| this._active = true; | ||
| this._layout._activeBlock = this; | ||
| if (deactivateParent) { | ||
| if (this._parent != null) { | ||
| this._parent._deactivate(false); | ||
| } | ||
| } | ||
| return this; | ||
| } | ||
| if (this._closed) { | ||
| throw Error("This block is closed and cannot be activated. This is probably a bug in RenderKid itself"); | ||
| }, { | ||
| key: "_deactivate", | ||
| value: function _deactivate() { | ||
| var activateParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
| this._ensureActive(); | ||
| this._flushBuffer(); | ||
| if (activateParent) { | ||
| if (this._parent != null) { | ||
| this._parent._activate(false); | ||
| } | ||
| } | ||
| this._active = false; | ||
| return this; | ||
| } | ||
| this._active = true; | ||
| this._layout._activeBlock = this; | ||
| if (deactivateParent) { | ||
| if (this._parent != null) { | ||
| this._parent._deactivate(false); | ||
| }, { | ||
| key: "_ensureActive", | ||
| value: function _ensureActive() { | ||
| if (!this._wasOpenOnce) { | ||
| throw Error("This block has never been open before. This is probably a bug in RenderKid itself."); | ||
| } | ||
| if (!this._active) { | ||
| throw Error("This block is not active. This is probably a bug in RenderKid itself."); | ||
| } | ||
| if (this._closed) { | ||
| throw Error("This block is already closed. This is probably a bug in RenderKid itself."); | ||
| } | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_open", | ||
| value: function _open() { | ||
| if (this._wasOpenOnce) { | ||
| throw Error("Block._open() has been called twice. This is probably a RenderKid bug."); | ||
| } | ||
| _deactivate(activateParent = true) { | ||
| this._ensureActive(); | ||
| this._flushBuffer(); | ||
| if (activateParent) { | ||
| this._wasOpenOnce = true; | ||
| if (this._parent != null) { | ||
| this._parent._activate(false); | ||
| this._parent.write(this._whatToPrependToBlock()); | ||
| } | ||
| } | ||
| this._active = false; | ||
| return this; | ||
| } | ||
| _ensureActive() { | ||
| if (!this._wasOpenOnce) { | ||
| throw Error("This block has never been open before. This is probably a bug in RenderKid itself."); | ||
| this._activate(); | ||
| return this; | ||
| } | ||
| if (!this._active) { | ||
| throw Error("This block is not active. This is probably a bug in RenderKid itself."); | ||
| } | ||
| if (this._closed) { | ||
| throw Error("This block is already closed. This is probably a bug in RenderKid itself."); | ||
| } | ||
| } | ||
| }, { | ||
| key: "close", | ||
| value: function close() { | ||
| this._deactivate(); | ||
| _open() { | ||
| if (this._wasOpenOnce) { | ||
| throw Error("Block._open() has been called twice. This is probably a RenderKid bug."); | ||
| this._closed = true; | ||
| if (this._parent != null) { | ||
| this._parent.write(this._whatToAppendToBlock()); | ||
| } | ||
| return this; | ||
| } | ||
| this._wasOpenOnce = true; | ||
| if (this._parent != null) { | ||
| this._parent.write(this._whatToPrependToBlock()); | ||
| }, { | ||
| key: "isOpen", | ||
| value: function isOpen() { | ||
| return this._wasOpenOnce && !this._closed; | ||
| } | ||
| this._activate(); | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "write", | ||
| value: function write(str) { | ||
| this._ensureActive(); | ||
| close() { | ||
| this._deactivate(); | ||
| this._closed = true; | ||
| if (this._parent != null) { | ||
| this._parent.write(this._whatToAppendToBlock()); | ||
| if (str === '') { | ||
| return; | ||
| } | ||
| str = String(str); | ||
| this._buffer += str; | ||
| return this; | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "openBlock", | ||
| value: function openBlock(config, name) { | ||
| var block; | ||
| isOpen() { | ||
| return this._wasOpenOnce && !this._closed; | ||
| } | ||
| this._ensureActive(); | ||
| write(str) { | ||
| this._ensureActive(); | ||
| if (str === '') { | ||
| return; | ||
| } | ||
| str = String(str); | ||
| this._buffer += str; | ||
| return this; | ||
| } | ||
| block = new Block(this._layout, this, config, name); | ||
| openBlock(config, name) { | ||
| var block; | ||
| this._ensureActive(); | ||
| block = new Block(this._layout, this, config, name); | ||
| block._open(); | ||
| return block; | ||
| } | ||
| block._open(); | ||
| _flushBuffer() { | ||
| var str; | ||
| if (this._buffer === '') { | ||
| return; | ||
| return block; | ||
| } | ||
| str = this._buffer; | ||
| this._buffer = ''; | ||
| this._writeInline(str); | ||
| } | ||
| }, { | ||
| key: "_flushBuffer", | ||
| value: function _flushBuffer() { | ||
| var str; | ||
| _toPrependToLine() { | ||
| var fromParent; | ||
| fromParent = ''; | ||
| if (this._parent != null) { | ||
| fromParent = this._parent._toPrependToLine(); | ||
| } | ||
| return this._linePrependor.render(fromParent); | ||
| } | ||
| if (this._buffer === '') { | ||
| return; | ||
| } | ||
| _toAppendToLine() { | ||
| var fromParent; | ||
| fromParent = ''; | ||
| if (this._parent != null) { | ||
| fromParent = this._parent._toAppendToLine(); | ||
| str = this._buffer; | ||
| this._buffer = ''; | ||
| this._writeInline(str); | ||
| } | ||
| return this._lineAppendor.render(fromParent); | ||
| } | ||
| }, { | ||
| key: "_toPrependToLine", | ||
| value: function _toPrependToLine() { | ||
| var fromParent; | ||
| fromParent = ''; | ||
| _whatToPrependToBlock() { | ||
| return this._blockPrependor.render(); | ||
| } | ||
| if (this._parent != null) { | ||
| fromParent = this._parent._toPrependToLine(); | ||
| } | ||
| _whatToAppendToBlock() { | ||
| return this._blockAppendor.render(); | ||
| } | ||
| return this._linePrependor.render(fromParent); | ||
| } | ||
| }, { | ||
| key: "_toAppendToLine", | ||
| value: function _toAppendToLine() { | ||
| var fromParent; | ||
| fromParent = ''; | ||
| _writeInline(str) { | ||
| var i, j, k, l, lineBreaksToAppend, m, ref, ref1, ref2, remaining; | ||
| // special characters (such as <bg-white>) don't require | ||
| // any wrapping... | ||
| if (new SpecialString(str).isOnlySpecialChars()) { | ||
| // ... and directly get appended to the layout. | ||
| this._layout._append(str); | ||
| return; | ||
| } | ||
| // we'll be removing from the original string till it's empty | ||
| remaining = str; | ||
| // we might need to add a few line breaks at the end of the text. | ||
| lineBreaksToAppend = 0; | ||
| // if text starts with line breaks... | ||
| if (m = remaining.match(/^\n+/)) { | ||
| // ... we want to write the exact same number of line breaks | ||
| // to the layout. | ||
| for (i = j = 1, ref = m[0].length; (1 <= ref ? j <= ref : j >= ref); i = 1 <= ref ? ++j : --j) { | ||
| this._writeLine(''); | ||
| if (this._parent != null) { | ||
| fromParent = this._parent._toAppendToLine(); | ||
| } | ||
| remaining = remaining.substr(m[0].length, remaining.length); | ||
| return this._lineAppendor.render(fromParent); | ||
| } | ||
| // and if the text ends with line breaks... | ||
| if (m = remaining.match(/\n+$/)) { | ||
| // we want to write the exact same number of line breaks | ||
| // to the end of the layout. | ||
| lineBreaksToAppend = m[0].length; | ||
| remaining = remaining.substr(0, remaining.length - m[0].length); | ||
| }, { | ||
| key: "_whatToPrependToBlock", | ||
| value: function _whatToPrependToBlock() { | ||
| return this._blockPrependor.render(); | ||
| } | ||
| // now let's parse the body of the text: | ||
| while (remaining.length > 0) { | ||
| // anything other than a break line... | ||
| if (m = remaining.match(/^[^\n]+/)) { | ||
| // ... should be wrapped as a block of text. | ||
| this._writeLine(m[0]); | ||
| }, { | ||
| key: "_whatToAppendToBlock", | ||
| value: function _whatToAppendToBlock() { | ||
| return this._blockAppendor.render(); | ||
| } | ||
| }, { | ||
| key: "_writeInline", | ||
| value: function _writeInline(str) { | ||
| var i, j, k, l, lineBreaksToAppend, m, ref, ref1, ref2, remaining; // special characters (such as <bg-white>) don't require | ||
| // any wrapping... | ||
| if (new SpecialString(str).isOnlySpecialChars()) { | ||
| // ... and directly get appended to the layout. | ||
| this._layout._append(str); | ||
| return; | ||
| } // we'll be removing from the original string till it's empty | ||
| remaining = str; // we might need to add a few line breaks at the end of the text. | ||
| lineBreaksToAppend = 0; // if text starts with line breaks... | ||
| if (m = remaining.match(/^\n+/)) { | ||
| // ... we want to write the exact same number of line breaks | ||
| // to the layout. | ||
| for (i = j = 1, ref = m[0].length; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) { | ||
| this._writeLine(''); | ||
| } | ||
| remaining = remaining.substr(m[0].length, remaining.length); | ||
| // for any number of line breaks we find inside the text... | ||
| } else if (m = remaining.match(/^\n+/)) { | ||
| // ... we write one less break line to the layout. | ||
| for (i = k = 1, ref1 = m[0].length; (1 <= ref1 ? k < ref1 : k > ref1); i = 1 <= ref1 ? ++k : --k) { | ||
| } // and if the text ends with line breaks... | ||
| if (m = remaining.match(/\n+$/)) { | ||
| // we want to write the exact same number of line breaks | ||
| // to the end of the layout. | ||
| lineBreaksToAppend = m[0].length; | ||
| remaining = remaining.substr(0, remaining.length - m[0].length); | ||
| } // now let's parse the body of the text: | ||
| while (remaining.length > 0) { | ||
| // anything other than a break line... | ||
| if (m = remaining.match(/^[^\n]+/)) { | ||
| // ... should be wrapped as a block of text. | ||
| this._writeLine(m[0]); | ||
| remaining = remaining.substr(m[0].length, remaining.length); // for any number of line breaks we find inside the text... | ||
| } else if (m = remaining.match(/^\n+/)) { | ||
| // ... we write one less break line to the layout. | ||
| for (i = k = 1, ref1 = m[0].length; 1 <= ref1 ? k < ref1 : k > ref1; i = 1 <= ref1 ? ++k : --k) { | ||
| this._writeLine(''); | ||
| } | ||
| remaining = remaining.substr(m[0].length, remaining.length); | ||
| } | ||
| } // if we had line breaks to append to the layout... | ||
| if (lineBreaksToAppend > 0) { | ||
| // ... we append the exact same number of line breaks to the layout. | ||
| for (i = l = 1, ref2 = lineBreaksToAppend; 1 <= ref2 ? l <= ref2 : l >= ref2; i = 1 <= ref2 ? ++l : --l) { | ||
| this._writeLine(''); | ||
| } | ||
| remaining = remaining.substr(m[0].length, remaining.length); | ||
| } | ||
| } | ||
| // if we had line breaks to append to the layout... | ||
| if (lineBreaksToAppend > 0) { | ||
| // ... we append the exact same number of line breaks to the layout. | ||
| for (i = l = 1, ref2 = lineBreaksToAppend; (1 <= ref2 ? l <= ref2 : l >= ref2); i = 1 <= ref2 ? ++l : --l) { | ||
| this._writeLine(''); | ||
| } | ||
| } | ||
| } | ||
| } // wraps a line into multiple lines if necessary, adds horizontal margins, | ||
| // etc, and appends it to the layout. | ||
| // wraps a line into multiple lines if necessary, adds horizontal margins, | ||
| // etc, and appends it to the layout. | ||
| _writeLine(str) { | ||
| var line, lineContent, lineContentLength, remaining, roomLeft, toAppend, toAppendLength, toPrepend, toPrependLength; | ||
| // we'll be cutting from our string as we go | ||
| remaining = new SpecialString(str); | ||
| while (true) { | ||
| // left margin... | ||
| // this will continue until nothing is left of our block. | ||
| toPrepend = this._toPrependToLine(); | ||
| // ... and its length | ||
| toPrependLength = new SpecialString(toPrepend).length; | ||
| // right margin... | ||
| toAppend = this._toAppendToLine(); | ||
| // ... and its length | ||
| toAppendLength = new SpecialString(toAppend).length; | ||
| // how much room is left for content | ||
| roomLeft = this._layout._config.terminalWidth - (toPrependLength + toAppendLength); | ||
| // how much room each line of content will have | ||
| lineContentLength = Math.min(this._config.width, roomLeft); | ||
| // cut line content, only for the amount needed | ||
| lineContent = remaining.cut(0, lineContentLength, true); | ||
| // line will consist of both margins and the content | ||
| line = toPrepend + lineContent.str + toAppend; | ||
| // send it off to layout | ||
| this._layout._appendLine(line); | ||
| if (remaining.isEmpty()) { | ||
| break; | ||
| }, { | ||
| key: "_writeLine", | ||
| value: function _writeLine(str) { | ||
| var line, lineContent, lineContentLength, remaining, roomLeft, toAppend, toAppendLength, toPrepend, toPrependLength; // we'll be cutting from our string as we go | ||
| remaining = new SpecialString(str); | ||
| while (true) { | ||
| // left margin... | ||
| // this will continue until nothing is left of our block. | ||
| toPrepend = this._toPrependToLine(); // ... and its length | ||
| toPrependLength = new SpecialString(toPrepend).length; // right margin... | ||
| toAppend = this._toAppendToLine(); // ... and its length | ||
| toAppendLength = new SpecialString(toAppend).length; // how much room is left for content | ||
| roomLeft = this._layout._config.terminalWidth - (toPrependLength + toAppendLength); // how much room each line of content will have | ||
| lineContentLength = Math.min(this._config.width, roomLeft); // cut line content, only for the amount needed | ||
| lineContent = remaining.cut(0, lineContentLength, true); // line will consist of both margins and the content | ||
| line = toPrepend + lineContent.str + toAppend; // send it off to layout | ||
| this._layout._appendLine(line); | ||
| if (remaining.isEmpty()) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }]); | ||
| }; | ||
| return Block; | ||
| }(); | ||
| ; | ||
| self = Block; | ||
| Block.defaultConfig = { | ||
@@ -276,5 +350,3 @@ blockPrependor: { | ||
| }; | ||
| return Block; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,13 +1,27 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var _BlockAppendor; | ||
| module.exports = _BlockAppendor = class _BlockAppendor { | ||
| constructor(_config) { | ||
| module.exports = _BlockAppendor = /*#__PURE__*/function () { | ||
| function _BlockAppendor(_config) { | ||
| _classCallCheck(this, _BlockAppendor); | ||
| this._config = _config; | ||
| } | ||
| render(options) { | ||
| return this._render(options); | ||
| } | ||
| _createClass(_BlockAppendor, [{ | ||
| key: "render", | ||
| value: function render(options) { | ||
| return this._render(options); | ||
| } | ||
| }]); | ||
| }; | ||
| return _BlockAppendor; | ||
| }(); |
@@ -0,11 +1,48 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DefaultBlockAppendor, tools; | ||
| tools = require('../../../tools'); | ||
| module.exports = DefaultBlockAppendor = class DefaultBlockAppendor extends require('./_BlockAppendor') { | ||
| _render(options) { | ||
| return tools.repeatString("\n", this._config.amount); | ||
| module.exports = DefaultBlockAppendor = /*#__PURE__*/function (_require) { | ||
| _inherits(DefaultBlockAppendor, _require); | ||
| var _super = _createSuper(DefaultBlockAppendor); | ||
| function DefaultBlockAppendor() { | ||
| _classCallCheck(this, DefaultBlockAppendor); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| }; | ||
| _createClass(DefaultBlockAppendor, [{ | ||
| key: "_render", | ||
| value: function _render(options) { | ||
| return tools.repeatString("\n", this._config.amount); | ||
| } | ||
| }]); | ||
| return DefaultBlockAppendor; | ||
| }(require('./_BlockAppendor')); |
@@ -0,13 +1,27 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var _BlockPrependor; | ||
| module.exports = _BlockPrependor = class _BlockPrependor { | ||
| constructor(_config) { | ||
| module.exports = _BlockPrependor = /*#__PURE__*/function () { | ||
| function _BlockPrependor(_config) { | ||
| _classCallCheck(this, _BlockPrependor); | ||
| this._config = _config; | ||
| } | ||
| render(options) { | ||
| return this._render(options); | ||
| } | ||
| _createClass(_BlockPrependor, [{ | ||
| key: "render", | ||
| value: function render(options) { | ||
| return this._render(options); | ||
| } | ||
| }]); | ||
| }; | ||
| return _BlockPrependor; | ||
| }(); |
@@ -0,11 +1,48 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DefaultBlockPrependor, tools; | ||
| tools = require('../../../tools'); | ||
| module.exports = DefaultBlockPrependor = class DefaultBlockPrependor extends require('./_BlockPrependor') { | ||
| _render(options) { | ||
| return tools.repeatString("\n", this._config.amount); | ||
| module.exports = DefaultBlockPrependor = /*#__PURE__*/function (_require) { | ||
| _inherits(DefaultBlockPrependor, _require); | ||
| var _super = _createSuper(DefaultBlockPrependor); | ||
| function DefaultBlockPrependor() { | ||
| _classCallCheck(this, DefaultBlockPrependor); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| }; | ||
| _createClass(DefaultBlockPrependor, [{ | ||
| key: "_render", | ||
| value: function _render(options) { | ||
| return tools.repeatString("\n", this._config.amount); | ||
| } | ||
| }]); | ||
| return DefaultBlockPrependor; | ||
| }(require('./_BlockPrependor')); |
@@ -0,6 +1,16 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var _LineAppendor; | ||
| module.exports = _LineAppendor = class _LineAppendor { | ||
| constructor(_config) { | ||
| module.exports = _LineAppendor = /*#__PURE__*/function () { | ||
| function _LineAppendor(_config) { | ||
| _classCallCheck(this, _LineAppendor); | ||
| this._config = _config; | ||
@@ -10,7 +20,11 @@ this._lineNo = 0; | ||
| render(inherited, options) { | ||
| this._lineNo++; | ||
| return '<none>' + this._render(inherited, options) + '</none>'; | ||
| } | ||
| _createClass(_LineAppendor, [{ | ||
| key: "render", | ||
| value: function render(inherited, options) { | ||
| this._lineNo++; | ||
| return '<none>' + this._render(inherited, options) + '</none>'; | ||
| } | ||
| }]); | ||
| }; | ||
| return _LineAppendor; | ||
| }(); |
@@ -0,11 +1,48 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DefaultLineAppendor, tools; | ||
| tools = require('../../../tools'); | ||
| module.exports = DefaultLineAppendor = class DefaultLineAppendor extends require('./_LineAppendor') { | ||
| _render(inherited, options) { | ||
| return inherited + tools.repeatString(" ", this._config.amount); | ||
| module.exports = DefaultLineAppendor = /*#__PURE__*/function (_require) { | ||
| _inherits(DefaultLineAppendor, _require); | ||
| var _super = _createSuper(DefaultLineAppendor); | ||
| function DefaultLineAppendor() { | ||
| _classCallCheck(this, DefaultLineAppendor); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| }; | ||
| _createClass(DefaultLineAppendor, [{ | ||
| key: "_render", | ||
| value: function _render(inherited, options) { | ||
| return inherited + tools.repeatString(" ", this._config.amount); | ||
| } | ||
| }]); | ||
| return DefaultLineAppendor; | ||
| }(require('./_LineAppendor')); |
@@ -0,6 +1,16 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var _LinePrependor; | ||
| module.exports = _LinePrependor = class _LinePrependor { | ||
| constructor(_config) { | ||
| module.exports = _LinePrependor = /*#__PURE__*/function () { | ||
| function _LinePrependor(_config) { | ||
| _classCallCheck(this, _LinePrependor); | ||
| this._config = _config; | ||
@@ -10,7 +20,11 @@ this._lineNo = -1; | ||
| render(inherited, options) { | ||
| this._lineNo++; | ||
| return '<none>' + this._render(inherited, options) + '</none>'; | ||
| } | ||
| _createClass(_LinePrependor, [{ | ||
| key: "render", | ||
| value: function render(inherited, options) { | ||
| this._lineNo++; | ||
| return '<none>' + this._render(inherited, options) + '</none>'; | ||
| } | ||
| }]); | ||
| }; | ||
| return _LinePrependor; | ||
| }(); |
@@ -0,53 +1,94 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DefaultLinePrependor, SpecialString, tools; | ||
| tools = require('../../../tools'); | ||
| SpecialString = require('../../SpecialString'); | ||
| module.exports = DefaultLinePrependor = (function() { | ||
| module.exports = DefaultLinePrependor = function () { | ||
| var self; | ||
| class DefaultLinePrependor extends require('./_LinePrependor') { | ||
| static pad(howMuch) { | ||
| return tools.repeatString(" ", howMuch); | ||
| var DefaultLinePrependor = /*#__PURE__*/function (_require) { | ||
| _inherits(DefaultLinePrependor, _require); | ||
| var _super = _createSuper(DefaultLinePrependor); | ||
| function DefaultLinePrependor() { | ||
| _classCallCheck(this, DefaultLinePrependor); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| _render(inherited, options) { | ||
| var addToLeft, addToRight, alignment, bullet, char, charLen, diff, left, output, space, toWrite; | ||
| if (this._lineNo === 0 && (bullet = this._config.bullet)) { | ||
| char = bullet.char; | ||
| charLen = new SpecialString(char).length; | ||
| alignment = bullet.alignment; | ||
| space = this._config.amount; | ||
| toWrite = char; | ||
| addToLeft = ''; | ||
| addToRight = ''; | ||
| if (space > charLen) { | ||
| diff = space - charLen; | ||
| if (alignment === 'right') { | ||
| addToLeft = self.pad(diff); | ||
| } else if (alignment === 'left') { | ||
| addToRight = self.pad(diff); | ||
| } else if (alignment === 'center') { | ||
| left = Math.round(diff / 2); | ||
| addToLeft = self.pad(left); | ||
| addToRight = self.pad(diff - left); | ||
| } else { | ||
| throw Error(`Unknown alignment \`${alignment}\``); | ||
| _createClass(DefaultLinePrependor, [{ | ||
| key: "_render", | ||
| value: function _render(inherited, options) { | ||
| var addToLeft, addToRight, alignment, bullet, char, charLen, diff, left, output, space, toWrite; | ||
| if (this._lineNo === 0 && (bullet = this._config.bullet)) { | ||
| char = bullet.char; | ||
| charLen = new SpecialString(char).length; | ||
| alignment = bullet.alignment; | ||
| space = this._config.amount; | ||
| toWrite = char; | ||
| addToLeft = ''; | ||
| addToRight = ''; | ||
| if (space > charLen) { | ||
| diff = space - charLen; | ||
| if (alignment === 'right') { | ||
| addToLeft = self.pad(diff); | ||
| } else if (alignment === 'left') { | ||
| addToRight = self.pad(diff); | ||
| } else if (alignment === 'center') { | ||
| left = Math.round(diff / 2); | ||
| addToLeft = self.pad(left); | ||
| addToRight = self.pad(diff - left); | ||
| } else { | ||
| throw Error("Unknown alignment `".concat(alignment, "`")); | ||
| } | ||
| } | ||
| output = addToLeft + char + addToRight; | ||
| } else { | ||
| output = self.pad(this._config.amount); | ||
| } | ||
| output = addToLeft + char + addToRight; | ||
| } else { | ||
| output = self.pad(this._config.amount); | ||
| return inherited + output; | ||
| } | ||
| return inherited + output; | ||
| } | ||
| }], [{ | ||
| key: "pad", | ||
| value: function pad(howMuch) { | ||
| return tools.repeatString(" ", howMuch); | ||
| } | ||
| }]); | ||
| }; | ||
| return DefaultLinePrependor; | ||
| }(require('./_LinePrependor')); | ||
| ; | ||
| self = DefaultLinePrependor; | ||
| return DefaultLinePrependor; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,11 +1,25 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var _LineWrapper; | ||
| module.exports = _LineWrapper = class _LineWrapper { | ||
| constructor() {} | ||
| render(str, options) { | ||
| return this._render(str, options); | ||
| module.exports = _LineWrapper = /*#__PURE__*/function () { | ||
| function _LineWrapper() { | ||
| _classCallCheck(this, _LineWrapper); | ||
| } | ||
| }; | ||
| _createClass(_LineWrapper, [{ | ||
| key: "render", | ||
| value: function render(str, options) { | ||
| return this._render(str, options); | ||
| } | ||
| }]); | ||
| return _LineWrapper; | ||
| }(); |
@@ -0,7 +1,45 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DefaultLineWrapper; | ||
| module.exports = DefaultLineWrapper = class DefaultLineWrapper extends require('./_LineWrapper') { | ||
| _render() {} | ||
| module.exports = DefaultLineWrapper = /*#__PURE__*/function (_require) { | ||
| _inherits(DefaultLineWrapper, _require); | ||
| }; | ||
| var _super = _createSuper(DefaultLineWrapper); | ||
| function DefaultLineWrapper() { | ||
| _classCallCheck(this, DefaultLineWrapper); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| _createClass(DefaultLineWrapper, [{ | ||
| key: "_render", | ||
| value: function _render() {} | ||
| }]); | ||
| return DefaultLineWrapper; | ||
| }(require('./_LineWrapper')); |
+173
-126
@@ -0,12 +1,23 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var SpecialString, i, len, prop, ref; | ||
| module.exports = SpecialString = (function() { | ||
| module.exports = SpecialString = function () { | ||
| var self; | ||
| class SpecialString { | ||
| constructor(str) { | ||
| var SpecialString = /*#__PURE__*/function () { | ||
| function SpecialString(str) { | ||
| _classCallCheck(this, SpecialString); | ||
| if (!(this instanceof self)) { | ||
| return new self(str); | ||
| } | ||
| this._str = String(str); | ||
@@ -16,157 +27,193 @@ this._len = 0; | ||
| _getStr() { | ||
| return this._str; | ||
| } | ||
| _createClass(SpecialString, [{ | ||
| key: "_getStr", | ||
| value: function _getStr() { | ||
| return this._str; | ||
| } | ||
| }, { | ||
| key: "set", | ||
| value: function set(str) { | ||
| this._str = String(str); | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "clone", | ||
| value: function clone() { | ||
| return new SpecialString(this._str); | ||
| } | ||
| }, { | ||
| key: "isEmpty", | ||
| value: function isEmpty() { | ||
| return this._str === ''; | ||
| } | ||
| }, { | ||
| key: "isOnlySpecialChars", | ||
| value: function isOnlySpecialChars() { | ||
| return !this.isEmpty() && this.length === 0; | ||
| } | ||
| }, { | ||
| key: "_reset", | ||
| value: function _reset() { | ||
| return this._len = 0; | ||
| } | ||
| }, { | ||
| key: "splitIn", | ||
| value: function splitIn(limit) { | ||
| var trimLeftEachLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
| var buffer, bufferLength, justSkippedSkipChar, lines; | ||
| buffer = ''; | ||
| bufferLength = 0; | ||
| lines = []; | ||
| justSkippedSkipChar = false; | ||
| set(str) { | ||
| this._str = String(str); | ||
| return this; | ||
| } | ||
| self._countChars(this._str, function (char, charLength) { | ||
| if (bufferLength > limit || bufferLength + charLength > limit) { | ||
| lines.push(buffer); | ||
| buffer = ''; | ||
| bufferLength = 0; | ||
| } | ||
| clone() { | ||
| return new SpecialString(this._str); | ||
| } | ||
| if (bufferLength === 0 && char === ' ' && !justSkippedSkipChar && trimLeftEachLine) { | ||
| return justSkippedSkipChar = true; | ||
| } else { | ||
| buffer += char; | ||
| bufferLength += charLength; | ||
| return justSkippedSkipChar = false; | ||
| } | ||
| }); | ||
| isEmpty() { | ||
| return this._str === ''; | ||
| } | ||
| if (buffer.length > 0) { | ||
| lines.push(buffer); | ||
| } | ||
| isOnlySpecialChars() { | ||
| return !this.isEmpty() && this.length === 0; | ||
| } | ||
| return lines; | ||
| } | ||
| }, { | ||
| key: "trim", | ||
| value: function trim() { | ||
| return new SpecialString(this.str.trim()); | ||
| } | ||
| }, { | ||
| key: "trimLeft", | ||
| value: function trimLeft() { | ||
| return new SpecialString(this.str.replace(/^\s+/, '')); | ||
| } | ||
| }, { | ||
| key: "trimRight", | ||
| value: function trimRight() { | ||
| return new SpecialString(this.str.replace(/\s+$/, '')); | ||
| } | ||
| }, { | ||
| key: "_getLength", | ||
| value: function _getLength() { | ||
| var sum; | ||
| sum = 0; | ||
| _reset() { | ||
| return this._len = 0; | ||
| } | ||
| self._countChars(this._str, function (char, charLength) { | ||
| sum += charLength; | ||
| }); | ||
| splitIn(limit, trimLeftEachLine = false) { | ||
| var buffer, bufferLength, justSkippedSkipChar, lines; | ||
| buffer = ''; | ||
| bufferLength = 0; | ||
| lines = []; | ||
| justSkippedSkipChar = false; | ||
| self._countChars(this._str, function(char, charLength) { | ||
| if (bufferLength > limit || bufferLength + charLength > limit) { | ||
| lines.push(buffer); | ||
| buffer = ''; | ||
| bufferLength = 0; | ||
| return sum; | ||
| } | ||
| }, { | ||
| key: "cut", | ||
| value: function cut(from, to) { | ||
| var _this = this; | ||
| var trimLeft = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
| var after, before, cur, cut; | ||
| if (to == null) { | ||
| to = this.length; | ||
| } | ||
| if (bufferLength === 0 && char === ' ' && !justSkippedSkipChar && trimLeftEachLine) { | ||
| return justSkippedSkipChar = true; | ||
| } else { | ||
| buffer += char; | ||
| bufferLength += charLength; | ||
| return justSkippedSkipChar = false; | ||
| from = parseInt(from); | ||
| if (from >= to) { | ||
| throw Error("`from` shouldn't be larger than `to`"); | ||
| } | ||
| }); | ||
| if (buffer.length > 0) { | ||
| lines.push(buffer); | ||
| } | ||
| return lines; | ||
| } | ||
| trim() { | ||
| return new SpecialString(this.str.trim()); | ||
| } | ||
| before = ''; | ||
| after = ''; | ||
| cut = ''; | ||
| cur = 0; | ||
| trimLeft() { | ||
| return new SpecialString(this.str.replace(/^\s+/, '')); | ||
| } | ||
| self._countChars(this._str, function (char, charLength) { | ||
| if (_this.str === 'ab<tag>') { | ||
| console.log(charLength, char); | ||
| } | ||
| trimRight() { | ||
| return new SpecialString(this.str.replace(/\s+$/, '')); | ||
| } | ||
| if (cur === from && char.match(/^\s+$/) && trimLeft) { | ||
| return; | ||
| } | ||
| _getLength() { | ||
| var sum; | ||
| sum = 0; | ||
| self._countChars(this._str, function(char, charLength) { | ||
| sum += charLength; | ||
| }); | ||
| return sum; | ||
| } | ||
| if (cur < from) { | ||
| before += char; // let's be greedy | ||
| } else if (cur < to || cur + charLength <= to) { | ||
| cut += char; | ||
| } else { | ||
| after += char; | ||
| } | ||
| cut(from, to, trimLeft = false) { | ||
| var after, before, cur, cut; | ||
| if (to == null) { | ||
| to = this.length; | ||
| cur += charLength; | ||
| }); | ||
| this._str = before + after; | ||
| this._reset(); | ||
| return new SpecialString(cut); | ||
| } | ||
| from = parseInt(from); | ||
| if (from >= to) { | ||
| throw Error("`from` shouldn't be larger than `to`"); | ||
| } | ||
| before = ''; | ||
| after = ''; | ||
| cut = ''; | ||
| cur = 0; | ||
| self._countChars(this._str, (char, charLength) => { | ||
| if (this.str === 'ab<tag>') { | ||
| console.log(charLength, char); | ||
| } | ||
| if (cur === from && char.match(/^\s+$/) && trimLeft) { | ||
| return; | ||
| } | ||
| if (cur < from) { | ||
| before += char; | ||
| // let's be greedy | ||
| } else if (cur < to || cur + charLength <= to) { | ||
| cut += char; | ||
| } else { | ||
| after += char; | ||
| } | ||
| cur += charLength; | ||
| }); | ||
| this._str = before + after; | ||
| this._reset(); | ||
| return new SpecialString(cut); | ||
| } | ||
| }], [{ | ||
| key: "_countChars", | ||
| value: function _countChars(text, cb) { | ||
| var char, charLength, m; | ||
| static _countChars(text, cb) { | ||
| var char, charLength, m; | ||
| while (text.length !== 0) { | ||
| if (m = text.match(self._tagRx)) { | ||
| char = m[0]; | ||
| charLength = 0; | ||
| text = text.substr(char.length, text.length); | ||
| } else if (m = text.match(self._quotedHtmlRx)) { | ||
| char = m[0]; | ||
| charLength = 1; | ||
| text = text.substr(char.length, text.length); | ||
| } else if (text.match(self._tabRx)) { | ||
| char = "\t"; | ||
| charLength = 8; | ||
| text = text.substr(1, text.length); | ||
| } else { | ||
| char = text[0]; | ||
| charLength = 1; | ||
| text = text.substr(1, text.length); | ||
| while (text.length !== 0) { | ||
| if (m = text.match(self._tagRx)) { | ||
| char = m[0]; | ||
| charLength = 0; | ||
| text = text.substr(char.length, text.length); | ||
| } else if (m = text.match(self._quotedHtmlRx)) { | ||
| char = m[0]; | ||
| charLength = 1; | ||
| text = text.substr(char.length, text.length); | ||
| } else if (text.match(self._tabRx)) { | ||
| char = "\t"; | ||
| charLength = 8; | ||
| text = text.substr(1, text.length); | ||
| } else { | ||
| char = text[0]; | ||
| charLength = 1; | ||
| text = text.substr(1, text.length); | ||
| } | ||
| cb.call(null, char, charLength); | ||
| } | ||
| cb.call(null, char, charLength); | ||
| } | ||
| } | ||
| }]); | ||
| }; | ||
| return SpecialString; | ||
| }(); | ||
| ; | ||
| self = SpecialString; | ||
| SpecialString._tabRx = /^\t/; | ||
| SpecialString._tagRx = /^<[^>]+>/; | ||
| SpecialString._quotedHtmlRx = /^&(gt|lt|quot|amp|apos|sp);/; | ||
| return SpecialString; | ||
| }.call(void 0); | ||
| }).call(this); | ||
| ref = ['str', 'length']; | ||
| ref = ['str', 'length']; | ||
| for (i = 0, len = ref.length; i < len; i++) { | ||
| prop = ref[i]; | ||
| (function() { | ||
| (function () { | ||
| var methodName; | ||
| methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length); | ||
| return SpecialString.prototype.__defineGetter__(prop, function() { | ||
| return SpecialString.prototype.__defineGetter__(prop, function () { | ||
| return this[methodName](); | ||
| }); | ||
| })(); | ||
| } | ||
| } |
+185
-135
@@ -0,183 +1,235 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var AnsiPainter, Layout, RenderKid, Styles, blockStyleApplier, cloneAndMergeDeep, inlineStyleApplier, isPlainObject, stripAnsi, terminalWidth, tools; | ||
| inlineStyleApplier = require('./renderKid/styleApplier/inline'); | ||
| blockStyleApplier = require('./renderKid/styleApplier/block'); | ||
| isPlainObject = require('lodash/isPlainObject'); | ||
| ({cloneAndMergeDeep} = require('./tools')); | ||
| var _require = require('./tools'); | ||
| cloneAndMergeDeep = _require.cloneAndMergeDeep; | ||
| AnsiPainter = require('./AnsiPainter'); | ||
| Styles = require('./renderKid/Styles'); | ||
| Layout = require('./Layout'); | ||
| tools = require('./tools'); | ||
| stripAnsi = require('strip-ansi'); | ||
| terminalWidth = require('./tools').getCols(); | ||
| module.exports = RenderKid = (function() { | ||
| module.exports = RenderKid = function () { | ||
| var self; | ||
| class RenderKid { | ||
| constructor(config = {}) { | ||
| var RenderKid = /*#__PURE__*/function () { | ||
| function RenderKid() { | ||
| var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
| _classCallCheck(this, RenderKid); | ||
| this.tools = self.tools; | ||
| this._config = cloneAndMergeDeep(self._defaultConfig, config); | ||
| this._initStyles(); | ||
| } | ||
| _initStyles() { | ||
| return this._styles = new Styles(); | ||
| } | ||
| _createClass(RenderKid, [{ | ||
| key: "_initStyles", | ||
| value: function _initStyles() { | ||
| return this._styles = new Styles(); | ||
| } | ||
| }, { | ||
| key: "style", | ||
| value: function style() { | ||
| return this._styles.setRule.apply(this._styles, arguments); | ||
| } | ||
| }, { | ||
| key: "_getStyleFor", | ||
| value: function _getStyleFor(el) { | ||
| return this._styles.getStyleFor(el); | ||
| } | ||
| }, { | ||
| key: "render", | ||
| value: function render(input) { | ||
| var withColors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
| return this._paint(this._renderDom(this._toDom(input)), withColors); | ||
| } | ||
| }, { | ||
| key: "_toDom", | ||
| value: function _toDom(input) { | ||
| if (typeof input === 'string') { | ||
| return this._parse(input); | ||
| } else if (isPlainObject(input) || Array.isArray(input)) { | ||
| return this._objToDom(input); | ||
| } else { | ||
| throw Error("Invalid input type. Only strings, arrays and objects are accepted"); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_objToDom", | ||
| value: function _objToDom(o) { | ||
| var injectFakeRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
| style() { | ||
| return this._styles.setRule.apply(this._styles, arguments); | ||
| } | ||
| if (injectFakeRoot) { | ||
| o = { | ||
| body: o | ||
| }; | ||
| } | ||
| _getStyleFor(el) { | ||
| return this._styles.getStyleFor(el); | ||
| } | ||
| render(input, withColors = true) { | ||
| return this._paint(this._renderDom(this._toDom(input)), withColors); | ||
| } | ||
| _toDom(input) { | ||
| if (typeof input === 'string') { | ||
| return this._parse(input); | ||
| } else if (isPlainObject(input) || Array.isArray(input)) { | ||
| return this._objToDom(input); | ||
| } else { | ||
| throw Error("Invalid input type. Only strings, arrays and objects are accepted"); | ||
| return tools.objectToDom(o); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_paint", | ||
| value: function _paint(text, withColors) { | ||
| var painted; | ||
| painted = AnsiPainter.paint(text); | ||
| _objToDom(o, injectFakeRoot = true) { | ||
| if (injectFakeRoot) { | ||
| o = { | ||
| body: o | ||
| }; | ||
| if (withColors) { | ||
| return painted; | ||
| } else { | ||
| return stripAnsi(painted); | ||
| } | ||
| } | ||
| return tools.objectToDom(o); | ||
| } | ||
| }, { | ||
| key: "_parse", | ||
| value: function _parse(string) { | ||
| var injectFakeRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
| _paint(text, withColors) { | ||
| var painted; | ||
| painted = AnsiPainter.paint(text); | ||
| if (withColors) { | ||
| return painted; | ||
| } else { | ||
| return stripAnsi(painted); | ||
| } | ||
| } | ||
| if (injectFakeRoot) { | ||
| string = '<body>' + string + '</body>'; | ||
| } | ||
| _parse(string, injectFakeRoot = true) { | ||
| if (injectFakeRoot) { | ||
| string = '<body>' + string + '</body>'; | ||
| return tools.stringToDom(string); | ||
| } | ||
| return tools.stringToDom(string); | ||
| } | ||
| }, { | ||
| key: "_renderDom", | ||
| value: function _renderDom(dom) { | ||
| var bodyTag, layout, rootBlock; | ||
| bodyTag = dom[0]; | ||
| layout = new Layout(this._config.layout); | ||
| rootBlock = layout.getRootBlock(); | ||
| _renderDom(dom) { | ||
| var bodyTag, layout, rootBlock; | ||
| bodyTag = dom[0]; | ||
| layout = new Layout(this._config.layout); | ||
| rootBlock = layout.getRootBlock(); | ||
| this._renderBlockNode(bodyTag, null, rootBlock); | ||
| return layout.get(); | ||
| } | ||
| this._renderBlockNode(bodyTag, null, rootBlock); | ||
| _renderChildrenOf(parentNode, parentBlock) { | ||
| var i, len, node, nodes; | ||
| nodes = parentNode.children; | ||
| for (i = 0, len = nodes.length; i < len; i++) { | ||
| node = nodes[i]; | ||
| this._renderNode(node, parentNode, parentBlock); | ||
| return layout.get(); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_renderChildrenOf", | ||
| value: function _renderChildrenOf(parentNode, parentBlock) { | ||
| var i, len, node, nodes; | ||
| nodes = parentNode.children; | ||
| _renderNode(node, parentNode, parentBlock) { | ||
| if (node.type === 'text') { | ||
| this._renderText(node, parentNode, parentBlock); | ||
| } else if (node.name === 'br') { | ||
| this._renderBr(node, parentNode, parentBlock); | ||
| } else if (this._isBlock(node)) { | ||
| this._renderBlockNode(node, parentNode, parentBlock); | ||
| } else if (this._isNone(node)) { | ||
| return; | ||
| } else { | ||
| this._renderInlineNode(node, parentNode, parentBlock); | ||
| } | ||
| } | ||
| for (i = 0, len = nodes.length; i < len; i++) { | ||
| node = nodes[i]; | ||
| _renderText(node, parentNode, parentBlock) { | ||
| var ref, text; | ||
| text = node.data; | ||
| text = text.replace(/\s+/g, ' '); | ||
| // let's only trim if the parent is an inline element | ||
| if ((parentNode != null ? (ref = parentNode.styles) != null ? ref.display : void 0 : void 0) !== 'inline') { | ||
| text = text.trim(); | ||
| this._renderNode(node, parentNode, parentBlock); | ||
| } | ||
| } | ||
| if (text.length === 0) { | ||
| return; | ||
| }, { | ||
| key: "_renderNode", | ||
| value: function _renderNode(node, parentNode, parentBlock) { | ||
| if (node.type === 'text') { | ||
| this._renderText(node, parentNode, parentBlock); | ||
| } else if (node.name === 'br') { | ||
| this._renderBr(node, parentNode, parentBlock); | ||
| } else if (this._isBlock(node)) { | ||
| this._renderBlockNode(node, parentNode, parentBlock); | ||
| } else if (this._isNone(node)) { | ||
| return; | ||
| } else { | ||
| this._renderInlineNode(node, parentNode, parentBlock); | ||
| } | ||
| } | ||
| text = text.replace(/&nl;/g, "\n"); | ||
| return parentBlock.write(text); | ||
| } | ||
| }, { | ||
| key: "_renderText", | ||
| value: function _renderText(node, parentNode, parentBlock) { | ||
| var ref, text; | ||
| text = node.data; | ||
| text = text.replace(/\s+/g, ' '); // let's only trim if the parent is an inline element | ||
| _renderBlockNode(node, parentNode, parentBlock) { | ||
| var after, before, block, blockConfig; | ||
| ({before, after, blockConfig} = blockStyleApplier.applyTo(node, this._getStyleFor(node))); | ||
| block = parentBlock.openBlock(blockConfig); | ||
| if (before !== '') { | ||
| block.write(before); | ||
| if ((parentNode != null ? (ref = parentNode.styles) != null ? ref.display : void 0 : void 0) !== 'inline') { | ||
| text = text.trim(); | ||
| } | ||
| if (text.length === 0) { | ||
| return; | ||
| } | ||
| text = text.replace(/&nl;/g, "\n"); | ||
| return parentBlock.write(text); | ||
| } | ||
| this._renderChildrenOf(node, block); | ||
| if (after !== '') { | ||
| block.write(after); | ||
| } | ||
| return block.close(); | ||
| } | ||
| }, { | ||
| key: "_renderBlockNode", | ||
| value: function _renderBlockNode(node, parentNode, parentBlock) { | ||
| var after, before, block, blockConfig; | ||
| _renderInlineNode(node, parentNode, parentBlock) { | ||
| var after, before; | ||
| ({before, after} = inlineStyleApplier.applyTo(node, this._getStyleFor(node))); | ||
| if (before !== '') { | ||
| parentBlock.write(before); | ||
| var _blockStyleApplier$ap = blockStyleApplier.applyTo(node, this._getStyleFor(node)); | ||
| before = _blockStyleApplier$ap.before; | ||
| after = _blockStyleApplier$ap.after; | ||
| blockConfig = _blockStyleApplier$ap.blockConfig; | ||
| block = parentBlock.openBlock(blockConfig); | ||
| if (before !== '') { | ||
| block.write(before); | ||
| } | ||
| this._renderChildrenOf(node, block); | ||
| if (after !== '') { | ||
| block.write(after); | ||
| } | ||
| return block.close(); | ||
| } | ||
| this._renderChildrenOf(node, parentBlock); | ||
| if (after !== '') { | ||
| return parentBlock.write(after); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_renderInlineNode", | ||
| value: function _renderInlineNode(node, parentNode, parentBlock) { | ||
| var after, before; | ||
| _renderBr(node, parentNode, parentBlock) { | ||
| return parentBlock.write("\n"); | ||
| } | ||
| var _inlineStyleApplier$a = inlineStyleApplier.applyTo(node, this._getStyleFor(node)); | ||
| _isBlock(node) { | ||
| return !(node.type === 'text' || node.name === 'br' || this._getStyleFor(node).display !== 'block'); | ||
| } | ||
| before = _inlineStyleApplier$a.before; | ||
| after = _inlineStyleApplier$a.after; | ||
| _isNone(node) { | ||
| return !(node.type === 'text' || node.name === 'br' || this._getStyleFor(node).display !== 'none'); | ||
| } | ||
| if (before !== '') { | ||
| parentBlock.write(before); | ||
| } | ||
| }; | ||
| this._renderChildrenOf(node, parentBlock); | ||
| if (after !== '') { | ||
| return parentBlock.write(after); | ||
| } | ||
| } | ||
| }, { | ||
| key: "_renderBr", | ||
| value: function _renderBr(node, parentNode, parentBlock) { | ||
| return parentBlock.write("\n"); | ||
| } | ||
| }, { | ||
| key: "_isBlock", | ||
| value: function _isBlock(node) { | ||
| return !(node.type === 'text' || node.name === 'br' || this._getStyleFor(node).display !== 'block'); | ||
| } | ||
| }, { | ||
| key: "_isNone", | ||
| value: function _isNone(node) { | ||
| return !(node.type === 'text' || node.name === 'br' || this._getStyleFor(node).display !== 'none'); | ||
| } | ||
| }]); | ||
| return RenderKid; | ||
| }(); | ||
| ; | ||
| self = RenderKid; | ||
| RenderKid.AnsiPainter = AnsiPainter; | ||
| RenderKid.Layout = Layout; | ||
| RenderKid.quote = tools.quote; | ||
| RenderKid.tools = tools; | ||
| RenderKid._defaultConfig = { | ||
@@ -188,5 +240,3 @@ layout: { | ||
| }; | ||
| return RenderKid; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,3 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,21 +7,27 @@ var AnsiPainter, _common; | ||
| AnsiPainter = require('../../AnsiPainter'); | ||
| module.exports = _common = { | ||
| getStyleTagsFor: function(style) { | ||
| getStyleTagsFor: function getStyleTagsFor(style) { | ||
| var i, len, ret, tag, tagName, tagsToAdd; | ||
| tagsToAdd = []; | ||
| if (style.color != null) { | ||
| tagName = 'color-' + style.color; | ||
| if (AnsiPainter.tags[tagName] == null) { | ||
| throw Error(`Unknown color \`${style.color}\``); | ||
| throw Error("Unknown color `".concat(style.color, "`")); | ||
| } | ||
| tagsToAdd.push(tagName); | ||
| } | ||
| if (style.background != null) { | ||
| tagName = 'bg-' + style.background; | ||
| if (AnsiPainter.tags[tagName] == null) { | ||
| throw Error(`Unknown background \`${style.background}\``); | ||
| throw Error("Unknown background `".concat(style.background, "`")); | ||
| } | ||
| tagsToAdd.push(tagName); | ||
| } | ||
| ret = { | ||
@@ -29,9 +37,11 @@ before: '', | ||
| }; | ||
| for (i = 0, len = tagsToAdd.length; i < len; i++) { | ||
| tag = tagsToAdd[i]; | ||
| ret.before = `<${tag}>` + ret.before; | ||
| ret.after = ret.after + `</${tag}>`; | ||
| ret.before = "<".concat(tag, ">") + ret.before; | ||
| ret.after = ret.after + "</".concat(tag, ">"); | ||
| } | ||
| return ret; | ||
| } | ||
| }; | ||
| }; |
@@ -0,1 +1,3 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,16 +7,18 @@ var _common, blockStyleApplier, merge, self; | ||
| _common = require('./_common'); | ||
| merge = require('lodash/merge'); | ||
| module.exports = blockStyleApplier = self = { | ||
| applyTo: function(el, style) { | ||
| applyTo: function applyTo(el, style) { | ||
| var config, ret; | ||
| ret = _common.getStyleTagsFor(style); | ||
| ret.blockConfig = config = {}; | ||
| this._margins(style, config); | ||
| this._bullet(style, config); | ||
| this._dims(style, config); | ||
| return ret; | ||
| }, | ||
| _margins: function(style, config) { | ||
| _margins: function _margins(style, config) { | ||
| if (style.marginLeft != null) { | ||
@@ -29,2 +33,3 @@ merge(config, { | ||
| } | ||
| if (style.marginRight != null) { | ||
@@ -39,2 +44,3 @@ merge(config, { | ||
| } | ||
| if (style.marginTop != null) { | ||
@@ -49,2 +55,3 @@ merge(config, { | ||
| } | ||
| if (style.marginBottom != null) { | ||
@@ -60,12 +67,17 @@ merge(config, { | ||
| }, | ||
| _bullet: function(style, config) { | ||
| _bullet: function _bullet(style, config) { | ||
| var after, before, bullet, conf; | ||
| if ((style.bullet != null) && style.bullet.enabled) { | ||
| if (style.bullet != null && style.bullet.enabled) { | ||
| bullet = style.bullet; | ||
| conf = {}; | ||
| conf.alignment = style.bullet.alignment; | ||
| ({before, after} = _common.getStyleTagsFor({ | ||
| var _common$getStyleTagsF = _common.getStyleTagsFor({ | ||
| color: bullet.color, | ||
| background: bullet.background | ||
| })); | ||
| }); | ||
| before = _common$getStyleTagsF.before; | ||
| after = _common$getStyleTagsF.after; | ||
| conf.char = before + bullet.char + after; | ||
@@ -81,4 +93,5 @@ merge(config, { | ||
| }, | ||
| _dims: function(style, config) { | ||
| _dims: function _dims(style, config) { | ||
| var w; | ||
| if (style.width != null) { | ||
@@ -89,2 +102,2 @@ w = parseInt(style.width); | ||
| } | ||
| }; | ||
| }; |
@@ -0,1 +1,3 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,23 +7,26 @@ var _common, inlineStyleApplier, self, tools; | ||
| tools = require('../../tools'); | ||
| _common = require('./_common'); | ||
| module.exports = inlineStyleApplier = self = { | ||
| applyTo: function(el, style) { | ||
| applyTo: function applyTo(el, style) { | ||
| var ret; | ||
| ret = _common.getStyleTagsFor(style); | ||
| if (style.marginLeft != null) { | ||
| ret.before = (tools.repeatString("&sp;", parseInt(style.marginLeft))) + ret.before; | ||
| ret.before = tools.repeatString("&sp;", parseInt(style.marginLeft)) + ret.before; | ||
| } | ||
| if (style.marginRight != null) { | ||
| ret.after += tools.repeatString("&sp;", parseInt(style.marginRight)); | ||
| } | ||
| if (style.paddingLeft != null) { | ||
| ret.before += tools.repeatString("&sp;", parseInt(style.paddingLeft)); | ||
| } | ||
| if (style.paddingRight != null) { | ||
| ret.after = (tools.repeatString("&sp;", parseInt(style.paddingRight))) + ret.after; | ||
| ret.after = tools.repeatString("&sp;", parseInt(style.paddingRight)) + ret.after; | ||
| } | ||
| return ret; | ||
| } | ||
| }; | ||
| }; |
+64
-44
@@ -0,65 +1,87 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var MixedDeclarationSet, StyleSheet, Styles, terminalWidth; | ||
| StyleSheet = require('./styles/StyleSheet'); | ||
| MixedDeclarationSet = require('./styles/rule/MixedDeclarationSet'); | ||
| terminalWidth = require('../tools').getCols(); | ||
| module.exports = Styles = (function() { | ||
| module.exports = Styles = function () { | ||
| var self; | ||
| class Styles { | ||
| constructor() { | ||
| var Styles = /*#__PURE__*/function () { | ||
| function Styles() { | ||
| _classCallCheck(this, Styles); | ||
| this._defaultStyles = new StyleSheet(); | ||
| this._userStyles = new StyleSheet(); | ||
| this._setDefaultStyles(); | ||
| } | ||
| _setDefaultStyles() { | ||
| this._defaultStyles.setRule(self.defaultRules); | ||
| } | ||
| _createClass(Styles, [{ | ||
| key: "_setDefaultStyles", | ||
| value: function _setDefaultStyles() { | ||
| this._defaultStyles.setRule(self.defaultRules); | ||
| } | ||
| }, { | ||
| key: "setRule", | ||
| value: function setRule(selector, rules) { | ||
| this._userStyles.setRule.apply(this._userStyles, arguments); | ||
| setRule(selector, rules) { | ||
| this._userStyles.setRule.apply(this._userStyles, arguments); | ||
| return this; | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "getStyleFor", | ||
| value: function getStyleFor(el) { | ||
| var styles; | ||
| styles = el.styles; | ||
| getStyleFor(el) { | ||
| var styles; | ||
| styles = el.styles; | ||
| if (styles == null) { | ||
| el.styles = styles = this._getComputedStyleFor(el); | ||
| if (styles == null) { | ||
| el.styles = styles = this._getComputedStyleFor(el); | ||
| } | ||
| return styles; | ||
| } | ||
| return styles; | ||
| } | ||
| }, { | ||
| key: "_getRawStyleFor", | ||
| value: function _getRawStyleFor(el) { | ||
| var def, user; | ||
| def = this._defaultStyles.getRulesFor(el); | ||
| user = this._userStyles.getRulesFor(el); | ||
| return MixedDeclarationSet.mix(def, user).toObject(); | ||
| } | ||
| }, { | ||
| key: "_getComputedStyleFor", | ||
| value: function _getComputedStyleFor(el) { | ||
| var decs, parent, prop, ref, val; | ||
| decs = {}; | ||
| parent = el.parent; | ||
| ref = this._getRawStyleFor(el); | ||
| _getRawStyleFor(el) { | ||
| var def, user; | ||
| def = this._defaultStyles.getRulesFor(el); | ||
| user = this._userStyles.getRulesFor(el); | ||
| return MixedDeclarationSet.mix(def, user).toObject(); | ||
| } | ||
| for (prop in ref) { | ||
| val = ref[prop]; | ||
| _getComputedStyleFor(el) { | ||
| var decs, parent, prop, ref, val; | ||
| decs = {}; | ||
| parent = el.parent; | ||
| ref = this._getRawStyleFor(el); | ||
| for (prop in ref) { | ||
| val = ref[prop]; | ||
| if (val !== 'inherit') { | ||
| decs[prop] = val; | ||
| } else { | ||
| throw Error("Inherited styles are not supported yet."); | ||
| if (val !== 'inherit') { | ||
| decs[prop] = val; | ||
| } else { | ||
| throw Error("Inherited styles are not supported yet."); | ||
| } | ||
| } | ||
| return decs; | ||
| } | ||
| return decs; | ||
| } | ||
| }]); | ||
| }; | ||
| return Styles; | ||
| }(); | ||
| ; | ||
| self = Styles; | ||
| Styles.defaultRules = { | ||
@@ -76,5 +98,3 @@ '*': { | ||
| }; | ||
| return Styles; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,10 +1,18 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var DeclarationBlock, Rule, Selector; | ||
| Selector = require('./rule/Selector'); | ||
| DeclarationBlock = require('./rule/DeclarationBlock'); | ||
| module.exports = Rule = class Rule { | ||
| constructor(selector) { | ||
| module.exports = Rule = /*#__PURE__*/function () { | ||
| function Rule(selector) { | ||
| _classCallCheck(this, Rule); | ||
| this.selector = new Selector(selector); | ||
@@ -14,7 +22,11 @@ this.styles = new DeclarationBlock(); | ||
| setStyles(styles) { | ||
| this.styles.set(styles); | ||
| return this; | ||
| } | ||
| _createClass(Rule, [{ | ||
| key: "setStyles", | ||
| value: function setStyles(styles) { | ||
| this.styles.set(styles); | ||
| return this; | ||
| } | ||
| }]); | ||
| }; | ||
| return Rule; | ||
| }(); |
@@ -0,51 +1,75 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var Arbitrary, DeclarationBlock, declarationClasses; | ||
| module.exports = DeclarationBlock = (function() { | ||
| module.exports = DeclarationBlock = function () { | ||
| var self; | ||
| class DeclarationBlock { | ||
| constructor() { | ||
| var DeclarationBlock = /*#__PURE__*/function () { | ||
| function DeclarationBlock() { | ||
| _classCallCheck(this, DeclarationBlock); | ||
| this._declarations = {}; | ||
| } | ||
| set(prop, value) { | ||
| var key, val; | ||
| if (typeof prop === 'object') { | ||
| for (key in prop) { | ||
| val = prop[key]; | ||
| this.set(key, val); | ||
| _createClass(DeclarationBlock, [{ | ||
| key: "set", | ||
| value: function set(prop, value) { | ||
| var key, val; | ||
| if (_typeof(prop) === 'object') { | ||
| for (key in prop) { | ||
| val = prop[key]; | ||
| this.set(key, val); | ||
| } | ||
| return this; | ||
| } | ||
| prop = self.sanitizeProp(prop); | ||
| this._getDeclarationClass(prop).setOnto(this._declarations, prop, value); | ||
| return this; | ||
| } | ||
| prop = self.sanitizeProp(prop); | ||
| this._getDeclarationClass(prop).setOnto(this._declarations, prop, value); | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_getDeclarationClass", | ||
| value: function _getDeclarationClass(prop) { | ||
| var cls; | ||
| _getDeclarationClass(prop) { | ||
| var cls; | ||
| if (prop[0] === '_') { | ||
| return Arbitrary; | ||
| if (prop[0] === '_') { | ||
| return Arbitrary; | ||
| } | ||
| if (!(cls = declarationClasses[prop])) { | ||
| throw Error("Unknown property `".concat(prop, "`. Write it as `_").concat(prop, "` if you're defining a custom property")); | ||
| } | ||
| return cls; | ||
| } | ||
| if (!(cls = declarationClasses[prop])) { | ||
| throw Error(`Unknown property \`${prop}\`. Write it as \`_${prop}\` if you're defining a custom property`); | ||
| }], [{ | ||
| key: "sanitizeProp", | ||
| value: function sanitizeProp(prop) { | ||
| return String(prop).trim(); | ||
| } | ||
| return cls; | ||
| } | ||
| }]); | ||
| static sanitizeProp(prop) { | ||
| return String(prop).trim(); | ||
| } | ||
| return DeclarationBlock; | ||
| }(); | ||
| }; | ||
| ; | ||
| self = DeclarationBlock; | ||
| return DeclarationBlock; | ||
| }.call(void 0); | ||
| }).call(this); | ||
| Arbitrary = require('./declarationBlock/Arbitrary'); | ||
| declarationClasses = { | ||
@@ -68,2 +92,2 @@ color: require('./declarationBlock/Color'), | ||
| paddingBottom: require('./declarationBlock/PaddingBottom') | ||
| }; | ||
| }; |
@@ -0,1 +1,9 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,20 +13,9 @@ // Abstract Style Declaration | ||
| module.exports = _Declaration = (function() { | ||
| module.exports = _Declaration = function () { | ||
| var self; | ||
| class _Declaration { | ||
| static setOnto(declarations, prop, val) { | ||
| var dec; | ||
| if (!(dec = declarations[prop])) { | ||
| return declarations[prop] = new this(prop, val); | ||
| } else { | ||
| return dec.set(val); | ||
| } | ||
| } | ||
| var _Declaration = /*#__PURE__*/function () { | ||
| function _Declaration(prop1, val) { | ||
| _classCallCheck(this, _Declaration); | ||
| static sanitizeValue(val) { | ||
| return String(val).trim().replace(/[\s]+/g, ' '); | ||
| } | ||
| constructor(prop1, val) { | ||
| this.prop = prop1; | ||
@@ -29,62 +26,89 @@ this.important = false; | ||
| get() { | ||
| return this._get(); | ||
| } | ||
| _createClass(_Declaration, [{ | ||
| key: "get", | ||
| value: function get() { | ||
| return this._get(); | ||
| } | ||
| }, { | ||
| key: "_get", | ||
| value: function _get() { | ||
| return this.val; | ||
| } | ||
| }, { | ||
| key: "_pickImportantClause", | ||
| value: function _pickImportantClause(val) { | ||
| if (self.importantClauseRx.test(String(val))) { | ||
| this.important = true; | ||
| return val.replace(self.importantClauseRx, ''); | ||
| } else { | ||
| this.important = false; | ||
| return val; | ||
| } | ||
| } | ||
| }, { | ||
| key: "set", | ||
| value: function set(val) { | ||
| val = self.sanitizeValue(val); | ||
| val = this._pickImportantClause(val); | ||
| val = val.trim(); | ||
| _get() { | ||
| return this.val; | ||
| } | ||
| if (this._handleNullOrInherit(val)) { | ||
| return this; | ||
| } | ||
| _pickImportantClause(val) { | ||
| if (self.importantClauseRx.test(String(val))) { | ||
| this.important = true; | ||
| return val.replace(self.importantClauseRx, ''); | ||
| } else { | ||
| this.important = false; | ||
| return val; | ||
| } | ||
| } | ||
| this._set(val); | ||
| set(val) { | ||
| val = self.sanitizeValue(val); | ||
| val = this._pickImportantClause(val); | ||
| val = val.trim(); | ||
| if (this._handleNullOrInherit(val)) { | ||
| return this; | ||
| } | ||
| this._set(val); | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_set", | ||
| value: function _set(val) { | ||
| return this.val = val; | ||
| } | ||
| }, { | ||
| key: "_handleNullOrInherit", | ||
| value: function _handleNullOrInherit(val) { | ||
| if (val === '') { | ||
| this.val = ''; | ||
| return true; | ||
| } | ||
| _set(val) { | ||
| return this.val = val; | ||
| } | ||
| if (val === 'inherit') { | ||
| if (this.constructor.inheritAllowed) { | ||
| this.val = 'inherit'; | ||
| } else { | ||
| throw Error("Inherit is not allowed for `".concat(this.prop, "`")); | ||
| } | ||
| _handleNullOrInherit(val) { | ||
| if (val === '') { | ||
| this.val = ''; | ||
| return true; | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
| if (val === 'inherit') { | ||
| if (this.constructor.inheritAllowed) { | ||
| this.val = 'inherit'; | ||
| }], [{ | ||
| key: "setOnto", | ||
| value: function setOnto(declarations, prop, val) { | ||
| var dec; | ||
| if (!(dec = declarations[prop])) { | ||
| return declarations[prop] = new this(prop, val); | ||
| } else { | ||
| throw Error(`Inherit is not allowed for \`${this.prop}\``); | ||
| return dec.set(val); | ||
| } | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
| }, { | ||
| key: "sanitizeValue", | ||
| value: function sanitizeValue(val) { | ||
| return String(val).trim().replace(/[\s]+/g, ' '); | ||
| } | ||
| }]); | ||
| }; | ||
| return _Declaration; | ||
| }(); | ||
| ; | ||
| self = _Declaration; | ||
| _Declaration.importantClauseRx = /(\s\!important)$/; | ||
| _Declaration.inheritAllowed = false; | ||
| return _Declaration; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,25 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,10 +30,25 @@ var _Declaration, _Length; | ||
| module.exports = _Length = class _Length extends _Declaration { | ||
| _set(val) { | ||
| if (!/^[0-9]+$/.test(String(val))) { | ||
| throw Error(`\`${this.prop}\` only takes an integer for value`); | ||
| } | ||
| return this.val = parseInt(val); | ||
| module.exports = _Length = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(_Length, _Declaration2); | ||
| var _super = _createSuper(_Length); | ||
| function _Length() { | ||
| _classCallCheck(this, _Length); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| }; | ||
| _createClass(_Length, [{ | ||
| key: "_set", | ||
| value: function _set(val) { | ||
| if (!/^[0-9]+$/.test(String(val))) { | ||
| throw Error("`".concat(this.prop, "` only takes an integer for value")); | ||
| } | ||
| return this.val = parseInt(val); | ||
| } | ||
| }]); | ||
| return _Length; | ||
| }(_Declaration); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var Arbitrary, _Declaration; | ||
| module.exports = Arbitrary = class Arbitrary extends _Declaration {}; | ||
| module.exports = Arbitrary = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Arbitrary, _Declaration2); | ||
| var _super = _createSuper(Arbitrary); | ||
| function Arbitrary() { | ||
| _classCallCheck(this, Arbitrary); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return Arbitrary; | ||
| }(_Declaration); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var Background, _Declaration; | ||
| module.exports = Background = class Background extends _Declaration {}; | ||
| module.exports = Background = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Background, _Declaration2); | ||
| var _super = _createSuper(Background); | ||
| function Background() { | ||
| _classCallCheck(this, Background); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return Background; | ||
| }(_Declaration); |
@@ -0,1 +1,25 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,54 +30,74 @@ var Bullet, _Declaration; | ||
| module.exports = Bullet = (function() { | ||
| module.exports = Bullet = function () { | ||
| var self; | ||
| class Bullet extends _Declaration { | ||
| _set(val) { | ||
| var alignment, bg, char, color, enabled, m, original; | ||
| val = String(val); | ||
| original = val; | ||
| char = null; | ||
| enabled = false; | ||
| color = 'none'; | ||
| bg = 'none'; | ||
| if (m = val.match(/\"([^"]+)\"/) || (m = val.match(/\'([^']+)\'/))) { | ||
| char = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| enabled = true; | ||
| } | ||
| if (m = val.match(/(none|left|right|center)/)) { | ||
| alignment = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } else { | ||
| alignment = 'left'; | ||
| } | ||
| if (alignment === 'none') { | ||
| var Bullet = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Bullet, _Declaration2); | ||
| var _super = _createSuper(Bullet); | ||
| function Bullet() { | ||
| _classCallCheck(this, Bullet); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| _createClass(Bullet, [{ | ||
| key: "_set", | ||
| value: function _set(val) { | ||
| var alignment, bg, char, color, enabled, m, original; | ||
| val = String(val); | ||
| original = val; | ||
| char = null; | ||
| enabled = false; | ||
| color = 'none'; | ||
| bg = 'none'; | ||
| if (m = val.match(/\"([^"]+)\"/) || (m = val.match(/\'([^']+)\'/))) { | ||
| char = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| enabled = true; | ||
| } | ||
| if (m = val.match(/(none|left|right|center)/)) { | ||
| alignment = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } else { | ||
| alignment = 'left'; | ||
| } | ||
| if (alignment === 'none') { | ||
| enabled = false; | ||
| } | ||
| if (m = val.match(/color\:([\w\-]+)/)) { | ||
| color = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } | ||
| if (m = val.match(/bg\:([\w\-]+)/)) { | ||
| bg = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } | ||
| if (val.trim() !== '') { | ||
| throw Error("Unrecognizable value `".concat(original, "` for `").concat(this.prop, "`")); | ||
| } | ||
| return this.val = { | ||
| enabled: enabled, | ||
| char: char, | ||
| alignment: alignment, | ||
| background: bg, | ||
| color: color | ||
| }; | ||
| } | ||
| if (m = val.match(/color\:([\w\-]+)/)) { | ||
| color = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } | ||
| if (m = val.match(/bg\:([\w\-]+)/)) { | ||
| bg = m[1]; | ||
| val = val.replace(m[0], ''); | ||
| } | ||
| if (val.trim() !== '') { | ||
| throw Error(`Unrecognizable value \`${original}\` for \`${this.prop}\``); | ||
| } | ||
| return this.val = { | ||
| enabled: enabled, | ||
| char: char, | ||
| alignment: alignment, | ||
| background: bg, | ||
| color: color | ||
| }; | ||
| } | ||
| }]); | ||
| }; | ||
| return Bullet; | ||
| }(_Declaration); | ||
| ; | ||
| self = Bullet; | ||
| return Bullet; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var Color, _Declaration; | ||
| module.exports = Color = class Color extends _Declaration {}; | ||
| module.exports = Color = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Color, _Declaration2); | ||
| var _super = _createSuper(Color); | ||
| function Color() { | ||
| _classCallCheck(this, Color); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return Color; | ||
| }(_Declaration); |
@@ -0,27 +1,66 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var Display, _Declaration, | ||
| indexOf = [].indexOf; | ||
| var Display, | ||
| _Declaration, | ||
| indexOf = [].indexOf; | ||
| _Declaration = require('./_Declaration'); | ||
| module.exports = Display = (function() { | ||
| module.exports = Display = function () { | ||
| var self; | ||
| class Display extends _Declaration { | ||
| _set(val) { | ||
| val = String(val).toLowerCase(); | ||
| if (indexOf.call(self._allowed, val) < 0) { | ||
| throw Error(`Unrecognizable value \`${val}\` for \`${this.prop}\``); | ||
| } | ||
| return this.val = val; | ||
| var Display = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Display, _Declaration2); | ||
| var _super = _createSuper(Display); | ||
| function Display() { | ||
| _classCallCheck(this, Display); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| }; | ||
| _createClass(Display, [{ | ||
| key: "_set", | ||
| value: function _set(val) { | ||
| val = String(val).toLowerCase(); | ||
| if (indexOf.call(self._allowed, val) < 0) { | ||
| throw Error("Unrecognizable value `".concat(val, "` for `").concat(this.prop, "`")); | ||
| } | ||
| return this.val = val; | ||
| } | ||
| }]); | ||
| return Display; | ||
| }(_Declaration); | ||
| ; | ||
| self = Display; | ||
| Display._allowed = ['inline', 'block', 'none']; | ||
| return Display; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var Height, _Length; | ||
| module.exports = Height = class Height extends _Length {}; | ||
| module.exports = Height = /*#__PURE__*/function (_Length2) { | ||
| _inherits(Height, _Length2); | ||
| var _super = _createSuper(Height); | ||
| function Height() { | ||
| _classCallCheck(this, Height); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return Height; | ||
| }(_Length); |
@@ -0,1 +1,25 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,56 +29,71 @@ var Margin, MarginBottom, MarginLeft, MarginRight, MarginTop, _Declaration; | ||
| _Declaration = require('./_Declaration'); | ||
| MarginTop = require('./MarginTop'); | ||
| MarginLeft = require('./MarginLeft'); | ||
| MarginRight = require('./MarginRight'); | ||
| MarginBottom = require('./MarginBottom'); | ||
| module.exports = Margin = (function() { | ||
| module.exports = Margin = function () { | ||
| var self; | ||
| class Margin extends _Declaration { | ||
| static setOnto(declarations, prop, originalValue) { | ||
| var append, val, vals; | ||
| append = ''; | ||
| val = _Declaration.sanitizeValue(originalValue); | ||
| if (_Declaration.importantClauseRx.test(String(val))) { | ||
| append = ' !important'; | ||
| val = val.replace(_Declaration.importantClauseRx, ''); | ||
| var Margin = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Margin, _Declaration2); | ||
| var _super = _createSuper(Margin); | ||
| function Margin() { | ||
| _classCallCheck(this, Margin); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| _createClass(Margin, null, [{ | ||
| key: "setOnto", | ||
| value: function setOnto(declarations, prop, originalValue) { | ||
| var append, val, vals; | ||
| append = ''; | ||
| val = _Declaration.sanitizeValue(originalValue); | ||
| if (_Declaration.importantClauseRx.test(String(val))) { | ||
| append = ' !important'; | ||
| val = val.replace(_Declaration.importantClauseRx, ''); | ||
| } | ||
| val = val.trim(); | ||
| if (val.length === 0) { | ||
| return self._setAllDirections(declarations, append, append, append, append); | ||
| } | ||
| vals = val.split(" ").map(function (val) { | ||
| return val + append; | ||
| }); | ||
| if (vals.length === 1) { | ||
| return self._setAllDirections(declarations, vals[0], vals[0], vals[0], vals[0]); | ||
| } else if (vals.length === 2) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[0], vals[1]); | ||
| } else if (vals.length === 3) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[1]); | ||
| } else if (vals.length === 4) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[3]); | ||
| } else { | ||
| throw Error("Can't understand value for margin: `".concat(originalValue, "`")); | ||
| } | ||
| } | ||
| val = val.trim(); | ||
| if (val.length === 0) { | ||
| return self._setAllDirections(declarations, append, append, append, append); | ||
| }, { | ||
| key: "_setAllDirections", | ||
| value: function _setAllDirections(declarations, top, right, bottom, left) { | ||
| MarginTop.setOnto(declarations, 'marginTop', top); | ||
| MarginTop.setOnto(declarations, 'marginRight', right); | ||
| MarginTop.setOnto(declarations, 'marginBottom', bottom); | ||
| MarginTop.setOnto(declarations, 'marginLeft', left); | ||
| } | ||
| vals = val.split(" ").map(function(val) { | ||
| return val + append; | ||
| }); | ||
| if (vals.length === 1) { | ||
| return self._setAllDirections(declarations, vals[0], vals[0], vals[0], vals[0]); | ||
| } else if (vals.length === 2) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[0], vals[1]); | ||
| } else if (vals.length === 3) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[1]); | ||
| } else if (vals.length === 4) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[3]); | ||
| } else { | ||
| throw Error(`Can't understand value for margin: \`${originalValue}\``); | ||
| } | ||
| } | ||
| }]); | ||
| static _setAllDirections(declarations, top, right, bottom, left) { | ||
| MarginTop.setOnto(declarations, 'marginTop', top); | ||
| MarginTop.setOnto(declarations, 'marginRight', right); | ||
| MarginTop.setOnto(declarations, 'marginBottom', bottom); | ||
| MarginTop.setOnto(declarations, 'marginLeft', left); | ||
| } | ||
| return Margin; | ||
| }(_Declaration); | ||
| }; | ||
| ; | ||
| self = Margin; | ||
| return Margin; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var MarginBottom, _Length; | ||
| module.exports = MarginBottom = class MarginBottom extends _Length {}; | ||
| module.exports = MarginBottom = /*#__PURE__*/function (_Length2) { | ||
| _inherits(MarginBottom, _Length2); | ||
| var _super = _createSuper(MarginBottom); | ||
| function MarginBottom() { | ||
| _classCallCheck(this, MarginBottom); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return MarginBottom; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var MarginLeft, _Length; | ||
| module.exports = MarginLeft = class MarginLeft extends _Length {}; | ||
| module.exports = MarginLeft = /*#__PURE__*/function (_Length2) { | ||
| _inherits(MarginLeft, _Length2); | ||
| var _super = _createSuper(MarginLeft); | ||
| function MarginLeft() { | ||
| _classCallCheck(this, MarginLeft); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return MarginLeft; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var MarginRight, _Length; | ||
| module.exports = MarginRight = class MarginRight extends _Length {}; | ||
| module.exports = MarginRight = /*#__PURE__*/function (_Length2) { | ||
| _inherits(MarginRight, _Length2); | ||
| var _super = _createSuper(MarginRight); | ||
| function MarginRight() { | ||
| _classCallCheck(this, MarginRight); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return MarginRight; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var MarginTop, _Length; | ||
| module.exports = MarginTop = class MarginTop extends _Length {}; | ||
| module.exports = MarginTop = /*#__PURE__*/function (_Length2) { | ||
| _inherits(MarginTop, _Length2); | ||
| var _super = _createSuper(MarginTop); | ||
| function MarginTop() { | ||
| _classCallCheck(this, MarginTop); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return MarginTop; | ||
| }(_Length); |
@@ -0,1 +1,25 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -5,56 +29,71 @@ var Padding, PaddingBottom, PaddingLeft, PaddingRight, PaddingTop, _Declaration; | ||
| _Declaration = require('./_Declaration'); | ||
| PaddingTop = require('./PaddingTop'); | ||
| PaddingLeft = require('./PaddingLeft'); | ||
| PaddingRight = require('./PaddingRight'); | ||
| PaddingBottom = require('./PaddingBottom'); | ||
| module.exports = Padding = (function() { | ||
| module.exports = Padding = function () { | ||
| var self; | ||
| class Padding extends _Declaration { | ||
| static setOnto(declarations, prop, originalValue) { | ||
| var append, val, vals; | ||
| append = ''; | ||
| val = _Declaration.sanitizeValue(originalValue); | ||
| if (_Declaration.importantClauseRx.test(String(val))) { | ||
| append = ' !important'; | ||
| val = val.replace(_Declaration.importantClauseRx, ''); | ||
| var Padding = /*#__PURE__*/function (_Declaration2) { | ||
| _inherits(Padding, _Declaration2); | ||
| var _super = _createSuper(Padding); | ||
| function Padding() { | ||
| _classCallCheck(this, Padding); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| _createClass(Padding, null, [{ | ||
| key: "setOnto", | ||
| value: function setOnto(declarations, prop, originalValue) { | ||
| var append, val, vals; | ||
| append = ''; | ||
| val = _Declaration.sanitizeValue(originalValue); | ||
| if (_Declaration.importantClauseRx.test(String(val))) { | ||
| append = ' !important'; | ||
| val = val.replace(_Declaration.importantClauseRx, ''); | ||
| } | ||
| val = val.trim(); | ||
| if (val.length === 0) { | ||
| return self._setAllDirections(declarations, append, append, append, append); | ||
| } | ||
| vals = val.split(" ").map(function (val) { | ||
| return val + append; | ||
| }); | ||
| if (vals.length === 1) { | ||
| return self._setAllDirections(declarations, vals[0], vals[0], vals[0], vals[0]); | ||
| } else if (vals.length === 2) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[0], vals[1]); | ||
| } else if (vals.length === 3) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[1]); | ||
| } else if (vals.length === 4) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[3]); | ||
| } else { | ||
| throw Error("Can't understand value for padding: `".concat(originalValue, "`")); | ||
| } | ||
| } | ||
| val = val.trim(); | ||
| if (val.length === 0) { | ||
| return self._setAllDirections(declarations, append, append, append, append); | ||
| }, { | ||
| key: "_setAllDirections", | ||
| value: function _setAllDirections(declarations, top, right, bottom, left) { | ||
| PaddingTop.setOnto(declarations, 'paddingTop', top); | ||
| PaddingTop.setOnto(declarations, 'paddingRight', right); | ||
| PaddingTop.setOnto(declarations, 'paddingBottom', bottom); | ||
| PaddingTop.setOnto(declarations, 'paddingLeft', left); | ||
| } | ||
| vals = val.split(" ").map(function(val) { | ||
| return val + append; | ||
| }); | ||
| if (vals.length === 1) { | ||
| return self._setAllDirections(declarations, vals[0], vals[0], vals[0], vals[0]); | ||
| } else if (vals.length === 2) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[0], vals[1]); | ||
| } else if (vals.length === 3) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[1]); | ||
| } else if (vals.length === 4) { | ||
| return self._setAllDirections(declarations, vals[0], vals[1], vals[2], vals[3]); | ||
| } else { | ||
| throw Error(`Can't understand value for padding: \`${originalValue}\``); | ||
| } | ||
| } | ||
| }]); | ||
| static _setAllDirections(declarations, top, right, bottom, left) { | ||
| PaddingTop.setOnto(declarations, 'paddingTop', top); | ||
| PaddingTop.setOnto(declarations, 'paddingRight', right); | ||
| PaddingTop.setOnto(declarations, 'paddingBottom', bottom); | ||
| PaddingTop.setOnto(declarations, 'paddingLeft', left); | ||
| } | ||
| return Padding; | ||
| }(_Declaration); | ||
| }; | ||
| ; | ||
| self = Padding; | ||
| return Padding; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var PaddingBottom, _Length; | ||
| module.exports = PaddingBottom = class PaddingBottom extends _Length {}; | ||
| module.exports = PaddingBottom = /*#__PURE__*/function (_Length2) { | ||
| _inherits(PaddingBottom, _Length2); | ||
| var _super = _createSuper(PaddingBottom); | ||
| function PaddingBottom() { | ||
| _classCallCheck(this, PaddingBottom); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return PaddingBottom; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var PaddingLeft, _Length; | ||
| module.exports = PaddingLeft = class PaddingLeft extends _Length {}; | ||
| module.exports = PaddingLeft = /*#__PURE__*/function (_Length2) { | ||
| _inherits(PaddingLeft, _Length2); | ||
| var _super = _createSuper(PaddingLeft); | ||
| function PaddingLeft() { | ||
| _classCallCheck(this, PaddingLeft); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return PaddingLeft; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var PaddingRight, _Length; | ||
| module.exports = PaddingRight = class PaddingRight extends _Length {}; | ||
| module.exports = PaddingRight = /*#__PURE__*/function (_Length2) { | ||
| _inherits(PaddingRight, _Length2); | ||
| var _super = _createSuper(PaddingRight); | ||
| function PaddingRight() { | ||
| _classCallCheck(this, PaddingRight); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return PaddingRight; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var PaddingTop, _Length; | ||
| module.exports = PaddingTop = class PaddingTop extends _Length {}; | ||
| module.exports = PaddingTop = /*#__PURE__*/function (_Length2) { | ||
| _inherits(PaddingTop, _Length2); | ||
| var _super = _createSuper(PaddingTop); | ||
| function PaddingTop() { | ||
| _classCallCheck(this, PaddingTop); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return PaddingTop; | ||
| }(_Length); |
@@ -0,1 +1,21 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| // Generated by CoffeeScript 2.5.1 | ||
@@ -6,2 +26,14 @@ var Width, _Length; | ||
| module.exports = Width = class Width extends _Length {}; | ||
| module.exports = Width = /*#__PURE__*/function (_Length2) { | ||
| _inherits(Width, _Length2); | ||
| var _super = _createSuper(Width); | ||
| function Width() { | ||
| _classCallCheck(this, Width); | ||
| return _super.apply(this, arguments); | ||
| } | ||
| return Width; | ||
| }(_Length); |
@@ -0,79 +1,114 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var MixedDeclarationSet; | ||
| module.exports = MixedDeclarationSet = (function() { | ||
| module.exports = MixedDeclarationSet = function () { | ||
| var self; | ||
| class MixedDeclarationSet { | ||
| static mix(...ruleSets) { | ||
| var i, len, mixed, rules; | ||
| mixed = new self(); | ||
| for (i = 0, len = ruleSets.length; i < len; i++) { | ||
| rules = ruleSets[i]; | ||
| mixed.mixWithList(rules); | ||
| } | ||
| return mixed; | ||
| } | ||
| var MixedDeclarationSet = /*#__PURE__*/function () { | ||
| function MixedDeclarationSet() { | ||
| _classCallCheck(this, MixedDeclarationSet); | ||
| constructor() { | ||
| this._declarations = {}; | ||
| } | ||
| mixWithList(rules) { | ||
| var i, len, rule; | ||
| rules.sort(function(a, b) { | ||
| return a.selector.priority > b.selector.priority; | ||
| }); | ||
| for (i = 0, len = rules.length; i < len; i++) { | ||
| rule = rules[i]; | ||
| this._mixWithRule(rule); | ||
| _createClass(MixedDeclarationSet, [{ | ||
| key: "mixWithList", | ||
| value: function mixWithList(rules) { | ||
| var i, len, rule; | ||
| rules.sort(function (a, b) { | ||
| return a.selector.priority > b.selector.priority; | ||
| }); | ||
| for (i = 0, len = rules.length; i < len; i++) { | ||
| rule = rules[i]; | ||
| this._mixWithRule(rule); | ||
| } | ||
| return this; | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_mixWithRule", | ||
| value: function _mixWithRule(rule) { | ||
| var dec, prop, ref; | ||
| ref = rule.styles._declarations; | ||
| _mixWithRule(rule) { | ||
| var dec, prop, ref; | ||
| ref = rule.styles._declarations; | ||
| for (prop in ref) { | ||
| dec = ref[prop]; | ||
| this._mixWithDeclaration(dec); | ||
| for (prop in ref) { | ||
| dec = ref[prop]; | ||
| this._mixWithDeclaration(dec); | ||
| } | ||
| } | ||
| } | ||
| }, { | ||
| key: "_mixWithDeclaration", | ||
| value: function _mixWithDeclaration(dec) { | ||
| var cur; | ||
| cur = this._declarations[dec.prop]; | ||
| _mixWithDeclaration(dec) { | ||
| var cur; | ||
| cur = this._declarations[dec.prop]; | ||
| if ((cur != null) && cur.important && !dec.important) { | ||
| return; | ||
| if (cur != null && cur.important && !dec.important) { | ||
| return; | ||
| } | ||
| this._declarations[dec.prop] = dec; | ||
| } | ||
| this._declarations[dec.prop] = dec; | ||
| } | ||
| }, { | ||
| key: "get", | ||
| value: function get(prop) { | ||
| if (prop == null) { | ||
| return this._declarations; | ||
| } | ||
| get(prop) { | ||
| if (prop == null) { | ||
| return this._declarations; | ||
| if (this._declarations[prop] == null) { | ||
| return null; | ||
| } | ||
| return this._declarations[prop].val; | ||
| } | ||
| if (this._declarations[prop] == null) { | ||
| return null; | ||
| }, { | ||
| key: "toObject", | ||
| value: function toObject() { | ||
| var dec, obj, prop, ref; | ||
| obj = {}; | ||
| ref = this._declarations; | ||
| for (prop in ref) { | ||
| dec = ref[prop]; | ||
| obj[prop] = dec.val; | ||
| } | ||
| return obj; | ||
| } | ||
| return this._declarations[prop].val; | ||
| } | ||
| }], [{ | ||
| key: "mix", | ||
| value: function mix() { | ||
| var i, len, mixed, rules; | ||
| mixed = new self(); | ||
| toObject() { | ||
| var dec, obj, prop, ref; | ||
| obj = {}; | ||
| ref = this._declarations; | ||
| for (prop in ref) { | ||
| dec = ref[prop]; | ||
| obj[prop] = dec.val; | ||
| for (var _len = arguments.length, ruleSets = new Array(_len), _key = 0; _key < _len; _key++) { | ||
| ruleSets[_key] = arguments[_key]; | ||
| } | ||
| for (i = 0, len = ruleSets.length; i < len; i++) { | ||
| rules = ruleSets[i]; | ||
| mixed.mixWithList(rules); | ||
| } | ||
| return mixed; | ||
| } | ||
| return obj; | ||
| } | ||
| }]); | ||
| }; | ||
| return MixedDeclarationSet; | ||
| }(); | ||
| ; | ||
| self = MixedDeclarationSet; | ||
| return MixedDeclarationSet; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,11 +1,20 @@ | ||
| "use strict"; | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var CSSSelect, Selector; | ||
| CSSSelect = require('css-select'); | ||
| module.exports = Selector = (function() { | ||
| module.exports = Selector = function () { | ||
| var self; | ||
| class Selector { | ||
| constructor(text1) { | ||
| var Selector = /*#__PURE__*/function () { | ||
| function Selector(text1) { | ||
| _classCallCheck(this, Selector); | ||
| this.text = text1; | ||
@@ -16,30 +25,38 @@ this._fn = CSSSelect.compile(this.text); | ||
| matches(elem) { | ||
| return CSSSelect.is(elem, this._fn); | ||
| } | ||
| _createClass(Selector, [{ | ||
| key: "matches", | ||
| value: function matches(elem) { | ||
| return CSSSelect.is(elem, this._fn); | ||
| } // This stupid piece of code is supposed to calculate | ||
| // selector priority, somehow according to | ||
| // http://www.w3.org/wiki/CSS/Training/Priority_level_of_selector | ||
| // This stupid piece of code is supposed to calculate | ||
| // selector priority, somehow according to | ||
| // http://www.w3.org/wiki/CSS/Training/Priority_level_of_selector | ||
| static calculatePriority(text) { | ||
| var n, priotrity; | ||
| priotrity = 0; | ||
| if (n = text.match(/[\#]{1}/g)) { | ||
| priotrity += 100 * n.length; | ||
| }], [{ | ||
| key: "calculatePriority", | ||
| value: function calculatePriority(text) { | ||
| var n, priotrity; | ||
| priotrity = 0; | ||
| if (n = text.match(/[\#]{1}/g)) { | ||
| priotrity += 100 * n.length; | ||
| } | ||
| if (n = text.match(/[a-zA-Z]+/g)) { | ||
| priotrity += 2 * n.length; | ||
| } | ||
| if (n = text.match(/\*/g)) { | ||
| priotrity += 1 * n.length; | ||
| } | ||
| return priotrity; | ||
| } | ||
| if (n = text.match(/[a-zA-Z]+/g)) { | ||
| priotrity += 2 * n.length; | ||
| } | ||
| if (n = text.match(/\*/g)) { | ||
| priotrity += 1 * n.length; | ||
| } | ||
| return priotrity; | ||
| } | ||
| }]); | ||
| }; | ||
| return Selector; | ||
| }(); | ||
| ; | ||
| self = Selector; | ||
| return Selector; | ||
| }).call(this); | ||
| }.call(void 0); |
@@ -0,75 +1,105 @@ | ||
| "use strict"; | ||
| function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var Rule, StyleSheet; | ||
| Rule = require('./Rule'); | ||
| module.exports = StyleSheet = (function() { | ||
| module.exports = StyleSheet = function () { | ||
| var self; | ||
| class StyleSheet { | ||
| constructor() { | ||
| var StyleSheet = /*#__PURE__*/function () { | ||
| function StyleSheet() { | ||
| _classCallCheck(this, StyleSheet); | ||
| this._rulesBySelector = {}; | ||
| } | ||
| setRule(selector, styles) { | ||
| var key, val; | ||
| if (typeof selector === 'string') { | ||
| this._setRule(selector, styles); | ||
| } else if (typeof selector === 'object') { | ||
| for (key in selector) { | ||
| val = selector[key]; | ||
| this._setRule(key, val); | ||
| _createClass(StyleSheet, [{ | ||
| key: "setRule", | ||
| value: function setRule(selector, styles) { | ||
| var key, val; | ||
| if (typeof selector === 'string') { | ||
| this._setRule(selector, styles); | ||
| } else if (_typeof(selector) === 'object') { | ||
| for (key in selector) { | ||
| val = selector[key]; | ||
| this._setRule(key, val); | ||
| } | ||
| } | ||
| } | ||
| return this; | ||
| } | ||
| _setRule(s, styles) { | ||
| var i, len, ref, selector; | ||
| ref = self.splitSelectors(s); | ||
| for (i = 0, len = ref.length; i < len; i++) { | ||
| selector = ref[i]; | ||
| this._setSingleRule(selector, styles); | ||
| return this; | ||
| } | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_setRule", | ||
| value: function _setRule(s, styles) { | ||
| var i, len, ref, selector; | ||
| ref = self.splitSelectors(s); | ||
| _setSingleRule(s, styles) { | ||
| var rule, selector; | ||
| selector = self.normalizeSelector(s); | ||
| if (!(rule = this._rulesBySelector[selector])) { | ||
| rule = new Rule(selector); | ||
| this._rulesBySelector[selector] = rule; | ||
| for (i = 0, len = ref.length; i < len; i++) { | ||
| selector = ref[i]; | ||
| this._setSingleRule(selector, styles); | ||
| } | ||
| return this; | ||
| } | ||
| rule.setStyles(styles); | ||
| return this; | ||
| } | ||
| }, { | ||
| key: "_setSingleRule", | ||
| value: function _setSingleRule(s, styles) { | ||
| var rule, selector; | ||
| selector = self.normalizeSelector(s); | ||
| getRulesFor(el) { | ||
| var ref, rule, rules, selector; | ||
| rules = []; | ||
| ref = this._rulesBySelector; | ||
| for (selector in ref) { | ||
| rule = ref[selector]; | ||
| if (rule.selector.matches(el)) { | ||
| rules.push(rule); | ||
| if (!(rule = this._rulesBySelector[selector])) { | ||
| rule = new Rule(selector); | ||
| this._rulesBySelector[selector] = rule; | ||
| } | ||
| rule.setStyles(styles); | ||
| return this; | ||
| } | ||
| return rules; | ||
| } | ||
| }, { | ||
| key: "getRulesFor", | ||
| value: function getRulesFor(el) { | ||
| var ref, rule, rules, selector; | ||
| rules = []; | ||
| ref = this._rulesBySelector; | ||
| static normalizeSelector(selector) { | ||
| return selector.replace(/[\s]+/g, ' ').replace(/[\s]*([>\,\+]{1})[\s]*/g, '$1').trim(); | ||
| } | ||
| for (selector in ref) { | ||
| rule = ref[selector]; | ||
| static splitSelectors(s) { | ||
| return s.trim().split(','); | ||
| } | ||
| if (rule.selector.matches(el)) { | ||
| rules.push(rule); | ||
| } | ||
| } | ||
| }; | ||
| return rules; | ||
| } | ||
| }], [{ | ||
| key: "normalizeSelector", | ||
| value: function normalizeSelector(selector) { | ||
| return selector.replace(/[\s]+/g, ' ').replace(/[\s]*([>\,\+]{1})[\s]*/g, '$1').trim(); | ||
| } | ||
| }, { | ||
| key: "splitSelectors", | ||
| value: function splitSelectors(s) { | ||
| return s.trim().split(','); | ||
| } | ||
| }]); | ||
| return StyleSheet; | ||
| }(); | ||
| ; | ||
| self = StyleSheet; | ||
| return StyleSheet; | ||
| }).call(this); | ||
| }.call(void 0); |
+31
-21
@@ -0,27 +1,29 @@ | ||
| "use strict"; | ||
| // Generated by CoffeeScript 2.5.1 | ||
| var cloneDeep, htmlparser, isPlainObject, merge, objectToDom, self; | ||
| var cloneDeep, htmlparser, isPlainObject, merge, _objectToDom, self; | ||
| htmlparser = require('htmlparser2'); | ||
| ({objectToDom} = require('dom-converter')); | ||
| var _require = require('dom-converter'); | ||
| _objectToDom = _require.objectToDom; | ||
| merge = require('lodash/merge'); | ||
| cloneDeep = require('lodash/cloneDeep'); | ||
| isPlainObject = require('lodash/isPlainObject'); | ||
| module.exports = self = { | ||
| repeatString: function(str, times) { | ||
| repeatString: function repeatString(str, times) { | ||
| var i, j, output, ref; | ||
| output = ''; | ||
| for (i = j = 0, ref = times; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) { | ||
| for (i = j = 0, ref = times; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { | ||
| output += str; | ||
| } | ||
| return output; | ||
| }, | ||
| cloneAndMergeDeep: function(base, toAppend) { | ||
| cloneAndMergeDeep: function cloneAndMergeDeep(base, toAppend) { | ||
| return merge(cloneDeep(base), toAppend); | ||
| }, | ||
| toDom: function(subject) { | ||
| toDom: function toDom(subject) { | ||
| if (typeof subject === 'string') { | ||
@@ -35,3 +37,3 @@ return self.stringToDom(subject); | ||
| }, | ||
| stringToDom: function(string) { | ||
| stringToDom: function stringToDom(string) { | ||
| var handler, parser; | ||
@@ -44,12 +46,17 @@ handler = new htmlparser.DomHandler(); | ||
| }, | ||
| _fixQuotesInDom: function(input) { | ||
| _fixQuotesInDom: function _fixQuotesInDom(input) { | ||
| var j, len, node; | ||
| if (Array.isArray(input)) { | ||
| for (j = 0, len = input.length; j < len; j++) { | ||
| node = input[j]; | ||
| self._fixQuotesInDom(node); | ||
| } | ||
| return input; | ||
| } | ||
| node = input; | ||
| if (node.type === 'text') { | ||
@@ -61,3 +68,3 @@ return node.data = self._quoteNodeText(node.data); | ||
| }, | ||
| objectToDom: function(o) { | ||
| objectToDom: function objectToDom(o) { | ||
| if (!Array.isArray(o)) { | ||
@@ -68,15 +75,17 @@ if (!isPlainObject(o)) { | ||
| } | ||
| return self._fixQuotesInDom(objectToDom(o)); | ||
| return self._fixQuotesInDom(_objectToDom(o)); | ||
| }, | ||
| quote: function(str) { | ||
| quote: function quote(str) { | ||
| return String(str).replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"').replace(/\ /g, '&sp;').replace(/\n/g, '<br />'); | ||
| }, | ||
| _quoteNodeText: function(text) { | ||
| _quoteNodeText: function _quoteNodeText(text) { | ||
| return String(text).replace(/\&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"').replace(/\ /g, '&sp;').replace(/\n/g, "&nl;"); | ||
| }, | ||
| getCols: function() { | ||
| var cols, tty; | ||
| // Based on https://github.com/jonschlinkert/window-size | ||
| getCols: function getCols() { | ||
| var cols, tty; // Based on https://github.com/jonschlinkert/window-size | ||
| tty = require('tty'); | ||
| cols = (function() { | ||
| cols = function () { | ||
| try { | ||
@@ -93,3 +102,4 @@ if (tty.isatty(1) && tty.isatty(2)) { | ||
| } catch (error) {} | ||
| })(); | ||
| }(); | ||
| if (typeof cols === 'number' && cols > 30) { | ||
@@ -101,2 +111,2 @@ return cols; | ||
| } | ||
| }; | ||
| }; |
+5
-4
| { | ||
| "name": "renderkid", | ||
| "version": "2.0.6", | ||
| "version": "2.0.7-dev.1", | ||
| "description": "Stylish console.log for node", | ||
@@ -14,2 +14,4 @@ "main": "lib/RenderKid.js", | ||
| "devDependencies": { | ||
| "@babel/core": "^7.14.5", | ||
| "@babel/preset-env": "^7.14.5", | ||
| "chai": "^4.3.4", | ||
@@ -26,6 +28,5 @@ "chai-changes": "^1.3.6", | ||
| "test:watch": "npm run test -- --watch", | ||
| "compile": "coffee --bare --compile --output ./lib ./src", | ||
| "compile:watch": "coffee --watch --bare --compile --output ./lib ./src", | ||
| "compile": "coffee --bare --transpile --output ./lib ./src", | ||
| "compile:watch": "coffee --watch --bare --transpile --output ./lib ./src", | ||
| "watch": "npm run compile:watch & npm run test:watch", | ||
| "winwatch": "start/b npm run compile:watch & npm run test:watch", | ||
| "prepublish": "npm run compile" | ||
@@ -32,0 +33,0 @@ }, |
| { | ||
| "name": "renderkid", | ||
| "version": "2.0.5", | ||
| "description": "Stylish console.log for node", | ||
| "main": "lib/RenderKid.js", | ||
| "dependencies": { | ||
| "css-select": "^4.1.3", | ||
| "dom-converter": "^0.2.0", | ||
| "htmlparser2": "^6.1.0", | ||
| "lodash": "^4.17.21", | ||
| "strip-ansi": "^6.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "chai": "^4.3.4", | ||
| "chai-changes": "^1.3.6", | ||
| "chai-fuzzy": "^1.6.1", | ||
| "coffeescript": "^2.5.1", | ||
| "mocha": "^9.0.0", | ||
| "sinon": "^11.1.1", | ||
| "sinon-chai": "^3.7.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "mocha \"test/**/*.coffee\"", | ||
| "test:watch": "npm run test -- --watch", | ||
| "compile": "coffee --bare --compile --output ./lib ./src", | ||
| "compile:watch": "coffee --watch --bare --compile --output ./lib ./src", | ||
| "watch": "npm run compile:watch & npm run test:watch", | ||
| "winwatch": "start/b npm run compile:watch & npm run test:watch", | ||
| "prepublish": "npm run compile" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/AriaMinaei/RenderKid.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/AriaMinaei/RenderKid/issues" | ||
| }, | ||
| "author": "Aria Minaei", | ||
| "license": "MIT" | ||
| } |
| { | ||
| "name": "renderkid", | ||
| "version": "2.0.6", | ||
| "description": "Stylish console.log for node", | ||
| "main": "lib/RenderKid.js", | ||
| "dependencies": { | ||
| "css-select": "^4.1.3", | ||
| "dom-converter": "^0.2.0", | ||
| "htmlparser2": "^6.1.0", | ||
| "lodash": "^4.17.21", | ||
| "strip-ansi": "^6.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "chai": "^4.3.4", | ||
| "chai-changes": "^1.3.6", | ||
| "chai-fuzzy": "^1.6.1", | ||
| "coffeescript": "^2.5.1", | ||
| "mocha": "^9.0.0", | ||
| "sinon": "^11.1.1", | ||
| "sinon-chai": "^3.7.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "mocha \"test/**/*.coffee\"", | ||
| "test:watch": "npm run test -- --watch", | ||
| "compile": "coffee --bare --compile --output ./lib ./src", | ||
| "compile:watch": "coffee --watch --bare --compile --output ./lib ./src", | ||
| "watch": "npm run compile:watch & npm run test:watch", | ||
| "winwatch": "start/b npm run compile:watch & npm run test:watch", | ||
| "prepublish": "npm run compile" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/AriaMinaei/RenderKid.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/AriaMinaei/RenderKid/issues" | ||
| }, | ||
| "author": "Aria Minaei", | ||
| "license": "MIT" | ||
| } |
| require: 'coffeescript/register' | ||
| recursive: true | ||
| reporter: 'spec' | ||
| ui: 'bdd' | ||
| timeout: 20000 |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
169406
110.81%2676
43.64%9
28.57%52
-5.45%2
100%