sequenceserver 1.1.0.beta → 1.1.0.beta2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sequenceserver might be problematic. Click here for more details.

Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -7
  3. data/README.md +9 -11
  4. data/Rakefile +2 -15
  5. data/lib/sequenceserver/database.rb +7 -1
  6. data/lib/sequenceserver/routes.rb +5 -2
  7. data/lib/sequenceserver/version.rb +1 -1
  8. data/lib/sequenceserver.rb +3 -1
  9. data/package.json +2 -3
  10. data/public/config.js +0 -7
  11. data/public/css/sequenceserver.css +8 -17
  12. data/public/css/sequenceserver.min.css +2 -2
  13. data/public/js/report.js +62 -45
  14. data/public/js/search.js +24 -17
  15. data/public/js/sequenceserver.js +23 -60
  16. data/public/sequenceserver-report.min.js +17 -0
  17. data/public/sequenceserver-search.min.js +11 -0
  18. data/sequenceserver.gemspec +5 -5
  19. data/spec/capybara_spec.rb +3 -3
  20. data/spec/sequence_spec.rb +2 -2
  21. data/views/layout.erb +1 -13
  22. data/views/report.erb +13 -0
  23. data/views/search.erb +45 -0
  24. metadata +26 -92
  25. data/public/css/sequenceserver.min.css.gz +0 -0
  26. data/public/sequenceserver.min.js +0 -26
  27. data/public/sequenceserver.min.js.gz +0 -0
  28. data/public/vendor/npm/object-assign@2.1.1/.jspm-hash +0 -1
  29. data/public/vendor/npm/object-assign@2.1.1/.jspm.json +0 -72
  30. data/public/vendor/npm/object-assign@2.1.1/index.js +0 -27
  31. data/public/vendor/npm/object-assign@2.1.1/package.json +0 -38
  32. data/public/vendor/npm/object-assign@2.1.1.js +0 -1
  33. data/public/vendor/npm/qs@2.4.1/.jshintignore +0 -1
  34. data/public/vendor/npm/qs@2.4.1/.jshintrc +0 -10
  35. data/public/vendor/npm/qs@2.4.1/.jspm-hash +0 -1
  36. data/public/vendor/npm/qs@2.4.1/.jspm.json +0 -61
  37. data/public/vendor/npm/qs@2.4.1/.npmignore +0 -18
  38. data/public/vendor/npm/qs@2.4.1/.travis.yml +0 -6
  39. data/public/vendor/npm/qs@2.4.1/CHANGELOG.md +0 -68
  40. data/public/vendor/npm/qs@2.4.1/CONTRIBUTING.md +0 -1
  41. data/public/vendor/npm/qs@2.4.1/LICENSE +0 -28
  42. data/public/vendor/npm/qs@2.4.1/Makefile +0 -8
  43. data/public/vendor/npm/qs@2.4.1/README.md +0 -233
  44. data/public/vendor/npm/qs@2.4.1/index.js +0 -2
  45. data/public/vendor/npm/qs@2.4.1/lib/index.js +0 -8
  46. data/public/vendor/npm/qs@2.4.1/lib/parse.js +0 -100
  47. data/public/vendor/npm/qs@2.4.1/lib/stringify.js +0 -67
  48. data/public/vendor/npm/qs@2.4.1/lib/utils.js +0 -132
  49. data/public/vendor/npm/qs@2.4.1/lib.js +0 -2
  50. data/public/vendor/npm/qs@2.4.1/package.json +0 -29
  51. data/public/vendor/npm/qs@2.4.1/test/parse.js +0 -359
  52. data/public/vendor/npm/qs@2.4.1.js +0 -1
  53. data/public/vendor/npm/react-router@0.13.3/.jspm-hash +0 -1
  54. data/public/vendor/npm/react-router@0.13.3/.jspm.json +0 -70
  55. data/public/vendor/npm/react-router@0.13.3/README.md +0 -140
  56. data/public/vendor/npm/react-router@0.13.3/lib/Cancellation.js +0 -9
  57. data/public/vendor/npm/react-router@0.13.3/lib/History.js +0 -31
  58. data/public/vendor/npm/react-router@0.13.3/lib/Match.js +0 -80
  59. data/public/vendor/npm/react-router@0.13.3/lib/Navigation.js +0 -22
  60. data/public/vendor/npm/react-router@0.13.3/lib/PathUtils.js +0 -154
  61. data/public/vendor/npm/react-router@0.13.3/lib/PropTypes.js +0 -15
  62. data/public/vendor/npm/react-router@0.13.3/lib/Redirect.js +0 -12
  63. data/public/vendor/npm/react-router@0.13.3/lib/Route.js +0 -133
  64. data/public/vendor/npm/react-router@0.13.3/lib/ScrollHistory.js +0 -53
  65. data/public/vendor/npm/react-router@0.13.3/lib/State.js +0 -25
  66. data/public/vendor/npm/react-router@0.13.3/lib/TestUtils.js +0 -102
  67. data/public/vendor/npm/react-router@0.13.3/lib/Transition.js +0 -58
  68. data/public/vendor/npm/react-router@0.13.3/lib/actions/LocationActions.js +0 -25
  69. data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ImitateBrowserBehavior.js +0 -19
  70. data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ScrollToTopBehavior.js +0 -15
  71. data/public/vendor/npm/react-router@0.13.3/lib/components/ActiveHandler.js +0 -111
  72. data/public/vendor/npm/react-router@0.13.3/lib/components/ContextWrapper.js +0 -39
  73. data/public/vendor/npm/react-router@0.13.3/lib/components/DefaultRoute.js +0 -41
  74. data/public/vendor/npm/react-router@0.13.3/lib/components/Link.js +0 -119
  75. data/public/vendor/npm/react-router@0.13.3/lib/components/NotFoundRoute.js +0 -41
  76. data/public/vendor/npm/react-router@0.13.3/lib/components/Redirect.js +0 -40
  77. data/public/vendor/npm/react-router@0.13.3/lib/components/Route.js +0 -67
  78. data/public/vendor/npm/react-router@0.13.3/lib/components/RouteHandler.js +0 -111
  79. data/public/vendor/npm/react-router@0.13.3/lib/createRouter.js +0 -329
  80. data/public/vendor/npm/react-router@0.13.3/lib/createRoutesFromReactChildren.js +0 -59
  81. data/public/vendor/npm/react-router@0.13.3/lib/getWindowScrollPosition.js +0 -19
  82. data/public/vendor/npm/react-router@0.13.3/lib/index.js +0 -26
  83. data/public/vendor/npm/react-router@0.13.3/lib/isReactChildren.js +0 -14
  84. data/public/vendor/npm/react-router@0.13.3/lib/locations/HashLocation.js +0 -79
  85. data/public/vendor/npm/react-router@0.13.3/lib/locations/HistoryLocation.js +0 -64
  86. data/public/vendor/npm/react-router@0.13.3/lib/locations/RefreshLocation.js +0 -18
  87. data/public/vendor/npm/react-router@0.13.3/lib/locations/StaticLocation.js +0 -50
  88. data/public/vendor/npm/react-router@0.13.3/lib/locations/TestLocation.js +0 -104
  89. data/public/vendor/npm/react-router@0.13.3/lib/runRouter.js +0 -16
  90. data/public/vendor/npm/react-router@0.13.3/lib/supportsHistory.js +0 -17
  91. data/public/vendor/npm/react-router@0.13.3/lib.js +0 -2
  92. data/public/vendor/npm/react-router@0.13.3/package.json +0 -36
  93. data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.js +0 -3388
  94. data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.min.js +0 -8
@@ -1,40 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var _classCallCheck = function(instance, Constructor) {
4
- if (!(instance instanceof Constructor)) {
5
- throw new TypeError('Cannot call a class as a function');
6
- }
7
- };
8
- var _inherits = function(subClass, superClass) {
9
- if (typeof superClass !== 'function' && superClass !== null) {
10
- throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
11
- }
12
- subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
13
- value: subClass,
14
- enumerable: false,
15
- writable: true,
16
- configurable: true
17
- }});
18
- if (superClass)
19
- subClass.__proto__ = superClass;
20
- };
21
- var PropTypes = require("../PropTypes");
22
- var Route = require("./Route");
23
- var Redirect = (function(_Route) {
24
- function Redirect() {
25
- _classCallCheck(this, Redirect);
26
- if (_Route != null) {
27
- _Route.apply(this, arguments);
28
- }
29
- }
30
- _inherits(Redirect, _Route);
31
- return Redirect;
32
- })(Route);
33
- Redirect.propTypes = {
34
- path: PropTypes.string,
35
- from: PropTypes.string,
36
- to: PropTypes.string,
37
- handler: PropTypes.falsy
38
- };
39
- Redirect.defaultProps = {};
40
- module.exports = Redirect;
@@ -1,67 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var _classCallCheck = function(instance, Constructor) {
4
- if (!(instance instanceof Constructor)) {
5
- throw new TypeError('Cannot call a class as a function');
6
- }
7
- };
8
- var _createClass = (function() {
9
- function defineProperties(target, props) {
10
- for (var i = 0; i < props.length; i++) {
11
- var descriptor = props[i];
12
- descriptor.enumerable = descriptor.enumerable || false;
13
- descriptor.configurable = true;
14
- if ('value' in descriptor)
15
- descriptor.writable = true;
16
- Object.defineProperty(target, descriptor.key, descriptor);
17
- }
18
- }
19
- return function(Constructor, protoProps, staticProps) {
20
- if (protoProps)
21
- defineProperties(Constructor.prototype, protoProps);
22
- if (staticProps)
23
- defineProperties(Constructor, staticProps);
24
- return Constructor;
25
- };
26
- })();
27
- var _inherits = function(subClass, superClass) {
28
- if (typeof superClass !== 'function' && superClass !== null) {
29
- throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
30
- }
31
- subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
32
- value: subClass,
33
- enumerable: false,
34
- writable: true,
35
- configurable: true
36
- }});
37
- if (superClass)
38
- subClass.__proto__ = superClass;
39
- };
40
- var React = require("react");
41
- var invariant = require("react/lib/invariant");
42
- var PropTypes = require("../PropTypes");
43
- var RouteHandler = require("./RouteHandler");
44
- var Route = (function(_React$Component) {
45
- function Route() {
46
- _classCallCheck(this, Route);
47
- if (_React$Component != null) {
48
- _React$Component.apply(this, arguments);
49
- }
50
- }
51
- _inherits(Route, _React$Component);
52
- _createClass(Route, [{
53
- key: 'render',
54
- value: function render() {
55
- invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name);
56
- }
57
- }]);
58
- return Route;
59
- })(React.Component);
60
- Route.propTypes = {
61
- name: PropTypes.string,
62
- path: PropTypes.string,
63
- handler: PropTypes.func,
64
- ignoreScrollBehavior: PropTypes.bool
65
- };
66
- Route.defaultProps = {handler: RouteHandler};
67
- module.exports = Route;
@@ -1,111 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var _classCallCheck = function(instance, Constructor) {
4
- if (!(instance instanceof Constructor)) {
5
- throw new TypeError('Cannot call a class as a function');
6
- }
7
- };
8
- var _createClass = (function() {
9
- function defineProperties(target, props) {
10
- for (var i = 0; i < props.length; i++) {
11
- var descriptor = props[i];
12
- descriptor.enumerable = descriptor.enumerable || false;
13
- descriptor.configurable = true;
14
- if ('value' in descriptor)
15
- descriptor.writable = true;
16
- Object.defineProperty(target, descriptor.key, descriptor);
17
- }
18
- }
19
- return function(Constructor, protoProps, staticProps) {
20
- if (protoProps)
21
- defineProperties(Constructor.prototype, protoProps);
22
- if (staticProps)
23
- defineProperties(Constructor, staticProps);
24
- return Constructor;
25
- };
26
- })();
27
- var _inherits = function(subClass, superClass) {
28
- if (typeof superClass !== 'function' && superClass !== null) {
29
- throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
30
- }
31
- subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
32
- value: subClass,
33
- enumerable: false,
34
- writable: true,
35
- configurable: true
36
- }});
37
- if (superClass)
38
- subClass.__proto__ = superClass;
39
- };
40
- var React = require("react");
41
- var ContextWrapper = require("./ContextWrapper");
42
- var assign = require("react/lib/Object.assign");
43
- var PropTypes = require("../PropTypes");
44
- var REF_NAME = '__routeHandler__';
45
- var RouteHandler = (function(_React$Component) {
46
- function RouteHandler() {
47
- _classCallCheck(this, RouteHandler);
48
- if (_React$Component != null) {
49
- _React$Component.apply(this, arguments);
50
- }
51
- }
52
- _inherits(RouteHandler, _React$Component);
53
- _createClass(RouteHandler, [{
54
- key: 'getChildContext',
55
- value: function getChildContext() {
56
- return {routeDepth: this.context.routeDepth + 1};
57
- }
58
- }, {
59
- key: 'componentDidMount',
60
- value: function componentDidMount() {
61
- this._updateRouteComponent(this.refs[REF_NAME]);
62
- }
63
- }, {
64
- key: 'componentDidUpdate',
65
- value: function componentDidUpdate() {
66
- this._updateRouteComponent(this.refs[REF_NAME]);
67
- }
68
- }, {
69
- key: 'componentWillUnmount',
70
- value: function componentWillUnmount() {
71
- this._updateRouteComponent(null);
72
- }
73
- }, {
74
- key: '_updateRouteComponent',
75
- value: function _updateRouteComponent(component) {
76
- this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component);
77
- }
78
- }, {
79
- key: 'getRouteDepth',
80
- value: function getRouteDepth() {
81
- return this.context.routeDepth;
82
- }
83
- }, {
84
- key: 'createChildRouteHandler',
85
- value: function createChildRouteHandler(props) {
86
- var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
87
- if (route == null) {
88
- return null;
89
- }
90
- var childProps = assign({}, props || this.props, {
91
- ref: REF_NAME,
92
- params: this.context.router.getCurrentParams(),
93
- query: this.context.router.getCurrentQuery()
94
- });
95
- return React.createElement(route.handler, childProps);
96
- }
97
- }, {
98
- key: 'render',
99
- value: function render() {
100
- var handler = this.createChildRouteHandler();
101
- return handler ? React.createElement(ContextWrapper, null, handler) : React.createElement('script', null);
102
- }
103
- }]);
104
- return RouteHandler;
105
- })(React.Component);
106
- RouteHandler.contextTypes = {
107
- routeDepth: PropTypes.number.isRequired,
108
- router: PropTypes.router.isRequired
109
- };
110
- RouteHandler.childContextTypes = {routeDepth: PropTypes.number.isRequired};
111
- module.exports = RouteHandler;
@@ -1,329 +0,0 @@
1
- /* */
2
- (function(process) {
3
- 'use strict';
4
- var React = require("react");
5
- var warning = require("react/lib/warning");
6
- var invariant = require("react/lib/invariant");
7
- var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM;
8
- var LocationActions = require("./actions/LocationActions");
9
- var ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior");
10
- var HashLocation = require("./locations/HashLocation");
11
- var HistoryLocation = require("./locations/HistoryLocation");
12
- var RefreshLocation = require("./locations/RefreshLocation");
13
- var StaticLocation = require("./locations/StaticLocation");
14
- var ScrollHistory = require("./ScrollHistory");
15
- var createRoutesFromReactChildren = require("./createRoutesFromReactChildren");
16
- var isReactChildren = require("./isReactChildren");
17
- var Transition = require("./Transition");
18
- var PropTypes = require("./PropTypes");
19
- var Redirect = require("./Redirect");
20
- var History = require("./History");
21
- var Cancellation = require("./Cancellation");
22
- var Match = require("./Match");
23
- var Route = require("./Route");
24
- var supportsHistory = require("./supportsHistory");
25
- var PathUtils = require("./PathUtils");
26
- var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/';
27
- var DEFAULT_SCROLL_BEHAVIOR = canUseDOM ? ImitateBrowserBehavior : null;
28
- function hasProperties(object, properties) {
29
- for (var propertyName in properties)
30
- if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName]) {
31
- return false;
32
- }
33
- return true;
34
- }
35
- function hasMatch(routes, route, prevParams, nextParams, prevQuery, nextQuery) {
36
- return routes.some(function(r) {
37
- if (r !== route)
38
- return false;
39
- var paramNames = route.paramNames;
40
- var paramName;
41
- for (var i = 0,
42
- len = paramNames.length; i < len; ++i) {
43
- paramName = paramNames[i];
44
- if (nextParams[paramName] !== prevParams[paramName])
45
- return false;
46
- }
47
- return hasProperties(prevQuery, nextQuery) && hasProperties(nextQuery, prevQuery);
48
- });
49
- }
50
- function addRoutesToNamedRoutes(routes, namedRoutes) {
51
- var route;
52
- for (var i = 0,
53
- len = routes.length; i < len; ++i) {
54
- route = routes[i];
55
- if (route.name) {
56
- invariant(namedRoutes[route.name] == null, 'You may not have more than one route named "%s"', route.name);
57
- namedRoutes[route.name] = route;
58
- }
59
- if (route.childRoutes)
60
- addRoutesToNamedRoutes(route.childRoutes, namedRoutes);
61
- }
62
- }
63
- function routeIsActive(activeRoutes, routeName) {
64
- return activeRoutes.some(function(route) {
65
- return route.name === routeName;
66
- });
67
- }
68
- function paramsAreActive(activeParams, params) {
69
- for (var property in params)
70
- if (String(activeParams[property]) !== String(params[property])) {
71
- return false;
72
- }
73
- return true;
74
- }
75
- function queryIsActive(activeQuery, query) {
76
- for (var property in query)
77
- if (String(activeQuery[property]) !== String(query[property])) {
78
- return false;
79
- }
80
- return true;
81
- }
82
- function createRouter(options) {
83
- options = options || {};
84
- if (isReactChildren(options))
85
- options = {routes: options};
86
- var mountedComponents = [];
87
- var location = options.location || DEFAULT_LOCATION;
88
- var scrollBehavior = options.scrollBehavior || DEFAULT_SCROLL_BEHAVIOR;
89
- var state = {};
90
- var nextState = {};
91
- var pendingTransition = null;
92
- var dispatchHandler = null;
93
- if (typeof location === 'string')
94
- location = new StaticLocation(location);
95
- if (location instanceof StaticLocation) {
96
- warning(!canUseDOM || process.env.NODE_ENV === 'test', 'You should not use a static location in a DOM environment because ' + 'the router will not be kept in sync with the current URL');
97
- } else {
98
- invariant(canUseDOM || location.needsDOM === false, 'You cannot use %s without a DOM', location);
99
- }
100
- if (location === HistoryLocation && !supportsHistory())
101
- location = RefreshLocation;
102
- var Router = React.createClass({
103
- displayName: 'Router',
104
- statics: {
105
- isRunning: false,
106
- cancelPendingTransition: function cancelPendingTransition() {
107
- if (pendingTransition) {
108
- pendingTransition.cancel();
109
- pendingTransition = null;
110
- }
111
- },
112
- clearAllRoutes: function clearAllRoutes() {
113
- Router.cancelPendingTransition();
114
- Router.namedRoutes = {};
115
- Router.routes = [];
116
- },
117
- addRoutes: function addRoutes(routes) {
118
- if (isReactChildren(routes))
119
- routes = createRoutesFromReactChildren(routes);
120
- addRoutesToNamedRoutes(routes, Router.namedRoutes);
121
- Router.routes.push.apply(Router.routes, routes);
122
- },
123
- replaceRoutes: function replaceRoutes(routes) {
124
- Router.clearAllRoutes();
125
- Router.addRoutes(routes);
126
- Router.refresh();
127
- },
128
- match: function match(path) {
129
- return Match.findMatch(Router.routes, path);
130
- },
131
- makePath: function makePath(to, params, query) {
132
- var path;
133
- if (PathUtils.isAbsolute(to)) {
134
- path = to;
135
- } else {
136
- var route = to instanceof Route ? to : Router.namedRoutes[to];
137
- invariant(route instanceof Route, 'Cannot find a route named "%s"', to);
138
- path = route.path;
139
- }
140
- return PathUtils.withQuery(PathUtils.injectParams(path, params), query);
141
- },
142
- makeHref: function makeHref(to, params, query) {
143
- var path = Router.makePath(to, params, query);
144
- return location === HashLocation ? '#' + path : path;
145
- },
146
- transitionTo: function transitionTo(to, params, query) {
147
- var path = Router.makePath(to, params, query);
148
- if (pendingTransition) {
149
- location.replace(path);
150
- } else {
151
- location.push(path);
152
- }
153
- },
154
- replaceWith: function replaceWith(to, params, query) {
155
- location.replace(Router.makePath(to, params, query));
156
- },
157
- goBack: function goBack() {
158
- if (History.length > 1 || location === RefreshLocation) {
159
- location.pop();
160
- return true;
161
- }
162
- warning(false, 'goBack() was ignored because there is no router history');
163
- return false;
164
- },
165
- handleAbort: options.onAbort || function(abortReason) {
166
- if (location instanceof StaticLocation)
167
- throw new Error('Unhandled aborted transition! Reason: ' + abortReason);
168
- if (abortReason instanceof Cancellation) {
169
- return;
170
- } else if (abortReason instanceof Redirect) {
171
- location.replace(Router.makePath(abortReason.to, abortReason.params, abortReason.query));
172
- } else {
173
- location.pop();
174
- }
175
- },
176
- handleError: options.onError || function(error) {
177
- throw error;
178
- },
179
- handleLocationChange: function handleLocationChange(change) {
180
- Router.dispatch(change.path, change.type);
181
- },
182
- dispatch: function dispatch(path, action) {
183
- Router.cancelPendingTransition();
184
- var prevPath = state.path;
185
- var isRefreshing = action == null;
186
- if (prevPath === path && !isRefreshing) {
187
- return;
188
- }
189
- if (prevPath && action === LocationActions.PUSH)
190
- Router.recordScrollPosition(prevPath);
191
- var match = Router.match(path);
192
- warning(match != null, 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', path, path);
193
- if (match == null)
194
- match = {};
195
- var prevRoutes = state.routes || [];
196
- var prevParams = state.params || {};
197
- var prevQuery = state.query || {};
198
- var nextRoutes = match.routes || [];
199
- var nextParams = match.params || {};
200
- var nextQuery = match.query || {};
201
- var fromRoutes,
202
- toRoutes;
203
- if (prevRoutes.length) {
204
- fromRoutes = prevRoutes.filter(function(route) {
205
- return !hasMatch(nextRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
206
- });
207
- toRoutes = nextRoutes.filter(function(route) {
208
- return !hasMatch(prevRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
209
- });
210
- } else {
211
- fromRoutes = [];
212
- toRoutes = nextRoutes;
213
- }
214
- var transition = new Transition(path, Router.replaceWith.bind(Router, path));
215
- pendingTransition = transition;
216
- var fromComponents = mountedComponents.slice(prevRoutes.length - fromRoutes.length);
217
- Transition.from(transition, fromRoutes, fromComponents, function(error) {
218
- if (error || transition.abortReason)
219
- return dispatchHandler.call(Router, error, transition);
220
- Transition.to(transition, toRoutes, nextParams, nextQuery, function(error) {
221
- dispatchHandler.call(Router, error, transition, {
222
- path: path,
223
- action: action,
224
- pathname: match.pathname,
225
- routes: nextRoutes,
226
- params: nextParams,
227
- query: nextQuery
228
- });
229
- });
230
- });
231
- },
232
- run: function run(callback) {
233
- invariant(!Router.isRunning, 'Router is already running');
234
- dispatchHandler = function(error, transition, newState) {
235
- if (error)
236
- Router.handleError(error);
237
- if (pendingTransition !== transition)
238
- return;
239
- pendingTransition = null;
240
- if (transition.abortReason) {
241
- Router.handleAbort(transition.abortReason);
242
- } else {
243
- callback.call(Router, Router, nextState = newState);
244
- }
245
- };
246
- if (!(location instanceof StaticLocation)) {
247
- if (location.addChangeListener)
248
- location.addChangeListener(Router.handleLocationChange);
249
- Router.isRunning = true;
250
- }
251
- Router.refresh();
252
- },
253
- refresh: function refresh() {
254
- Router.dispatch(location.getCurrentPath(), null);
255
- },
256
- stop: function stop() {
257
- Router.cancelPendingTransition();
258
- if (location.removeChangeListener)
259
- location.removeChangeListener(Router.handleLocationChange);
260
- Router.isRunning = false;
261
- },
262
- getLocation: function getLocation() {
263
- return location;
264
- },
265
- getScrollBehavior: function getScrollBehavior() {
266
- return scrollBehavior;
267
- },
268
- getRouteAtDepth: function getRouteAtDepth(routeDepth) {
269
- var routes = state.routes;
270
- return routes && routes[routeDepth];
271
- },
272
- setRouteComponentAtDepth: function setRouteComponentAtDepth(routeDepth, component) {
273
- mountedComponents[routeDepth] = component;
274
- },
275
- getCurrentPath: function getCurrentPath() {
276
- return state.path;
277
- },
278
- getCurrentPathname: function getCurrentPathname() {
279
- return state.pathname;
280
- },
281
- getCurrentParams: function getCurrentParams() {
282
- return state.params;
283
- },
284
- getCurrentQuery: function getCurrentQuery() {
285
- return state.query;
286
- },
287
- getCurrentRoutes: function getCurrentRoutes() {
288
- return state.routes;
289
- },
290
- isActive: function isActive(to, params, query) {
291
- if (PathUtils.isAbsolute(to)) {
292
- return to === state.path;
293
- }
294
- return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
295
- }
296
- },
297
- mixins: [ScrollHistory],
298
- propTypes: {children: PropTypes.falsy},
299
- childContextTypes: {
300
- routeDepth: PropTypes.number.isRequired,
301
- router: PropTypes.router.isRequired
302
- },
303
- getChildContext: function getChildContext() {
304
- return {
305
- routeDepth: 1,
306
- router: Router
307
- };
308
- },
309
- getInitialState: function getInitialState() {
310
- return state = nextState;
311
- },
312
- componentWillReceiveProps: function componentWillReceiveProps() {
313
- this.setState(state = nextState);
314
- },
315
- componentWillUnmount: function componentWillUnmount() {
316
- Router.stop();
317
- },
318
- render: function render() {
319
- var route = Router.getRouteAtDepth(0);
320
- return route ? React.createElement(route.handler, this.props) : null;
321
- }
322
- });
323
- Router.clearAllRoutes();
324
- if (options.routes)
325
- Router.addRoutes(options.routes);
326
- return Router;
327
- }
328
- module.exports = createRouter;
329
- })(require("process"));
@@ -1,59 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var React = require("react");
4
- var assign = require("react/lib/Object.assign");
5
- var warning = require("react/lib/warning");
6
- var DefaultRoute = require("./components/DefaultRoute");
7
- var NotFoundRoute = require("./components/NotFoundRoute");
8
- var Redirect = require("./components/Redirect");
9
- var Route = require("./Route");
10
- function checkPropTypes(componentName, propTypes, props) {
11
- componentName = componentName || 'UnknownComponent';
12
- for (var propName in propTypes) {
13
- if (propTypes.hasOwnProperty(propName)) {
14
- var error = propTypes[propName](props, propName, componentName);
15
- if (error instanceof Error)
16
- warning(false, error.message);
17
- }
18
- }
19
- }
20
- function createRouteOptions(props) {
21
- var options = assign({}, props);
22
- var handler = options.handler;
23
- if (handler) {
24
- options.onEnter = handler.willTransitionTo;
25
- options.onLeave = handler.willTransitionFrom;
26
- }
27
- return options;
28
- }
29
- function createRouteFromReactElement(element) {
30
- if (!React.isValidElement(element)) {
31
- return;
32
- }
33
- var type = element.type;
34
- var props = assign({}, type.defaultProps, element.props);
35
- if (type.propTypes)
36
- checkPropTypes(type.displayName, type.propTypes, props);
37
- if (type === DefaultRoute) {
38
- return Route.createDefaultRoute(createRouteOptions(props));
39
- }
40
- if (type === NotFoundRoute) {
41
- return Route.createNotFoundRoute(createRouteOptions(props));
42
- }
43
- if (type === Redirect) {
44
- return Route.createRedirect(createRouteOptions(props));
45
- }
46
- return Route.createRoute(createRouteOptions(props), function() {
47
- if (props.children)
48
- createRoutesFromReactChildren(props.children);
49
- });
50
- }
51
- function createRoutesFromReactChildren(children) {
52
- var routes = [];
53
- React.Children.forEach(children, function(child) {
54
- if (child = createRouteFromReactElement(child))
55
- routes.push(child);
56
- });
57
- return routes;
58
- }
59
- module.exports = createRoutesFromReactChildren;
@@ -1,19 +0,0 @@
1
- /* */
2
- 'use strict';
3
-
4
- var invariant = require('react/lib/invariant');
5
- var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
6
-
7
- /**
8
- * Returns the current scroll position of the window as { x, y }.
9
- */
10
- function getWindowScrollPosition() {
11
- invariant(canUseDOM, 'Cannot get current scroll position without a DOM');
12
-
13
- return {
14
- x: window.pageXOffset || document.documentElement.scrollLeft,
15
- y: window.pageYOffset || document.documentElement.scrollTop
16
- };
17
- }
18
-
19
- module.exports = getWindowScrollPosition;
@@ -1,26 +0,0 @@
1
- /* */
2
- 'use strict';
3
- exports.DefaultRoute = require("./components/DefaultRoute");
4
- exports.Link = require("./components/Link");
5
- exports.NotFoundRoute = require("./components/NotFoundRoute");
6
- exports.Redirect = require("./components/Redirect");
7
- exports.Route = require("./components/Route");
8
- exports.ActiveHandler = require("./components/RouteHandler");
9
- exports.RouteHandler = exports.ActiveHandler;
10
- exports.HashLocation = require("./locations/HashLocation");
11
- exports.HistoryLocation = require("./locations/HistoryLocation");
12
- exports.RefreshLocation = require("./locations/RefreshLocation");
13
- exports.StaticLocation = require("./locations/StaticLocation");
14
- exports.TestLocation = require("./locations/TestLocation");
15
- exports.ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior");
16
- exports.ScrollToTopBehavior = require("./behaviors/ScrollToTopBehavior");
17
- exports.History = require("./History");
18
- exports.Navigation = require("./Navigation");
19
- exports.State = require("./State");
20
- exports.createRoute = require("./Route").createRoute;
21
- exports.createDefaultRoute = require("./Route").createDefaultRoute;
22
- exports.createNotFoundRoute = require("./Route").createNotFoundRoute;
23
- exports.createRedirect = require("./Route").createRedirect;
24
- exports.createRoutesFromReactChildren = require("./createRoutesFromReactChildren");
25
- exports.create = require("./createRouter");
26
- exports.run = require("./runRouter");
@@ -1,14 +0,0 @@
1
- /* */
2
- 'use strict';
3
-
4
- var React = require('react');
5
-
6
- function isValidChild(object) {
7
- return object == null || React.isValidElement(object);
8
- }
9
-
10
- function isReactChildren(object) {
11
- return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
12
- }
13
-
14
- module.exports = isReactChildren;