@teambit/ui-foundation.ui.react-router.slot-router 0.0.506 → 0.0.508

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/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { SlotRouter, SlotRouterProps, RouteSlot, NavigationSlot } from './slot-router';
1
+ export { SlotRouter } from './slot-router';
2
+ export type { SlotRouterProps, RouteSlot, NavigationSlot } from './slot-router';
package/dist/index.js CHANGED
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SlotRouter = void 0;
4
- var slot_router_1 = require("./slot-router");
5
- Object.defineProperty(exports, "SlotRouter", { enumerable: true, get: function () { return slot_router_1.SlotRouter; } });
1
+ export { SlotRouter } from './slot-router';
6
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,6CAAuF;AAA9E,yGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -2,9 +2,9 @@ import { PropsWithChildren } from 'react';
2
2
  import { SlotRegistry } from '@teambit/harmony';
3
3
  import { RouteProps } from 'react-router-dom';
4
4
  import type { LinkProps } from '@teambit/base-react.navigation.link';
5
- export declare type RouteSlot = SlotRegistry<RouteProps | RouteProps[]>;
6
- export declare type NavigationSlot = SlotRegistry<LinkProps>;
7
- export declare type SlotRouterProps = PropsWithChildren<{
5
+ export type RouteSlot = SlotRegistry<RouteProps | RouteProps[]>;
6
+ export type NavigationSlot = SlotRegistry<LinkProps>;
7
+ export type SlotRouterProps = PropsWithChildren<{
8
8
  /**
9
9
  * @deprecated
10
10
  * use @property routes to pass list of routes instead
@@ -1,28 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SlotRouter = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const react_router_dom_1 = require("react-router-dom");
9
- const lodash_1 = require("lodash");
10
- function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }) {
11
- const routes = routesFromProps || (slot && (0, lodash_1.flatten)(slot.values())) || [];
12
- const withRoot = routes.concat(rootRoutes || []);
13
- const jsxRoutes = withRoot.map((route) => react_1.default.createElement(react_router_dom_1.Route, Object.assign({ key: toKey(route) }, route)));
14
- if (parentPath) {
15
- return (react_1.default.createElement(react_router_dom_1.Routes, null,
16
- react_1.default.createElement(react_router_dom_1.Route, { path: parentPath },
17
- jsxRoutes,
18
- children)));
19
- }
20
- return (react_1.default.createElement(react_router_dom_1.Routes, null,
21
- react_1.default.createElement(react_router_dom_1.Route, { path: parentPath },
22
- jsxRoutes,
23
- children)));
24
- }
25
- exports.SlotRouter = SlotRouter;
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Routes, Route } from 'react-router-dom';
3
+ import { flatten } from 'lodash';
26
4
  function toKey(route) {
27
5
  if (route.path)
28
6
  return route.path;
@@ -30,4 +8,13 @@ function toKey(route) {
30
8
  return '/';
31
9
  return '.';
32
10
  }
11
+ export function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }) {
12
+ const routes = routesFromProps || (slot && flatten(slot.values())) || [];
13
+ const withRoot = routes.concat(rootRoutes || []);
14
+ const jsxRoutes = withRoot.map((route) => _jsx(Route, { ...route }, toKey(route)));
15
+ if (parentPath) {
16
+ return (_jsx(Routes, { children: _jsxs(Route, { path: parentPath, children: [jsxRoutes, children] }) }));
17
+ }
18
+ return (_jsx(Routes, { children: _jsxs(Route, { path: parentPath, children: [jsxRoutes, children] }) }));
19
+ }
33
20
  //# sourceMappingURL=slot-router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot-router.js","sourceRoot":"","sources":["../slot-router.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;AAEjD,uDAA6D;AAC7D,mCAAiC;AAiBjC,SAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAmB;IAC7G,MAAM,MAAM,GAAG,eAAe,IAAI,CAAC,IAAI,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,8BAAC,wBAAK,kBAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,IAAM,KAAK,EAAI,CAAC,CAAC;IAEnF,IAAI,UAAU,EAAE;QACd,OAAO,CACL,8BAAC,yBAAM;YACL,8BAAC,wBAAK,IAAC,IAAI,EAAE,UAAU;gBACpB,SAAS;gBACT,QAAQ,CACH,CACD,CACV,CAAC;KACH;IAED,OAAO,CACL,8BAAC,yBAAM;QACL,8BAAC,wBAAK,IAAC,IAAI,EAAE,UAAU;YACpB,SAAS;YACT,QAAQ,CACH,CACD,CACV,CAAC;AACJ,CAAC;AAzBD,gCAyBC;AAED,SAAS,KAAK,CAAC,KAAiB;IAC9B,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAClC,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"slot-router.js","sourceRoot":"","sources":["../slot-router.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAc,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAiBjC,SAAS,KAAK,CAAC,KAAiB;IAC9B,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAClC,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAmB;IAC7G,MAAM,MAAM,GAAG,eAAe,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,KAAK,OAAwB,KAAK,IAAvB,KAAK,CAAC,KAAK,CAAC,CAAe,CAAC,CAAC;IAEnF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CACL,KAAC,MAAM,cACL,MAAC,KAAK,IAAC,IAAI,EAAE,UAAU,aACpB,SAAS,EACT,QAAQ,IACH,GACD,CACV,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,MAAM,cACL,MAAC,KAAK,IAAC,IAAI,EAAE,UAAU,aACpB,SAAS,EACT,QAAQ,IACH,GACD,CACV,CAAC;AACJ,CAAC"}
@@ -1,29 +1,36 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
8
7
  ],
9
- "target": "es2015",
10
- "module": "CommonJS",
11
- "jsx": "react",
12
- "allowJs": true,
13
- "composite": true,
8
+ "target": "es2020",
9
+ "module": "es2020",
10
+ "jsx": "react-jsx",
14
11
  "declaration": true,
15
12
  "sourceMap": true,
16
- "skipLibCheck": true,
17
13
  "experimentalDecorators": true,
18
- "outDir": "dist",
14
+ "skipLibCheck": true,
19
15
  "moduleResolution": "node",
20
16
  "esModuleInterop": true,
21
- "rootDir": ".",
22
- "resolveJsonModule": true
17
+ "resolveJsonModule": true,
18
+ "allowJs": true,
19
+ "outDir": "dist",
20
+ "strict": true,
21
+ "emitDecoratorMetadata": true,
22
+ "preserveConstEnums": true,
23
+ "strictPropertyInitialization": false,
24
+ "noImplicitAny": false
23
25
  },
24
26
  "exclude": [
27
+ "artifacts",
28
+ "public",
25
29
  "dist",
26
- "package.json"
30
+ "node_modules",
31
+ "package.json",
32
+ "**/*.cjs",
33
+ "./dist"
27
34
  ],
28
35
  "include": [
29
36
  "**/*",
package/index.ts CHANGED
@@ -1 +1,2 @@
1
- export { SlotRouter, SlotRouterProps, RouteSlot, NavigationSlot } from './slot-router';
1
+ export { SlotRouter } from './slot-router';
2
+ export type { SlotRouterProps, RouteSlot, NavigationSlot } from './slot-router';
package/package.json CHANGED
@@ -1,35 +1,31 @@
1
1
  {
2
2
  "name": "@teambit/ui-foundation.ui.react-router.slot-router",
3
- "version": "0.0.506",
3
+ "version": "0.0.508",
4
4
  "homepage": "https://bit.cloud/teambit/ui-foundation/ui/react-router/slot-router",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.ui-foundation",
8
8
  "name": "ui/react-router/slot-router",
9
- "version": "0.0.506"
9
+ "version": "0.0.508"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
13
- "core-js": "^3.0.0",
14
- "@teambit/base-react.navigation.link": "2.0.27",
15
13
  "@teambit/harmony": "0.4.6"
16
14
  },
17
15
  "devDependencies": {
18
16
  "@types/lodash": "4.14.165",
19
- "@types/react": "^17.0.8",
20
17
  "@types/mocha": "9.1.0",
21
- "@types/node": "12.20.4",
22
- "@types/react-dom": "^17.0.5",
23
- "@types/jest": "^26.0.0",
24
- "@babel/runtime": "7.20.0",
25
- "@types/testing-library__jest-dom": "5.9.5"
18
+ "@teambit/react.v17.react-env": "1.1.6"
26
19
  },
27
20
  "peerDependencies": {
28
- "react-router-dom": "^6.0.0",
29
21
  "react": "^16.8.0 || ^17.0.0",
30
- "react-dom": "^16.8.0 || ^17.0.0"
22
+ "react-router-dom": "^6.16.0",
23
+ "@types/react": "^17.0.0",
24
+ "@teambit/base-react.navigation.link": "2.0.27"
31
25
  },
32
26
  "license": "Apache-2.0",
27
+ "optionalDependencies": {},
28
+ "peerDependenciesMeta": {},
33
29
  "private": false,
34
30
  "engines": {
35
31
  "node": ">=12.22.0"
@@ -48,4 +44,4 @@
48
44
  "angular",
49
45
  "angular-components"
50
46
  ]
51
- }
47
+ }
package/slot-router.tsx CHANGED
@@ -18,6 +18,12 @@ export type SlotRouterProps = PropsWithChildren<{
18
18
  parentPath?: string;
19
19
  }>;
20
20
 
21
+ function toKey(route: RouteProps) {
22
+ if (route.path) return route.path;
23
+ if (route.index) return '/';
24
+ return '.';
25
+ }
26
+
21
27
  export function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }: SlotRouterProps) {
22
28
  const routes = routesFromProps || (slot && flatten(slot.values())) || [];
23
29
  const withRoot = routes.concat(rootRoutes || []);
@@ -44,9 +50,3 @@ export function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children
44
50
  </Routes>
45
51
  );
46
52
  }
47
-
48
- function toKey(route: RouteProps) {
49
- if (route.path) return route.path;
50
- if (route.index) return '/';
51
- return '.';
52
- }
package/tsconfig.json CHANGED
@@ -1,29 +1,36 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
8
7
  ],
9
- "target": "es2015",
10
- "module": "CommonJS",
11
- "jsx": "react",
12
- "allowJs": true,
13
- "composite": true,
8
+ "target": "es2020",
9
+ "module": "es2020",
10
+ "jsx": "react-jsx",
14
11
  "declaration": true,
15
12
  "sourceMap": true,
16
- "skipLibCheck": true,
17
13
  "experimentalDecorators": true,
18
- "outDir": "dist",
14
+ "skipLibCheck": true,
19
15
  "moduleResolution": "node",
20
16
  "esModuleInterop": true,
21
- "rootDir": ".",
22
- "resolveJsonModule": true
17
+ "resolveJsonModule": true,
18
+ "allowJs": true,
19
+ "outDir": "dist",
20
+ "strict": true,
21
+ "emitDecoratorMetadata": true,
22
+ "preserveConstEnums": true,
23
+ "strictPropertyInitialization": false,
24
+ "noImplicitAny": false
23
25
  },
24
26
  "exclude": [
27
+ "artifacts",
28
+ "public",
25
29
  "dist",
26
- "package.json"
30
+ "node_modules",
31
+ "package.json",
32
+ "**/*.cjs",
33
+ "./dist"
27
34
  ],
28
35
  "include": [
29
36
  "**/*",
package/types/asset.d.ts CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
5
5
  declare module '*.svg' {
6
6
  import type { FunctionComponent, SVGProps } from 'react';
7
7
 
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
9
11
  const src: string;
10
12
  export default src;
11
13
  }
12
-
13
- // @TODO Gilad
14
14
  declare module '*.jpg' {
15
15
  const value: any;
16
16
  export = value;
@@ -27,3 +27,15 @@ declare module '*.bmp' {
27
27
  const value: any;
28
28
  export = value;
29
29
  }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }