Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
45086e2
Initial addition of JSON Tree Inspector
dzannotti Aug 7, 2015
669b1be
Merge remote-tracking branch 'gaearon/master'
dzannotti Aug 7, 2015
50212f8
beautified devtools look and removed lodash.assign as dep
dzannotti Aug 7, 2015
42d4c3f
added theming
dzannotti Aug 7, 2015
e28a543
added monokai theme
dzannotti Aug 7, 2015
244b897
set ocean as default theme
dzannotti Aug 7, 2015
46e71e7
linting
dzannotti Aug 7, 2015
c14dffc
Merge remote-tracking branch 'gaearon/master'
dzannotti Aug 7, 2015
f0c7d3f
added all base16 themes
dzannotti Aug 7, 2015
4ca436f
cleaned up json tree items font sizing
dzannotti Aug 7, 2015
a19d7d6
readded scroll and removed no longer used style
dzannotti Aug 7, 2015
2b2724c
restored scroll functionality to default
dzannotti Aug 7, 2015
61250b5
fixed error display
dzannotti Aug 7, 2015
fb83a18
tentative diff highlight
dzannotti Aug 7, 2015
deb9fa6
removed diff from object and arrays
dzannotti Aug 7, 2015
b74e977
linting
dzannotti Aug 7, 2015
0055b02
removed debug code
dzannotti Aug 7, 2015
37a8fc1
deep equal on shouldComponentUpdate
dzannotti Aug 7, 2015
1ec3c01
linting
dzannotti Aug 8, 2015
dbbe482
fixed typo that forced payload never to appear
dzannotti Aug 10, 2015
2c1643b
renamed Items to Keys for clarity
dzannotti Aug 10, 2015
c398b11
prioritized monaco font
dzannotti Aug 10, 2015
fbbb5b1
tuned down font sizing
dzannotti Aug 10, 2015
fb228b6
Merge remote-tracking branch 'gaearon/master'
dzannotti Aug 10, 2015
c2a92a7
removed letter spacing
dzannotti Aug 10, 2015
4398378
unified fontSize
dzannotti Aug 10, 2015
da140c1
made highlight of diff slightly more visible
dzannotti Aug 10, 2015
292d582
Made the action type slightly taller
dzannotti Aug 10, 2015
021e950
renamed keys and items to unify fonting perception
dzannotti Aug 10, 2015
b7468c3
aligned arrows as per https://github.com/gaearon/redux-devtools/pull/…
dzannotti Aug 10, 2015
1394ea0
removed no longer used style
dzannotti Aug 10, 2015
7ad9616
improved click precision
dzannotti Aug 10, 2015
696b3bb
fixes https://github.com/dzannotti/redux-devtools/commit/021e95071f23…
dzannotti Aug 10, 2015
6677e37
removed opacity on monitor
dzannotti Aug 10, 2015
98d5ed3
renamed payload to action as requested in https://github.com/gaearon/…
dzannotti Aug 10, 2015
c0afa39
Consolidated font stack to be the same across all devtool
dzannotti Aug 11, 2015
626562a
added nicinabox base16 theme and made it default
dzannotti Aug 11, 2015
65d9e58
ignored undefined nodes in array/objects
dzannotti Aug 11, 2015
a695bb2
implemented nicinabox theme
dzannotti Aug 11, 2015
4ec79f8
adjusted height of buttonbar and padding on actionbar
dzannotti Aug 11, 2015
6f839bd
Merge remote-tracking branch 'gaearon/master'
dzannotti Aug 11, 2015
39512ff
removed no longer used colorFromString
dzannotti Aug 11, 2015
e222f98
added disabled state to button, and always show all buttons even if d…
dzannotti Aug 11, 2015
4761222
pixel pushed buttons at top
dzannotti Aug 11, 2015
9ad4fb2
Style buttons
nicinabox Aug 12, 2015
cb355c3
Bump min width to 300
nicinabox Aug 12, 2015
da7995c
Bump padding on section titles
nicinabox Aug 12, 2015
c6811b0
Fix base09 color in nicinabox theme
nicinabox Aug 12, 2015
184853c
Change highlight color to white with 0.1 alpha
nicinabox Aug 12, 2015
0e6c4d2
Change number node color
nicinabox Aug 12, 2015
6af5d98
Increase node indentation
nicinabox Aug 12, 2015
c4fa259
Fix action node overflow, background
nicinabox Aug 12, 2015
540e9e5
Add box shadow to DebugPanel for depth
nicinabox Aug 12, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"redux": "^1.0.0 || 1.0.0-rc"
},
"dependencies": {
"react-mixin": "^1.7.0",
"react-redux": "^0.5.0",
"redux": "^1.0.0-rc"
}
Expand Down
10 changes: 6 additions & 4 deletions src/react/DebugPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ export function getDefaultStyle(props) {
position: 'fixed',
zIndex: 10000,
fontSize: 17,
overflow: 'auto',
opacity: 0.92,
background: 'black',
overflow: 'hidden',
opacity: 1,
color: 'white',
left: left ? 0 : undefined,
right: right ? 0 : undefined,
top: top ? 0 : undefined,
bottom: bottom ? 0 : undefined,
maxHeight: (bottom && top) ? '100%' : '20%',
maxWidth: (left && right) ? '100%' : '20%',
wordWrap: 'break-word'
minWidth: 300,
wordWrap: 'break-word',
boxSizing: 'border-box',
boxShadow: '-2px 0 7px 0 rgba(0, 0, 0, 0.5)'
};
}

Expand Down
125 changes: 125 additions & 0 deletions src/react/JSONTree/JSONArrayNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import React from 'react';
import reactMixin from 'react-mixin';
import { ExpandedStateHandlerMixin } from './mixins';
import JSONArrow from './JSONArrow';
import grabNode from './grab-node';

const styles = {
base: {
position: 'relative',
paddingTop: 3,
paddingBottom: 3,
paddingRight: 0,
marginLeft: 14
},
label: {
margin: 0,
padding: 0,
display: 'inline-block'
},
span: {
cursor: 'default'
},
spanType: {
marginLeft: 5,
marginRight: 5
}
};

@reactMixin.decorate(ExpandedStateHandlerMixin)
export default class JSONArrayNode extends React.Component {
defaultProps = {
data: [],
initialExpanded: false
};

// flag to see if we still need to render our child nodes
needsChildNodes = true;

// cache store for our child nodes
renderedChildren = [];

// cache store for the number of items string we display
itemString = false;

constructor(props) {
super(props);
this.state = {
expanded: this.props.initialExpanded,
createdChildNodes: false
};
}

// Returns the child nodes for each element in the array. If we have
// generated them previously, we return from cache, otherwise we create
// them.
getChildNodes() {
if (this.state.expanded && this.needsChildNodes) {
let childNodes = [];
this.props.data.forEach((element, idx) => {
let prevData;
if (typeof this.props.previousData !== 'undefined') {
prevData = this.props.previousData[idx];
}
const node = grabNode(idx, element, prevData, this.props.theme);
if (node !== false) {
childNodes.push(node);
}
});
this.needsChildNodes = false;
this.renderedChildren = childNodes;
}
return this.renderedChildren;
}

// Returns the "n Items" string for this node, generating and
// caching it if it hasn't been created yet.
getItemString() {
if (!this.itemString) {
this.itemString = this.props.data.length + ' item' + (this.props.data.length !== 0 ? 's' : '');
}
return this.itemString;
}

render() {
const childNodes = this.getChildNodes();
const childListStyle = {
padding: 0,
margin: 0,
listStyle: 'none',
display: (this.state.expanded) ? 'block' : 'none'
};
let containerStyle;
let spanStyle = {
...styles.span,
color: this.props.theme.base0E
};
containerStyle = {
...styles.base
};
if (this.state.expanded) {
spanStyle = {
...spanStyle,
color: this.props.theme.base03
};
}
return (
<li style={containerStyle}>
<JSONArrow theme={this.props.theme} open={this.state.expanded} onClick={::this.handleClick}/>
<label style={{
...styles.label,
color: this.props.theme.base0D
}} onClick={::this.handleClick}>
{this.props.keyName}:
</label>
<span style={spanStyle} onClick={::this.handleClick}>
<span style={styles.spanType}>[]</span>
{this.getItemString()}
</span>
<ol style={childListStyle}>
{childNodes}
</ol>
</li>
);
}
}
42 changes: 42 additions & 0 deletions src/react/JSONTree/JSONArrow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';

const styles = {
base: {
display: 'inline-block',
marginLeft: 0,
marginTop: 8,
marginRight: 5,
'float': 'left',
transition: '150ms',
WebkitTransition: '150ms',
MozTransition: '150ms',
borderLeft: '5px solid transparent',
borderRight: '5px solid transparent',
borderTopWidth: 5,
borderTopStyle: 'solid',
WebkitTransform: 'rotateZ(-90deg)',
MozTransform: 'rotateZ(-90deg)',
transform: 'rotateZ(-90deg)'
},
open: {
WebkitTransform: 'rotateZ(0deg)',
MozTransform: 'rotateZ(0deg)',
transform: 'rotateZ(0deg)'
}
};

export default class JSONArrow extends React.Component {
render() {
let style = {
...styles.base,
borderTopColor: this.props.theme.base0D
};
if (this.props.open) {
style = {
...style,
...styles.open
};
}
return <div style={style} onClick={this.props.onClick}/>;
}
}
40 changes: 40 additions & 0 deletions src/react/JSONTree/JSONBooleanNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import reactMixin from 'react-mixin';
import { SquashClickEventMixin } from './mixins';
import hexToRgb from '../../utils/hexToRgb';

const styles = {
base: {
paddingTop: 3,
paddingBottom: 3,
paddingRight: 0,
marginLeft: 14
},
label: {
display: 'inline-block',
marginRight: 5
}
};

@reactMixin.decorate(SquashClickEventMixin)
export default class JSONBooleanNode extends React.Component {
render() {
const truthString = (this.props.value) ? 'true' : 'false';
let backgroundColor = 'transparent';
if (this.props.previousValue !== this.props.value) {
const bgColor = hexToRgb(this.props.theme.base06);
backgroundColor = `rgba(${bgColor.r}, ${bgColor.g}, ${bgColor.b}, 0.1)`;
}
return (
<li style={{ ...styles.base, backgroundColor }} onClick={::this.handleClick}>
<label style={{
...styles.label,
color: this.props.theme.base0D
}}>
{this.props.keyName}:
</label>
<span style={{ color: this.props.theme.base09 }}>{truthString}</span>
</li>
);
}
}
39 changes: 39 additions & 0 deletions src/react/JSONTree/JSONNullNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import reactMixin from 'react-mixin';
import { SquashClickEventMixin } from './mixins';
import hexToRgb from '../../utils/hexToRgb';

const styles = {
base: {
paddingTop: 3,
paddingBottom: 3,
paddingRight: 0,
marginLeft: 14
},
label: {
display: 'inline-block',
marginRight: 5
}
};

@reactMixin.decorate(SquashClickEventMixin)
export default class JSONNullNode extends React.Component {
render() {
let backgroundColor = 'transparent';
if (this.props.previousValue !== this.props.value) {
const bgColor = hexToRgb(this.props.theme.base06);
backgroundColor = `rgba(${bgColor.r}, ${bgColor.g}, ${bgColor.b}, 0.1)`;
}
return (
<li style={{ ...styles.base, backgroundColor }} onClick={::this.handleClick}>
<label style={{
...styles.label,
color: this.props.theme.base0D
}}>
{this.props.keyName}:
</label>
<span style={{ color: this.props.theme.base08 }}>null</span>
</li>
);
}
}
39 changes: 39 additions & 0 deletions src/react/JSONTree/JSONNumberNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import reactMixin from 'react-mixin';
import { SquashClickEventMixin } from './mixins';
import hexToRgb from '../../utils/hexToRgb';

const styles = {
base: {
paddingTop: 3,
paddingBottom: 3,
paddingRight: 0,
marginLeft: 14
},
label: {
display: 'inline-block',
marginRight: 5
}
};

@reactMixin.decorate(SquashClickEventMixin)
export default class JSONNumberNode extends React.Component {
render() {
let backgroundColor = 'transparent';
if (this.props.previousValue !== this.props.value) {
const bgColor = hexToRgb(this.props.theme.base06);
backgroundColor = `rgba(${bgColor.r}, ${bgColor.g}, ${bgColor.b}, 0.1)`;
}
return (
<li style={{ ...styles.base, backgroundColor }} onClick={::this.handleClick}>
<label style={{
...styles.label,
color: this.props.theme.base0D
}}>
{this.props.keyName}:
</label>
<span style={{ color: this.props.theme.base09 }}>{this.props.value}</span>
</li>
);
}
}
Loading