react-demo
Advanced tools
+5
-1
@@ -0,4 +1,8 @@ | ||
| ## 1.1.0 (November 5, 2015) | ||
| - Improve jsx props output in stringify() | ||
| ## 1.0.0 (October 19, 2015) | ||
| - Start use Semantic Versioning | ||
| - Start using Semantic Versioning | ||
| - Start tracking changes |
+31
-21
@@ -82,26 +82,36 @@ 'use strict'; | ||
| if (_react2['default'].isValidElement(x)) { | ||
| var lastIndent = indent === '' ? '' : indent.replace(/\s\s$/, ''); | ||
| var _name = typeof x.type === 'string' ? x.type : x.type.displayName || 'Unknown'; | ||
| var keys = Object.keys(x.props); | ||
| var props = ''; | ||
| var children = null; | ||
| if (keys.length > 0) { | ||
| seen.push(x); | ||
| var _keys = keys.filter(function (key) { | ||
| return key !== 'children'; | ||
| var _ret = (function () { | ||
| var lastIndent = indent === '' ? '' : indent.replace(/\s\s$/, ''); | ||
| var name = typeof x.type === 'string' ? x.type : x.type.displayName || 'Unknown'; | ||
| var defaultProps = x.type && typeof x.type.getDefaultProps === 'function' ? x.type.getDefaultProps() : {}; | ||
| var keys = Object.keys(x.props).filter(function (key) { | ||
| return defaultProps[key] !== x.props[key]; | ||
| }); | ||
| if (_keys.length > 0) { | ||
| var joint = indent === '' ? ' ' : indent; | ||
| props = _keys.map(function (key) { | ||
| return key + '=' + wrapJsxProp(next(x.props[key])); | ||
| var props = ''; | ||
| var children = null; | ||
| if (keys.length > 0) { | ||
| seen.push(x); | ||
| var _keys = keys.filter(function (key) { | ||
| return key !== 'children'; | ||
| }); | ||
| props = '' + joint + props.join(joint) + lastIndent; | ||
| if (_keys.length > 0) { | ||
| var joint = indent === '' ? ' ' : indent; | ||
| props = _keys.map(function (key) { | ||
| var val = x.props[key]; | ||
| return val === true ? key : key + '=' + wrapJsxProp(next(val)); | ||
| }); | ||
| props = '' + joint + props.join(joint) + lastIndent; | ||
| } | ||
| if (keys.indexOf('children') !== -1) { | ||
| children = wrapJsxChildren(next(x.props.children)); | ||
| } | ||
| seen.pop(); | ||
| } | ||
| if (keys.indexOf('children') !== -1) { | ||
| children = wrapJsxChildren(next(x.props.children)); | ||
| } | ||
| seen.pop(); | ||
| } | ||
| var ending = children === null ? '/>' : '>' + indent + children + lastIndent + '</' + _name + '>'; | ||
| return '<' + _name + props + ending; | ||
| var ending = children === null ? '/>' : '>' + indent + children + lastIndent + '</' + name + '>'; | ||
| return { | ||
| v: '<' + name + props + ending | ||
| }; | ||
| })(); | ||
| if (typeof _ret === 'object') return _ret.v; | ||
| } | ||
@@ -108,0 +118,0 @@ return null; |
+1
-1
| { | ||
| "name": "react-demo", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "A React-component for creating demos of other components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+2
-2
@@ -188,3 +188,3 @@ # React-demo [](https://travis-ci.org/rpominov/react-demo) | ||
| #### `props.constan(value)` | ||
| #### `props.constant(value)` | ||
@@ -199,3 +199,3 @@ Allows us set a constant value for a prop. Doesn't create a control on the panel. | ||
| props={{ | ||
| foo: P.constan('bar'), | ||
| foo: P.constant('bar'), | ||
| }} | ||
@@ -202,0 +202,0 @@ /> |
43932
1.1%1014
0.9%