Comparing version 0.9.1 to 0.10.0
@@ -22,3 +22,3 @@ "use strict"; | ||
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; } /** | ||
* Copyright (c) 2015, Peter W Moresi | ||
* Copyright (c) 2015, JC Fisher | ||
*/ | ||
@@ -40,8 +40,6 @@ | ||
// properties must be passed in. | ||
var _props = this.props, | ||
router = _props.router, | ||
location = _props.location; | ||
var router = this.props.router; | ||
if (!router || !location) throw Error("Router and location expected to be initialized!"); | ||
if (!router) throw Error("Router and location expected to be initialized!"); | ||
@@ -56,3 +54,3 @@ var Content = router.content; | ||
// render the content for the route! | ||
return _react2.default.createElement(Content, _extends({ router: router, location: location }, this.props)); | ||
return _react2.default.createElement(Content, _extends({ router: router, location: router.location }, this.props)); | ||
} | ||
@@ -59,0 +57,0 @@ }]); |
@@ -11,4 +11,6 @@ 'use strict'; | ||
var router = require('rootr'); | ||
// Copyright 2017 JC Fisher | ||
var router = require('./router'); | ||
var _require = require('fluxury'), | ||
@@ -65,8 +67,7 @@ getState = _require.getState, | ||
xander.loadRoutes = router.loadRoutes; | ||
xander.location = router.location; | ||
xander.default = xander; | ||
xander.openPath = function (path) { | ||
return router.location.open(path); | ||
return router.open(path); | ||
}; | ||
module.exports = xander; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { | ||
var _react = require('react'); | ||
var _react = require("react"); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _location = require('rootr/lib/location'); | ||
var _router = require("./router"); | ||
var _location2 = _interopRequireDefault(_location); | ||
var _router2 = _interopRequireDefault(_router); | ||
@@ -47,5 +47,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
_createClass(Link, [{ | ||
key: 'handleClick', | ||
key: "handleClick", | ||
value: function handleClick(event) { | ||
if (this.props.onClick) this.props.onClick(event); | ||
@@ -60,12 +59,16 @@ | ||
this.props.action ? this.props.action(event) : _location2.default.open(this.props.to); | ||
this.props.action ? this.props.action(event) : _router2.default.open(this.props.to); | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
if (this.props.type === 'button') { | ||
if (this.props.type === "button") { | ||
return _react2.default.createElement( | ||
'button', | ||
{ disabled: this.props.disabled, className: this.props.className, style: this.props.style, onClick: this.handleClick }, | ||
"button", | ||
{ | ||
disabled: this.props.disabled, | ||
className: this.props.className, | ||
style: this.props.style, | ||
onClick: this.handleClick | ||
}, | ||
this.props.children | ||
@@ -76,4 +79,10 @@ ); | ||
return _react2.default.createElement( | ||
'a', | ||
{ disabled: this.props.disabled, className: this.props.className, style: this.props.style, onClick: this.handleClick, href: this.props.to }, | ||
"a", | ||
{ | ||
disabled: this.props.disabled, | ||
className: this.props.className, | ||
style: this.props.style, | ||
onClick: this.handleClick, | ||
href: this.props.to | ||
}, | ||
this.props.children | ||
@@ -87,5 +96,3 @@ ); | ||
; | ||
exports.default = Link; | ||
module.exports = exports['default']; | ||
module.exports = exports["default"]; |
{ | ||
"name": "xander", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "Single page app framework", | ||
@@ -9,3 +9,3 @@ "repository": "git+https://github.com/formula/xander.git", | ||
"build": "gulp", | ||
"test": "babel-node test" | ||
"test": "babel-node tests/public-api; babel-node tests/router" | ||
}, | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
"homepage": "https://github.com/formula/xander#readme", | ||
"devDependencies": { | ||
"devDependencies": { | ||
"babel-cli": "^6.1.2", | ||
@@ -39,5 +39,4 @@ "babel-core": "^6.1.2", | ||
"fluxury": "^3.1.0", | ||
"formula": "^2.3.1", | ||
"rootr": "^0.3.0" | ||
"formula": "^2.3.1" | ||
} | ||
} |
@@ -11,5 +11,2 @@ # xander | ||
This project was born out of a desire to build | ||
alternatives to React-Router and Redux. | ||
## Usage | ||
@@ -60,13 +57,9 @@ | ||
#### Location | ||
Manage location with the easy to use API. | ||
```js | ||
import {location} from 'xander' | ||
location.open('/buckets/1') | ||
import {router} from 'xander' | ||
router.open('/buckets/1') | ||
``` | ||
Use `redirect` to change the URL without adding an entry to the history state. | ||
```js | ||
location.redirect('/buckets') | ||
router.redirect('/buckets') | ||
``` | ||
@@ -76,3 +69,3 @@ | ||
Routes and related location information stored as routes. | ||
Load routes and related configuration. | ||
@@ -86,5 +79,2 @@ ```js | ||
See [rootr](https://github.com/formula/rootr) for more examples. | ||
### State management | ||
@@ -100,21 +90,1 @@ | ||
For more examples see [fluxury](https://github.com/formula/fluxury). | ||
#### connect #### | ||
A higher order function to connect React component | ||
```js | ||
import {connect} from 'xander' | ||
let Connected = connect(store, component)` | ||
ReactDOM.render(<Connected />) | ||
``` | ||
#### Container #### | ||
A component to render the current route content. | ||
```js | ||
import {Container} from 'xander' | ||
render( <Container router={...} location={...} />, document.all.root ) | ||
``` | ||
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
34253
3
16
738
86
1
- Removedrootr@^0.3.0
- Removedrootr@0.3.0(transitive)