@teambit/react-router 0.0.881 → 0.0.882
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/dist/LocationHooks.js +0 -8
- package/dist/LocationHooks.js.map +1 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +1 -1
- package/dist/react-router.aspect.js +0 -5
- package/dist/react-router.aspect.js.map +1 -1
- package/dist/react-router.composition.js +0 -6
- package/dist/react-router.composition.js.map +1 -1
- package/dist/react-router.ui.runtime.js +4 -44
- package/dist/react-router.ui.runtime.js.map +1 -1
- package/dist/route-context.js +1 -29
- package/dist/route-context.js.map +1 -1
- package/dist/routing-method.js +0 -1
- package/dist/routing-method.js.map +1 -1
- package/package-tar/teambit-react-router-0.0.882.tgz +0 -0
- package/package.json +3 -3
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-react-router-0.0.881.tgz +0 -0
package/dist/LocationHooks.js
CHANGED
|
@@ -4,34 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LocationHooks = LocationHooks;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = require("react");
|
|
10
|
-
|
|
11
9
|
_react = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _reactRouterDom() {
|
|
19
15
|
const data = require("react-router-dom");
|
|
20
|
-
|
|
21
16
|
_reactRouterDom = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function LocationHooks({
|
|
29
22
|
onLocationChange,
|
|
30
23
|
onNavigatorChange
|
|
31
24
|
}) {
|
|
32
25
|
const location = (0, _reactRouterDom().useLocation)();
|
|
33
26
|
const navAction = (0, _reactRouterDom().useNavigationType)(); // the action that got react router to this location
|
|
34
|
-
|
|
35
27
|
const navigate = (0, _reactRouterDom().useNavigate)();
|
|
36
28
|
(0, _react().useEffect)(() => {
|
|
37
29
|
onLocationChange(location, navAction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LocationHooks","onLocationChange","onNavigatorChange","location","useLocation","navAction","useNavigationType","navigate","useNavigate","useEffect"],"sources":["LocationHooks.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation, useNavigate, NavigateFunction, useNavigationType } from 'react-router-dom';\nimport { LocationListener } from './react-router.ui.runtime';\n\nexport function LocationHooks({\n onLocationChange,\n onNavigatorChange,\n}: {\n onLocationChange: LocationListener;\n onNavigatorChange: (nav: NavigateFunction) => void;\n}) {\n const location = useLocation();\n const navAction = useNavigationType(); // the action that got react router to this location\n const navigate = useNavigate();\n\n useEffect(() => {\n onLocationChange(location, navAction);\n }, [location, navAction, onLocationChange]);\n\n useEffect(() => {\n onNavigatorChange(navigate);\n }, [navigate, onNavigatorChange]);\n\n return null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["LocationHooks","onLocationChange","onNavigatorChange","location","useLocation","navAction","useNavigationType","navigate","useNavigate","useEffect"],"sources":["LocationHooks.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation, useNavigate, NavigateFunction, useNavigationType } from 'react-router-dom';\nimport { LocationListener } from './react-router.ui.runtime';\n\nexport function LocationHooks({\n onLocationChange,\n onNavigatorChange,\n}: {\n onLocationChange: LocationListener;\n onNavigatorChange: (nav: NavigateFunction) => void;\n}) {\n const location = useLocation();\n const navAction = useNavigationType(); // the action that got react router to this location\n const navigate = useNavigate();\n\n useEffect(() => {\n onLocationChange(location, navAction);\n }, [location, navAction, onLocationChange]);\n\n useEffect(() => {\n onNavigatorChange(navigate);\n }, [navigate, onNavigatorChange]);\n\n return null;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,aAAa,CAAC;EAC5BC,gBAAgB;EAChBC;AAIF,CAAC,EAAE;EACD,MAAMC,QAAQ,GAAG,IAAAC,6BAAW,GAAE;EAC9B,MAAMC,SAAS,GAAG,IAAAC,mCAAiB,GAAE,CAAC,CAAC;EACvC,MAAMC,QAAQ,GAAG,IAAAC,6BAAW,GAAE;EAE9B,IAAAC,kBAAS,EAAC,MAAM;IACdR,gBAAgB,CAACE,QAAQ,EAAEE,SAAS,CAAC;EACvC,CAAC,EAAE,CAACF,QAAQ,EAAEE,SAAS,EAAEJ,gBAAgB,CAAC,CAAC;EAE3C,IAAAQ,kBAAS,EAAC,MAAM;IACdP,iBAAiB,CAACK,QAAQ,CAAC;EAC7B,CAAC,EAAE,CAACA,QAAQ,EAAEL,iBAAiB,CAAC,CAAC;EAEjC,OAAO,IAAI;AACb"}
|
package/dist/index.js
CHANGED
|
@@ -17,67 +17,49 @@ Object.defineProperty(exports, "Routing", {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
exports.navigation = exports.default = void 0;
|
|
20
|
-
|
|
21
20
|
function _reactRouter() {
|
|
22
21
|
const data = require("./react-router.aspect");
|
|
23
|
-
|
|
24
22
|
_reactRouter = function () {
|
|
25
23
|
return data;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
25
|
return data;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
function _routingMethod() {
|
|
32
28
|
const data = require("./routing-method");
|
|
33
|
-
|
|
34
29
|
_routingMethod = function () {
|
|
35
30
|
return data;
|
|
36
31
|
};
|
|
37
|
-
|
|
38
32
|
return data;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
function _navigation() {
|
|
42
35
|
const data = _interopRequireWildcard(require("@teambit/base-react.navigation.link"));
|
|
43
|
-
|
|
44
36
|
_navigation = function () {
|
|
45
37
|
return data;
|
|
46
38
|
};
|
|
47
|
-
|
|
48
39
|
return data;
|
|
49
40
|
}
|
|
50
|
-
|
|
51
41
|
Object.defineProperty(exports, "navigation", {
|
|
52
42
|
enumerable: true,
|
|
53
43
|
get: function () {
|
|
54
44
|
return _navigation();
|
|
55
45
|
}
|
|
56
46
|
});
|
|
57
|
-
|
|
58
47
|
function _ReactRouter() {
|
|
59
48
|
const data = _interopRequireWildcard(require("react-router-dom"));
|
|
60
|
-
|
|
61
49
|
_ReactRouter = function () {
|
|
62
50
|
return data;
|
|
63
51
|
};
|
|
64
|
-
|
|
65
52
|
return data;
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
Object.defineProperty(exports, "ReactRouter", {
|
|
69
55
|
enumerable: true,
|
|
70
56
|
get: function () {
|
|
71
57
|
return _ReactRouter();
|
|
72
58
|
}
|
|
73
59
|
});
|
|
74
|
-
|
|
75
60
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
76
|
-
|
|
77
61
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
78
|
-
|
|
79
62
|
var _default = _reactRouter().ReactRouterAspect;
|
|
80
|
-
|
|
81
63
|
exports.default = _default;
|
|
82
64
|
|
|
83
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactRouterAspect"],"sources":["index.ts"],"sourcesContent":["import { ReactRouterAspect } from './react-router.aspect';\n\nexport { Routing } from './routing-method';\nexport type { ReactRouterUI } from './react-router.ui.runtime';\n\nexport * as navigation from '@teambit/base-react.navigation.link';\nexport * as ReactRouter from 'react-router-dom';\n\nexport { ReactRouterAspect };\nexport default ReactRouterAspect;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ReactRouterAspect"],"sources":["index.ts"],"sourcesContent":["import { ReactRouterAspect } from './react-router.aspect';\n\nexport { Routing } from './routing-method';\nexport type { ReactRouterUI } from './react-router.ui.runtime';\n\nexport * as navigation from '@teambit/base-react.navigation.link';\nexport * as ReactRouter from 'react-router-dom';\n\nexport { ReactRouterAspect };\nexport default ReactRouterAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA2C;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAA;EAAA;EAAA;IAAA;EAAA;AAAA;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAA;EAAA;EAAA;IAAA;EAAA;AAAA;AAAA;AAAA;AAAA,eAO5BA,gCAAiB;AAAA"}
|
|
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ReactRouterAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const ReactRouterAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.ui-foundation/react-router'
|
|
20
16
|
});
|
|
21
|
-
|
|
22
17
|
exports.ReactRouterAspect = ReactRouterAspect;
|
|
23
18
|
|
|
24
19
|
//# sourceMappingURL=react-router.aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactRouterAspect","Aspect","create","id"],"sources":["react-router.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ReactRouterAspect = Aspect.create({\n id: 'teambit.ui-foundation/react-router',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ReactRouterAspect","Aspect","create","id"],"sources":["react-router.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ReactRouterAspect = Aspect.create({\n id: 'teambit.ui-foundation/react-router',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,iBAAiB,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC7CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Logo = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
21
16
|
style: {
|
|
22
17
|
height: '100%',
|
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
|
29
24
|
},
|
|
30
25
|
src: "https://static.bit.dev/extensions-icons/react-router.svg"
|
|
31
26
|
}));
|
|
32
|
-
|
|
33
27
|
exports.Logo = Logo;
|
|
34
28
|
|
|
35
29
|
//# sourceMappingURL=react-router.composition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["react-router.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/react-router.svg\" />\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["react-router.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/react-router.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAA0D,EAAG,CAE/F;AAAC"}
|
|
@@ -1,98 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
-
|
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
10
|
exports.ReactRouterUI = void 0;
|
|
15
|
-
|
|
16
11
|
function _defineProperty2() {
|
|
17
12
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
|
|
19
13
|
_defineProperty2 = function () {
|
|
20
14
|
return data;
|
|
21
15
|
};
|
|
22
|
-
|
|
23
16
|
return data;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
function _react() {
|
|
27
19
|
const data = _interopRequireDefault(require("react"));
|
|
28
|
-
|
|
29
20
|
_react = function () {
|
|
30
21
|
return data;
|
|
31
22
|
};
|
|
32
|
-
|
|
33
23
|
return data;
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
function _harmony() {
|
|
37
26
|
const data = require("@teambit/harmony");
|
|
38
|
-
|
|
39
27
|
_harmony = function () {
|
|
40
28
|
return data;
|
|
41
29
|
};
|
|
42
|
-
|
|
43
30
|
return data;
|
|
44
31
|
}
|
|
45
|
-
|
|
46
32
|
function _ui() {
|
|
47
33
|
const data = require("@teambit/ui");
|
|
48
|
-
|
|
49
34
|
_ui = function () {
|
|
50
35
|
return data;
|
|
51
36
|
};
|
|
52
|
-
|
|
53
37
|
return data;
|
|
54
38
|
}
|
|
55
|
-
|
|
56
39
|
function _reactRouter() {
|
|
57
40
|
const data = require("./react-router.aspect");
|
|
58
|
-
|
|
59
41
|
_reactRouter = function () {
|
|
60
42
|
return data;
|
|
61
43
|
};
|
|
62
|
-
|
|
63
44
|
return data;
|
|
64
45
|
}
|
|
65
|
-
|
|
66
46
|
function _routeContext() {
|
|
67
47
|
const data = require("./route-context");
|
|
68
|
-
|
|
69
48
|
_routeContext = function () {
|
|
70
49
|
return data;
|
|
71
50
|
};
|
|
72
|
-
|
|
73
51
|
return data;
|
|
74
52
|
}
|
|
75
|
-
|
|
76
53
|
function _routingMethod() {
|
|
77
54
|
const data = require("./routing-method");
|
|
78
|
-
|
|
79
55
|
_routingMethod = function () {
|
|
80
56
|
return data;
|
|
81
57
|
};
|
|
82
|
-
|
|
83
58
|
return data;
|
|
84
59
|
}
|
|
85
|
-
|
|
86
60
|
function _LocationHooks() {
|
|
87
61
|
const data = require("./LocationHooks");
|
|
88
|
-
|
|
89
62
|
_LocationHooks = function () {
|
|
90
63
|
return data;
|
|
91
64
|
};
|
|
92
|
-
|
|
93
65
|
return data;
|
|
94
66
|
}
|
|
95
|
-
|
|
96
67
|
class ReactRouterUI {
|
|
97
68
|
constructor(
|
|
98
69
|
/**
|
|
@@ -108,21 +79,17 @@ class ReactRouterUI {
|
|
|
108
79
|
(0, _defineProperty2().default)(this, "routingMode", _routingMethod().Routing.url);
|
|
109
80
|
(0, _defineProperty2().default)(this, "navigateTo", (path, action) => {
|
|
110
81
|
var _this$navigate, _this$navigate2;
|
|
111
|
-
|
|
112
82
|
const state = typeof path !== 'string' ? path.state : undefined;
|
|
113
|
-
|
|
114
83
|
switch (action) {
|
|
115
84
|
case 'POP':
|
|
116
85
|
return;
|
|
117
86
|
// TBD;
|
|
118
|
-
|
|
119
87
|
case 'REPLACE':
|
|
120
88
|
(_this$navigate = this.navigate) === null || _this$navigate === void 0 ? void 0 : _this$navigate.call(this, path, {
|
|
121
89
|
replace: true,
|
|
122
90
|
state
|
|
123
91
|
});
|
|
124
92
|
return;
|
|
125
|
-
|
|
126
93
|
case 'PUSH':
|
|
127
94
|
default:
|
|
128
95
|
(_this$navigate2 = this.navigate) === null || _this$navigate2 === void 0 ? void 0 : _this$navigate2.call(this, path, {
|
|
@@ -180,55 +147,48 @@ class ReactRouterUI {
|
|
|
180
147
|
reactServerContext: this.ServerRouting
|
|
181
148
|
});
|
|
182
149
|
}
|
|
150
|
+
|
|
183
151
|
/**
|
|
184
152
|
* render all slot routes.
|
|
185
153
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
154
|
renderRoutes(routes) {
|
|
189
155
|
return /*#__PURE__*/_react().default.createElement(_routeContext().RootRoute, {
|
|
190
156
|
routeSlot: this.routeSlot,
|
|
191
157
|
rootRoutes: routes
|
|
192
158
|
});
|
|
193
159
|
}
|
|
160
|
+
|
|
194
161
|
/** decides how navigation is stored and applied.
|
|
195
162
|
* Url - updates the `window.location.pathname`.
|
|
196
163
|
* Hash - updates `window.location.hash`.
|
|
197
164
|
* InMemory - store state internally and don't update the browser.
|
|
198
165
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
166
|
setRoutingMode(routing) {
|
|
202
167
|
this.routingMode = routing;
|
|
203
168
|
}
|
|
169
|
+
|
|
204
170
|
/**
|
|
205
171
|
* register a new route.
|
|
206
172
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
173
|
register(route) {
|
|
210
174
|
this.routeSlot.register(route);
|
|
211
175
|
return this;
|
|
212
176
|
}
|
|
213
|
-
|
|
214
177
|
registerListener(listener) {
|
|
215
178
|
this.routeChangeListener.register(listener);
|
|
216
179
|
}
|
|
180
|
+
|
|
217
181
|
/**
|
|
218
182
|
* change browser location
|
|
219
183
|
*/
|
|
220
184
|
|
|
221
|
-
|
|
222
185
|
static async provider(deps, config, [routeSlot, routeChangeSlot]) {
|
|
223
186
|
return new ReactRouterUI(routeSlot, routeChangeSlot);
|
|
224
187
|
}
|
|
225
|
-
|
|
226
188
|
}
|
|
227
|
-
|
|
228
189
|
exports.ReactRouterUI = ReactRouterUI;
|
|
229
190
|
(0, _defineProperty2().default)(ReactRouterUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
230
191
|
(0, _defineProperty2().default)(ReactRouterUI, "runtime", _ui().UIRuntime);
|
|
231
|
-
|
|
232
192
|
_reactRouter().ReactRouterAspect.addRuntime(ReactRouterUI);
|
|
233
193
|
|
|
234
194
|
//# sourceMappingURL=react-router.ui.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactRouterUI","constructor","routeSlot","routeChangeListener","Routing","url","path","action","state","undefined","navigate","replace","location","listeners","values","forEach","listener","children","renderCtx","routingMode","initialLocation","handleLocationChange","nav","static","browserInit","window","pathname","search","hash","serverInit","browser","reactClientContext","RoutingContext","reactServerContext","ServerRouting","renderRoutes","routes","setRoutingMode","routing","register","route","registerListener","provider","deps","config","routeChangeSlot","Slot","withType","UIRuntime","ReactRouterAspect","addRuntime"],"sources":["react-router.ui.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { NavigateFunction } from 'react-router-dom';\nimport type { Location, NavigationType, RouteProps } from 'react-router-dom';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport type { SSR } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\n\nimport { ReactRouterAspect } from './react-router.aspect';\nimport { RouteContext, RootRoute } from './route-context';\nimport { Routing } from './routing-method';\nimport { LocationHooks } from './LocationHooks';\n\nexport type LocationListener = (location: Location, action: NavigationType) => void;\ntype RouteChangeSlot = SlotRegistry<LocationListener>;\ntype RenderContext = { initialLocation?: string };\n\nexport class ReactRouterUI {\n private routingMode = Routing.url;\n\n constructor(\n /**\n * route slot.\n */\n private routeSlot: RouteSlot,\n /**\n *\n */\n private routeChangeListener: RouteChangeSlot\n ) {}\n\n /**\n * render all slot routes.\n */\n renderRoutes(routes: RouteProps[]) {\n return <RootRoute routeSlot={this.routeSlot} rootRoutes={routes} />;\n }\n\n /** decides how navigation is stored and applied.\n * Url - updates the `window.location.pathname`.\n * Hash - updates `window.location.hash`.\n * InMemory - store state internally and don't update the browser.\n */\n setRoutingMode(routing: Routing) {\n this.routingMode = routing;\n }\n\n /**\n * register a new route.\n */\n register(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n registerListener(listener: LocationListener) {\n this.routeChangeListener.register(listener);\n }\n\n /**\n * change browser location\n */\n navigateTo = (\n /** destination */\n path: Location | string,\n /** history action to execute (pop / push / replace) */\n action?: NavigationType\n ) => {\n const state = typeof path !== 'string' ? path.state : undefined;\n\n switch (action) {\n case 'POP':\n return; // TBD;\n case 'REPLACE':\n this.navigate?.(path, { replace: true, state });\n return;\n case 'PUSH':\n default:\n this.navigate?.(path, { state });\n }\n };\n\n private navigate?: NavigateFunction = undefined;\n\n private handleLocationChange = (location: Location, action: NavigationType) => {\n const listeners = this.routeChangeListener.values();\n listeners.forEach((listener) => listener(location, action));\n };\n\n private RoutingContext = ({ children, renderCtx }: { children: ReactNode; renderCtx?: RenderContext }) => {\n return (\n <RouteContext reactRouterUi={this} routing={this.routingMode} location={renderCtx?.initialLocation}>\n {children}\n <LocationHooks\n onLocationChange={this.handleLocationChange}\n onNavigatorChange={(nav) => (this.navigate = nav)}\n />\n </RouteContext>\n );\n };\n\n private ServerRouting = ({ children, renderCtx }: { children: ReactNode; renderCtx?: RenderContext }) => {\n return (\n <RouteContext reactRouterUi={this} routing={Routing.static} location={renderCtx?.initialLocation}>\n {children}\n <LocationHooks\n onLocationChange={this.handleLocationChange}\n onNavigatorChange={(nav) => (this.navigate = nav)}\n />\n </RouteContext>\n );\n };\n\n public renderPlugin: SSR.RenderPlugin<RenderContext> = {\n browserInit: () => {\n const initialLocation = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return { initialLocation };\n },\n serverInit: ({ browser }) => {\n const initialLocation = browser?.location.url;\n return { initialLocation };\n },\n reactClientContext: this.RoutingContext,\n reactServerContext: this.ServerRouting,\n };\n\n static slots = [Slot.withType<RouteProps>(), Slot.withType<LocationListener>()];\n static runtime = UIRuntime;\n\n static async provider(deps, config, [routeSlot, routeChangeSlot]: [RouteSlot, RouteChangeSlot]) {\n return new ReactRouterUI(routeSlot, routeChangeSlot);\n }\n}\n\nReactRouterAspect.addRuntime(ReactRouterUI);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ReactRouterUI","constructor","routeSlot","routeChangeListener","Routing","url","path","action","state","undefined","navigate","replace","location","listeners","values","forEach","listener","children","renderCtx","routingMode","initialLocation","handleLocationChange","nav","static","browserInit","window","pathname","search","hash","serverInit","browser","reactClientContext","RoutingContext","reactServerContext","ServerRouting","renderRoutes","routes","setRoutingMode","routing","register","route","registerListener","provider","deps","config","routeChangeSlot","Slot","withType","UIRuntime","ReactRouterAspect","addRuntime"],"sources":["react-router.ui.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { NavigateFunction } from 'react-router-dom';\nimport type { Location, NavigationType, RouteProps } from 'react-router-dom';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport type { SSR } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\n\nimport { ReactRouterAspect } from './react-router.aspect';\nimport { RouteContext, RootRoute } from './route-context';\nimport { Routing } from './routing-method';\nimport { LocationHooks } from './LocationHooks';\n\nexport type LocationListener = (location: Location, action: NavigationType) => void;\ntype RouteChangeSlot = SlotRegistry<LocationListener>;\ntype RenderContext = { initialLocation?: string };\n\nexport class ReactRouterUI {\n private routingMode = Routing.url;\n\n constructor(\n /**\n * route slot.\n */\n private routeSlot: RouteSlot,\n /**\n *\n */\n private routeChangeListener: RouteChangeSlot\n ) {}\n\n /**\n * render all slot routes.\n */\n renderRoutes(routes: RouteProps[]) {\n return <RootRoute routeSlot={this.routeSlot} rootRoutes={routes} />;\n }\n\n /** decides how navigation is stored and applied.\n * Url - updates the `window.location.pathname`.\n * Hash - updates `window.location.hash`.\n * InMemory - store state internally and don't update the browser.\n */\n setRoutingMode(routing: Routing) {\n this.routingMode = routing;\n }\n\n /**\n * register a new route.\n */\n register(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n registerListener(listener: LocationListener) {\n this.routeChangeListener.register(listener);\n }\n\n /**\n * change browser location\n */\n navigateTo = (\n /** destination */\n path: Location | string,\n /** history action to execute (pop / push / replace) */\n action?: NavigationType\n ) => {\n const state = typeof path !== 'string' ? path.state : undefined;\n\n switch (action) {\n case 'POP':\n return; // TBD;\n case 'REPLACE':\n this.navigate?.(path, { replace: true, state });\n return;\n case 'PUSH':\n default:\n this.navigate?.(path, { state });\n }\n };\n\n private navigate?: NavigateFunction = undefined;\n\n private handleLocationChange = (location: Location, action: NavigationType) => {\n const listeners = this.routeChangeListener.values();\n listeners.forEach((listener) => listener(location, action));\n };\n\n private RoutingContext = ({ children, renderCtx }: { children: ReactNode; renderCtx?: RenderContext }) => {\n return (\n <RouteContext reactRouterUi={this} routing={this.routingMode} location={renderCtx?.initialLocation}>\n {children}\n <LocationHooks\n onLocationChange={this.handleLocationChange}\n onNavigatorChange={(nav) => (this.navigate = nav)}\n />\n </RouteContext>\n );\n };\n\n private ServerRouting = ({ children, renderCtx }: { children: ReactNode; renderCtx?: RenderContext }) => {\n return (\n <RouteContext reactRouterUi={this} routing={Routing.static} location={renderCtx?.initialLocation}>\n {children}\n <LocationHooks\n onLocationChange={this.handleLocationChange}\n onNavigatorChange={(nav) => (this.navigate = nav)}\n />\n </RouteContext>\n );\n };\n\n public renderPlugin: SSR.RenderPlugin<RenderContext> = {\n browserInit: () => {\n const initialLocation = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return { initialLocation };\n },\n serverInit: ({ browser }) => {\n const initialLocation = browser?.location.url;\n return { initialLocation };\n },\n reactClientContext: this.RoutingContext,\n reactServerContext: this.ServerRouting,\n };\n\n static slots = [Slot.withType<RouteProps>(), Slot.withType<LocationListener>()];\n static runtime = UIRuntime;\n\n static async provider(deps, config, [routeSlot, routeChangeSlot]: [RouteSlot, RouteChangeSlot]) {\n return new ReactRouterUI(routeSlot, routeChangeSlot);\n }\n}\n\nReactRouterAspect.addRuntime(ReactRouterUI);\n"],"mappings":"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"}
|
package/dist/route-context.js
CHANGED
|
@@ -1,83 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.RootRoute = RootRoute;
|
|
9
8
|
exports.RouteContext = RouteContext;
|
|
10
|
-
|
|
11
9
|
function _react() {
|
|
12
10
|
const data = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
11
|
_react = function () {
|
|
15
12
|
return data;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
14
|
return data;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
function _reactRouterDom() {
|
|
22
17
|
const data = require("react-router-dom");
|
|
23
|
-
|
|
24
18
|
_reactRouterDom = function () {
|
|
25
19
|
return data;
|
|
26
20
|
};
|
|
27
|
-
|
|
28
21
|
return data;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
function _server() {
|
|
32
24
|
const data = require("react-router-dom/server");
|
|
33
|
-
|
|
34
25
|
_server = function () {
|
|
35
26
|
return data;
|
|
36
27
|
};
|
|
37
|
-
|
|
38
28
|
return data;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
function _uiFoundationUiReactRouter() {
|
|
42
31
|
const data = require("@teambit/ui-foundation.ui.react-router.slot-router");
|
|
43
|
-
|
|
44
32
|
_uiFoundationUiReactRouter = function () {
|
|
45
33
|
return data;
|
|
46
34
|
};
|
|
47
|
-
|
|
48
35
|
return data;
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
function _baseReactNavigation() {
|
|
52
38
|
const data = require("@teambit/base-react.navigation.link");
|
|
53
|
-
|
|
54
39
|
_baseReactNavigation = function () {
|
|
55
40
|
return data;
|
|
56
41
|
};
|
|
57
|
-
|
|
58
42
|
return data;
|
|
59
43
|
}
|
|
60
|
-
|
|
61
44
|
function _uiFoundationUiNavigation() {
|
|
62
45
|
const data = require("@teambit/ui-foundation.ui.navigation.react-router-adapter");
|
|
63
|
-
|
|
64
46
|
_uiFoundationUiNavigation = function () {
|
|
65
47
|
return data;
|
|
66
48
|
};
|
|
67
|
-
|
|
68
49
|
return data;
|
|
69
50
|
}
|
|
70
|
-
|
|
71
51
|
function _routingMethod() {
|
|
72
52
|
const data = require("./routing-method");
|
|
73
|
-
|
|
74
53
|
_routingMethod = function () {
|
|
75
54
|
return data;
|
|
76
55
|
};
|
|
77
|
-
|
|
78
56
|
return data;
|
|
79
57
|
}
|
|
80
|
-
|
|
81
58
|
/**
|
|
82
59
|
* Setup context needed for routing.
|
|
83
60
|
*/
|
|
@@ -93,7 +70,6 @@ function RouteContext({
|
|
|
93
70
|
implementation: _uiFoundationUiNavigation().reactRouterAdapter
|
|
94
71
|
}, children));
|
|
95
72
|
}
|
|
96
|
-
|
|
97
73
|
function RootRoute({
|
|
98
74
|
rootRoutes,
|
|
99
75
|
routeSlot
|
|
@@ -103,9 +79,8 @@ function RootRoute({
|
|
|
103
79
|
rootRoutes: rootRoutes
|
|
104
80
|
});
|
|
105
81
|
}
|
|
106
|
-
/** provides the router engine (browser, inMemory, etc) */
|
|
107
|
-
|
|
108
82
|
|
|
83
|
+
/** provides the router engine (browser, inMemory, etc) */
|
|
109
84
|
function Router({
|
|
110
85
|
type,
|
|
111
86
|
children,
|
|
@@ -116,17 +91,14 @@ function Router({
|
|
|
116
91
|
return /*#__PURE__*/_react().default.createElement(_server().StaticRouter, {
|
|
117
92
|
location: location || '/'
|
|
118
93
|
}, children);
|
|
119
|
-
|
|
120
94
|
case _routingMethod().Routing.inMemory:
|
|
121
95
|
return /*#__PURE__*/_react().default.createElement(_reactRouterDom().MemoryRouter, {
|
|
122
96
|
initialEntries: [location || '/'],
|
|
123
97
|
initialIndex: 1
|
|
124
98
|
}, children);
|
|
125
|
-
|
|
126
99
|
case _routingMethod().Routing.hash:
|
|
127
100
|
// @ts-ignore - https://github.com/teambit/bit/issues/5746
|
|
128
101
|
return /*#__PURE__*/_react().default.createElement(_reactRouterDom().HashRouter, null, children);
|
|
129
|
-
|
|
130
102
|
case _routingMethod().Routing.url:
|
|
131
103
|
default:
|
|
132
104
|
// @ts-ignore - https://github.com/teambit/bit/issues/5746
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RouteContext","routing","Routing","url","children","location","reactRouterAdapter","RootRoute","rootRoutes","routeSlot","Router","type","static","inMemory","hash"],"sources":["route-context.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { BrowserRouter, MemoryRouter, HashRouter, RouteProps } from 'react-router-dom';\nimport { StaticRouter } from 'react-router-dom/server';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { NavigationProvider } from '@teambit/base-react.navigation.link';\nimport { reactRouterAdapter } from '@teambit/ui-foundation.ui.navigation.react-router-adapter';\nimport { ReactRouterUI } from './react-router.ui.runtime';\nimport { Routing } from './routing-method';\n\ntype RouterContextProps = {\n reactRouterUi: ReactRouterUI;\n routing?: Routing;\n children: ReactNode;\n location?: string;\n};\n\ntype RootRouteProps = {\n rootRoutes: RouteProps[];\n routeSlot: RouteSlot;\n};\n\n/**\n * Setup context needed for routing.\n */\nexport function RouteContext({ routing = Routing.url, children, location }: RouterContextProps) {\n return (\n <Router type={routing} location={location}>\n <NavigationProvider implementation={reactRouterAdapter}>{children}</NavigationProvider>\n </Router>\n );\n}\n\nexport function RootRoute({ rootRoutes, routeSlot }: RootRouteProps) {\n return <SlotRouter slot={routeSlot} rootRoutes={rootRoutes} />;\n}\n\n/** provides the router engine (browser, inMemory, etc) */\nfunction Router({ type, children, location }: { type: Routing; children: ReactNode; location?: string }) {\n switch (type) {\n case Routing.static:\n return <StaticRouter location={location || '/'}>{children}</StaticRouter>;\n case Routing.inMemory:\n return (\n <MemoryRouter initialEntries={[location || '/']} initialIndex={1}>\n {children}\n </MemoryRouter>\n );\n case Routing.hash:\n // @ts-ignore - https://github.com/teambit/bit/issues/5746\n return <HashRouter>{children}</HashRouter>;\n case Routing.url:\n default:\n // @ts-ignore - https://github.com/teambit/bit/issues/5746\n return <BrowserRouter>{children}</BrowserRouter>;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["RouteContext","routing","Routing","url","children","location","reactRouterAdapter","RootRoute","rootRoutes","routeSlot","Router","type","static","inMemory","hash"],"sources":["route-context.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { BrowserRouter, MemoryRouter, HashRouter, RouteProps } from 'react-router-dom';\nimport { StaticRouter } from 'react-router-dom/server';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { NavigationProvider } from '@teambit/base-react.navigation.link';\nimport { reactRouterAdapter } from '@teambit/ui-foundation.ui.navigation.react-router-adapter';\nimport { ReactRouterUI } from './react-router.ui.runtime';\nimport { Routing } from './routing-method';\n\ntype RouterContextProps = {\n reactRouterUi: ReactRouterUI;\n routing?: Routing;\n children: ReactNode;\n location?: string;\n};\n\ntype RootRouteProps = {\n rootRoutes: RouteProps[];\n routeSlot: RouteSlot;\n};\n\n/**\n * Setup context needed for routing.\n */\nexport function RouteContext({ routing = Routing.url, children, location }: RouterContextProps) {\n return (\n <Router type={routing} location={location}>\n <NavigationProvider implementation={reactRouterAdapter}>{children}</NavigationProvider>\n </Router>\n );\n}\n\nexport function RootRoute({ rootRoutes, routeSlot }: RootRouteProps) {\n return <SlotRouter slot={routeSlot} rootRoutes={rootRoutes} />;\n}\n\n/** provides the router engine (browser, inMemory, etc) */\nfunction Router({ type, children, location }: { type: Routing; children: ReactNode; location?: string }) {\n switch (type) {\n case Routing.static:\n return <StaticRouter location={location || '/'}>{children}</StaticRouter>;\n case Routing.inMemory:\n return (\n <MemoryRouter initialEntries={[location || '/']} initialIndex={1}>\n {children}\n </MemoryRouter>\n );\n case Routing.hash:\n // @ts-ignore - https://github.com/teambit/bit/issues/5746\n return <HashRouter>{children}</HashRouter>;\n case Routing.url:\n default:\n // @ts-ignore - https://github.com/teambit/bit/issues/5746\n return <BrowserRouter>{children}</BrowserRouter>;\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAcA;AACA;AACA;AACO,SAASA,YAAY,CAAC;EAAEC,OAAO,GAAGC,wBAAO,CAACC,GAAG;EAAEC,QAAQ;EAAEC;AAA6B,CAAC,EAAE;EAC9F,oBACE,+BAAC,MAAM;IAAC,IAAI,EAAEJ,OAAQ;IAAC,QAAQ,EAAEI;EAAS,gBACxC,+BAAC,yCAAkB;IAAC,cAAc,EAAEC;EAAmB,GAAEF,QAAQ,CAAsB,CAChF;AAEb;AAEO,SAASG,SAAS,CAAC;EAAEC,UAAU;EAAEC;AAA0B,CAAC,EAAE;EACnE,oBAAO,+BAAC,uCAAU;IAAC,IAAI,EAAEA,SAAU;IAAC,UAAU,EAAED;EAAW,EAAG;AAChE;;AAEA;AACA,SAASE,MAAM,CAAC;EAAEC,IAAI;EAAEP,QAAQ;EAAEC;AAAoE,CAAC,EAAE;EACvG,QAAQM,IAAI;IACV,KAAKT,wBAAO,CAACU,MAAM;MACjB,oBAAO,+BAAC,sBAAY;QAAC,QAAQ,EAAEP,QAAQ,IAAI;MAAI,GAAED,QAAQ,CAAgB;IAC3E,KAAKF,wBAAO,CAACW,QAAQ;MACnB,oBACE,+BAAC,8BAAY;QAAC,cAAc,EAAE,CAACR,QAAQ,IAAI,GAAG,CAAE;QAAC,YAAY,EAAE;MAAE,GAC9DD,QAAQ,CACI;IAEnB,KAAKF,wBAAO,CAACY,IAAI;MACf;MACA,oBAAO,+BAAC,4BAAU,QAAEV,QAAQ,CAAc;IAC5C,KAAKF,wBAAO,CAACC,GAAG;IAChB;MACE;MACA,oBAAO,+BAAC,+BAAa,QAAEC,QAAQ,CAAiB;EAAC;AAEvD"}
|
package/dist/routing-method.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Routing"],"sources":["routing-method.tsx"],"sourcesContent":["export enum Routing {\n url,\n hash,\n inMemory,\n static,\n}\n"],"mappings":";;;;;;IAAYA,
|
|
1
|
+
{"version":3,"names":["Routing"],"sources":["routing-method.tsx"],"sourcesContent":["export enum Routing {\n url,\n hash,\n inMemory,\n static,\n}\n"],"mappings":";;;;;;IAAYA,OAAO;AAAA;AAAA,WAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;AAAA,GAAPA,OAAO,uBAAPA,OAAO"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.882",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/ui-foundation/react-router",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.ui-foundation",
|
|
8
8
|
"name": "react-router",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.882"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/runtime": "7.12.18",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@teambit/harmony": "0.3.3",
|
|
16
16
|
"@teambit/ui-foundation.ui.navigation.react-router-adapter": "6.1.1",
|
|
17
17
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.496",
|
|
18
|
-
"@teambit/ui": "0.0.
|
|
18
|
+
"@teambit/ui": "0.0.882"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/react": "^17.0.8",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.882/dist/react-router.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.882/dist/react-router.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|