aboutsummaryrefslogtreecommitdiff
path: root/node_modules/renderkid/lib/renderKid
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/renderkid/lib/renderKid')
-rw-r--r--node_modules/renderkid/lib/renderKid/Styles.js76
-rw-r--r--node_modules/renderkid/lib/renderKid/styleApplier/_common.js35
-rw-r--r--node_modules/renderkid/lib/renderKid/styleApplier/block.js83
-rw-r--r--node_modules/renderkid/lib/renderKid/styleApplier/inline.js26
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/Rule.js21
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/StyleSheet.js72
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/DeclarationBlock.js65
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/MixedDeclarationSet.js78
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/Selector.js38
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Arbitrary.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Background.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Bullet.js63
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Color.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Display.js32
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Height.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Margin.js64
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginBottom.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginLeft.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginRight.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginTop.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Padding.js64
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingBottom.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingLeft.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingRight.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingTop.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Width.js17
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Declaration.js84
-rw-r--r--node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Length.js24
28 files changed, 1046 insertions, 0 deletions
diff --git a/node_modules/renderkid/lib/renderKid/Styles.js b/node_modules/renderkid/lib/renderKid/Styles.js
new file mode 100644
index 000000000..52651aa01
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/Styles.js
@@ -0,0 +1,76 @@
+// Generated by CoffeeScript 1.9.3
+var MixedDeclarationSet, StyleSheet, Styles, terminalWidth;
+
+StyleSheet = require('./styles/StyleSheet');
+
+MixedDeclarationSet = require('./styles/rule/MixedDeclarationSet');
+
+terminalWidth = require('../tools').getCols();
+
+module.exports = Styles = (function() {
+ var self;
+
+ self = Styles;
+
+ Styles.defaultRules = {
+ '*': {
+ display: 'inline'
+ },
+ 'body': {
+ background: 'none',
+ color: 'white',
+ display: 'block',
+ width: terminalWidth + ' !important'
+ }
+ };
+
+ function Styles() {
+ this._defaultStyles = new StyleSheet;
+ this._userStyles = new StyleSheet;
+ this._setDefaultStyles();
+ }
+
+ Styles.prototype._setDefaultStyles = function() {
+ this._defaultStyles.setRule(self.defaultRules);
+ };
+
+ Styles.prototype.setRule = function(selector, rules) {
+ this._userStyles.setRule.apply(this._userStyles, arguments);
+ return this;
+ };
+
+ Styles.prototype.getStyleFor = function(el) {
+ var styles;
+ styles = el.styles;
+ if (styles == null) {
+ el.styles = styles = this._getComputedStyleFor(el);
+ }
+ return styles;
+ };
+
+ Styles.prototype._getRawStyleFor = function(el) {
+ var def, user;
+ def = this._defaultStyles.getRulesFor(el);
+ user = this._userStyles.getRulesFor(el);
+ return MixedDeclarationSet.mix(def, user).toObject();
+ };
+
+ Styles.prototype._getComputedStyleFor = function(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.");
+ }
+ }
+ return decs;
+ };
+
+ return Styles;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styleApplier/_common.js b/node_modules/renderkid/lib/renderKid/styleApplier/_common.js
new file mode 100644
index 000000000..8e3bc5627
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styleApplier/_common.js
@@ -0,0 +1,35 @@
+// Generated by CoffeeScript 1.9.3
+var AnsiPainter, _common;
+
+AnsiPainter = require('../../AnsiPainter');
+
+module.exports = _common = {
+ getStyleTagsFor: function(style) {
+ var i, len, ret, tag, tagName, tagsToAdd;
+ tagsToAdd = [];
+ if (style.color != null) {
+ tagName = 'color-' + style.color;
+ if (AnsiPainter.tags[tagName] == null) {
+ throw Error("Unkown color `" + style.color + "`");
+ }
+ tagsToAdd.push(tagName);
+ }
+ if (style.background != null) {
+ tagName = 'bg-' + style.background;
+ if (AnsiPainter.tags[tagName] == null) {
+ throw Error("Unkown background `" + style.background + "`");
+ }
+ tagsToAdd.push(tagName);
+ }
+ ret = {
+ before: '',
+ after: ''
+ };
+ for (i = 0, len = tagsToAdd.length; i < len; i++) {
+ tag = tagsToAdd[i];
+ ret.before = ("<" + tag + ">") + ret.before;
+ ret.after = ret.after + ("</" + tag + ">");
+ }
+ return ret;
+ }
+};
diff --git a/node_modules/renderkid/lib/renderKid/styleApplier/block.js b/node_modules/renderkid/lib/renderKid/styleApplier/block.js
new file mode 100644
index 000000000..de091d72b
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styleApplier/block.js
@@ -0,0 +1,83 @@
+// Generated by CoffeeScript 1.9.3
+var _common, blockStyleApplier, object, self;
+
+_common = require('./_common');
+
+object = require('utila').object;
+
+module.exports = blockStyleApplier = self = {
+ applyTo: function(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) {
+ if (style.marginLeft != null) {
+ object.appendOnto(config, {
+ linePrependor: {
+ options: {
+ amount: parseInt(style.marginLeft)
+ }
+ }
+ });
+ }
+ if (style.marginRight != null) {
+ object.appendOnto(config, {
+ lineAppendor: {
+ options: {
+ amount: parseInt(style.marginRight)
+ }
+ }
+ });
+ }
+ if (style.marginTop != null) {
+ object.appendOnto(config, {
+ blockPrependor: {
+ options: {
+ amount: parseInt(style.marginTop)
+ }
+ }
+ });
+ }
+ if (style.marginBottom != null) {
+ object.appendOnto(config, {
+ blockAppendor: {
+ options: {
+ amount: parseInt(style.marginBottom)
+ }
+ }
+ });
+ }
+ },
+ _bullet: function(style, config) {
+ var after, before, bullet, conf, ref;
+ if ((style.bullet != null) && style.bullet.enabled) {
+ bullet = style.bullet;
+ conf = {};
+ conf.alignment = style.bullet.alignment;
+ ref = _common.getStyleTagsFor({
+ color: bullet.color,
+ background: bullet.background
+ }), before = ref.before, after = ref.after;
+ conf.char = before + bullet.char + after;
+ object.appendOnto(config, {
+ linePrependor: {
+ options: {
+ bullet: conf
+ }
+ }
+ });
+ }
+ },
+ _dims: function(style, config) {
+ var w;
+ if (style.width != null) {
+ w = parseInt(style.width);
+ config.width = w;
+ }
+ }
+};
diff --git a/node_modules/renderkid/lib/renderKid/styleApplier/inline.js b/node_modules/renderkid/lib/renderKid/styleApplier/inline.js
new file mode 100644
index 000000000..0978fb07d
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styleApplier/inline.js
@@ -0,0 +1,26 @@
+// Generated by CoffeeScript 1.9.3
+var _common, inlineStyleApplier, self, tools;
+
+tools = require('../../tools');
+
+_common = require('./_common');
+
+module.exports = inlineStyleApplier = self = {
+ applyTo: function(el, style) {
+ var ret;
+ ret = _common.getStyleTagsFor(style);
+ if (style.marginLeft != null) {
+ 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;
+ }
+ return ret;
+ }
+};
diff --git a/node_modules/renderkid/lib/renderKid/styles/Rule.js b/node_modules/renderkid/lib/renderKid/styles/Rule.js
new file mode 100644
index 000000000..8e289281a
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/Rule.js
@@ -0,0 +1,21 @@
+// Generated by CoffeeScript 1.9.3
+var DeclarationBlock, Rule, Selector;
+
+Selector = require('./rule/Selector');
+
+DeclarationBlock = require('./rule/DeclarationBlock');
+
+module.exports = Rule = (function() {
+ function Rule(selector) {
+ this.selector = new Selector(selector);
+ this.styles = new DeclarationBlock;
+ }
+
+ Rule.prototype.setStyles = function(styles) {
+ this.styles.set(styles);
+ return this;
+ };
+
+ return Rule;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js b/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js
new file mode 100644
index 000000000..2ea260751
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js
@@ -0,0 +1,72 @@
+// Generated by CoffeeScript 1.9.3
+var Rule, StyleSheet;
+
+Rule = require('./Rule');
+
+module.exports = StyleSheet = (function() {
+ var self;
+
+ self = StyleSheet;
+
+ function StyleSheet() {
+ this._rulesBySelector = {};
+ }
+
+ StyleSheet.prototype.setRule = function(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;
+ };
+
+ StyleSheet.prototype._setRule = function(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;
+ };
+
+ StyleSheet.prototype._setSingleRule = function(s, styles) {
+ var rule, selector;
+ selector = self.normalizeSelector(s);
+ if (!(rule = this._rulesBySelector[selector])) {
+ rule = new Rule(selector);
+ this._rulesBySelector[selector] = rule;
+ }
+ rule.setStyles(styles);
+ return this;
+ };
+
+ StyleSheet.prototype.getRulesFor = function(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);
+ }
+ }
+ return rules;
+ };
+
+ StyleSheet.normalizeSelector = function(selector) {
+ return selector.replace(/[\s]+/g, ' ').replace(/[\s]*([>\,\+]{1})[\s]*/g, '$1').trim();
+ };
+
+ StyleSheet.splitSelectors = function(s) {
+ return s.trim().split(',');
+ };
+
+ return StyleSheet;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/DeclarationBlock.js b/node_modules/renderkid/lib/renderKid/styles/rule/DeclarationBlock.js
new file mode 100644
index 000000000..b2821804b
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/DeclarationBlock.js
@@ -0,0 +1,65 @@
+// Generated by CoffeeScript 1.9.3
+var Arbitrary, DeclarationBlock, declarationClasses;
+
+module.exports = DeclarationBlock = (function() {
+ var self;
+
+ self = DeclarationBlock;
+
+ function DeclarationBlock() {
+ this._declarations = {};
+ }
+
+ DeclarationBlock.prototype.set = function(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;
+ };
+
+ DeclarationBlock.prototype._getDeclarationClass = function(prop) {
+ var cls;
+ if (prop[0] === '_') {
+ return Arbitrary;
+ }
+ if (!(cls = declarationClasses[prop])) {
+ throw Error("Unkown property `" + prop + "`. Write it as `_" + prop + "` if you're defining a custom property");
+ }
+ return cls;
+ };
+
+ DeclarationBlock.sanitizeProp = function(prop) {
+ return String(prop).trim();
+ };
+
+ return DeclarationBlock;
+
+})();
+
+Arbitrary = require('./declarationBlock/Arbitrary');
+
+declarationClasses = {
+ color: require('./declarationBlock/Color'),
+ background: require('./declarationBlock/Background'),
+ width: require('./declarationBlock/Width'),
+ height: require('./declarationBlock/Height'),
+ bullet: require('./declarationBlock/Bullet'),
+ display: require('./declarationBlock/Display'),
+ margin: require('./declarationBlock/Margin'),
+ marginTop: require('./declarationBlock/MarginTop'),
+ marginLeft: require('./declarationBlock/MarginLeft'),
+ marginRight: require('./declarationBlock/MarginRight'),
+ marginBottom: require('./declarationBlock/MarginBottom'),
+ padding: require('./declarationBlock/Padding'),
+ paddingTop: require('./declarationBlock/PaddingTop'),
+ paddingLeft: require('./declarationBlock/PaddingLeft'),
+ paddingRight: require('./declarationBlock/PaddingRight'),
+ paddingBottom: require('./declarationBlock/PaddingBottom')
+};
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/MixedDeclarationSet.js b/node_modules/renderkid/lib/renderKid/styles/rule/MixedDeclarationSet.js
new file mode 100644
index 000000000..ceea06ed7
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/MixedDeclarationSet.js
@@ -0,0 +1,78 @@
+// Generated by CoffeeScript 1.9.3
+var MixedDeclarationSet,
+ slice = [].slice;
+
+module.exports = MixedDeclarationSet = (function() {
+ var self;
+
+ self = MixedDeclarationSet;
+
+ MixedDeclarationSet.mix = function() {
+ var i, len, mixed, ruleSets, rules;
+ ruleSets = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ mixed = new self;
+ for (i = 0, len = ruleSets.length; i < len; i++) {
+ rules = ruleSets[i];
+ mixed.mixWithList(rules);
+ }
+ return mixed;
+ };
+
+ function MixedDeclarationSet() {
+ this._declarations = {};
+ }
+
+ MixedDeclarationSet.prototype.mixWithList = function(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;
+ };
+
+ MixedDeclarationSet.prototype._mixWithRule = function(rule) {
+ var dec, prop, ref;
+ ref = rule.styles._declarations;
+ for (prop in ref) {
+ dec = ref[prop];
+ this._mixWithDeclaration(dec);
+ }
+ };
+
+ MixedDeclarationSet.prototype._mixWithDeclaration = function(dec) {
+ var cur;
+ cur = this._declarations[dec.prop];
+ if ((cur != null) && cur.important && !dec.important) {
+ return;
+ }
+ this._declarations[dec.prop] = dec;
+ };
+
+ MixedDeclarationSet.prototype.get = function(prop) {
+ if (prop == null) {
+ return this._declarations;
+ }
+ if (this._declarations[prop] == null) {
+ return null;
+ }
+ return this._declarations[prop].val;
+ };
+
+ MixedDeclarationSet.prototype.toObject = function() {
+ var dec, obj, prop, ref;
+ obj = {};
+ ref = this._declarations;
+ for (prop in ref) {
+ dec = ref[prop];
+ obj[prop] = dec.val;
+ }
+ return obj;
+ };
+
+ return MixedDeclarationSet;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/Selector.js b/node_modules/renderkid/lib/renderKid/styles/rule/Selector.js
new file mode 100644
index 000000000..7b23903d3
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/Selector.js
@@ -0,0 +1,38 @@
+// Generated by CoffeeScript 1.9.3
+var CSSSelect, Selector;
+
+CSSSelect = require('css-select');
+
+module.exports = Selector = (function() {
+ var self;
+
+ self = Selector;
+
+ function Selector(text1) {
+ this.text = text1;
+ this._fn = CSSSelect.compile(this.text);
+ this.priority = self.calculatePriority(this.text);
+ }
+
+ Selector.prototype.matches = function(elem) {
+ return CSSSelect.is(elem, this._fn);
+ };
+
+ Selector.calculatePriority = function(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;
+ };
+
+ return Selector;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Arbitrary.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Arbitrary.js
new file mode 100644
index 000000000..5411b3a73
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Arbitrary.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var Arbitrary, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+module.exports = Arbitrary = (function(superClass) {
+ extend(Arbitrary, superClass);
+
+ function Arbitrary() {
+ return Arbitrary.__super__.constructor.apply(this, arguments);
+ }
+
+ return Arbitrary;
+
+})(_Declaration);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Background.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Background.js
new file mode 100644
index 000000000..e02b377cd
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Background.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var Background, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+module.exports = Background = (function(superClass) {
+ extend(Background, superClass);
+
+ function Background() {
+ return Background.__super__.constructor.apply(this, arguments);
+ }
+
+ return Background;
+
+})(_Declaration);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Bullet.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Bullet.js
new file mode 100644
index 000000000..a04e0c7be
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Bullet.js
@@ -0,0 +1,63 @@
+// Generated by CoffeeScript 1.9.3
+var Bullet, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+module.exports = Bullet = (function(superClass) {
+ var self;
+
+ extend(Bullet, superClass);
+
+ function Bullet() {
+ return Bullet.__super__.constructor.apply(this, arguments);
+ }
+
+ self = Bullet;
+
+ Bullet.prototype._set = function(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 `" + original + "` for `" + this.prop + "`");
+ }
+ return this.val = {
+ enabled: enabled,
+ char: char,
+ alignment: alignment,
+ background: bg,
+ color: color
+ };
+ };
+
+ return Bullet;
+
+})(_Declaration);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Color.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Color.js
new file mode 100644
index 000000000..709dd89ea
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Color.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var Color, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+module.exports = Color = (function(superClass) {
+ extend(Color, superClass);
+
+ function Color() {
+ return Color.__super__.constructor.apply(this, arguments);
+ }
+
+ return Color;
+
+})(_Declaration);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Display.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Display.js
new file mode 100644
index 000000000..80a9ae440
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Display.js
@@ -0,0 +1,32 @@
+// Generated by CoffeeScript 1.9.3
+var Display, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty,
+ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+_Declaration = require('./_Declaration');
+
+module.exports = Display = (function(superClass) {
+ var self;
+
+ extend(Display, superClass);
+
+ function Display() {
+ return Display.__super__.constructor.apply(this, arguments);
+ }
+
+ self = Display;
+
+ Display._allowed = ['inline', 'block', 'none'];
+
+ Display.prototype._set = function(val) {
+ val = String(val).toLowerCase();
+ if (indexOf.call(self._allowed, val) < 0) {
+ throw Error("Unrecognizable value `" + val + "` for `" + this.prop + "`");
+ }
+ return this.val = val;
+ };
+
+ return Display;
+
+})(_Declaration);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Height.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Height.js
new file mode 100644
index 000000000..35bf7ba78
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Height.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var Height, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = Height = (function(superClass) {
+ extend(Height, superClass);
+
+ function Height() {
+ return Height.__super__.constructor.apply(this, arguments);
+ }
+
+ return Height;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Margin.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Margin.js
new file mode 100644
index 000000000..6dfe0764d
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Margin.js
@@ -0,0 +1,64 @@
+// Generated by CoffeeScript 1.9.3
+var Margin, MarginBottom, MarginLeft, MarginRight, MarginTop, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+MarginTop = require('./MarginTop');
+
+MarginLeft = require('./MarginLeft');
+
+MarginRight = require('./MarginRight');
+
+MarginBottom = require('./MarginBottom');
+
+module.exports = Margin = (function(superClass) {
+ var self;
+
+ extend(Margin, superClass);
+
+ function Margin() {
+ return Margin.__super__.constructor.apply(this, arguments);
+ }
+
+ self = Margin;
+
+ Margin.setOnto = function(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: `" + originalValue + "`");
+ }
+ };
+
+ Margin._setAllDirections = function(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);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginBottom.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginBottom.js
new file mode 100644
index 000000000..45f2e21af
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginBottom.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var MarginBottom, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = MarginBottom = (function(superClass) {
+ extend(MarginBottom, superClass);
+
+ function MarginBottom() {
+ return MarginBottom.__super__.constructor.apply(this, arguments);
+ }
+
+ return MarginBottom;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginLeft.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginLeft.js
new file mode 100644
index 000000000..e4b1ddd6d
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginLeft.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var MarginLeft, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = MarginLeft = (function(superClass) {
+ extend(MarginLeft, superClass);
+
+ function MarginLeft() {
+ return MarginLeft.__super__.constructor.apply(this, arguments);
+ }
+
+ return MarginLeft;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginRight.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginRight.js
new file mode 100644
index 000000000..3d6fcdc03
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginRight.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var MarginRight, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = MarginRight = (function(superClass) {
+ extend(MarginRight, superClass);
+
+ function MarginRight() {
+ return MarginRight.__super__.constructor.apply(this, arguments);
+ }
+
+ return MarginRight;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginTop.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginTop.js
new file mode 100644
index 000000000..ffd5ef329
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/MarginTop.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var MarginTop, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = MarginTop = (function(superClass) {
+ extend(MarginTop, superClass);
+
+ function MarginTop() {
+ return MarginTop.__super__.constructor.apply(this, arguments);
+ }
+
+ return MarginTop;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Padding.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Padding.js
new file mode 100644
index 000000000..9681204ba
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Padding.js
@@ -0,0 +1,64 @@
+// Generated by CoffeeScript 1.9.3
+var Padding, PaddingBottom, PaddingLeft, PaddingRight, PaddingTop, _Declaration,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+PaddingTop = require('./PaddingTop');
+
+PaddingLeft = require('./PaddingLeft');
+
+PaddingRight = require('./PaddingRight');
+
+PaddingBottom = require('./PaddingBottom');
+
+module.exports = Padding = (function(superClass) {
+ var self;
+
+ extend(Padding, superClass);
+
+ function Padding() {
+ return Padding.__super__.constructor.apply(this, arguments);
+ }
+
+ self = Padding;
+
+ Padding.setOnto = function(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: `" + originalValue + "`");
+ }
+ };
+
+ Padding._setAllDirections = function(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);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingBottom.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingBottom.js
new file mode 100644
index 000000000..7052a6064
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingBottom.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var PaddingBottom, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = PaddingBottom = (function(superClass) {
+ extend(PaddingBottom, superClass);
+
+ function PaddingBottom() {
+ return PaddingBottom.__super__.constructor.apply(this, arguments);
+ }
+
+ return PaddingBottom;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingLeft.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingLeft.js
new file mode 100644
index 000000000..35d5fbd68
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingLeft.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var PaddingLeft, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = PaddingLeft = (function(superClass) {
+ extend(PaddingLeft, superClass);
+
+ function PaddingLeft() {
+ return PaddingLeft.__super__.constructor.apply(this, arguments);
+ }
+
+ return PaddingLeft;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingRight.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingRight.js
new file mode 100644
index 000000000..31d2af99c
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingRight.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var PaddingRight, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = PaddingRight = (function(superClass) {
+ extend(PaddingRight, superClass);
+
+ function PaddingRight() {
+ return PaddingRight.__super__.constructor.apply(this, arguments);
+ }
+
+ return PaddingRight;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingTop.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingTop.js
new file mode 100644
index 000000000..a6cf14ac3
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/PaddingTop.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var PaddingTop, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = PaddingTop = (function(superClass) {
+ extend(PaddingTop, superClass);
+
+ function PaddingTop() {
+ return PaddingTop.__super__.constructor.apply(this, arguments);
+ }
+
+ return PaddingTop;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Width.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Width.js
new file mode 100644
index 000000000..4f573b62f
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/Width.js
@@ -0,0 +1,17 @@
+// Generated by CoffeeScript 1.9.3
+var Width, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Length = require('./_Length');
+
+module.exports = Width = (function(superClass) {
+ extend(Width, superClass);
+
+ function Width() {
+ return Width.__super__.constructor.apply(this, arguments);
+ }
+
+ return Width;
+
+})(_Length);
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Declaration.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Declaration.js
new file mode 100644
index 000000000..dce27e213
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Declaration.js
@@ -0,0 +1,84 @@
+// Generated by CoffeeScript 1.9.3
+var _Declaration;
+
+module.exports = _Declaration = (function() {
+ var self;
+
+ self = _Declaration;
+
+ _Declaration.importantClauseRx = /(\s\!important)$/;
+
+ _Declaration.setOnto = function(declarations, prop, val) {
+ var dec;
+ if (!(dec = declarations[prop])) {
+ return declarations[prop] = new this(prop, val);
+ } else {
+ return dec.set(val);
+ }
+ };
+
+ _Declaration.sanitizeValue = function(val) {
+ return String(val).trim().replace(/[\s]+/g, ' ');
+ };
+
+ _Declaration.inheritAllowed = false;
+
+ function _Declaration(prop1, val) {
+ this.prop = prop1;
+ this.important = false;
+ this.set(val);
+ }
+
+ _Declaration.prototype.get = function() {
+ return this._get();
+ };
+
+ _Declaration.prototype._get = function() {
+ return this.val;
+ };
+
+ _Declaration.prototype._pickImportantClause = function(val) {
+ if (self.importantClauseRx.test(String(val))) {
+ this.important = true;
+ return val.replace(self.importantClauseRx, '');
+ } else {
+ this.important = false;
+ return val;
+ }
+ };
+
+ _Declaration.prototype.set = function(val) {
+ val = self.sanitizeValue(val);
+ val = this._pickImportantClause(val);
+ val = val.trim();
+ if (this._handleNullOrInherit(val)) {
+ return this;
+ }
+ this._set(val);
+ return this;
+ };
+
+ _Declaration.prototype._set = function(val) {
+ return this.val = val;
+ };
+
+ _Declaration.prototype._handleNullOrInherit = function(val) {
+ if (val === '') {
+ this.val = '';
+ return true;
+ }
+ if (val === 'inherit') {
+ if (this.constructor.inheritAllowed) {
+ this.val = 'inherit';
+ } else {
+ throw Error("Inherit is not allowed for `" + this.prop + "`");
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ return _Declaration;
+
+})();
diff --git a/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Length.js b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Length.js
new file mode 100644
index 000000000..0440d30c3
--- /dev/null
+++ b/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Length.js
@@ -0,0 +1,24 @@
+// Generated by CoffeeScript 1.9.3
+var _Declaration, _Length,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+
+_Declaration = require('./_Declaration');
+
+module.exports = _Length = (function(superClass) {
+ extend(_Length, superClass);
+
+ function _Length() {
+ return _Length.__super__.constructor.apply(this, arguments);
+ }
+
+ _Length.prototype._set = function(val) {
+ if (!/^[0-9]+$/.test(String(val))) {
+ throw Error("`" + this.prop + "` only takes an integer for value");
+ }
+ return this.val = parseInt(val);
+ };
+
+ return _Length;
+
+})(_Declaration);