-
Notifications
You must be signed in to change notification settings - Fork 47
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
0 parents
commit 20bb5ed
Showing
17 changed files
with
286 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"stage": 0, | ||
"loose": "all" | ||
} |
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,2 @@ | ||
lib | ||
**/node_modules |
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,21 @@ | ||
{ | ||
"extends": "eslint-config-airbnb", | ||
"env": { | ||
"browser": true, | ||
"mocha": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"react/jsx-uses-react": 2, | ||
"react/jsx-uses-vars": 2, | ||
"react/react-in-jsx-scope": 2, | ||
"no-console": 0, | ||
"no-use-before-define": 0, | ||
// Temporarily disabled due to babel-eslint issues: | ||
"block-scoped-var": 0, | ||
"padded-blocks": 0, | ||
}, | ||
"plugins": [ | ||
"react" | ||
] | ||
} |
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,5 @@ | ||
node_modules | ||
*.log | ||
.DS_Store | ||
lib | ||
coverage |
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,5 @@ | ||
.DS_Store | ||
*.log | ||
src | ||
test | ||
coverage |
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,3 @@ | ||
language: node_js | ||
node_js: | ||
- "iojs" |
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,4 @@ | ||
# Change log | ||
|
||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
See all notable changes on [Releases](https://github.com/gaearon/redux-devtools-log-monitor/releases) page. |
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 @@ | ||
# Contributor Code of Conduct | ||
|
||
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. | ||
|
||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. | ||
|
||
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) | ||
|
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Dan Abramov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,13 @@ | ||
Redux DevTools Dock Monitor | ||
========================= | ||
|
||
A resizable and movable dock for [Redux DevTools](https://github.com/gaearon/redux-devtools). | ||
Powered by [React Dock](https://github.com/alexkuz/react-dock). | ||
|
||
**Note: this is a work-in-progress version for [Redux DevTools 3](https://github.com/gaearon/redux-devtools/pull/132), and will not work with stable devtools. It also requires React 0.14.** | ||
|
||
![](http://i.imgur.com/e2vaIAc.gif) | ||
|
||
### License | ||
|
||
MIT |
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,55 @@ | ||
{ | ||
"name": "redux-devtools-dock-monitor", | ||
"version": "1.0.0-beta-1", | ||
"description": "A resizable and movable dock for Redux DevTools monitors", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"build": "babel src --out-dir lib", | ||
"lint": "eslint src test", | ||
"test": "NODE_ENV=test mocha --compilers js:babel/register --recursive", | ||
"test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch", | ||
"prepublish": "npm run lint && npm run test && npm run clean && npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gaearon/redux-devtools-dock-monitor.git" | ||
}, | ||
"keywords": [ | ||
"redux", | ||
"devtools", | ||
"flux", | ||
"react", | ||
"hot reloading", | ||
"time travel", | ||
"live edit" | ||
], | ||
"author": "Dan Abramov <[email protected]> (https://github.com/gaearon)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gaearon/redux-devtools-dock-monitor/issues" | ||
}, | ||
"homepage": "https://github.com/gaearon/redux-devtools-dock-monitor", | ||
"devDependencies": { | ||
"babel": "^5.5.8", | ||
"babel-core": "^5.6.18", | ||
"babel-eslint": "^3.1.15", | ||
"babel-loader": "^5.1.4", | ||
"eslint": "^0.23", | ||
"eslint-config-airbnb": "0.0.6", | ||
"eslint-plugin-react": "^2.3.0", | ||
"expect": "^1.6.0", | ||
"mocha": "^2.2.5", | ||
"rimraf": "^2.3.4", | ||
"webpack": "^1.11.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^0.14.0", | ||
"redux-devtools": "^3.0.0-beta-1" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^5.8.25", | ||
"react-dock": "^0.2.1", | ||
"react-pure-render": "^1.0.2" | ||
} | ||
} |
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,89 @@ | ||
import React, { cloneElement, Component, PropTypes } from 'react'; | ||
import Dock from 'react-dock'; | ||
import { POSITIONS } from './constants'; | ||
import { toggleVisibility, changePosition, changeSize } from './actions'; | ||
import reducer from './reducers'; | ||
|
||
export default class DockMonitor extends Component { | ||
static reducer = reducer; | ||
|
||
static propTypes = { | ||
defaultPosition: PropTypes.oneOf(POSITIONS).isRequired, | ||
defaultIsVisible: PropTypes.bool.isRequired, | ||
defaultSize: PropTypes.number.isRequired, | ||
toggleVisibilityKey: PropTypes.string.isRequired, | ||
changePositionKey: PropTypes.string.isRequired, | ||
children: PropTypes.element, | ||
|
||
dispatch: PropTypes.func, | ||
monitorState: PropTypes.shape({ | ||
position: PropTypes.oneOf(POSITIONS).isRequired, | ||
size: PropTypes.number.isRequired, | ||
isVisible: PropTypes.bool.isRequired, | ||
childMonitorState: PropTypes.any | ||
}) | ||
}; | ||
|
||
static defaultProps = { | ||
defaultIsVisible: true, | ||
defaultPosition: 'right', | ||
defaultSize: 0.3 | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.handleKeyDown = this.handleKeyDown.bind(this); | ||
this.handleSizeChange = this.handleSizeChange.bind(this); | ||
} | ||
|
||
componentDidMount() { | ||
window.addEventListener('keydown', this.handleKeyDown); | ||
} | ||
|
||
componentWillUnmount() { | ||
window.removeEventListener('keydown', this.handleKeyDown); | ||
} | ||
|
||
handleKeyDown(e) { | ||
if (!e.ctrlKey) { | ||
return; | ||
} | ||
e.preventDefault(); | ||
|
||
const key = event.keyCode || event.which; | ||
const char = String.fromCharCode(key); | ||
switch (char.toUpperCase()) { | ||
case this.props.toggleVisibilityKey.toUpperCase(): | ||
this.props.dispatch(toggleVisibility()); | ||
break; | ||
case this.props.changePositionKey.toUpperCase(): | ||
this.props.dispatch(changePosition()); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
handleSizeChange(requestedSize) { | ||
this.props.dispatch(changeSize(requestedSize)); | ||
} | ||
|
||
render() { | ||
const { monitorState, children, ...rest } = this.props; | ||
const { position, isVisible, size } = monitorState; | ||
const childProps = { | ||
...rest, | ||
monitorState: monitorState.childMonitorState | ||
}; | ||
|
||
return ( | ||
<Dock position={position} | ||
isVisible={isVisible} | ||
size={size} | ||
onSizeChange={this.handleSizeChange} | ||
dimMode='none'> | ||
{cloneElement(children, childProps)} | ||
</Dock> | ||
); | ||
} | ||
} |
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 @@ | ||
export const TOGGLE_VISIBILITY = '@@redux-devtools-log-monitor/TOGGLE_VISIBILITY'; | ||
export function toggleVisibility() { | ||
return { type: TOGGLE_VISIBILITY }; | ||
} | ||
|
||
export const CHANGE_POSITION = '@@redux-devtools-log-monitor/CHANGE_POSITION'; | ||
export function changePosition() { | ||
return { type: CHANGE_POSITION }; | ||
} | ||
|
||
export const CHANGE_SIZE = '@@redux-devtools-log-monitor/CHANGE_SIZE'; | ||
export function changeSize(size) { | ||
return { type: CHANGE_SIZE, size: size }; | ||
} |
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 @@ | ||
export const POSITIONS = ['left', 'top', 'right', 'bottom']; |
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 @@ | ||
export default from './DockMonitor'; |
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,34 @@ | ||
import { CHANGE_POSITION, CHANGE_SIZE, TOGGLE_VISIBILITY } from './actions'; | ||
import { POSITIONS } from './constants'; | ||
|
||
function position(state = props.defaultPosition, action, props) { | ||
return (action.type === CHANGE_POSITION) ? | ||
POSITIONS[(POSITIONS.indexOf(state) + 1) % POSITIONS.length] : | ||
state; | ||
} | ||
|
||
function size(state = props.defaultSize, action, props) { | ||
return (action.type === CHANGE_SIZE) ? | ||
action.size : | ||
state; | ||
} | ||
|
||
function isVisible(state = props.defaultIsVisible, action, props) { | ||
return (action.type === TOGGLE_VISIBILITY) ? | ||
!state : | ||
state; | ||
} | ||
|
||
function childMonitorState(state, action, props) { | ||
const child = props.children; | ||
return child.type.reducer(state, action, child.props); | ||
} | ||
|
||
export default function reducer(state = {}, action, props) { | ||
return { | ||
position: position(state.position, action, props), | ||
isVisible: isVisible(state.isVisible, action, props), | ||
size: size(state.size, action, props), | ||
childMonitorState: childMonitorState(state.childMonitorState, action, props) | ||
}; | ||
} |
Empty file.