@teambit/react-router 0.0.763 → 0.0.766
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/route-context.js +1 -11
- package/dist/route-context.js.map +1 -1
- package/package-tar/teambit-react-router-0.0.766.tgz +0 -0
- package/package.json +5 -7
- package/{preview-1655373564849.js → preview-1655695598583.js} +2 -2
- package/route-context.tsx +1 -7
- package/dist/legacy-routing.d.ts +0 -2
- package/dist/legacy-routing.js +0 -102
- package/dist/legacy-routing.js.map +0 -1
- package/legacy-routing.tsx +0 -24
- package/package-tar/teambit-react-router-0.0.763.tgz +0 -0
package/dist/route-context.js
CHANGED
|
@@ -78,16 +78,6 @@ function _routingMethod() {
|
|
|
78
78
|
return data;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function _legacyRouting() {
|
|
82
|
-
const data = require("./legacy-routing");
|
|
83
|
-
|
|
84
|
-
_legacyRouting = function () {
|
|
85
|
-
return data;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return data;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
81
|
/**
|
|
92
82
|
* Setup context needed for routing.
|
|
93
83
|
*/
|
|
@@ -101,7 +91,7 @@ function RouteContext({
|
|
|
101
91
|
location: location
|
|
102
92
|
}, /*#__PURE__*/_react().default.createElement(_baseReactNavigation().NavigationProvider, {
|
|
103
93
|
implementation: _uiFoundationUiNavigation().reactRouterAdapter
|
|
104
|
-
},
|
|
94
|
+
}, children));
|
|
105
95
|
}
|
|
106
96
|
|
|
107
97
|
function RootRoute({
|
|
@@ -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';\
|
|
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,YAAT,CAAsB;EAAEC,OAAO,GAAGC,wBAAA,CAAQC,GAApB;EAAyBC,QAAzB;EAAmCC;AAAnC,CAAtB,EAAyF;EAC9F,oBACE,+BAAC,MAAD;IAAQ,IAAI,EAAEJ,OAAd;IAAuB,QAAQ,EAAEI;EAAjC,gBACE,+BAAC,yCAAD;IAAoB,cAAc,EAAEC;EAApC,GAAyDF,QAAzD,CADF,CADF;AAKD;;AAEM,SAASG,SAAT,CAAmB;EAAEC,UAAF;EAAcC;AAAd,CAAnB,EAA8D;EACnE,oBAAO,+BAAC,uCAAD;IAAY,IAAI,EAAEA,SAAlB;IAA6B,UAAU,EAAED;EAAzC,EAAP;AACD;AAED;;;AACA,SAASE,MAAT,CAAgB;EAAEC,IAAF;EAAQP,QAAR;EAAkBC;AAAlB,CAAhB,EAAyG;EACvG,QAAQM,IAAR;IACE,KAAKT,wBAAA,CAAQU,MAAb;MACE,oBAAO,+BAAC,sBAAD;QAAc,QAAQ,EAAEP,QAAQ,IAAI;MAApC,GAA0CD,QAA1C,CAAP;;IACF,KAAKF,wBAAA,CAAQW,QAAb;MACE,oBACE,+BAAC,8BAAD;QAAc,cAAc,EAAE,CAACR,QAAQ,IAAI,GAAb,CAA9B;QAAiD,YAAY,EAAE;MAA/D,GACGD,QADH,CADF;;IAKF,KAAKF,wBAAA,CAAQY,IAAb;MACE;MACA,oBAAO,+BAAC,4BAAD,QAAaV,QAAb,CAAP;;IACF,KAAKF,wBAAA,CAAQC,GAAb;IACA;MACE;MACA,oBAAO,+BAAC,+BAAD,QAAgBC,QAAhB,CAAP;EAfJ;AAiBD"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.766",
|
|
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.766"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/runtime": "7.12.18",
|
|
13
13
|
"core-js": "^3.0.0",
|
|
14
14
|
"@teambit/base-react.navigation.link": "2.0.27",
|
|
15
|
-
"@teambit/base-ui.routing.native-nav-link": "1.0.0",
|
|
16
|
-
"@teambit/base-ui.routing.routing-provider": "1.0.0",
|
|
17
15
|
"@teambit/harmony": "0.3.3",
|
|
18
16
|
"@teambit/ui-foundation.ui.navigation.react-router-adapter": "6.1.1",
|
|
19
17
|
"@teambit/ui-foundation.ui.is-browser": "0.0.486",
|
|
20
18
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.490",
|
|
21
|
-
"@teambit/ui": "0.0.
|
|
19
|
+
"@teambit/ui": "0.0.766"
|
|
22
20
|
},
|
|
23
21
|
"devDependencies": {
|
|
24
22
|
"@types/react": "^17.0.8",
|
|
@@ -30,7 +28,7 @@
|
|
|
30
28
|
},
|
|
31
29
|
"peerDependencies": {
|
|
32
30
|
"react-router-dom": "^6.0.0",
|
|
33
|
-
"@teambit/legacy": "1.0.
|
|
31
|
+
"@teambit/legacy": "1.0.286",
|
|
34
32
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
35
33
|
"react": "^16.8.0 || ^17.0.0"
|
|
36
34
|
},
|
|
@@ -58,7 +56,7 @@
|
|
|
58
56
|
"react": "-"
|
|
59
57
|
},
|
|
60
58
|
"peerDependencies": {
|
|
61
|
-
"@teambit/legacy": "1.0.
|
|
59
|
+
"@teambit/legacy": "1.0.286",
|
|
62
60
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
63
61
|
"react": "^16.8.0 || ^17.0.0"
|
|
64
62
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.766/dist/react-router.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_react-router@0.0.766/dist/react-router.docs.mdx')]
|
package/route-context.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { NavigationProvider } from '@teambit/base-react.navigation.link';
|
|
|
6
6
|
import { reactRouterAdapter } from '@teambit/ui-foundation.ui.navigation.react-router-adapter';
|
|
7
7
|
import { ReactRouterUI } from './react-router.ui.runtime';
|
|
8
8
|
import { Routing } from './routing-method';
|
|
9
|
-
import { LegacyNavProvider } from './legacy-routing';
|
|
10
9
|
|
|
11
10
|
type RouterContextProps = {
|
|
12
11
|
reactRouterUi: ReactRouterUI;
|
|
@@ -26,12 +25,7 @@ type RootRouteProps = {
|
|
|
26
25
|
export function RouteContext({ routing = Routing.url, children, location }: RouterContextProps) {
|
|
27
26
|
return (
|
|
28
27
|
<Router type={routing} location={location}>
|
|
29
|
-
<NavigationProvider implementation={reactRouterAdapter}>
|
|
30
|
-
<LegacyNavProvider>
|
|
31
|
-
{/* route tree root: */}
|
|
32
|
-
{children}
|
|
33
|
-
</LegacyNavProvider>
|
|
34
|
-
</NavigationProvider>
|
|
28
|
+
<NavigationProvider implementation={reactRouterAdapter}>{children}</NavigationProvider>
|
|
35
29
|
</Router>
|
|
36
30
|
);
|
|
37
31
|
}
|
package/dist/legacy-routing.d.ts
DELETED
package/dist/legacy-routing.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.LegacyNavProvider = LegacyNavProvider;
|
|
9
|
-
|
|
10
|
-
function _extends2() {
|
|
11
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
-
|
|
13
|
-
_extends2 = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _objectWithoutProperties2() {
|
|
21
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
|
-
|
|
23
|
-
_objectWithoutProperties2 = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _react() {
|
|
31
|
-
const data = _interopRequireWildcard(require("react"));
|
|
32
|
-
|
|
33
|
-
_react = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _baseUiRouting() {
|
|
41
|
-
const data = require("@teambit/base-ui.routing.routing-provider");
|
|
42
|
-
|
|
43
|
-
_baseUiRouting = function () {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _baseReactNavigation() {
|
|
51
|
-
const data = require("@teambit/base-react.navigation.link");
|
|
52
|
-
|
|
53
|
-
_baseReactNavigation = function () {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
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); }
|
|
61
|
-
|
|
62
|
-
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; }
|
|
63
|
-
|
|
64
|
-
function useLegacyRouting() {
|
|
65
|
-
return {
|
|
66
|
-
Link: _baseReactNavigation().Link,
|
|
67
|
-
// eslint-disable-next-line react/prop-types
|
|
68
|
-
NavLink: /*#__PURE__*/(0, _react().forwardRef)(function NavLinkAdapter(_ref, ref) {
|
|
69
|
-
let {
|
|
70
|
-
isActive
|
|
71
|
-
} = _ref,
|
|
72
|
-
props = (0, _objectWithoutProperties2().default)(_ref, ["isActive"]);
|
|
73
|
-
const active = isActive === null || isActive === void 0 ? void 0 : isActive();
|
|
74
|
-
return /*#__PURE__*/_react().default.createElement(_baseReactNavigation().Link, (0, _extends2().default)({}, props, {
|
|
75
|
-
active: active,
|
|
76
|
-
ref: ref
|
|
77
|
-
}));
|
|
78
|
-
}),
|
|
79
|
-
useLocation: () => {
|
|
80
|
-
var _useLocation;
|
|
81
|
-
|
|
82
|
-
return (// @ts-ignore
|
|
83
|
-
(_useLocation = (0, _baseReactNavigation().useLocation)()) !== null && _useLocation !== void 0 ? _useLocation : {
|
|
84
|
-
pathname: '/',
|
|
85
|
-
hash: '',
|
|
86
|
-
search: ''
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function LegacyNavProvider({
|
|
94
|
-
children
|
|
95
|
-
}) {
|
|
96
|
-
const legacyRouting = useLegacyRouting();
|
|
97
|
-
return /*#__PURE__*/_react().default.createElement(_baseUiRouting().RoutingProvider, {
|
|
98
|
-
value: legacyRouting
|
|
99
|
-
}, children);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=legacy-routing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useLegacyRouting","Link","NavLink","forwardRef","NavLinkAdapter","ref","isActive","props","active","useLocation","pathname","hash","search","LegacyNavProvider","children","legacyRouting"],"sources":["legacy-routing.tsx"],"sourcesContent":["import React, { PropsWithChildren, forwardRef } from 'react';\nimport { RoutingProvider, Routing } from '@teambit/base-ui.routing.routing-provider';\nimport type { NavLinkProps } from '@teambit/base-ui.routing.native-nav-link';\nimport { Link, useLocation } from '@teambit/base-react.navigation.link';\n\nfunction useLegacyRouting(): Routing {\n return {\n Link,\n // eslint-disable-next-line react/prop-types\n NavLink: forwardRef<HTMLAnchorElement, NavLinkProps>(function NavLinkAdapter({ isActive, ...props }, ref) {\n const active = isActive?.();\n return <Link {...props} active={active} ref={ref} />;\n }),\n useLocation: () =>\n // @ts-ignore\n useLocation() ?? { pathname: '/', hash: '', search: '' },\n };\n}\n\nexport function LegacyNavProvider({ children }: PropsWithChildren<{}>) {\n const legacyRouting = useLegacyRouting();\n\n return <RoutingProvider value={legacyRouting}>{children}</RoutingProvider>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEA,SAASA,gBAAT,GAAqC;EACnC,OAAO;IACLC,IAAI,EAAJA,2BADK;IAEL;IACAC,OAAO,eAAE,IAAAC,mBAAA,EAA4C,SAASC,cAAT,OAAgDC,GAAhD,EAAqD;MAAA,IAA7B;QAAEC;MAAF,CAA6B;MAAA,IAAdC,KAAc;MACxG,MAAMC,MAAM,GAAGF,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,EAAvB;MACA,oBAAO,+BAAC,2BAAD,+BAAUC,KAAV;QAAiB,MAAM,EAAEC,MAAzB;QAAiC,GAAG,EAAEH;MAAtC,GAAP;IACD,CAHQ,CAHJ;IAOLI,WAAW,EAAE;MAAA;;MAAA,OACX;QADW,gBAEX,IAAAA,kCAAA,GAFW,uDAEM;UAAEC,QAAQ,EAAE,GAAZ;UAAiBC,IAAI,EAAE,EAAvB;UAA2BC,MAAM,EAAE;QAAnC;MAFN;IAAA;EAPR,CAAP;AAWD;;AAEM,SAASC,iBAAT,CAA2B;EAAEC;AAAF,CAA3B,EAAgE;EACrE,MAAMC,aAAa,GAAGf,gBAAgB,EAAtC;EAEA,oBAAO,+BAAC,gCAAD;IAAiB,KAAK,EAAEe;EAAxB,GAAwCD,QAAxC,CAAP;AACD"}
|
package/legacy-routing.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, forwardRef } from 'react';
|
|
2
|
-
import { RoutingProvider, Routing } from '@teambit/base-ui.routing.routing-provider';
|
|
3
|
-
import type { NavLinkProps } from '@teambit/base-ui.routing.native-nav-link';
|
|
4
|
-
import { Link, useLocation } from '@teambit/base-react.navigation.link';
|
|
5
|
-
|
|
6
|
-
function useLegacyRouting(): Routing {
|
|
7
|
-
return {
|
|
8
|
-
Link,
|
|
9
|
-
// eslint-disable-next-line react/prop-types
|
|
10
|
-
NavLink: forwardRef<HTMLAnchorElement, NavLinkProps>(function NavLinkAdapter({ isActive, ...props }, ref) {
|
|
11
|
-
const active = isActive?.();
|
|
12
|
-
return <Link {...props} active={active} ref={ref} />;
|
|
13
|
-
}),
|
|
14
|
-
useLocation: () =>
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
useLocation() ?? { pathname: '/', hash: '', search: '' },
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function LegacyNavProvider({ children }: PropsWithChildren<{}>) {
|
|
21
|
-
const legacyRouting = useLegacyRouting();
|
|
22
|
-
|
|
23
|
-
return <RoutingProvider value={legacyRouting}>{children}</RoutingProvider>;
|
|
24
|
-
}
|
|
Binary file
|