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,70 +0,0 @@
1
- {
2
- "name": "react-router",
3
- "version": "0.13.3",
4
- "description": "A complete routing library for React.js",
5
- "main": "lib",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/rackt/react-router.git"
9
- },
10
- "homepage": "https://github.com/rackt/react-router/blob/latest/README.md",
11
- "bugs": {
12
- "url": "https://github.com/rackt/react-router/issues"
13
- },
14
- "authors": [
15
- "Ryan Florence",
16
- "Michael Jackson"
17
- ],
18
- "license": "MIT",
19
- "peerDependencies": {
20
- "react": "0.13.x"
21
- },
22
- "tags": [
23
- "react",
24
- "router"
25
- ],
26
- "keywords": [
27
- "react",
28
- "react-component",
29
- "routing",
30
- "route",
31
- "routes",
32
- "router"
33
- ],
34
- "_id": "react-router@0.13.3",
35
- "scripts": {},
36
- "_shasum": "95455dd19d2c04c7b2957ff7fccda76031ac29b1",
37
- "_from": "build",
38
- "_resolved": "file:build",
39
- "_npmVersion": "2.5.1",
40
- "_nodeVersion": "0.12.0",
41
- "_npmUser": {
42
- "name": "ryanflorence",
43
- "email": "rpflorence@gmail.com"
44
- },
45
- "maintainers": [
46
- {
47
- "name": "ryanflorence",
48
- "email": "rpflorence@gmail.com"
49
- },
50
- {
51
- "name": "mjackson",
52
- "email": "mjijackson@gmail.com"
53
- }
54
- ],
55
- "dist": {
56
- "shasum": "95455dd19d2c04c7b2957ff7fccda76031ac29b1",
57
- "tarball": "http://registry.npmjs.org/react-router/-/react-router-0.13.3.tgz"
58
- },
59
- "format": "cjs",
60
- "ignore": [
61
- "node_modules"
62
- ],
63
- "registry": "npm",
64
- "dependencies": {
65
- "object-assign": "object-assign@^2.0.0",
66
- "qs": "qs@2.4.1",
67
- "react": "react@~0.13.0",
68
- "process": "github:jspm/nodelibs-process@^0.1.0"
69
- }
70
- }
@@ -1,140 +0,0 @@
1
- [![npm package](https://img.shields.io/npm/v/react-router.svg?style=flat-square)](https://www.npmjs.org/package/react-router)
2
- [![build status](https://img.shields.io/travis/rackt/react-router/master.svg?style=flat-square)](https://travis-ci.org/rackt/react-router)
3
- [![dependency status](https://img.shields.io/david/rackt/react-router.svg?style=flat-square)](https://david-dm.org/rackt/react-router)
4
- [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rackt/react-router?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5
-
6
- React Router
7
- ============
8
-
9
- A complete routing library for React.
10
-
11
- Docs
12
- ----
13
-
14
- - [Guide: Overview](/docs/guides/overview.md)
15
- - [API](/docs/api/)
16
-
17
- Important Notes
18
- ---------------
19
-
20
- ### SemVer
21
-
22
- Before our `1.0` release, breaking API changes will cause a bump to
23
- `0.x`. For example, `0.4.1` and `0.4.8` will have the same API, but
24
- `0.5.0` will have breaking changes.
25
-
26
- Please refer to the [upgrade guide](/UPGRADE_GUIDE.md) and
27
- [changelog](/CHANGELOG.md) when upgrading.
28
-
29
- Installation
30
- ------------
31
-
32
- ```sh
33
- npm install react-router
34
- # or
35
- bower install react-router
36
- ```
37
-
38
- This library is written with CommonJS modules. If you are using
39
- browserify, webpack, or similar, you can consume it like anything else
40
- installed from npm.
41
-
42
- There is also a global build available on bower, find the library on
43
- `window.ReactRouter`.
44
-
45
- The library is also available on the popular CDN [cdnjs](https://cdnjs.com/libraries/react-router).
46
-
47
- Features
48
- --------
49
-
50
- - Nested views mapped to nested routes
51
- - Modular construction of route hierarchy
52
- - Sync and async transition hooks
53
- - Transition abort / redirect / retry
54
- - Dynamic segments
55
- - Query parameters
56
- - Links with automatic `.active` class when their route is active
57
- - Multiple root routes
58
- - Hash or HTML5 history (with fallback) URLs
59
- - Declarative Redirect routes
60
- - Declarative NotFound routes
61
- - Browser scroll behavior with transitions
62
-
63
- Check out the `examples` directory to see how simple previously complex UI
64
- and workflows are to create.
65
-
66
- What's it look like?
67
- --------------------
68
-
69
- ```js
70
- var routes = (
71
- <Route handler={App} path="/">
72
- <DefaultRoute handler={Home} />
73
- <Route name="about" handler={About} />
74
- <Route name="users" handler={Users}>
75
- <Route name="recent-users" path="recent" handler={RecentUsers} />
76
- <Route name="user" path="/user/:userId" handler={User} />
77
- <NotFoundRoute handler={UserRouteNotFound}/>
78
- </Route>
79
- <NotFoundRoute handler={NotFound}/>
80
- <Redirect from="company" to="about" />
81
- </Route>
82
- );
83
-
84
- Router.run(routes, function (Handler) {
85
- React.render(<Handler/>, document.body);
86
- });
87
-
88
- // Or, if you'd like to use the HTML5 history API for cleaner URLs:
89
-
90
- Router.run(routes, Router.HistoryLocation, function (Handler) {
91
- React.render(<Handler/>, document.body);
92
- });
93
- ```
94
-
95
- See more in the [overview guide](/docs/guides/overview.md).
96
-
97
- Benefits of this Approach
98
- -------------------------
99
-
100
- 1. **Incredible screen-creation productivity** - There is only one
101
- use-case when a user visits a route: render something. Every user
102
- interface has layers (or nesting) whether it's a simple navbar or
103
- multiple levels of master-detail. Coupling nested routes to these
104
- nested views gets rid of a ton of work for the developer to wire all
105
- of it together when the user switches routes. Adding new screens
106
- could not get faster.
107
-
108
- 2. **Immediate understanding of application structure** - When routes
109
- are declared in one place, developers can easily construct a mental
110
- image of the application. It's essentially a sitemap. There's not a
111
- better way to get so much information about your app this quickly.
112
-
113
- 3. **Code tractability** - When a developer gets a ticket to fix a bug
114
- at as specific url they simply 1) look at the route config, then 2)
115
- go find the handler for that route. Every entry point into your
116
- application is represented by these routes.
117
-
118
- 4. **URLs are your first thought, not an after-thought** - With React
119
- Router, you don't get UI on the page without configuring a url first.
120
- Fortunately, it's wildly productive this way, too.
121
-
122
- Related Modules
123
- ---------------
124
-
125
- - [rnr-constrained-route](https://github.com/bjyoungblood/rnr-constrained-route) - validate paths
126
- and parameters on route handlers.
127
- - [react-router-bootstrap](https://github.com/mtscout6/react-router-bootstrap) - Integration with [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap) components.
128
- - [react-router-proxy-loader](https://github.com/odysseyscience/react-router-proxy-loader) - A Webpack loader to dynamically load react-router components on-demand
129
-
130
- Contributing
131
- ------------
132
-
133
- Please see [CONTRIBUTING](CONTRIBUTING.md)
134
-
135
- Thanks, Ember
136
- -------------
137
-
138
- This library is highly inspired by the Ember.js routing API. In general,
139
- it's a translation of the Ember router api to React. Huge thanks to the
140
- Ember team for solving the hardest part already.
@@ -1,9 +0,0 @@
1
- /**
2
- * Represents a cancellation caused by navigating away
3
- * before the previous transition has fully resolved.
4
- */
5
- "use strict";
6
-
7
- function Cancellation() {}
8
-
9
- module.exports = Cancellation;
@@ -1,31 +0,0 @@
1
- /* */
2
- 'use strict';
3
-
4
- var invariant = require('react/lib/invariant');
5
- var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
6
-
7
- var History = {
8
-
9
- /**
10
- * The current number of entries in the history.
11
- *
12
- * Note: This property is read-only.
13
- */
14
- length: 1,
15
-
16
- /**
17
- * Sends the browser back one entry in the history.
18
- */
19
- back: function back() {
20
- invariant(canUseDOM, 'Cannot use History.back without a DOM');
21
-
22
- // Do this first so that History.length will
23
- // be accurate in location change listeners.
24
- History.length -= 1;
25
-
26
- window.history.back();
27
- }
28
-
29
- };
30
-
31
- module.exports = History;
@@ -1,80 +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 PathUtils = require("./PathUtils");
28
- function deepSearch(route, pathname, query) {
29
- var childRoutes = route.childRoutes;
30
- if (childRoutes) {
31
- var match,
32
- childRoute;
33
- for (var i = 0,
34
- len = childRoutes.length; i < len; ++i) {
35
- childRoute = childRoutes[i];
36
- if (childRoute.isDefault || childRoute.isNotFound)
37
- continue;
38
- if (match = deepSearch(childRoute, pathname, query)) {
39
- match.routes.unshift(route);
40
- return match;
41
- }
42
- }
43
- }
44
- var defaultRoute = route.defaultRoute;
45
- if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) {
46
- return new Match(pathname, params, query, [route, defaultRoute]);
47
- }
48
- var notFoundRoute = route.notFoundRoute;
49
- if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) {
50
- return new Match(pathname, params, query, [route, notFoundRoute]);
51
- }
52
- var params = PathUtils.extractParams(route.path, pathname);
53
- if (params) {
54
- return new Match(pathname, params, query, [route]);
55
- }
56
- return null;
57
- }
58
- var Match = (function() {
59
- function Match(pathname, params, query, routes) {
60
- _classCallCheck(this, Match);
61
- this.pathname = pathname;
62
- this.params = params;
63
- this.query = query;
64
- this.routes = routes;
65
- }
66
- _createClass(Match, null, [{
67
- key: 'findMatch',
68
- value: function findMatch(routes, path) {
69
- var pathname = PathUtils.withoutQuery(path);
70
- var query = PathUtils.extractQuery(path);
71
- var match = null;
72
- for (var i = 0,
73
- len = routes.length; match == null && i < len; ++i)
74
- match = deepSearch(routes[i], pathname, query);
75
- return match;
76
- }
77
- }]);
78
- return Match;
79
- })();
80
- module.exports = Match;
@@ -1,22 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var PropTypes = require("./PropTypes");
4
- var Navigation = {
5
- contextTypes: {router: PropTypes.router.isRequired},
6
- makePath: function makePath(to, params, query) {
7
- return this.context.router.makePath(to, params, query);
8
- },
9
- makeHref: function makeHref(to, params, query) {
10
- return this.context.router.makeHref(to, params, query);
11
- },
12
- transitionTo: function transitionTo(to, params, query) {
13
- this.context.router.transitionTo(to, params, query);
14
- },
15
- replaceWith: function replaceWith(to, params, query) {
16
- this.context.router.replaceWith(to, params, query);
17
- },
18
- goBack: function goBack() {
19
- return this.context.router.goBack();
20
- }
21
- };
22
- module.exports = Navigation;
@@ -1,154 +0,0 @@
1
- /* */
2
- 'use strict';
3
-
4
- var invariant = require('react/lib/invariant');
5
- var assign = require('object-assign');
6
- var qs = require('qs');
7
-
8
- var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g;
9
- var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g;
10
- var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?/g;
11
- var queryMatcher = /\?(.*)$/;
12
-
13
- var _compiledPatterns = {};
14
-
15
- function compilePattern(pattern) {
16
- if (!(pattern in _compiledPatterns)) {
17
- var paramNames = [];
18
- var source = pattern.replace(paramCompileMatcher, function (match, paramName) {
19
- if (paramName) {
20
- paramNames.push(paramName);
21
- return '([^/?#]+)';
22
- } else if (match === '*') {
23
- paramNames.push('splat');
24
- return '(.*?)';
25
- } else {
26
- return '\\' + match;
27
- }
28
- });
29
-
30
- _compiledPatterns[pattern] = {
31
- matcher: new RegExp('^' + source + '$', 'i'),
32
- paramNames: paramNames
33
- };
34
- }
35
-
36
- return _compiledPatterns[pattern];
37
- }
38
-
39
- var PathUtils = {
40
-
41
- /**
42
- * Returns true if the given path is absolute.
43
- */
44
- isAbsolute: function isAbsolute(path) {
45
- return path.charAt(0) === '/';
46
- },
47
-
48
- /**
49
- * Joins two URL paths together.
50
- */
51
- join: function join(a, b) {
52
- return a.replace(/\/*$/, '/') + b;
53
- },
54
-
55
- /**
56
- * Returns an array of the names of all parameters in the given pattern.
57
- */
58
- extractParamNames: function extractParamNames(pattern) {
59
- return compilePattern(pattern).paramNames;
60
- },
61
-
62
- /**
63
- * Extracts the portions of the given URL path that match the given pattern
64
- * and returns an object of param name => value pairs. Returns null if the
65
- * pattern does not match the given path.
66
- */
67
- extractParams: function extractParams(pattern, path) {
68
- var _compilePattern = compilePattern(pattern);
69
-
70
- var matcher = _compilePattern.matcher;
71
- var paramNames = _compilePattern.paramNames;
72
-
73
- var match = path.match(matcher);
74
-
75
- if (!match) {
76
- return null;
77
- }var params = {};
78
-
79
- paramNames.forEach(function (paramName, index) {
80
- params[paramName] = match[index + 1];
81
- });
82
-
83
- return params;
84
- },
85
-
86
- /**
87
- * Returns a version of the given route path with params interpolated. Throws
88
- * if there is a dynamic segment of the route path for which there is no param.
89
- */
90
- injectParams: function injectParams(pattern, params) {
91
- params = params || {};
92
-
93
- var splatIndex = 0;
94
-
95
- return pattern.replace(paramInjectMatcher, function (match, paramName) {
96
- paramName = paramName || 'splat';
97
-
98
- // If param is optional don't check for existence
99
- if (paramName.slice(-1) === '?') {
100
- paramName = paramName.slice(0, -1);
101
-
102
- if (params[paramName] == null) return '';
103
- } else {
104
- invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern);
105
- }
106
-
107
- var segment;
108
- if (paramName === 'splat' && Array.isArray(params[paramName])) {
109
- segment = params[paramName][splatIndex++];
110
-
111
- invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern);
112
- } else {
113
- segment = params[paramName];
114
- }
115
-
116
- return segment;
117
- }).replace(paramInjectTrailingSlashMatcher, '/');
118
- },
119
-
120
- /**
121
- * Returns an object that is the result of parsing any query string contained
122
- * in the given path, null if the path contains no query string.
123
- */
124
- extractQuery: function extractQuery(path) {
125
- var match = path.match(queryMatcher);
126
- return match && qs.parse(match[1]);
127
- },
128
-
129
- /**
130
- * Returns a version of the given path without the query string.
131
- */
132
- withoutQuery: function withoutQuery(path) {
133
- return path.replace(queryMatcher, '');
134
- },
135
-
136
- /**
137
- * Returns a version of the given path with the parameters in the given
138
- * query merged into the query string.
139
- */
140
- withQuery: function withQuery(path, query) {
141
- var existingQuery = PathUtils.extractQuery(path);
142
-
143
- if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery;
144
-
145
- var queryString = qs.stringify(query, { arrayFormat: 'brackets' });
146
-
147
- if (queryString) {
148
- return PathUtils.withoutQuery(path) + '?' + queryString;
149
- }return PathUtils.withoutQuery(path);
150
- }
151
-
152
- };
153
-
154
- module.exports = PathUtils;
@@ -1,15 +0,0 @@
1
- /* */
2
- 'use strict';
3
- var assign = require("react/lib/Object.assign");
4
- var ReactPropTypes = require("react").PropTypes;
5
- var Route = require("./Route");
6
- var PropTypes = assign({}, ReactPropTypes, {
7
- falsy: function falsy(props, propName, componentName) {
8
- if (props[propName]) {
9
- return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
10
- }
11
- },
12
- route: ReactPropTypes.instanceOf(Route),
13
- router: ReactPropTypes.func
14
- });
15
- module.exports = PropTypes;
@@ -1,12 +0,0 @@
1
- /**
2
- * Encapsulates a redirect to the given route.
3
- */
4
- "use strict";
5
-
6
- function Redirect(to, params, query) {
7
- this.to = to;
8
- this.params = params;
9
- this.query = query;
10
- }
11
-
12
- module.exports = Redirect;
@@ -1,133 +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 assign = require("react/lib/Object.assign");
28
- var invariant = require("react/lib/invariant");
29
- var warning = require("react/lib/warning");
30
- var PathUtils = require("./PathUtils");
31
- var _currentRoute;
32
- var Route = (function() {
33
- function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) {
34
- _classCallCheck(this, Route);
35
- this.name = name;
36
- this.path = path;
37
- this.paramNames = PathUtils.extractParamNames(this.path);
38
- this.ignoreScrollBehavior = !!ignoreScrollBehavior;
39
- this.isDefault = !!isDefault;
40
- this.isNotFound = !!isNotFound;
41
- this.onEnter = onEnter;
42
- this.onLeave = onLeave;
43
- this.handler = handler;
44
- }
45
- _createClass(Route, [{
46
- key: 'appendChild',
47
- value: function appendChild(route) {
48
- invariant(route instanceof Route, 'route.appendChild must use a valid Route');
49
- if (!this.childRoutes)
50
- this.childRoutes = [];
51
- this.childRoutes.push(route);
52
- }
53
- }, {
54
- key: 'toString',
55
- value: function toString() {
56
- var string = '<Route';
57
- if (this.name)
58
- string += ' name="' + this.name + '"';
59
- string += ' path="' + this.path + '">';
60
- return string;
61
- }
62
- }], [{
63
- key: 'createRoute',
64
- value: function createRoute(options, callback) {
65
- options = options || {};
66
- if (typeof options === 'string')
67
- options = {path: options};
68
- var parentRoute = _currentRoute;
69
- if (parentRoute) {
70
- warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored');
71
- } else {
72
- parentRoute = options.parentRoute;
73
- }
74
- var name = options.name;
75
- var path = options.path || name;
76
- if (path && !(options.isDefault || options.isNotFound)) {
77
- if (PathUtils.isAbsolute(path)) {
78
- if (parentRoute) {
79
- invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path);
80
- }
81
- } else if (parentRoute) {
82
- path = PathUtils.join(parentRoute.path, path);
83
- } else {
84
- path = '/' + path;
85
- }
86
- } else {
87
- path = parentRoute ? parentRoute.path : '/';
88
- }
89
- if (options.isNotFound && !/\*$/.test(path))
90
- path += '*';
91
- var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler);
92
- if (parentRoute) {
93
- if (route.isDefault) {
94
- invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute);
95
- parentRoute.defaultRoute = route;
96
- } else if (route.isNotFound) {
97
- invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute);
98
- parentRoute.notFoundRoute = route;
99
- }
100
- parentRoute.appendChild(route);
101
- }
102
- if (typeof callback === 'function') {
103
- var currentRoute = _currentRoute;
104
- _currentRoute = route;
105
- callback.call(route, route);
106
- _currentRoute = currentRoute;
107
- }
108
- return route;
109
- }
110
- }, {
111
- key: 'createDefaultRoute',
112
- value: function createDefaultRoute(options) {
113
- return Route.createRoute(assign({}, options, {isDefault: true}));
114
- }
115
- }, {
116
- key: 'createNotFoundRoute',
117
- value: function createNotFoundRoute(options) {
118
- return Route.createRoute(assign({}, options, {isNotFound: true}));
119
- }
120
- }, {
121
- key: 'createRedirect',
122
- value: function createRedirect(options) {
123
- return Route.createRoute(assign({}, options, {
124
- path: options.path || options.from || '*',
125
- onEnter: function onEnter(transition, params, query) {
126
- transition.redirect(options.to, options.params || params, options.query || query);
127
- }
128
- }));
129
- }
130
- }]);
131
- return Route;
132
- })();
133
- module.exports = Route;