@teambit/component 0.0.712 → 0.0.715
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/ui/use-component.js +4 -3
- package/dist/ui/use-component.js.map +1 -1
- package/package-tar/teambit-component-0.0.715.tgz +0 -0
- package/package.json +23 -23
- package/{preview-1650511604919.js → preview-1650770571653.js} +2 -2
- package/ui/use-component.tsx +8 -4
- package/package-tar/teambit-component-0.0.712.tgz +0 -0
package/dist/ui/use-component.js
CHANGED
|
@@ -62,13 +62,14 @@ function useComponent(host, id) {
|
|
|
62
62
|
if (!targetId) throw new TypeError('useComponent received no component id');
|
|
63
63
|
const currentLane = lanesContext === null || lanesContext === void 0 ? void 0 : lanesContext.viewedLane; // when on a lane, always fetch all the logs starting from the 'head' version
|
|
64
64
|
|
|
65
|
-
const
|
|
65
|
+
const laneComponentId = lanesContext === null || lanesContext === void 0 ? void 0 : (_lanesContext$viewedL = lanesContext.viewedLane) === null || _lanesContext$viewedL === void 0 ? void 0 : (_lanesContext$viewedL2 = _lanesContext$viewedL.components.find(component => component.id.fullName === targetId)) === null || _lanesContext$viewedL2 === void 0 ? void 0 : _lanesContext$viewedL2.id;
|
|
66
|
+
const componentIdStr = laneComponentId ? laneComponentId === null || laneComponentId === void 0 ? void 0 : laneComponentId.toString() : withVersion(targetId, version);
|
|
66
67
|
const logFilters = currentLane ? {
|
|
67
68
|
log: {
|
|
68
|
-
logHead
|
|
69
|
+
logHead: laneComponentId === null || laneComponentId === void 0 ? void 0 : laneComponentId.version
|
|
69
70
|
}
|
|
70
71
|
} : undefined;
|
|
71
|
-
return (0, _useComponentQuery().useComponentQuery)(
|
|
72
|
+
return (0, _useComponentQuery().useComponentQuery)(componentIdStr, host, logFilters);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
function withVersion(id, version) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["use-component.tsx"],"names":["useComponent","host","id","params","componentId","query","version","get","undefined","lanesContext","targetId","toString","ignoreVersion","TypeError","currentLane","viewedLane","
|
|
1
|
+
{"version":3,"sources":["use-component.tsx"],"names":["useComponent","host","id","params","componentId","query","version","get","undefined","lanesContext","targetId","toString","ignoreVersion","TypeError","currentLane","viewedLane","laneComponentId","components","find","component","fullName","componentIdStr","withVersion","logFilters","log","logHead","includes"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,SAASA,YAAT,CAAsBC,IAAtB,EAAoCC,EAApC,EAAiE;AAAA;;AACtE,QAAM;AACJC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADJ,MAEF,sCAFJ;AAGA,QAAMC,KAAK,GAAG,4CAAd;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,GAAN,CAAU,SAAV,KAAwBC,SAAxC;AACA,QAAMC,YAAY,GAAG,iCAArB;AACA,QAAMC,QAAQ,GAAG,CAAAR,EAAE,SAAF,IAAAA,EAAE,WAAF,YAAAA,EAAE,CAAES,QAAJ,CAAa;AAAEC,IAAAA,aAAa,EAAE;AAAjB,GAAb,MAAyCR,WAA1D;AACA,MAAI,CAACM,QAAL,EAAe,MAAM,IAAIG,SAAJ,CAAc,uCAAd,CAAN;AACf,QAAMC,WAAW,GAAGL,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEM,UAAlC,CATsE,CAUtE;;AACA,QAAMC,eAAe,GAAGP,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEM,UAAjB,oFAAG,sBAA0BE,UAA1B,CAAqCC,IAArC,CACrBC,SAAD,IAAeA,SAAS,CAACjB,EAAV,CAAakB,QAAb,KAA0BV,QADnB,CAAH,2DAAG,uBAErBR,EAFH;AAIA,QAAMmB,cAAc,GAAGL,eAAe,GAAGA,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAEL,QAAjB,EAAH,GAAiCW,WAAW,CAACZ,QAAD,EAAWJ,OAAX,CAAlF;AAEA,QAAMiB,UAAU,GAAGT,WAAW,GAC1B;AACEU,IAAAA,GAAG,EAAE;AACHC,MAAAA,OAAO,EAAET,eAAF,aAAEA,eAAF,uBAAEA,eAAe,CAAEV;AADvB;AADP,GAD0B,GAM1BE,SANJ;AAQA,SAAO,4CAAkBa,cAAlB,EAAkCpB,IAAlC,EAAwCsB,UAAxC,CAAP;AACD;;AAED,SAASD,WAAT,CAAqBpB,EAArB,EAAiCI,OAAjC,EAAmD;AACjD,MAAI,CAACA,OAAL,EAAc,OAAOJ,EAAP;AACd,MAAIA,EAAE,CAACwB,QAAH,CAAY,GAAZ,CAAJ,EAAsB,OAAOxB,EAAP;AACtB,SAAQ,GAAEA,EAAG,IAAGI,OAAQ,EAAxB;AACD","sourcesContent":["import { useRouteMatch } from 'react-router-dom';\nimport { ComponentID } from '@teambit/component-id';\nimport { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\nimport { useComponentQuery } from './use-component-query';\n\nexport type Component = {\n component?: ComponentModel;\n error?: ComponentError;\n componentDescriptor?: ComponentDescriptor;\n};\n\ntype ComponentRoute = {\n componentId?: string;\n};\n\nexport function useComponent(host: string, id?: ComponentID): Component {\n const {\n params: { componentId },\n } = useRouteMatch<ComponentRoute>();\n const query = useQuery();\n const version = query.get('version') || undefined;\n const lanesContext = useLanesContext();\n const targetId = id?.toString({ ignoreVersion: true }) || componentId;\n if (!targetId) throw new TypeError('useComponent received no component id');\n const currentLane = lanesContext?.viewedLane;\n // when on a lane, always fetch all the logs starting from the 'head' version\n const laneComponentId = lanesContext?.viewedLane?.components.find(\n (component) => component.id.fullName === targetId\n )?.id;\n\n const componentIdStr = laneComponentId ? laneComponentId?.toString() : withVersion(targetId, version);\n\n const logFilters = currentLane\n ? {\n log: {\n logHead: laneComponentId?.version,\n },\n }\n : undefined;\n\n return useComponentQuery(componentIdStr, host, logFilters);\n}\n\nfunction withVersion(id: string, version?: string) {\n if (!version) return id;\n if (id.includes('@')) return id;\n return `${id}@${version}`;\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.715",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.715"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -25,50 +25,50 @@
|
|
|
25
25
|
"core-js": "^3.0.0",
|
|
26
26
|
"@teambit/harmony": "0.3.3",
|
|
27
27
|
"@teambit/base-ui.routing.nav-link": "1.0.0",
|
|
28
|
-
"@teambit/explorer.ui.command-bar": "1.0.2",
|
|
29
28
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
30
29
|
"@teambit/documenter.ui.separator": "4.1.1",
|
|
30
|
+
"@teambit/explorer.ui.command-bar": "1.0.2",
|
|
31
31
|
"@teambit/base-ui.layout.breakpoints": "1.0.0",
|
|
32
32
|
"@teambit/base-ui.routing.routing-provider": "1.0.0",
|
|
33
33
|
"@teambit/design.elements.icon": "1.0.5",
|
|
34
34
|
"@teambit/design.inputs.dropdown": "0.0.7",
|
|
35
35
|
"@teambit/component-id": "0.0.402",
|
|
36
36
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.488",
|
|
37
|
-
"@teambit/aspect-loader": "0.0.
|
|
37
|
+
"@teambit/aspect-loader": "0.0.715",
|
|
38
38
|
"@teambit/legacy-bit-id": "0.0.399",
|
|
39
39
|
"@teambit/toolbox.string.capitalize": "0.0.483",
|
|
40
|
-
"@teambit/cli": "0.0.
|
|
41
|
-
"@teambit/config": "0.0.
|
|
42
|
-
"@teambit/express": "0.0.
|
|
43
|
-
"@teambit/graphql": "0.0.
|
|
40
|
+
"@teambit/cli": "0.0.476",
|
|
41
|
+
"@teambit/config": "0.0.489",
|
|
42
|
+
"@teambit/express": "0.0.572",
|
|
43
|
+
"@teambit/graphql": "0.0.715",
|
|
44
44
|
"@teambit/bit-error": "0.0.394",
|
|
45
|
-
"@teambit/command-bar": "0.0.
|
|
45
|
+
"@teambit/command-bar": "0.0.715",
|
|
46
46
|
"@teambit/component.ui.deprecation-icon": "0.0.493",
|
|
47
|
-
"@teambit/preview": "0.0.
|
|
48
|
-
"@teambit/pubsub": "0.0.
|
|
49
|
-
"@teambit/react-router": "0.0.
|
|
47
|
+
"@teambit/preview": "0.0.715",
|
|
48
|
+
"@teambit/pubsub": "0.0.715",
|
|
49
|
+
"@teambit/react-router": "0.0.715",
|
|
50
50
|
"@teambit/ui-foundation.ui.is-browser": "0.0.486",
|
|
51
51
|
"@teambit/ui-foundation.ui.main-dropdown": "0.0.487",
|
|
52
52
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.489",
|
|
53
53
|
"@teambit/ui-foundation.ui.use-box.menu": "0.0.114",
|
|
54
|
-
"@teambit/ui": "0.0.
|
|
54
|
+
"@teambit/ui": "0.0.715",
|
|
55
55
|
"@teambit/component-issues": "0.0.50",
|
|
56
56
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487",
|
|
57
57
|
"@teambit/cli-table": "0.0.34",
|
|
58
|
-
"@teambit/component-descriptor": "0.0.
|
|
59
|
-
"@teambit/lanes.ui.lanes": "0.0.
|
|
58
|
+
"@teambit/component-descriptor": "0.0.39",
|
|
59
|
+
"@teambit/lanes.ui.lanes": "0.0.42",
|
|
60
60
|
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.486",
|
|
61
|
+
"@teambit/design.ui.empty-box": "0.0.353",
|
|
62
|
+
"@teambit/harmony.ui.aspect-box": "0.0.486",
|
|
61
63
|
"@teambit/design.ui.pages.not-found": "0.0.354",
|
|
62
64
|
"@teambit/design.ui.pages.server-error": "0.0.354",
|
|
63
|
-
"@teambit/compositions": "0.0.
|
|
64
|
-
"@teambit/deprecation": "0.0.
|
|
65
|
-
"@teambit/envs": "0.0.
|
|
65
|
+
"@teambit/compositions": "0.0.715",
|
|
66
|
+
"@teambit/deprecation": "0.0.715",
|
|
67
|
+
"@teambit/envs": "0.0.715",
|
|
66
68
|
"@teambit/legacy-component-log": "0.0.392",
|
|
67
69
|
"@teambit/design.ui.styles.ellipsis": "0.0.347",
|
|
68
70
|
"@teambit/envs.ui.env-icon": "0.0.486",
|
|
69
|
-
"@teambit/
|
|
70
|
-
"@teambit/harmony.ui.aspect-box": "0.0.486",
|
|
71
|
-
"@teambit/component.ui.version-dropdown": "0.0.525",
|
|
71
|
+
"@teambit/component.ui.version-dropdown": "0.0.527",
|
|
72
72
|
"@teambit/ui-foundation.ui.full-loader": "0.0.486",
|
|
73
73
|
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.114",
|
|
74
74
|
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@apollo/client": "^3.0.0",
|
|
95
|
-
"@teambit/legacy": "1.0.
|
|
95
|
+
"@teambit/legacy": "1.0.256",
|
|
96
96
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
97
97
|
"react": "^16.8.0 || ^17.0.0"
|
|
98
98
|
},
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"react": "-"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
|
-
"@teambit/legacy": "1.0.
|
|
123
|
+
"@teambit/legacy": "1.0.256",
|
|
124
124
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
125
125
|
"react": "^16.8.0 || ^17.0.0"
|
|
126
126
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.715/dist/component.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.715/dist/component.docs.mdx')]
|
package/ui/use-component.tsx
CHANGED
|
@@ -28,17 +28,21 @@ export function useComponent(host: string, id?: ComponentID): Component {
|
|
|
28
28
|
if (!targetId) throw new TypeError('useComponent received no component id');
|
|
29
29
|
const currentLane = lanesContext?.viewedLane;
|
|
30
30
|
// when on a lane, always fetch all the logs starting from the 'head' version
|
|
31
|
-
const
|
|
32
|
-
.
|
|
31
|
+
const laneComponentId = lanesContext?.viewedLane?.components.find(
|
|
32
|
+
(component) => component.id.fullName === targetId
|
|
33
|
+
)?.id;
|
|
34
|
+
|
|
35
|
+
const componentIdStr = laneComponentId ? laneComponentId?.toString() : withVersion(targetId, version);
|
|
36
|
+
|
|
33
37
|
const logFilters = currentLane
|
|
34
38
|
? {
|
|
35
39
|
log: {
|
|
36
|
-
logHead,
|
|
40
|
+
logHead: laneComponentId?.version,
|
|
37
41
|
},
|
|
38
42
|
}
|
|
39
43
|
: undefined;
|
|
40
44
|
|
|
41
|
-
return useComponentQuery(
|
|
45
|
+
return useComponentQuery(componentIdStr, host, logFilters);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
function withVersion(id: string, version?: string) {
|
|
Binary file
|