@teambit/docs 0.0.629 → 0.0.633
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/{__preview-1642994756471.js → __preview-1643219209460.js} +0 -0
- package/dist/docs.ui.runtime.d.ts +14 -1
- package/dist/docs.ui.runtime.js +34 -2
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/overview/index.d.ts +1 -0
- package/dist/overview/index.js.map +1 -1
- package/dist/overview/overview.d.ts +7 -1
- package/dist/overview/overview.js +80 -1
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview/overview.module.scss +10 -0
- package/dist/overview.section.js +3 -1
- package/dist/overview.section.js.map +1 -1
- package/docs.ui.runtime.tsx +24 -2
- package/overview/index.ts +1 -0
- package/overview/overview.module.scss +10 -0
- package/overview/overview.tsx +40 -1
- package/overview.section.tsx +1 -1
- package/package-tar/teambit-docs-0.0.633.tgz +0 -0
- package/package.json +21 -17
- package/package-tar/teambit-docs-0.0.629.tgz +0 -0
|
File without changes
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { ComponentUI } from '@teambit/component';
|
|
2
|
+
import type { TitleBadge } from '@teambit/component.ui.component-meta';
|
|
3
|
+
import { TitleBadgeSlot } from './overview';
|
|
2
4
|
export declare class DocsUI {
|
|
5
|
+
readonly titleBadgeSlot: TitleBadgeSlot;
|
|
6
|
+
constructor(titleBadgeSlot: TitleBadgeSlot);
|
|
7
|
+
/**
|
|
8
|
+
* register a new title badge into the overview section of a component.
|
|
9
|
+
*/
|
|
10
|
+
registerTitleBadge(...titleBadge: TitleBadge[]): this;
|
|
11
|
+
/**
|
|
12
|
+
* list all title badges registered.
|
|
13
|
+
*/
|
|
14
|
+
listTitleBadges(): TitleBadgeSlot;
|
|
3
15
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
4
16
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
5
|
-
static
|
|
17
|
+
static slots: ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<TitleBadge>)[];
|
|
18
|
+
static provider([component]: [ComponentUI], config: any, [titleBadgeSlot]: [TitleBadgeSlot]): Promise<DocsUI>;
|
|
6
19
|
}
|
|
7
20
|
export default DocsUI;
|
package/dist/docs.ui.runtime.js
CHANGED
|
@@ -31,6 +31,16 @@ function _component() {
|
|
|
31
31
|
return data;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function _harmony() {
|
|
35
|
+
const data = require("@teambit/harmony");
|
|
36
|
+
|
|
37
|
+
_harmony = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
function _ui() {
|
|
35
45
|
const data = require("@teambit/ui");
|
|
36
46
|
|
|
@@ -62,8 +72,29 @@ function _overview() {
|
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
class DocsUI {
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
constructor(titleBadgeSlot) {
|
|
76
|
+
this.titleBadgeSlot = titleBadgeSlot;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* register a new title badge into the overview section of a component.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
registerTitleBadge(...titleBadge) {
|
|
84
|
+
this.titleBadgeSlot.register(titleBadge);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* list all title badges registered.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
listTitleBadges() {
|
|
93
|
+
return this.titleBadgeSlot;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static async provider([component], config, [titleBadgeSlot]) {
|
|
97
|
+
const docs = new DocsUI(titleBadgeSlot);
|
|
67
98
|
const section = new (_overview().OverviewSection)(docs);
|
|
68
99
|
component.registerRoute(section.route);
|
|
69
100
|
component.registerNavigation(section.navigationLink, section.order);
|
|
@@ -75,6 +106,7 @@ class DocsUI {
|
|
|
75
106
|
exports.DocsUI = DocsUI;
|
|
76
107
|
(0, _defineProperty2().default)(DocsUI, "dependencies", [_component().ComponentAspect]);
|
|
77
108
|
(0, _defineProperty2().default)(DocsUI, "runtime", _ui().UIRuntime);
|
|
109
|
+
(0, _defineProperty2().default)(DocsUI, "slots", [_harmony().Slot.withType()]);
|
|
78
110
|
var _default = DocsUI;
|
|
79
111
|
exports.default = _default;
|
|
80
112
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["docs.ui.runtime.tsx"],"names":["DocsUI","provider","component","docs","section","OverviewSection","registerRoute","route","registerNavigation","navigationLink","order","ComponentAspect","UIRuntime","DocsAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;
|
|
1
|
+
{"version":3,"sources":["docs.ui.runtime.tsx"],"names":["DocsUI","constructor","titleBadgeSlot","registerTitleBadge","titleBadge","register","listTitleBadges","provider","component","config","docs","section","OverviewSection","registerRoute","route","registerNavigation","navigationLink","order","ComponentAspect","UIRuntime","Slot","withType","DocsAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,MAAN,CAAa;AAClBC,EAAAA,WAAW,CAAUC,cAAV,EAA0C;AAAA,SAAhCA,cAAgC,GAAhCA,cAAgC;AAAE;AAEvD;AACF;AACA;;;AACEC,EAAAA,kBAAkB,CAAC,GAAGC,UAAJ,EAA8B;AAC9C,SAAKF,cAAL,CAAoBG,QAApB,CAA6BD,UAA7B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;;;AACEE,EAAAA,eAAe,GAAG;AAChB,WAAO,KAAKJ,cAAZ;AACD;;AAQoB,eAARK,QAAQ,CAAC,CAACC,SAAD,CAAD,EAA6BC,MAA7B,EAAqC,CAACP,cAAD,CAArC,EAAyE;AAC5F,UAAMQ,IAAI,GAAG,IAAIV,MAAJ,CAAWE,cAAX,CAAb;AACA,UAAMS,OAAO,GAAG,KAAIC,2BAAJ,EAAoBF,IAApB,CAAhB;AAEAF,IAAAA,SAAS,CAACK,aAAV,CAAwBF,OAAO,CAACG,KAAhC;AACAN,IAAAA,SAAS,CAACO,kBAAV,CAA6BJ,OAAO,CAACK,cAArC,EAAqDL,OAAO,CAACM,KAA7D;AAEA,WAAOP,IAAP;AACD;;AAhCiB;;;gCAAPV,M,kBAkBW,CAACkB,4BAAD,C;gCAlBXlB,M,aAoBMmB,e;gCApBNnB,M,WAsBI,CAACoB,gBAAKC,QAAL,EAAD,C;eAaFrB,M;;;AAEfsB,mBAAWC,UAAX,CAAsBvB,MAAtB","sourcesContent":["import { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { Slot } from '@teambit/harmony';\nimport type { TitleBadge } from '@teambit/component.ui.component-meta';\nimport { UIRuntime } from '@teambit/ui';\n\nimport { DocsAspect } from './docs.aspect';\nimport { OverviewSection } from './overview.section';\nimport { TitleBadgeSlot } from './overview';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot) {}\n\n /**\n * register a new title badge into the overview section of a component.\n */\n registerTitleBadge(...titleBadge: TitleBadge[]) {\n this.titleBadgeSlot.register(titleBadge);\n return this;\n }\n\n /**\n * list all title badges registered.\n */\n listTitleBadges() {\n return this.titleBadgeSlot;\n }\n\n static dependencies = [ComponentAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>()];\n\n static async provider([component]: [ComponentUI], config, [titleBadgeSlot]: [TitleBadgeSlot]) {\n const docs = new DocsUI(titleBadgeSlot);\n const section = new OverviewSection(docs);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n\n return docs;\n }\n}\n\nexport default DocsUI;\n\nDocsAspect.addRuntime(DocsUI);\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export type { DocsUI } from './docs.ui.runtime';
|
|
|
4
4
|
export type { DocsPreview } from './docs.preview.runtime';
|
|
5
5
|
export type { DocReader } from './doc-reader';
|
|
6
6
|
export { Doc, DocProp, DocPropList } from './doc';
|
|
7
|
+
export type { TitleBadgeSlot } from './overview';
|
|
7
8
|
export { DocsAspect };
|
|
8
9
|
export default DocsAspect;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["DocsAspect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["DocsAspect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAKeA,kB","sourcesContent":["import { DocsAspect } from './docs.aspect';\n\nexport type { DocsMain } from './docs.main.runtime';\nexport type { DocsUI } from './docs.ui.runtime';\nexport type { DocsPreview } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\nexport { Doc, DocProp, DocPropList } from './doc';\n\nexport type { TitleBadgeSlot } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"]}
|
package/dist/overview/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["export { Overview } from './overview';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["export { Overview } from './overview';\nexport type { TitleBadgeSlot } from './overview';\n"]}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import type { SlotRegistry } from '@teambit/harmony';
|
|
3
|
+
import { TitleBadge } from '@teambit/component.ui.component-meta';
|
|
4
|
+
export declare type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
|
|
5
|
+
export declare type OverviewProps = {
|
|
6
|
+
titleBadges: TitleBadgeSlot;
|
|
7
|
+
};
|
|
8
|
+
export declare function Overview({ titleBadges }: OverviewProps): JSX.Element;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.description.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.array.iterator.js");
|
|
8
|
+
|
|
3
9
|
Object.defineProperty(exports, "__esModule", {
|
|
4
10
|
value: true
|
|
5
11
|
});
|
|
@@ -15,6 +21,16 @@ function _react() {
|
|
|
15
21
|
return data;
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
function _lodash() {
|
|
25
|
+
const data = _interopRequireDefault(require("lodash.flatten"));
|
|
26
|
+
|
|
27
|
+
_lodash = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
function _component() {
|
|
19
35
|
const data = require("@teambit/component");
|
|
20
36
|
|
|
@@ -45,12 +61,50 @@ function _designUiSurfaces() {
|
|
|
45
61
|
return data;
|
|
46
62
|
}
|
|
47
63
|
|
|
64
|
+
function _componentUi() {
|
|
65
|
+
const data = require("@teambit/component.ui.component-meta");
|
|
66
|
+
|
|
67
|
+
_componentUi = function () {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _componentUiHooks() {
|
|
75
|
+
const data = require("@teambit/component.ui.hooks.use-fetch-docs");
|
|
76
|
+
|
|
77
|
+
_componentUiHooks = function () {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _overviewModule() {
|
|
85
|
+
const data = _interopRequireDefault(require("./overview.module.scss"));
|
|
86
|
+
|
|
87
|
+
_overviewModule = function () {
|
|
88
|
+
return data;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
|
|
48
94
|
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); }
|
|
49
95
|
|
|
50
96
|
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; }
|
|
51
97
|
|
|
52
|
-
function Overview(
|
|
98
|
+
function Overview({
|
|
99
|
+
titleBadges
|
|
100
|
+
}) {
|
|
101
|
+
var _component$preview;
|
|
102
|
+
|
|
53
103
|
const component = (0, _react().useContext)(_component().ComponentContext);
|
|
104
|
+
const {
|
|
105
|
+
data
|
|
106
|
+
} = (0, _componentUiHooks().useFetchDocs)(component.id.toString());
|
|
107
|
+
const fetchComponent = data === null || data === void 0 ? void 0 : data.component;
|
|
54
108
|
if ((component === null || component === void 0 ? void 0 : component.buildStatus) === 'pending' && (component === null || component === void 0 ? void 0 : component.host) === 'teambit.scope/scope') return /*#__PURE__*/_react().default.createElement(_designUiSurfaces().StatusMessageCard, {
|
|
55
109
|
style: {
|
|
56
110
|
margin: 'auto'
|
|
@@ -65,6 +119,31 @@ function Overview() {
|
|
|
65
119
|
status: "FAILURE",
|
|
66
120
|
title: "failed to get component preview "
|
|
67
121
|
});
|
|
122
|
+
|
|
123
|
+
if (((_component$preview = component.preview) === null || _component$preview === void 0 ? void 0 : _component$preview.includesEnvTemplate) === false) {
|
|
124
|
+
const labels = component.labels.length > 0 ? component.labels : fetchComponent === null || fetchComponent === void 0 ? void 0 : fetchComponent.labels;
|
|
125
|
+
const badges = (0, _lodash().default)(titleBadges.values());
|
|
126
|
+
return /*#__PURE__*/_react().default.createElement("div", {
|
|
127
|
+
className: _overviewModule().default.overviewWrapper
|
|
128
|
+
}, /*#__PURE__*/_react().default.createElement(_componentUi().ComponentOverview, {
|
|
129
|
+
className: _overviewModule().default.componentOverviewBlock,
|
|
130
|
+
displayName: component.displayName,
|
|
131
|
+
version: component.version,
|
|
132
|
+
abstract: component.description || (fetchComponent === null || fetchComponent === void 0 ? void 0 : fetchComponent.description),
|
|
133
|
+
labels: labels || [],
|
|
134
|
+
packageName: component.packageName,
|
|
135
|
+
titleBadges: badges
|
|
136
|
+
}), /*#__PURE__*/_react().default.createElement(_previewUi().ComponentPreview, {
|
|
137
|
+
component: component,
|
|
138
|
+
style: {
|
|
139
|
+
width: '100%',
|
|
140
|
+
height: '100%'
|
|
141
|
+
},
|
|
142
|
+
previewName: "overview",
|
|
143
|
+
fullContentHeight: true
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
|
|
68
147
|
return /*#__PURE__*/_react().default.createElement(_previewUi().ComponentPreview, {
|
|
69
148
|
component: component,
|
|
70
149
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["overview.tsx"],"names":["Overview","component","ComponentContext","buildStatus","host","margin","width","height"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["overview.tsx"],"names":["Overview","titleBadges","component","ComponentContext","data","id","toString","fetchComponent","buildStatus","host","margin","preview","includesEnvTemplate","labels","length","badges","values","styles","overviewWrapper","componentOverviewBlock","displayName","version","description","packageName","width","height"],"mappings":"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","sourcesContent":["import React, { useContext } from 'react';\nimport flatten from 'lodash.flatten';\nimport { ComponentContext } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview } from '@teambit/preview.ui.component-preview';\nimport { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview, TitleBadge } from '@teambit/component.ui.component-meta';\nimport { useFetchDocs } from '@teambit/component.ui.hooks.use-fetch-docs';\nimport styles from './overview.module.scss';\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n};\n\nexport function Overview({ titleBadges }: OverviewProps) {\n const component = useContext(ComponentContext);\n const { data } = useFetchDocs(component.id.toString());\n const fetchComponent = data?.component;\n if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard style={{ margin: 'auto' }} status=\"PROCESSING\" title=\"component preview pending\">\n this might take some time\n </StatusMessageCard>\n );\n if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard\n style={{ margin: 'auto' }}\n status=\"FAILURE\"\n title=\"failed to get component preview \"\n ></StatusMessageCard>\n );\n\n if (component.preview?.includesEnvTemplate === false) {\n const labels = component.labels.length > 0 ? component.labels : fetchComponent?.labels;\n const badges = flatten(titleBadges.values());\n\n return (\n <div className={styles.overviewWrapper}>\n <ComponentOverview\n className={styles.componentOverviewBlock}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description || fetchComponent?.description}\n labels={labels || []}\n packageName={component.packageName}\n titleBadges={badges}\n />\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n />\n </div>\n );\n }\n\n return <ComponentPreview component={component} style={{ width: '100%', height: '100%' }} previewName=\"overview\" />;\n}\n"]}
|
package/dist/overview.section.js
CHANGED
|
@@ -52,7 +52,9 @@ class OverviewSection {
|
|
|
52
52
|
(0, _defineProperty2().default)(this, "route", {
|
|
53
53
|
path: '',
|
|
54
54
|
exact: true,
|
|
55
|
-
children: /*#__PURE__*/_react().default.createElement(_overview().Overview,
|
|
55
|
+
children: /*#__PURE__*/_react().default.createElement(_overview().Overview, {
|
|
56
|
+
titleBadges: this.docs.titleBadgeSlot
|
|
57
|
+
})
|
|
56
58
|
});
|
|
57
59
|
(0, _defineProperty2().default)(this, "order", 10);
|
|
58
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["overview.section.tsx"],"names":["OverviewSection","constructor","docs","href","exact","children","path"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,eAAN,CAAyC;AAC9CC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,IAJC,EAKT;AAAA,SADQA,IACR,GADQA,IACR;AAAA,4DAEe;AACfC,MAAAA,IAAI,EAAE,EADS;AAEfC,MAAAA,KAAK,EAAE,IAFQ;AAGfC,MAAAA,QAAQ,EAAE;AAHK,KAFf;AAAA,mDAQM;AACNC,MAAAA,IAAI,EAAE,EADA;AAENF,MAAAA,KAAK,EAAE,IAFD;AAGNC,MAAAA,QAAQ,eAAE,+BAAC,oBAAD;AAHJ,KARN;AAAA,mDAcM,EAdN;AAAE;;AAN0C","sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\n\nimport { DocsUI } from './docs.ui.runtime';\nimport { Overview } from './overview';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * docs ui extension.\n */\n private docs: DocsUI\n ) {}\n\n navigationLink = {\n href: '',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n path: '',\n exact: true,\n children: <Overview />,\n };\n\n order = 10;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["overview.section.tsx"],"names":["OverviewSection","constructor","docs","href","exact","children","path","titleBadgeSlot"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,eAAN,CAAyC;AAC9CC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,IAJC,EAKT;AAAA,SADQA,IACR,GADQA,IACR;AAAA,4DAEe;AACfC,MAAAA,IAAI,EAAE,EADS;AAEfC,MAAAA,KAAK,EAAE,IAFQ;AAGfC,MAAAA,QAAQ,EAAE;AAHK,KAFf;AAAA,mDAQM;AACNC,MAAAA,IAAI,EAAE,EADA;AAENF,MAAAA,KAAK,EAAE,IAFD;AAGNC,MAAAA,QAAQ,eAAE,+BAAC,oBAAD;AAAU,QAAA,WAAW,EAAE,KAAKH,IAAL,CAAUK;AAAjC;AAHJ,KARN;AAAA,mDAcM,EAdN;AAAE;;AAN0C","sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\n\nimport { DocsUI } from './docs.ui.runtime';\nimport { Overview } from './overview';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * docs ui extension.\n */\n private docs: DocsUI\n ) {}\n\n navigationLink = {\n href: '',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n path: '',\n exact: true,\n children: <Overview titleBadges={this.docs.titleBadgeSlot} />,\n };\n\n order = 10;\n}\n"]}
|
package/docs.ui.runtime.tsx
CHANGED
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import { ComponentAspect, ComponentUI } from '@teambit/component';
|
|
2
|
+
import { Slot } from '@teambit/harmony';
|
|
3
|
+
import type { TitleBadge } from '@teambit/component.ui.component-meta';
|
|
2
4
|
import { UIRuntime } from '@teambit/ui';
|
|
3
5
|
|
|
4
6
|
import { DocsAspect } from './docs.aspect';
|
|
5
7
|
import { OverviewSection } from './overview.section';
|
|
8
|
+
import { TitleBadgeSlot } from './overview';
|
|
6
9
|
|
|
7
10
|
export class DocsUI {
|
|
11
|
+
constructor(readonly titleBadgeSlot: TitleBadgeSlot) {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* register a new title badge into the overview section of a component.
|
|
15
|
+
*/
|
|
16
|
+
registerTitleBadge(...titleBadge: TitleBadge[]) {
|
|
17
|
+
this.titleBadgeSlot.register(titleBadge);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* list all title badges registered.
|
|
23
|
+
*/
|
|
24
|
+
listTitleBadges() {
|
|
25
|
+
return this.titleBadgeSlot;
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
static dependencies = [ComponentAspect];
|
|
9
29
|
|
|
10
30
|
static runtime = UIRuntime;
|
|
11
31
|
|
|
12
|
-
static
|
|
13
|
-
|
|
32
|
+
static slots = [Slot.withType<TitleBadge>()];
|
|
33
|
+
|
|
34
|
+
static async provider([component]: [ComponentUI], config, [titleBadgeSlot]: [TitleBadgeSlot]) {
|
|
35
|
+
const docs = new DocsUI(titleBadgeSlot);
|
|
14
36
|
const section = new OverviewSection(docs);
|
|
15
37
|
|
|
16
38
|
component.registerRoute(section.route);
|
package/overview/index.ts
CHANGED
package/overview/overview.tsx
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
+
import flatten from 'lodash.flatten';
|
|
2
3
|
import { ComponentContext } from '@teambit/component';
|
|
4
|
+
import type { SlotRegistry } from '@teambit/harmony';
|
|
3
5
|
import { ComponentPreview } from '@teambit/preview.ui.component-preview';
|
|
4
6
|
import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
7
|
+
import { ComponentOverview, TitleBadge } from '@teambit/component.ui.component-meta';
|
|
8
|
+
import { useFetchDocs } from '@teambit/component.ui.hooks.use-fetch-docs';
|
|
9
|
+
import styles from './overview.module.scss';
|
|
5
10
|
|
|
6
|
-
export
|
|
11
|
+
export type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
|
|
12
|
+
|
|
13
|
+
export type OverviewProps = {
|
|
14
|
+
titleBadges: TitleBadgeSlot;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function Overview({ titleBadges }: OverviewProps) {
|
|
7
18
|
const component = useContext(ComponentContext);
|
|
19
|
+
const { data } = useFetchDocs(component.id.toString());
|
|
20
|
+
const fetchComponent = data?.component;
|
|
8
21
|
if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
|
|
9
22
|
return (
|
|
10
23
|
<StatusMessageCard style={{ margin: 'auto' }} status="PROCESSING" title="component preview pending">
|
|
@@ -19,5 +32,31 @@ export function Overview() {
|
|
|
19
32
|
title="failed to get component preview "
|
|
20
33
|
></StatusMessageCard>
|
|
21
34
|
);
|
|
35
|
+
|
|
36
|
+
if (component.preview?.includesEnvTemplate === false) {
|
|
37
|
+
const labels = component.labels.length > 0 ? component.labels : fetchComponent?.labels;
|
|
38
|
+
const badges = flatten(titleBadges.values());
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className={styles.overviewWrapper}>
|
|
42
|
+
<ComponentOverview
|
|
43
|
+
className={styles.componentOverviewBlock}
|
|
44
|
+
displayName={component.displayName}
|
|
45
|
+
version={component.version}
|
|
46
|
+
abstract={component.description || fetchComponent?.description}
|
|
47
|
+
labels={labels || []}
|
|
48
|
+
packageName={component.packageName}
|
|
49
|
+
titleBadges={badges}
|
|
50
|
+
/>
|
|
51
|
+
<ComponentPreview
|
|
52
|
+
component={component}
|
|
53
|
+
style={{ width: '100%', height: '100%' }}
|
|
54
|
+
previewName="overview"
|
|
55
|
+
fullContentHeight
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
22
61
|
return <ComponentPreview component={component} style={{ width: '100%', height: '100%' }} previewName="overview" />;
|
|
23
62
|
}
|
package/overview.section.tsx
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.633",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/docs/docs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.docs",
|
|
8
8
|
"name": "docs",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.633"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/harmony": "0.2.11",
|
|
13
13
|
"graphql-tag": "2.12.1",
|
|
14
|
+
"lodash.flatten": "4.4.0",
|
|
14
15
|
"@babel/runtime": "7.12.18",
|
|
15
16
|
"core-js": "^3.0.0",
|
|
16
|
-
"@teambit/compiler": "0.0.
|
|
17
|
-
"@teambit/component": "0.0.
|
|
18
|
-
"@teambit/pkg": "0.0.
|
|
19
|
-
"@teambit/workspace": "0.0.
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
21
|
-
"@teambit/dev-files": "0.0.
|
|
22
|
-
"@teambit/envs": "0.0.
|
|
23
|
-
"@teambit/graphql": "0.0.
|
|
24
|
-
"@teambit/logger": "0.0.
|
|
25
|
-
"@teambit/preview": "0.0.
|
|
26
|
-
"@teambit/ui": "0.0.
|
|
17
|
+
"@teambit/compiler": "0.0.633",
|
|
18
|
+
"@teambit/component": "0.0.633",
|
|
19
|
+
"@teambit/pkg": "0.0.633",
|
|
20
|
+
"@teambit/workspace": "0.0.633",
|
|
21
|
+
"@teambit/cli": "0.0.434",
|
|
22
|
+
"@teambit/dev-files": "0.0.633",
|
|
23
|
+
"@teambit/envs": "0.0.633",
|
|
24
|
+
"@teambit/graphql": "0.0.633",
|
|
25
|
+
"@teambit/logger": "0.0.524",
|
|
26
|
+
"@teambit/preview": "0.0.633",
|
|
27
|
+
"@teambit/component.ui.component-meta": "0.0.1",
|
|
28
|
+
"@teambit/ui": "0.0.633",
|
|
27
29
|
"@teambit/toolbox.types.serializable": "0.0.482",
|
|
28
|
-
"@teambit/pubsub": "0.0.
|
|
30
|
+
"@teambit/pubsub": "0.0.633",
|
|
31
|
+
"@teambit/component.ui.hooks.use-fetch-docs": "0.0.1",
|
|
29
32
|
"@teambit/design.ui.surfaces.status-message-card": "0.0.7",
|
|
30
|
-
"@teambit/preview.ui.component-preview": "0.0.
|
|
33
|
+
"@teambit/preview.ui.component-preview": "0.0.488"
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
36
|
"@types/react-dom": "^17.0.5",
|
|
34
37
|
"@types/react": "^17.0.8",
|
|
38
|
+
"@types/lodash.flatten": "4.4.6",
|
|
35
39
|
"@types/mocha": "5.2.7",
|
|
36
40
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
37
41
|
"@types/jest": "^26.0.0",
|
|
38
42
|
"@types/node": "12.20.4"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
|
-
"@teambit/legacy": "1.0.
|
|
45
|
+
"@teambit/legacy": "1.0.210",
|
|
42
46
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
43
47
|
"react": "^16.8.0 || ^17.0.0"
|
|
44
48
|
},
|
|
@@ -66,7 +70,7 @@
|
|
|
66
70
|
"react": "-"
|
|
67
71
|
},
|
|
68
72
|
"peerDependencies": {
|
|
69
|
-
"@teambit/legacy": "1.0.
|
|
73
|
+
"@teambit/legacy": "1.0.210",
|
|
70
74
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
71
75
|
"react": "^16.8.0 || ^17.0.0"
|
|
72
76
|
}
|
|
Binary file
|