Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomura committed Jul 21, 2016
1 parent 07ac788 commit c8eec35
Show file tree
Hide file tree
Showing 20 changed files with 574 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
<big><h1 align="center"><span style="color:CornflowerBlue; font-size:90%">> </span>react-log</h1></big>

<p align="center">
<a href="https://travis-ci.org/diegomura/react-log">
<img src="https://api.travis-ci.org/diegomura/react-log.svg?branch=master">
</a>

<a href="https://www.npmjs.com/package/react-log">
<img src="https://img.shields.io/npm/v/react-log.svg?maxAge=2592000">
</a>

<a href="https://www.npmjs.com/package/react-log">
<img src="https://img.shields.io/npm/dm/react-log.svg?maxAge=2592000">
</a>

<a href="https://www.npmjs.com/package/react-log">
<img src="https://img.shields.io/npm/l/react-log.svg?maxAge=2592000">
</a>
</p>

> React for the Console
## Install
Expand Down
69 changes: 69 additions & 0 deletions dist/Log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _parser = require('./parser');

var _parser2 = _interopRequireDefault(_parser);

var _styleObjectSerializer = require('./utils/styleObjectSerializer');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Log = function (_React$Component) {
_inherits(Log, _React$Component);

function Log() {
_classCallCheck(this, Log);

return _possibleConstructorReturn(this, Object.getPrototypeOf(Log).apply(this, arguments));
}

_createClass(Log, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _console;

var children = this.props.children;
var type = children.type;
var props = children.props;


var body = _react2.default.createElement('body', null, children);
var parsedData = (0, _parser2.default)(body);
var logMarkup = parsedData.map(function (item) {
return item.markup;
}).join('');
var logStyles = parsedData.map(function (item) {
return (0, _styleObjectSerializer.serializeStyleObject)(item.style);
});

(_console = console).log.apply(_console, [logMarkup].concat(_toConsumableArray(logStyles)));
}
}, {
key: 'render',
value: function render() {
return false;
}
}]);

return Log;
}(_react2.default.Component);

exports.default = Log;
14 changes: 14 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;

var _Log = require('./Log.jsx');

var _Log2 = _interopRequireDefault(_Log);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = _Log2.default;
39 changes: 39 additions & 0 deletions dist/parser/elements/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = a;
function a(parser, node) {
var defaultStyles = {
color: 'blue',
text_decoration: 'underline'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

if (children[0]) {
var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

parsedElement.markup += ' - ' + node.props.href;

return parsedElement;
} else {
return {
markup: '%c' + node.props.href,
style: _extends({}, defaultStyles, node.props)
};
}
}
18 changes: 18 additions & 0 deletions dist/parser/elements/body.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = body;
function body(parser, node) {
var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

return children.map(function (item) {
return parser(item, {});
});
}
30 changes: 30 additions & 0 deletions dist/parser/elements/div.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = div;
function div(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
32 changes: 32 additions & 0 deletions dist/parser/elements/h1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = h1;
function h1(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black',
font_weight: 'bold',
font_size: '2em'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
32 changes: 32 additions & 0 deletions dist/parser/elements/h2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = h2;
function h2(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black',
font_weight: 'bold',
font_size: '1.5em'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
32 changes: 32 additions & 0 deletions dist/parser/elements/h3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = h1;
function h1(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black',
font_weight: 'bold',
font_size: '1.17em'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
32 changes: 32 additions & 0 deletions dist/parser/elements/h4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = h1;
function h1(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black',
font_weight: 'bold',
font_size: '1.17em'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
32 changes: 32 additions & 0 deletions dist/parser/elements/h5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = h1;
function h1(parser, node) {
var defaultStyles = {
display: 'block',
color: 'black',
font_weight: 'bold',
font_size: '.83em'
};

var children = [];

if (node.props) {
children = node.props.children;
children = Array.isArray(children) ? children : [children];
}

var parsedElement = parser(children[0], _extends({}, defaultStyles, node.props));

if (parsedElement.style.display && parsedElement.style.display == 'block') {
parsedElement.markup += '\n';
}

return parsedElement;
}
Loading

0 comments on commit c8eec35

Please sign in to comment.