-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
574 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, {}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.