added migrations for instant delivery

This commit is contained in:
Senad Uka
2015-07-26 19:10:16 +02:00
parent af6864954a
commit 68b25bf491
374 changed files with 135456 additions and 6 deletions

View File

@@ -0,0 +1,108 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var React = require('react');
var ContextWrapper = require('./ContextWrapper');
var assign = require('react/lib/Object.assign');
var PropTypes = require('../PropTypes');
var REF_NAME = '__routeHandler__';
/**
* A <RouteHandler> component renders the active child route handler
* when routes are nested.
*/
var RouteHandler = (function (_React$Component) {
function RouteHandler() {
_classCallCheck(this, RouteHandler);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(RouteHandler, _React$Component);
_createClass(RouteHandler, [{
key: 'getChildContext',
value: function getChildContext() {
return {
routeDepth: this.context.routeDepth + 1
};
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this._updateRouteComponent(null);
}
}, {
key: '_updateRouteComponent',
value: function _updateRouteComponent(component) {
this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component);
}
}, {
key: 'getRouteDepth',
value: function getRouteDepth() {
return this.context.routeDepth;
}
}, {
key: 'createChildRouteHandler',
value: function createChildRouteHandler(props) {
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
if (route == null) {
return null;
}var childProps = assign({}, props || this.props, {
ref: REF_NAME,
params: this.context.router.getCurrentParams(),
query: this.context.router.getCurrentQuery()
});
return React.createElement(route.handler, childProps);
}
}, {
key: 'render',
value: function render() {
var handler = this.createChildRouteHandler();
// <script/> for things like <CSSTransitionGroup/> that don't like null
return handler ? React.createElement(
ContextWrapper,
null,
handler
) : React.createElement('script', null);
}
}]);
return RouteHandler;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
RouteHandler.contextTypes = {
routeDepth: PropTypes.number.isRequired,
router: PropTypes.router.isRequired
};
RouteHandler.childContextTypes = {
routeDepth: PropTypes.number.isRequired
};
module.exports = RouteHandler;

View File

@@ -0,0 +1,38 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
/**
* This component is necessary to get around a context warning
* present in React 0.13.0. It sovles this by providing a separation
* between the "owner" and "parent" contexts.
*/
var React = require('react');
var ContextWrapper = (function (_React$Component) {
function ContextWrapper() {
_classCallCheck(this, ContextWrapper);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(ContextWrapper, _React$Component);
_createClass(ContextWrapper, [{
key: 'render',
value: function render() {
return this.props.children;
}
}]);
return ContextWrapper;
})(React.Component);
module.exports = ContextWrapper;

View File

@@ -0,0 +1,47 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _inherits = function (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) subClass.__proto__ = superClass; };
var PropTypes = require('../PropTypes');
var RouteHandler = require('./RouteHandler');
var Route = require('./Route');
/**
* A <DefaultRoute> component is a special kind of <Route> that
* renders when its parent matches but none of its siblings do.
* Only one such route may be used at any given level in the
* route hierarchy.
*/
var DefaultRoute = (function (_Route) {
function DefaultRoute() {
_classCallCheck(this, DefaultRoute);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(DefaultRoute, _Route);
return DefaultRoute;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
DefaultRoute.propTypes = {
name: PropTypes.string,
path: PropTypes.falsy,
children: PropTypes.falsy,
handler: PropTypes.func.isRequired
};
DefaultRoute.defaultProps = {
handler: RouteHandler
};
module.exports = DefaultRoute;

135
node_modules/react-router/lib/components/Link.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var React = require('react');
var assign = require('react/lib/Object.assign');
var PropTypes = require('../PropTypes');
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
/**
* <Link> components are used to create an <a> element that links to a route.
* When that route is active, the link gets an "active" class name (or the
* value of its `activeClassName` prop).
*
* For example, assuming you have the following route:
*
* <Route name="showPost" path="/posts/:postID" handler={Post}/>
*
* You could use the following component to link to that route:
*
* <Link to="showPost" params={{ postID: "123" }} />
*
* In addition to params, links may pass along query string parameters
* using the `query` prop.
*
* <Link to="showPost" params={{ postID: "123" }} query={{ show:true }}/>
*/
var Link = (function (_React$Component) {
function Link() {
_classCallCheck(this, Link);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(Link, _React$Component);
_createClass(Link, [{
key: 'handleClick',
value: function handleClick(event) {
var allowTransition = true;
var clickResult;
if (this.props.onClick) clickResult = this.props.onClick(event);
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
return;
}if (clickResult === false || event.defaultPrevented === true) allowTransition = false;
event.preventDefault();
if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'getHref',
/**
* Returns the value of the "href" attribute to use on the DOM element.
*/
value: function getHref() {
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'getClassName',
/**
* Returns the value of the "class" attribute to use on the DOM element, which contains
* the value of the activeClassName property when this <Link> is active.
*/
value: function getClassName() {
var className = this.props.className;
if (this.getActiveState()) className += ' ' + this.props.activeClassName;
return className;
}
}, {
key: 'getActiveState',
value: function getActiveState() {
return this.context.router.isActive(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'render',
value: function render() {
var props = assign({}, this.props, {
href: this.getHref(),
className: this.getClassName(),
onClick: this.handleClick.bind(this)
});
if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle;
return React.DOM.a(props, this.props.children);
}
}]);
return Link;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Link.contextTypes = {
router: PropTypes.router.isRequired
};
Link.propTypes = {
activeClassName: PropTypes.string.isRequired,
to: PropTypes.oneOfType([PropTypes.string, PropTypes.route]).isRequired,
params: PropTypes.object,
query: PropTypes.object,
activeStyle: PropTypes.object,
onClick: PropTypes.func
};
Link.defaultProps = {
activeClassName: 'active',
className: ''
};
module.exports = Link;

View File

@@ -0,0 +1,48 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _inherits = function (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) subClass.__proto__ = superClass; };
var PropTypes = require('../PropTypes');
var RouteHandler = require('./RouteHandler');
var Route = require('./Route');
/**
* A <NotFoundRoute> is a special kind of <Route> that
* renders when the beginning of its parent's path matches
* but none of its siblings do, including any <DefaultRoute>.
* Only one such route may be used at any given level in the
* route hierarchy.
*/
var NotFoundRoute = (function (_Route) {
function NotFoundRoute() {
_classCallCheck(this, NotFoundRoute);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(NotFoundRoute, _Route);
return NotFoundRoute;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
NotFoundRoute.propTypes = {
name: PropTypes.string,
path: PropTypes.falsy,
children: PropTypes.falsy,
handler: PropTypes.func.isRequired
};
NotFoundRoute.defaultProps = {
handler: RouteHandler
};
module.exports = NotFoundRoute;

43
node_modules/react-router/lib/components/Redirect.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _inherits = function (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) subClass.__proto__ = superClass; };
var PropTypes = require('../PropTypes');
var Route = require('./Route');
/**
* A <Redirect> component is a special kind of <Route> that always
* redirects to another route when it matches.
*/
var Redirect = (function (_Route) {
function Redirect() {
_classCallCheck(this, Redirect);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(Redirect, _Route);
return Redirect;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Redirect.propTypes = {
path: PropTypes.string,
from: PropTypes.string, // Alias for path.
to: PropTypes.string,
handler: PropTypes.falsy
};
// Redirects should not have a default handler
Redirect.defaultProps = {};
module.exports = Redirect;

91
node_modules/react-router/lib/components/Route.js generated vendored Normal file
View File

@@ -0,0 +1,91 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var React = require('react');
var invariant = require('react/lib/invariant');
var PropTypes = require('../PropTypes');
var RouteHandler = require('./RouteHandler');
/**
* <Route> components specify components that are rendered to the page when the
* URL matches a given pattern.
*
* Routes are arranged in a nested tree structure. When a new URL is requested,
* the tree is searched depth-first to find a route whose path matches the URL.
* When one is found, all routes in the tree that lead to it are considered
* "active" and their components are rendered into the DOM, nested in the same
* order as they are in the tree.
*
* The preferred way to configure a router is using JSX. The XML-like syntax is
* a great way to visualize how routes are laid out in an application.
*
* var routes = [
* <Route handler={App}>
* <Route name="login" handler={Login}/>
* <Route name="logout" handler={Logout}/>
* <Route name="about" handler={About}/>
* </Route>
* ];
*
* Router.run(routes, function (Handler) {
* React.render(<Handler/>, document.body);
* });
*
* Handlers for Route components that contain children can render their active
* child route using a <RouteHandler> element.
*
* var App = React.createClass({
* render: function () {
* return (
* <div class="application">
* <RouteHandler/>
* </div>
* );
* }
* });
*
* If no handler is provided for the route, it will render a matched child route.
*/
var Route = (function (_React$Component) {
function Route() {
_classCallCheck(this, Route);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(Route, _React$Component);
_createClass(Route, [{
key: 'render',
value: function render() {
invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name);
}
}]);
return Route;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Route.propTypes = {
name: PropTypes.string,
path: PropTypes.string,
handler: PropTypes.func,
ignoreScrollBehavior: PropTypes.bool
};
Route.defaultProps = {
handler: RouteHandler
};
module.exports = Route;

View File

@@ -0,0 +1,108 @@
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var React = require('react');
var ContextWrapper = require('./ContextWrapper');
var assign = require('react/lib/Object.assign');
var PropTypes = require('../PropTypes');
var REF_NAME = '__routeHandler__';
/**
* A <RouteHandler> component renders the active child route handler
* when routes are nested.
*/
var RouteHandler = (function (_React$Component) {
function RouteHandler() {
_classCallCheck(this, RouteHandler);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(RouteHandler, _React$Component);
_createClass(RouteHandler, [{
key: 'getChildContext',
value: function getChildContext() {
return {
routeDepth: this.context.routeDepth + 1
};
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this._updateRouteComponent(null);
}
}, {
key: '_updateRouteComponent',
value: function _updateRouteComponent(component) {
this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component);
}
}, {
key: 'getRouteDepth',
value: function getRouteDepth() {
return this.context.routeDepth;
}
}, {
key: 'createChildRouteHandler',
value: function createChildRouteHandler(props) {
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
if (route == null) {
return null;
}var childProps = assign({}, props || this.props, {
ref: REF_NAME,
params: this.context.router.getCurrentParams(),
query: this.context.router.getCurrentQuery()
});
return React.createElement(route.handler, childProps);
}
}, {
key: 'render',
value: function render() {
var handler = this.createChildRouteHandler();
// <script/> for things like <CSSTransitionGroup/> that don't like null
return handler ? React.createElement(
ContextWrapper,
null,
handler
) : React.createElement('script', null);
}
}]);
return RouteHandler;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
RouteHandler.contextTypes = {
routeDepth: PropTypes.number.isRequired,
router: PropTypes.router.isRequired
};
RouteHandler.childContextTypes = {
routeDepth: PropTypes.number.isRequired
};
module.exports = RouteHandler;