@vve/react-router 9.0.0-alpha.3 → 9.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/deactivatable-wrapper.js +10 -39
- package/lib/deactivatable-wrapper.js.map +1 -0
- package/lib/garden.js +47 -84
- package/lib/garden.js.map +1 -0
- package/lib/generate-path.js +3 -7
- package/lib/generate-path.js.map +1 -0
- package/lib/index.js +12 -10
- package/lib/index.js.map +1 -0
- package/lib/lifecycle.js +15 -47
- package/lib/lifecycle.js.map +1 -0
- package/lib/link.js +45 -82
- package/lib/link.js.map +1 -0
- package/lib/match-path.js +24 -32
- package/lib/match-path.js.map +1 -0
- package/lib/nav-link.js +25 -35
- package/lib/nav-link.js.map +1 -0
- package/lib/prompt.js +11 -12
- package/lib/prompt.js.map +1 -0
- package/lib/redirect.js +17 -24
- package/lib/redirect.js.map +1 -0
- package/lib/route.js +62 -104
- package/lib/route.js.map +1 -0
- package/lib/router-context.js +2 -1
- package/lib/router-context.js.map +1 -0
- package/lib/router.js +54 -91
- package/lib/router.js.map +1 -0
- package/lib/switch.js +66 -104
- package/lib/switch.js.map +1 -0
- package/lib/with-router.js +10 -12
- package/lib/with-router.js.map +1 -0
- package/package.json +4 -3
package/lib/nav-link.js
CHANGED
|
@@ -1,56 +1,46 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
4
|
+
var _excluded = ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "strict", "style", "to"];
|
|
10
5
|
import React from 'react';
|
|
11
|
-
import Link from
|
|
12
|
-
import Route from
|
|
13
|
-
|
|
6
|
+
import Link from "./link";
|
|
7
|
+
import Route from "./route";
|
|
14
8
|
function joinClassnames() {
|
|
15
9
|
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
10
|
classnames[_key] = arguments[_key];
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
return classnames.filter(function (i) {
|
|
20
|
-
return i;
|
|
21
|
-
}).join(' ');
|
|
12
|
+
return classnames.filter(i => i).join(' ');
|
|
22
13
|
}
|
|
14
|
+
|
|
23
15
|
/**
|
|
24
16
|
* A <Link> wrapper that knows if it's "active" or not.
|
|
25
17
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
18
|
function NavLink(_ref) {
|
|
29
19
|
var _ref$ariaCurrent = _ref['aria-current'],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
20
|
+
ariaCurrent = _ref$ariaCurrent === void 0 ? 'page' : _ref$ariaCurrent,
|
|
21
|
+
_ref$activeClassName = _ref.activeClassName,
|
|
22
|
+
activeClassName = _ref$activeClassName === void 0 ? 'active' : _ref$activeClassName,
|
|
23
|
+
activeStyle = _ref.activeStyle,
|
|
24
|
+
classNameProp = _ref.className,
|
|
25
|
+
exact = _ref.exact,
|
|
26
|
+
isActiveProp = _ref.isActive,
|
|
27
|
+
location = _ref.location,
|
|
28
|
+
strict = _ref.strict,
|
|
29
|
+
styleProp = _ref.style,
|
|
30
|
+
to = _ref.to,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var path = typeof to === 'object' ? to.pathname : to;
|
|
33
|
+
|
|
34
|
+
// Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
45
35
|
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
|
46
36
|
return /*#__PURE__*/React.createElement(Route, {
|
|
47
37
|
path: escapedPath,
|
|
48
38
|
exact: exact,
|
|
49
39
|
strict: strict,
|
|
50
40
|
location: location
|
|
51
|
-
},
|
|
41
|
+
}, _ref2 => {
|
|
52
42
|
var location = _ref2.location,
|
|
53
|
-
|
|
43
|
+
match = _ref2.match;
|
|
54
44
|
var isActive = !!(isActiveProp ? isActiveProp(match, location) : match);
|
|
55
45
|
var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
|
|
56
46
|
var style = isActive ? _objectSpread(_objectSpread({}, styleProp), activeStyle) : styleProp;
|
|
@@ -62,5 +52,5 @@ function NavLink(_ref) {
|
|
|
62
52
|
}, rest));
|
|
63
53
|
});
|
|
64
54
|
}
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
export default NavLink;
|
|
56
|
+
//# sourceMappingURL=nav-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-link.js","names":["React","Link","Route","joinClassnames","_len","arguments","length","classnames","Array","_key","filter","i","join","NavLink","_ref","_ref$ariaCurrent","ariaCurrent","_ref$activeClassName","activeClassName","activeStyle","classNameProp","className","exact","isActiveProp","isActive","location","strict","styleProp","style","to","rest","_objectWithoutProperties","_excluded","path","pathname","escapedPath","replace","createElement","_ref2","match","_objectSpread","_extends"],"sources":["../nav-link.js"],"sourcesContent":["import React from 'react';\n\nimport Link from './link';\nimport Route from './route';\n\nfunction joinClassnames(...classnames) {\n return classnames.filter(i => i).join(' ');\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nfunction NavLink({\n 'aria-current': ariaCurrent = 'page',\n activeClassName = 'active',\n activeStyle,\n className: classNameProp,\n exact,\n isActive: isActiveProp,\n location,\n strict,\n style: styleProp,\n to,\n ...rest\n}) {\n const path = typeof to === 'object' ? to.pathname : to;\n\n // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202\n const escapedPath = path && path.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, '\\\\$1');\n\n return (\n <Route\n path={escapedPath}\n exact={exact}\n strict={strict}\n location={location}\n >\n {({ location, match }) => {\n const isActive = !!(isActiveProp\n ? isActiveProp(match, location)\n : match);\n\n const className = isActive\n ? joinClassnames(classNameProp, activeClassName)\n : classNameProp;\n const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;\n\n return (\n <Link\n aria-current={(isActive && ariaCurrent) || null}\n className={className}\n style={style}\n to={to}\n {...rest}\n />\n );\n }}\n </Route>\n );\n}\n\nexport default NavLink;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,IAAI;AACX,OAAOC,KAAK;AAEZ,SAASC,cAAcA,CAAA,EAAgB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAZC,UAAU,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAVF,UAAU,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACnC,OAAOF,UAAU,CAACG,MAAM,CAACC,CAAC,IAAIA,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG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AAQ,GACtBrB,cAAc,CAACiB,aAAa,EAAEF,eAAe,CAAC,GAC9CE,aAAa;IACjB,IAAMQ,KAAK,GAAGJ,QAAQ,GAAAgB,aAAA,CAAAA,aAAA,KAAQb,SAAS,GAAKR,WAAW,IAAKQ,SAAS;IAErE,oBACE3B,KAAA,CAAAqC,aAAA,CAACpC,IAAI,EAAAwC,QAAA;MACH,gBAAejB,QAAQ,IAAIR,WAAW,IAAK,IAAK;MAChDK,SAAS,EAAEA,SAAU;MACrBO,KAAK,EAAEA,KAAM;MACbC,EAAE,EAAEA;IAAG,GACHC,IAAI,EACR;EAEN,CAAC,CACK;AAEZ;AAEA,eAAejB,OAAO"}
|
package/lib/prompt.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
|
-
import Lifecycle from
|
|
5
|
-
import RouterContext from
|
|
4
|
+
import Lifecycle from "./lifecycle";
|
|
5
|
+
import RouterContext from "./router-context";
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* The public API for prompting the user before navigating away from a screen.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
function Prompt(_ref) {
|
|
11
11
|
var message = _ref.message,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null,
|
|
12
|
+
_ref$when = _ref.when,
|
|
13
|
+
when = _ref$when === void 0 ? true : _ref$when;
|
|
14
|
+
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null, context => {
|
|
15
15
|
invariant(context, 'You should not use <Prompt> outside a <Router>');
|
|
16
16
|
if (!when || context.staticContext) return null;
|
|
17
17
|
var method = context.history.block;
|
|
18
18
|
return /*#__PURE__*/React.createElement(Lifecycle, {
|
|
19
|
-
onMount:
|
|
19
|
+
onMount: self => {
|
|
20
20
|
self.release = method(message);
|
|
21
21
|
},
|
|
22
|
-
onUpdate:
|
|
22
|
+
onUpdate: (self, prevProps) => {
|
|
23
23
|
if (prevProps.message !== message) {
|
|
24
24
|
self.release();
|
|
25
25
|
self.release = method(message);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
onUnmount:
|
|
28
|
+
onUnmount: self => {
|
|
29
29
|
self.release();
|
|
30
30
|
},
|
|
31
31
|
message: message
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
37
36
|
var messageType = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);
|
|
38
37
|
Prompt.propTypes = {
|
|
@@ -40,5 +39,5 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
40
39
|
message: messageType.isRequired
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
export default Prompt;
|
|
43
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","names":["React","PropTypes","invariant","Lifecycle","RouterContext","Prompt","_ref","message","_ref$when","when","createElement","Consumer","context","staticContext","method","history","block","onMount","self","release","onUpdate","prevProps","onUnmount","process","env","NODE_ENV","messageType","oneOfType","func","string","propTypes","bool","isRequired"],"sources":["../prompt.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport invariant from 'tiny-invariant';\n\nimport Lifecycle from './lifecycle';\nimport RouterContext from './router-context';\n\n/**\n * The public API for prompting the user before navigating away from a screen.\n */\nfunction Prompt({ message, when = true }) {\n return (\n <RouterContext.Consumer>\n {(context) => {\n invariant(context, 'You should not use <Prompt> outside a <Router>');\n\n if (!when || context.staticContext) return null;\n\n const method = context.history.block;\n\n return (\n <Lifecycle\n onMount={(self) => {\n self.release = method(message);\n }}\n onUpdate={(self, prevProps) => {\n if (prevProps.message !== message) {\n self.release();\n self.release = method(message);\n }\n }}\n onUnmount={(self) => {\n self.release();\n }}\n message={message}\n />\n );\n }}\n </RouterContext.Consumer>\n );\n}\n\nif (process.env.NODE_ENV !== 'production') {\n const messageType = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);\n\n Prompt.propTypes = {\n when: PropTypes.bool,\n message: messageType.isRequired\n };\n}\n\nexport default Prompt;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,OAAOC,SAAS;AAChB,OAAOC,aAAa;;AAEpB;AACA;AACA;AACA,SAASC,MAAMA,CAAAC,IAAA,EAA2B;EAAA,IAAxBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAAC,SAAA,GAAAF,IAAA,CAAEG,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,IAAI,GAAAA,SAAA;EACpC,oBACER,KAAA,CAAAU,aAAA,CAACN,aAAa,CAACO,QAAQ,QACnBC,OAAO,IAAK;IACZV,SAAS,CAACU,OAAO,EAAE,gDAAgD,CAAC;IAEpE,IAAI,CAACH,IAAI,IAAIG,OAAO,CAACC,aAAa,EAAE,OAAO,IAAI;IAE/C,IAAMC,MAAM,GAAGF,OAAO,CAACG,OAAO,CAACC,KAAK;IAEpC,oBACEhB,KAAA,CAAAU,aAAA,CAACP,SAAS;MACRc,OAAO,EAAGC,IAAI,IAAK;QACjBA,IAAI,CAACC,OAAO,GAAGL,MAAM,CAACP,OAAO,CAAC;MAChC,CAAE;MACFa,QAAQ,EAAEA,CAACF,IAAI,EAAEG,SAAS,KAAK;QAC7B,IAAIA,SAAS,CAACd,OAAO,KAAKA,OAAO,EAAE;UACjCW,IAAI,CAACC,OAAO,EAAE;UACdD,IAAI,CAACC,OAAO,GAAGL,MAAM,CAACP,OAAO,CAAC;QAChC;MACF,CAAE;MACFe,SAAS,EAAGJ,IAAI,IAAK;QACnBA,IAAI,CAACC,OAAO,EAAE;MAChB,CAAE;MACFZ,OAAO,EAAEA;IAAQ,EACjB;EAEN,CAAC,CACsB;AAE7B;AAEA,IAAIgB,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzC,IAAMC,WAAW,GAAGzB,SAAS,CAAC0B,SAAS,CAAC,CAAC1B,SAAS,CAAC2B,IAAI,EAAE3B,SAAS,CAAC4B,MAAM,CAAC,CAAC;EAE3ExB,MAAM,CAACyB,SAAS,GAAG;IACjBrB,IAAI,EAAER,SAAS,CAAC8B,IAAI;IACpBxB,OAAO,EAAEmB,WAAW,CAACM;EACvB,CAAC;AACH;AAEA,eAAe3B,MAAM"}
|
package/lib/redirect.js
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
7
2
|
import React from 'react';
|
|
8
3
|
import PropTypes from 'prop-types';
|
|
9
4
|
import { createLocation, locationsAreEqual } from 'history';
|
|
10
5
|
import invariant from 'tiny-invariant';
|
|
11
|
-
import Lifecycle from
|
|
12
|
-
import RouterContext from
|
|
13
|
-
import generatePath from
|
|
6
|
+
import Lifecycle from "./lifecycle";
|
|
7
|
+
import RouterContext from "./router-context";
|
|
8
|
+
import generatePath from "./generate-path";
|
|
9
|
+
|
|
14
10
|
/**
|
|
15
11
|
* The public API for navigating programmatically with a component.
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
13
|
function Redirect(_ref) {
|
|
19
14
|
var computedMatch = _ref.computedMatch,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null,
|
|
15
|
+
to = _ref.to,
|
|
16
|
+
_ref$push = _ref.push,
|
|
17
|
+
push = _ref$push === void 0 ? false : _ref$push;
|
|
18
|
+
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null, context => {
|
|
24
19
|
invariant(context, 'You should not use <Redirect> outside a <Router>');
|
|
25
20
|
var history = context.history,
|
|
26
|
-
|
|
21
|
+
staticContext = context.staticContext;
|
|
27
22
|
var method = push ? history.push : history.replace;
|
|
28
23
|
var location = createLocation(computedMatch ? typeof to === 'string' ? generatePath(to, computedMatch.params) : _objectSpread(_objectSpread({}, to), {}, {
|
|
29
24
|
pathname: generatePath(to.pathname, computedMatch.params)
|
|
30
|
-
}) : to);
|
|
31
|
-
// set the new location immediately.
|
|
25
|
+
}) : to);
|
|
32
26
|
|
|
27
|
+
// When rendering in a static context,
|
|
28
|
+
// set the new location immediately.
|
|
33
29
|
if (staticContext) {
|
|
34
30
|
method(location);
|
|
35
31
|
return null;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return /*#__PURE__*/React.createElement(Lifecycle, {
|
|
39
|
-
onMount:
|
|
34
|
+
onMount: () => {
|
|
40
35
|
method(location);
|
|
41
36
|
},
|
|
42
|
-
onUpdate:
|
|
37
|
+
onUpdate: (self, prevProps) => {
|
|
43
38
|
var prevLocation = createLocation(prevProps.to);
|
|
44
|
-
|
|
45
39
|
if (!locationsAreEqual(prevLocation, _objectSpread(_objectSpread({}, location), {}, {
|
|
46
40
|
key: prevLocation.key
|
|
47
41
|
}))) {
|
|
@@ -52,7 +46,6 @@ function Redirect(_ref) {
|
|
|
52
46
|
});
|
|
53
47
|
});
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
if (process.env.NODE_ENV !== 'production') {
|
|
57
50
|
Redirect.propTypes = {
|
|
58
51
|
push: PropTypes.bool,
|
|
@@ -61,5 +54,5 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
61
54
|
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired
|
|
62
55
|
};
|
|
63
56
|
}
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
export default Redirect;
|
|
58
|
+
//# sourceMappingURL=redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.js","names":["React","PropTypes","createLocation","locationsAreEqual","invariant","Lifecycle","RouterContext","generatePath","Redirect","_ref","computedMatch","to","_ref$push","push","createElement","Consumer","context","history","staticContext","method","replace","location","params","_objectSpread","pathname","onMount","onUpdate","self","prevProps","prevLocation","key","process","env","NODE_ENV","propTypes","bool","from","string","oneOfType","object","isRequired"],"sources":["../redirect.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { createLocation, locationsAreEqual } from 'history';\nimport invariant from 'tiny-invariant';\n\nimport Lifecycle from './lifecycle';\nimport RouterContext from './router-context';\nimport generatePath from './generate-path';\n\n/**\n * The public API for navigating programmatically with a component.\n */\nfunction Redirect({ computedMatch, to, push = false }) {\n return (\n <RouterContext.Consumer>\n {(context) => {\n invariant(context, 'You should not use <Redirect> outside a <Router>');\n\n const { history, staticContext } = context;\n\n const method = push ? history.push : history.replace;\n const location = createLocation(\n computedMatch\n ? typeof to === 'string'\n ? generatePath(to, computedMatch.params)\n : {\n ...to,\n pathname: generatePath(to.pathname, computedMatch.params)\n }\n : to\n );\n\n // When rendering in a static context,\n // set the new location immediately.\n if (staticContext) {\n method(location);\n return null;\n }\n\n return (\n <Lifecycle\n onMount={() => {\n method(location);\n }}\n onUpdate={(self, prevProps) => {\n const prevLocation = createLocation(prevProps.to);\n if (\n !locationsAreEqual(prevLocation, {\n ...location,\n key: prevLocation.key\n })\n ) {\n method(location);\n }\n }}\n to={to}\n />\n );\n }}\n </RouterContext.Consumer>\n );\n}\n\nif (process.env.NODE_ENV !== 'production') {\n Redirect.propTypes = {\n push: PropTypes.bool,\n from: PropTypes.string,\n computedMatch: PropTypes.string,\n to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired\n };\n}\n\nexport default Redirect;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,cAAc,EAAEC,iBAAiB,QAAQ,SAAS;AAC3D,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,OAAOC,SAAS;AAChB,OAAOC,aAAa;AACpB,OAAOC,YAAY;;AAEnB;AACA;AACA;AACA,SAASC,QAAQA,CAAAC,IAAA,EAAsC;EAAA,IAAnCC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IAAEC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAAC,SAAA,GAAAH,IAAA,CAAEI,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;EACjD,oBACEZ,KAAA,CAAAc,aAAA,CAACR,aAAa,CAACS,QAAQ,QACnBC,OAAO,IAAK;IACZZ,SAAS,CAACY,OAAO,EAAE,kDAAkD,CAAC;IAEtE,IAAQC,OAAO,GAAoBD,OAAO,CAAlCC,OAAO;MAAEC,aAAa,GAAKF,OAAO,CAAzBE,aAAa;IAE9B,IAAMC,MAAM,GAAGN,IAAI,GAAGI,OAAO,CAACJ,IAAI,GAAGI,OAAO,CAACG,OAAO;IACpD,IAAMC,QAAQ,GAAGnB,cAAc,CAC7BQ,aAAa,GACT,OAAOC,EAAE,KAAK,QAAQ,GACpBJ,YAAY,CAACI,EAAE,EAAED,aAAa,CAACY,MAAM,CAAC,GAAAC,aAAA,CAAAA,aAAA,KAEnCZ,EAAE;MACLa,QAAQ,EAAEjB,YAAY,CAACI,EAAE,CAACa,QAAQ,EAAEd,aAAa,CAACY,MAAM;IAAC,EAC1D,GACDX,EAAE,CACP;;IAED;IACA;IACA,IAAIO,aAAa,EAAE;MACjBC,MAAM,CAACE,QAAQ,CAAC;MAChB,OAAO,IAAI;IACb;IAEA,oBACErB,KAAA,CAAAc,aAAA,CAACT,SAAS;MACRoB,OAAO,EAAEA,CAAA,KAAM;QACbN,MAAM,CAACE,QAAQ,CAAC;MAClB,CAAE;MACFK,QAAQ,EAAEA,CAACC,IAAI,EAAEC,SAAS,KAAK;QAC7B,IAAMC,YAAY,GAAG3B,cAAc,CAAC0B,SAAS,CAACjB,EAAE,CAAC;QACjD,IACE,CAACR,iBAAiB,CAAC0B,YAAY,EAAAN,aAAA,CAAAA,aAAA,KAC1BF,QAAQ;UACXS,GAAG,EAAED,YAAY,CAACC;QAAG,GACrB,EACF;UACAX,MAAM,CAACE,QAAQ,CAAC;QAClB;MACF,CAAE;MACFV,EAAE,EAAEA;IAAG,EACP;EAEN,CAAC,CACsB;AAE7B;AAEA,IAAIoB,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzCzB,QAAQ,CAAC0B,SAAS,GAAG;IACnBrB,IAAI,EAAEZ,SAAS,CAACkC,IAAI;IACpBC,IAAI,EAAEnC,SAAS,CAACoC,MAAM;IACtB3B,aAAa,EAAET,SAAS,CAACoC,MAAM;IAC/B1B,EAAE,EAAEV,SAAS,CAACqC,SAAS,CAAC,CAACrC,SAAS,CAACoC,MAAM,EAAEpC,SAAS,CAACsC,MAAM,CAAC,CAAC,CAACC;EAChE,CAAC;AACH;AAEA,eAAehC,QAAQ"}
|
package/lib/route.js
CHANGED
|
@@ -1,121 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
|
-
|
|
12
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
16
2
|
import React from 'react';
|
|
17
3
|
import { isValidElementType } from 'react-is';
|
|
18
4
|
import PropTypes from 'prop-types';
|
|
19
5
|
import invariant from 'tiny-invariant';
|
|
20
6
|
import warning from 'tiny-warning';
|
|
21
|
-
import RouterContext from
|
|
22
|
-
import matchPath from
|
|
23
|
-
|
|
7
|
+
import RouterContext from "./router-context";
|
|
8
|
+
import matchPath from "./match-path";
|
|
24
9
|
function isEmptyChildren(children) {
|
|
25
10
|
return React.Children.count(children) === 0;
|
|
26
11
|
}
|
|
12
|
+
|
|
27
13
|
/**
|
|
28
14
|
* The public API for matching a single path and rendering.
|
|
29
15
|
*/
|
|
16
|
+
class Route extends React.Component {
|
|
17
|
+
render() {
|
|
18
|
+
var _this$props = this.props,
|
|
19
|
+
givenLocation = _this$props.location,
|
|
20
|
+
computedMatch = _this$props.computedMatch,
|
|
21
|
+
path = _this$props.path,
|
|
22
|
+
component = _this$props.component,
|
|
23
|
+
render = _this$props.render,
|
|
24
|
+
keepAlive = _this$props.keepAlive,
|
|
25
|
+
rrcActive = _this$props.rrcActive;
|
|
26
|
+
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null, context => {
|
|
27
|
+
invariant(context, 'You should not use <Route> outside a <Router>');
|
|
28
|
+
var location = givenLocation || context.location;
|
|
29
|
+
var match = computedMatch || (path ? matchPath(location.pathname, this.props) : context.match);
|
|
30
|
+
var props = _objectSpread(_objectSpread({}, context), {}, {
|
|
31
|
+
location,
|
|
32
|
+
match,
|
|
33
|
+
rrcActive
|
|
34
|
+
});
|
|
35
|
+
var children = this.props.children;
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
_createClass(Route, [{
|
|
44
|
-
key: "render",
|
|
45
|
-
value: function render() {
|
|
46
|
-
var _this = this;
|
|
47
|
-
|
|
48
|
-
var _this$props = this.props,
|
|
49
|
-
givenLocation = _this$props.location,
|
|
50
|
-
computedMatch = _this$props.computedMatch,
|
|
51
|
-
path = _this$props.path,
|
|
52
|
-
component = _this$props.component,
|
|
53
|
-
render = _this$props.render,
|
|
54
|
-
keepAlive = _this$props.keepAlive,
|
|
55
|
-
rrcActive = _this$props.rrcActive;
|
|
56
|
-
return /*#__PURE__*/React.createElement(RouterContext.Consumer, null, function (context) {
|
|
57
|
-
invariant(context, 'You should not use <Route> outside a <Router>');
|
|
58
|
-
var location = givenLocation || context.location;
|
|
59
|
-
var match = computedMatch || (path ? matchPath(location.pathname, _this.props) : context.match);
|
|
60
|
-
|
|
61
|
-
var props = _objectSpread(_objectSpread({}, context), {}, {
|
|
62
|
-
location: location,
|
|
63
|
-
match: match,
|
|
64
|
-
rrcActive: rrcActive
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
var children = _this.props.children; // Preact uses an empty array as children by
|
|
68
|
-
// default, so use null if that's the case.
|
|
69
|
-
|
|
70
|
-
if (Array.isArray(children) && children.length === 0) {
|
|
71
|
-
children = null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (typeof children === 'function') {
|
|
75
|
-
children = children(props);
|
|
76
|
-
|
|
77
|
-
if (children === undefined) {
|
|
78
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
79
|
-
warning(false, 'You returned `undefined` from the `children` function of ' + "<Route".concat(path ? " path=\"".concat(path, "\"") : '', ">, but you ") + 'should have returned a React element or `null`');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
children = null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var renderChildren = null;
|
|
87
|
-
|
|
88
|
-
if (children && !isEmptyChildren(children)) {
|
|
89
|
-
renderChildren = children;
|
|
90
|
-
} else if (props.match || _this.rendered && keepAlive) {
|
|
91
|
-
props.match = props.match || _this.memedMatch;
|
|
92
|
-
|
|
93
|
-
if (component) {
|
|
94
|
-
renderChildren = /*#__PURE__*/React.createElement(component, props);
|
|
95
|
-
} else if (render) {
|
|
96
|
-
renderChildren = render(props);
|
|
37
|
+
// Preact uses an empty array as children by
|
|
38
|
+
// default, so use null if that's the case.
|
|
39
|
+
if (Array.isArray(children) && children.length === 0) {
|
|
40
|
+
children = null;
|
|
41
|
+
}
|
|
42
|
+
if (typeof children === 'function') {
|
|
43
|
+
children = children(props);
|
|
44
|
+
if (children === undefined) {
|
|
45
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
46
|
+
warning(false, 'You returned `undefined` from the `children` function of ' + `<Route${path ? ` path="${path}"` : ''}>, but you ` + 'should have returned a React element or `null`');
|
|
97
47
|
}
|
|
48
|
+
children = null;
|
|
98
49
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
}
|
|
51
|
+
var renderChildren = null;
|
|
52
|
+
if (children && !isEmptyChildren(children)) {
|
|
53
|
+
renderChildren = children;
|
|
54
|
+
} else if (props.match || this.rendered && keepAlive) {
|
|
55
|
+
props.match = props.match || this.memedMatch;
|
|
56
|
+
if (component) {
|
|
57
|
+
renderChildren = /*#__PURE__*/React.createElement(component, props);
|
|
58
|
+
} else if (render) {
|
|
59
|
+
renderChildren = render(props);
|
|
103
60
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
61
|
+
}
|
|
62
|
+
if (renderChildren && keepAlive) {
|
|
63
|
+
this.rendered = true;
|
|
64
|
+
this.memedMatch = props.match;
|
|
65
|
+
}
|
|
66
|
+
return /*#__PURE__*/React.createElement(RouterContext.Provider, {
|
|
67
|
+
value: props
|
|
68
|
+
}, renderChildren);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
115
72
|
if (process.env.NODE_ENV !== 'production') {
|
|
116
73
|
Route.propTypes = {
|
|
117
74
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
118
|
-
component:
|
|
75
|
+
component: (props, propName) => {
|
|
119
76
|
if (props[propName] && !isValidElementType(props[propName])) {
|
|
120
77
|
return new Error("Invalid prop 'component' supplied to 'Route': the prop is not a valid React component");
|
|
121
78
|
}
|
|
@@ -132,12 +89,13 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
132
89
|
Route.defaultProps = {
|
|
133
90
|
keepAlive: false
|
|
134
91
|
};
|
|
135
|
-
|
|
136
92
|
Route.prototype.componentDidMount = function () {
|
|
137
93
|
warning(!(this.props.children && !isEmptyChildren(this.props.children) && this.props.component), 'You should not use <Route component> and <Route children> in the same route; <Route component> will be ignored');
|
|
138
94
|
warning(!(this.props.children && !isEmptyChildren(this.props.children) && this.props.render), 'You should not use <Route render> and <Route children> in the same route; <Route render> will be ignored');
|
|
139
95
|
warning(!(this.props.component && this.props.render), 'You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored');
|
|
140
|
-
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Route.prototype.componentDidUpdate = function (prevProps) {
|
|
141
99
|
// warning(
|
|
142
100
|
// !(this.props.location && !prevProps.location),
|
|
143
101
|
// '<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'
|
|
@@ -148,7 +106,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
148
106
|
// '<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'
|
|
149
107
|
// );
|
|
150
108
|
// };
|
|
151
|
-
|
|
152
109
|
}
|
|
153
110
|
|
|
154
|
-
export default Route;
|
|
111
|
+
export default Route;
|
|
112
|
+
//# sourceMappingURL=route.js.map
|
package/lib/route.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","names":["React","isValidElementType","PropTypes","invariant","warning","RouterContext","matchPath","isEmptyChildren","children","Children","count","Route","Component","render","_this$props","props","givenLocation","location","computedMatch","path","component","keepAlive","rrcActive","createElement","Consumer","context","match","pathname","_objectSpread","Array","isArray","length","undefined","process","env","NODE_ENV","renderChildren","rendered","memedMatch","Provider","value","propTypes","oneOfType","func","node","propName","Error","exact","bool","object","string","arrayOf","sensitive","strict","defaultProps","prototype","componentDidMount"],"sources":["../route.js"],"sourcesContent":["import React from 'react';\nimport { isValidElementType } from 'react-is';\nimport PropTypes from 'prop-types';\nimport invariant from 'tiny-invariant';\nimport warning from 'tiny-warning';\n\nimport RouterContext from './router-context';\nimport matchPath from './match-path';\n\nfunction isEmptyChildren(children) {\n return React.Children.count(children) === 0;\n}\n\n/**\n * The public API for matching a single path and rendering.\n */\nclass Route extends React.Component {\n render() {\n const {\n location: givenLocation, computedMatch, path, component, render, keepAlive, rrcActive,\n } = this.props;\n return (\n <RouterContext.Consumer>\n {(context) => {\n invariant(context, 'You should not use <Route> outside a <Router>');\n\n const location = givenLocation || context.location;\n const match = computedMatch || (path ? matchPath(location.pathname, this.props) : context.match);\n\n const props = {\n ...context,\n location,\n match,\n rrcActive,\n };\n\n let { children } = this.props;\n\n // Preact uses an empty array as children by\n // default, so use null if that's the case.\n if (Array.isArray(children) && children.length === 0) {\n children = null;\n }\n\n if (typeof children === 'function') {\n children = children(props);\n\n if (children === undefined) {\n if (process.env.NODE_ENV !== 'production') {\n warning(\n false,\n 'You returned `undefined` from the `children` function of '\n + `<Route${path ? ` path=\"${path}\"` : ''}>, but you `\n + 'should have returned a React element or `null`',\n );\n }\n\n children = null;\n }\n }\n\n let renderChildren = null;\n\n if (children && !isEmptyChildren(children)) {\n renderChildren = children;\n } else if (props.match || (this.rendered && keepAlive)) {\n props.match = props.match || this.memedMatch;\n if (component) {\n renderChildren = React.createElement(component, props);\n } else if (render) {\n renderChildren = render(props);\n }\n }\n\n if (renderChildren && keepAlive) {\n this.rendered = true;\n this.memedMatch = props.match;\n }\n\n return <RouterContext.Provider value={props}>{renderChildren}</RouterContext.Provider>;\n }}\n </RouterContext.Consumer>\n );\n }\n}\n\nif (process.env.NODE_ENV !== 'production') {\n Route.propTypes = {\n children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),\n component: (props, propName) => {\n if (props[propName] && !isValidElementType(props[propName])) {\n return new Error(\"Invalid prop 'component' supplied to 'Route': the prop is not a valid React component\");\n }\n },\n exact: PropTypes.bool,\n location: PropTypes.object,\n path: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n render: PropTypes.func,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n keepAlive: PropTypes.bool,\n rrcActive: PropTypes.bool,\n };\n\n Route.defaultProps = {\n keepAlive: false,\n };\n\n Route.prototype.componentDidMount = function () {\n warning(\n !(this.props.children && !isEmptyChildren(this.props.children) && this.props.component),\n 'You should not use <Route component> and <Route children> in the same route; <Route component> will be ignored',\n );\n\n warning(\n !(this.props.children && !isEmptyChildren(this.props.children) && this.props.render),\n 'You should not use <Route render> and <Route children> in the same route; <Route render> will be ignored',\n );\n\n warning(\n !(this.props.component && this.props.render),\n 'You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored',\n );\n };\n\n // Route.prototype.componentDidUpdate = function (prevProps) {\n // warning(\n // !(this.props.location && !prevProps.location),\n // '<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no \"location\" prop and then provided one on a subsequent render.'\n // );\n //\n // warning(\n // !(!this.props.location && prevProps.location),\n // '<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a \"location\" prop initially but omitted it on a subsequent render.'\n // );\n // };\n}\n\nexport default Route;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,OAAO,MAAM,cAAc;AAElC,OAAOC,aAAa;AACpB,OAAOC,SAAS;AAEhB,SAASC,eAAeA,CAACC,QAAQ,EAAE;EACjC,OAAOR,KAAK,CAACS,QAAQ,CAACC,KAAK,CAACF,QAAQ,CAAC,KAAK,CAAC;AAC7C;;AAEA;AACA;AACA;AACA,MAAMG,KAAK,SAASX,KAAK,CAACY,SAAS,CAA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AEA,eAAeF,KAAK"}
|
package/lib/router-context.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-context.js","names":["createReactContext","routerContext","displayName"],"sources":["../router-context.js"],"sourcesContent":["import createReactContext from '@vve/create-react-context';\n\nconst routerContext = createReactContext(null);\nrouterContext.displayName = 'RRC-Router';\n\nexport default routerContext;\n"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,2BAA2B;AAE1D,IAAMC,aAAa,GAAGD,kBAAkB,CAAC,IAAI,CAAC;AAC9CC,aAAa,CAACC,WAAW,GAAG,YAAY;AAExC,eAAeD,aAAa"}
|