├── .babelrc ├── src ├── actionTypes │ └── index.js ├── components │ ├── index.js │ ├── Base.js │ ├── Provider.js │ ├── Fragment.js │ └── Link.js ├── error.js ├── reducer.js ├── index.js ├── parsers │ ├── locationToState.js │ ├── util.js │ ├── routeToLocation.js │ └── locationToRoute.js ├── actions │ └── index.js ├── router.js ├── constants.js ├── middleware.js └── store-enhancer.js ├── examples ├── src │ ├── index.css │ ├── components │ │ ├── CurrentRoute │ │ │ ├── CurrentRoute.css │ │ │ └── index.js │ │ ├── App │ │ │ ├── App.test.js │ │ │ ├── App.css │ │ │ └── App.js │ │ └── Lorem │ │ │ └── index.js │ ├── index.js │ ├── store │ │ └── index.js │ └── routes.js ├── public │ ├── favicon.ico │ └── index.html ├── .gitignore └── package.json ├── test ├── index.spec.js ├── helpers │ └── setup.js ├── parsers │ └── util.spec.js └── mock │ └── routes.js ├── .travis.yml ├── .npmignore ├── .gitignore ├── package.json ├── CHANGELOG.md ├── .eslintrc.js └── README.md /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["stage-0", "es2015", "react"] 3 | } -------------------------------------------------------------------------------- /src/actionTypes/index.js: -------------------------------------------------------------------------------- 1 | export { ACTION_TYPES as default } from '../constants'; -------------------------------------------------------------------------------- /examples/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 20px; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /examples/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auru/redux-unity-router/HEAD/examples/public/favicon.ico -------------------------------------------------------------------------------- /test/index.spec.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import router from '../src/'; 3 | 4 | test.failing('no tests', t => { 5 | t.fail() 6 | }); -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | export { default as Link } from './Link'; 2 | export { default as RouterProvider } from './Provider'; 3 | export { default as Fragment } from './Fragment'; -------------------------------------------------------------------------------- /test/helpers/setup.js: -------------------------------------------------------------------------------- 1 | const JSDOM = require('jsdom').JSDOM; 2 | 3 | global.document = new JSDOM('
'); 4 | global.window = document.window; 5 | global.navigator = window.navigator; -------------------------------------------------------------------------------- /src/error.js: -------------------------------------------------------------------------------- 1 | function RouterError(message) { 2 | this.name = 'RouterError'; 3 | this.message = (message || ''); 4 | } 5 | RouterError.prototype = Error.prototype; 6 | 7 | export default RouterError; -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | cache: 5 | directories: 6 | - node_modules 7 | branches: 8 | only: 9 | - master 10 | after_success: 11 | - 'npm run coverage:send' 12 | -------------------------------------------------------------------------------- /examples/src/components/CurrentRoute/CurrentRoute.css: -------------------------------------------------------------------------------- 1 | .current-route 2 | { 3 | margin: 0 0 12px; 4 | } 5 | 6 | .current-route__info 7 | { 8 | font-size: 18px; 9 | } 10 | 11 | .current-route__item 12 | { 13 | margin: 6px 0; 14 | } -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | -------------------------------------------------------------------------------- /examples/src/components/App/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(