@teambit/lanes.hooks.use-viewed-lane-from-url 0.0.1
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 +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.json +32 -0
- package/dist/use-viewed-lane-from-url.d.ts +2 -0
- package/dist/use-viewed-lane-from-url.js +14 -0
- package/dist/use-viewed-lane-from-url.js.map +1 -0
- package/index.ts +1 -0
- package/package-tar/teambit-lanes.hooks.use-viewed-lane-from-url-0.0.1.tgz +0 -0
- package/package.json +42 -0
- package/preview-1664735485436.js +7 -0
- package/tsconfig.json +32 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
- package/use-viewed-lane-from-url.ts +13 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewedLaneFromUrl } from './use-viewed-lane-from-url';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useViewedLaneFromUrl = void 0;
|
|
4
|
+
var use_viewed_lane_from_url_1 = require("./use-viewed-lane-from-url");
|
|
5
|
+
Object.defineProperty(exports, "useViewedLaneFromUrl", { enumerable: true, get: function () { return use_viewed_lane_from_url_1.useViewedLaneFromUrl; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAAzD,gIAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useViewedLaneFromUrl = void 0;
|
|
4
|
+
const base_react_navigation_link_1 = require("@teambit/base-react.navigation.link");
|
|
5
|
+
const ui_foundation_ui_react_router_use_query_1 = require("@teambit/ui-foundation.ui.react-router.use-query");
|
|
6
|
+
const lanes_ui_models_lanes_model_1 = require("@teambit/lanes.ui.models.lanes-model");
|
|
7
|
+
function useViewedLaneFromUrl() {
|
|
8
|
+
const location = (0, base_react_navigation_link_1.useLocation)();
|
|
9
|
+
const query = (0, ui_foundation_ui_react_router_use_query_1.useQuery)();
|
|
10
|
+
const viewedLaneFromUrl = ((location === null || location === void 0 ? void 0 : location.pathname) && lanes_ui_models_lanes_model_1.LanesModel.getLaneIdFromPathname(location === null || location === void 0 ? void 0 : location.pathname, query)) || undefined;
|
|
11
|
+
return viewedLaneFromUrl;
|
|
12
|
+
}
|
|
13
|
+
exports.useViewedLaneFromUrl = useViewedLaneFromUrl;
|
|
14
|
+
//# sourceMappingURL=use-viewed-lane-from-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-viewed-lane-from-url.js","sourceRoot":"","sources":["../use-viewed-lane-from-url.ts"],"names":[],"mappings":";;;AAAA,oFAAkE;AAClE,8GAA4E;AAE5E,sFAAkE;AAElE,SAAgB,oBAAoB;IAClC,MAAM,QAAQ,GAAG,IAAA,wCAAW,GAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAA,kDAAQ,GAAE,CAAC;IAEzB,MAAM,iBAAiB,GACrB,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,KAAI,wCAAU,CAAC,qBAAqB,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC;IACnG,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAPD,oDAOC"}
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewedLaneFromUrl } from './use-viewed-lane-from-url';
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teambit/lanes.hooks.use-viewed-lane-from-url",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"componentId": {
|
|
6
|
+
"scope": "teambit.lanes",
|
|
7
|
+
"name": "hooks/use-viewed-lane-from-url",
|
|
8
|
+
"version": "0.0.1"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@teambit/base-react.navigation.link": "2.0.27",
|
|
12
|
+
"@teambit/lane-id": "0.0.97",
|
|
13
|
+
"@teambit/lanes.ui.models.lanes-model": "0.0.1",
|
|
14
|
+
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.493"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/mocha": "9.1.0",
|
|
18
|
+
"@babel/runtime": "7.12.18",
|
|
19
|
+
"@types/node": "12.20.4",
|
|
20
|
+
"@types/jest": "26.0.20"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"private": false,
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=12.22.0"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/teambit/bit"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"bit",
|
|
34
|
+
"components",
|
|
35
|
+
"collaboration",
|
|
36
|
+
"web",
|
|
37
|
+
"react",
|
|
38
|
+
"react-components",
|
|
39
|
+
"angular",
|
|
40
|
+
"angular-components"
|
|
41
|
+
]
|
|
42
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module '*.png' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export = value;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
+
|
|
8
|
+
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
+
const src: string;
|
|
10
|
+
export default src;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @TODO Gilad
|
|
14
|
+
declare module '*.jpg' {
|
|
15
|
+
const value: any;
|
|
16
|
+
export = value;
|
|
17
|
+
}
|
|
18
|
+
declare module '*.jpeg' {
|
|
19
|
+
const value: any;
|
|
20
|
+
export = value;
|
|
21
|
+
}
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: any;
|
|
24
|
+
export = value;
|
|
25
|
+
}
|
|
26
|
+
declare module '*.bmp' {
|
|
27
|
+
const value: any;
|
|
28
|
+
export = value;
|
|
29
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.module.css' {
|
|
2
|
+
const classes: { readonly [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.module.scss' {
|
|
6
|
+
const classes: { readonly [key: string]: string };
|
|
7
|
+
export default classes;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.module.sass' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.module.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const classes: { readonly [key: string]: string };
|
|
21
|
+
export default classes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.css' {
|
|
25
|
+
const classes: { readonly [key: string]: string };
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.sass' {
|
|
30
|
+
const classes: { readonly [key: string]: string };
|
|
31
|
+
export default classes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.scss' {
|
|
35
|
+
const classes: { readonly [key: string]: string };
|
|
36
|
+
export default classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.mdx' {
|
|
40
|
+
const component: any;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useLocation } from '@teambit/base-react.navigation.link';
|
|
2
|
+
import { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';
|
|
3
|
+
import { LaneId } from '@teambit/lane-id';
|
|
4
|
+
import { LanesModel } from '@teambit/lanes.ui.models.lanes-model';
|
|
5
|
+
|
|
6
|
+
export function useViewedLaneFromUrl(): LaneId | undefined {
|
|
7
|
+
const location = useLocation();
|
|
8
|
+
const query = useQuery();
|
|
9
|
+
|
|
10
|
+
const viewedLaneFromUrl =
|
|
11
|
+
(location?.pathname && LanesModel.getLaneIdFromPathname(location?.pathname, query)) || undefined;
|
|
12
|
+
return viewedLaneFromUrl;
|
|
13
|
+
}
|