@teambit/docs 1.0.7 → 1.0.9
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/docs.ui.runtime.d.ts +4 -1
- package/dist/docs.ui.runtime.js +8 -1
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/overview/overview.d.ts +2 -1
- package/dist/overview/overview.js +17 -24
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview.section.d.ts +3 -1
- package/dist/overview.section.js +4 -2
- package/dist/overview.section.js.map +1 -1
- package/dist/{preview-1695513012057.js → preview-1695807370382.js} +2 -2
- package/docs.ui.runtime.tsx +12 -2
- package/overview/overview.tsx +16 -12
- package/overview.section.tsx +10 -2
- package/package.json +20 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentUI } from '@teambit/component';
|
|
3
3
|
import { ComponentCompareUI } from '@teambit/component-compare';
|
|
4
4
|
import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
|
|
@@ -14,6 +14,9 @@ export declare class DocsUI {
|
|
|
14
14
|
* list all title badges registered.
|
|
15
15
|
*/
|
|
16
16
|
listTitleBadges(): TitleBadge[];
|
|
17
|
+
private _emptyState?;
|
|
18
|
+
registerEmptyState(emptyState: ComponentType): React.ComponentType<{}>;
|
|
19
|
+
getEmptyState(): React.ComponentType<{}> | undefined;
|
|
17
20
|
getDocsCompare(): JSX.Element;
|
|
18
21
|
registerOverviewOptions(options: OverviewOptions): void;
|
|
19
22
|
static dependencies: import("@teambit/harmony").Aspect[];
|
package/dist/docs.ui.runtime.js
CHANGED
|
@@ -82,6 +82,7 @@ class DocsUI {
|
|
|
82
82
|
constructor(titleBadgeSlot, overviewOptionsSlot) {
|
|
83
83
|
this.titleBadgeSlot = titleBadgeSlot;
|
|
84
84
|
this.overviewOptionsSlot = overviewOptionsSlot;
|
|
85
|
+
_defineProperty(this, "_emptyState", void 0);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/**
|
|
@@ -99,6 +100,12 @@ class DocsUI {
|
|
|
99
100
|
listTitleBadges() {
|
|
100
101
|
return (0, _lodash().flatten)(this.titleBadgeSlot.values());
|
|
101
102
|
}
|
|
103
|
+
registerEmptyState(emptyState) {
|
|
104
|
+
return this._emptyState = emptyState;
|
|
105
|
+
}
|
|
106
|
+
getEmptyState() {
|
|
107
|
+
return this._emptyState;
|
|
108
|
+
}
|
|
102
109
|
getDocsCompare() {
|
|
103
110
|
return /*#__PURE__*/_react().default.createElement(_docsUi().OverviewCompare, {
|
|
104
111
|
titleBadges: this.titleBadgeSlot,
|
|
@@ -110,7 +117,7 @@ class DocsUI {
|
|
|
110
117
|
}
|
|
111
118
|
static async provider([component, componentCompare], config, [titleBadgeSlot, overviewOptionsSlot]) {
|
|
112
119
|
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
113
|
-
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot);
|
|
120
|
+
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs);
|
|
114
121
|
const compareSection = new (_docsUi2().OverviewCompareSection)(docs);
|
|
115
122
|
component.registerRoute(section.route);
|
|
116
123
|
component.registerNavigation(section.navigationLink, section.order);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_component","_harmony","_ui","_componentCompare","_docsUi","_docsUi2","_docs","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","DocsUI","constructor","titleBadgeSlot","overviewOptionsSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","getDocsCompare","createElement","OverviewCompare","overviewOptions","registerOverviewOptions","options","provider","component","componentCompare","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","exports","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","_default","DocsAspect","addRuntime"],"sources":["docs.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { flatten } from 'lodash';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { Slot } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare';\nimport { OverviewCompare } from '@teambit/docs.ui.overview-compare';\nimport { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';\nimport { DocsAspect } from './docs.aspect';\nimport { OverviewSection } from './overview.section';\nimport type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot, readonly overviewOptionsSlot: OverviewOptionsSlot) {}\n\n /**\n * register a new title badge into the overview section of a component.\n */\n registerTitleBadge(titleBadges: TitleBadge | TitleBadge[]) {\n const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];\n this.titleBadgeSlot.register(badges);\n return this;\n }\n\n /**\n * list all title badges registered.\n */\n listTitleBadges() {\n return flatten(this.titleBadgeSlot.values());\n }\n\n getDocsCompare() {\n return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;\n }\n\n registerOverviewOptions(options: OverviewOptions) {\n this.overviewOptionsSlot.register(options);\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);\n const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot);\n const compareSection = new OverviewCompareSection(docs);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation(compareSection);\n componentCompare.registerRoutes([compareSection.route]);\n return docs;\n }\n}\n\nexport default DocsUI;\n\nDocsAspect.addRuntime(DocsUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,kBAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,iBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAT,IA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,cAA8B,GAA9BA,cAA8B;IAAA,KAAWC,mBAAwC,GAAxCA,mBAAwC;EAAG;;EAEzG;AACF;AACA;
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_component","_harmony","_ui","_componentCompare","_docsUi","_docsUi2","_docs","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","DocsUI","constructor","titleBadgeSlot","overviewOptionsSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","registerEmptyState","emptyState","_emptyState","getEmptyState","getDocsCompare","createElement","OverviewCompare","overviewOptions","registerOverviewOptions","options","provider","component","componentCompare","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","exports","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","_default","DocsAspect","addRuntime"],"sources":["docs.ui.runtime.tsx"],"sourcesContent":["import React, { ComponentType } from 'react';\nimport { flatten } from 'lodash';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { Slot } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare';\nimport { OverviewCompare } from '@teambit/docs.ui.overview-compare';\nimport { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';\nimport { DocsAspect } from './docs.aspect';\nimport { OverviewSection } from './overview.section';\nimport type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot, readonly overviewOptionsSlot: OverviewOptionsSlot) {}\n\n /**\n * register a new title badge into the overview section of a component.\n */\n registerTitleBadge(titleBadges: TitleBadge | TitleBadge[]) {\n const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];\n this.titleBadgeSlot.register(badges);\n return this;\n }\n\n /**\n * list all title badges registered.\n */\n listTitleBadges() {\n return flatten(this.titleBadgeSlot.values());\n }\n\n private _emptyState?: ComponentType;\n\n registerEmptyState(emptyState: ComponentType) {\n return this._emptyState = emptyState;\n }\n\n getEmptyState() {\n return this._emptyState;\n }\n\n getDocsCompare() {\n return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;\n }\n\n registerOverviewOptions(options: OverviewOptions) {\n this.overviewOptionsSlot.register(options);\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);\n const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs);\n const compareSection = new OverviewCompareSection(docs);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation(compareSection);\n componentCompare.registerRoutes([compareSection.route]);\n return docs;\n }\n}\n\nexport default DocsUI;\n\nDocsAspect.addRuntime(DocsUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,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AM;AAAAsC,OAAA,CAAA7D,OAAA,GAAAmE,QAAA;AAErBC,kBAAU,CAACC,UAAU,CAAC9C,MAAM,CAAC"}
|
|
@@ -21,5 +21,6 @@ export declare type OverviewProps = {
|
|
|
21
21
|
titleBadges: TitleBadgeSlot;
|
|
22
22
|
overviewOptions: OverviewOptionsSlot;
|
|
23
23
|
previewProps?: Partial<ComponentPreviewProps>;
|
|
24
|
+
getEmptyState?: () => ComponentType | undefined;
|
|
24
25
|
};
|
|
25
|
-
export declare function Overview({ titleBadges, overviewOptions, previewProps }: OverviewProps): JSX.Element;
|
|
26
|
+
export declare function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps): JSX.Element;
|
|
@@ -47,13 +47,6 @@ function _previewUi() {
|
|
|
47
47
|
};
|
|
48
48
|
return data;
|
|
49
49
|
}
|
|
50
|
-
function _designUiSurfaces() {
|
|
51
|
-
const data = require("@teambit/design.ui.surfaces.status-message-card");
|
|
52
|
-
_designUiSurfaces = function () {
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
50
|
function _componentUi() {
|
|
58
51
|
const data = require("@teambit/component.ui.component-meta");
|
|
59
52
|
_componentUi = function () {
|
|
@@ -77,6 +70,7 @@ function _overviewModule() {
|
|
|
77
70
|
}
|
|
78
71
|
const _excluded = ["onLoad", "style"]; // import { Icon } from '@teambit/design.elements.icon';
|
|
79
72
|
// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';
|
|
73
|
+
// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
80
74
|
// import { ReadmeSkeleton } from './readme-skeleton';
|
|
81
75
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
82
76
|
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); }
|
|
@@ -95,7 +89,8 @@ exports.BadgePosition = BadgePosition;
|
|
|
95
89
|
function Overview({
|
|
96
90
|
titleBadges,
|
|
97
91
|
overviewOptions,
|
|
98
|
-
previewProps
|
|
92
|
+
previewProps,
|
|
93
|
+
getEmptyState
|
|
99
94
|
}) {
|
|
100
95
|
var _component$preview, _component$preview2, _component$preview3, _component$preview4, _component$preview5;
|
|
101
96
|
const component = (0, _react().useContext)(_component().ComponentContext);
|
|
@@ -103,20 +98,18 @@ function Overview({
|
|
|
103
98
|
const overviewProps = (0, _lodash().flatten)(overviewOptions.values())[0];
|
|
104
99
|
const showHeader = !((_component$preview = component.preview) !== null && _component$preview !== void 0 && _component$preview.legacyHeader);
|
|
105
100
|
const [isLoading, setLoading] = (0, _react().useState)(true);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
title: "failed to get component preview "
|
|
119
|
-
});
|
|
101
|
+
const EmptyState = getEmptyState && getEmptyState();
|
|
102
|
+
|
|
103
|
+
// if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
|
|
104
|
+
// return (
|
|
105
|
+
// <StatusMessageCard style={{ margin: 'auto' }} status="PROCESSING" title="component preview pending">
|
|
106
|
+
// this might take some time
|
|
107
|
+
// </StatusMessageCard>
|
|
108
|
+
// );
|
|
109
|
+
|
|
110
|
+
// if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')
|
|
111
|
+
// return <StatusMessageCard style={{ margin: 'auto' }} status="FAILURE" title="failed to get component preview " />;
|
|
112
|
+
const buildFailed = component.buildStatus !== 'Succeed' && (component === null || component === void 0 ? void 0 : component.host) === 'teambit.scope/scope';
|
|
120
113
|
const isScaling = (_component$preview2 = component.preview) === null || _component$preview2 === void 0 ? void 0 : _component$preview2.isScaling;
|
|
121
114
|
const iframeQueryParams = `skipIncludes=${((_component$preview3 = component.preview) === null || _component$preview3 === void 0 ? void 0 : _component$preview3.skipIncludes) || 'false'}`;
|
|
122
115
|
const overviewPropsValues = overviewProps && overviewProps();
|
|
@@ -145,7 +138,7 @@ function Overview({
|
|
|
145
138
|
titleBadges: (0, _lodash().flatten)(titleBadges.values()),
|
|
146
139
|
componentDescriptor: componentDescriptor,
|
|
147
140
|
component: component
|
|
148
|
-
}), /*#__PURE__*/_react().default.createElement("div", {
|
|
141
|
+
}), !buildFailed && /*#__PURE__*/_react().default.createElement("div", {
|
|
149
142
|
className: _overviewModule().default.readme
|
|
150
143
|
}, /*#__PURE__*/_react().default.createElement(_previewUi().ComponentPreview, _extends({
|
|
151
144
|
onLoad: onPreviewLoad,
|
|
@@ -168,7 +161,7 @@ function Overview({
|
|
|
168
161
|
}), ((_component$preview5 = component.preview) === null || _component$preview5 === void 0 ? void 0 : _component$preview5.skipIncludes) && /*#__PURE__*/_react().default.createElement(_reactUiDocs().PropertiesTable, {
|
|
169
162
|
className: _overviewModule().default.overviewPropsTable,
|
|
170
163
|
componentId: component.id.toString()
|
|
171
|
-
})));
|
|
164
|
+
})), buildFailed && EmptyState && /*#__PURE__*/_react().default.createElement(EmptyState, null));
|
|
172
165
|
}
|
|
173
166
|
|
|
174
167
|
//# sourceMappingURL=overview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_reactUiDocs","_component","_previewUi","_designUiSurfaces","_componentUi","_compositionsPanels","_overviewModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","_component$preview","_component$preview2","_component$preview3","_component$preview4","_component$preview5","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","overviewProps","flatten","values","showHeader","preview","legacyHeader","isLoading","setLoading","useState","buildStatus","host","createElement","StatusMessageCard","style","margin","status","title","isScaling","iframeQueryParams","skipIncludes","overviewPropsValues","_ref","onLoad","rest","onPreviewLoad","React","useCallback","e","props","className","styles","overviewWrapper","id","toString","ComponentOverview","classNames","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","PropertiesTable","overviewPropsTable","componentId"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType, useState } from 'react';\nimport classNames from 'classnames';\nimport { flatten } from 'lodash';\n// import { Icon } from '@teambit/design.elements.icon';\nimport { PropertiesTable } from '@teambit/react.ui.docs.properties-table';\n// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';\nimport { ComponentContext, useComponentDescriptor } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\nimport { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview } from '@teambit/component.ui.component-meta';\nimport { CompositionGallery } from '@teambit/compositions.panels.composition-gallery';\n// import { ReadmeSkeleton } from './readme-skeleton';\nimport styles from './overview.module.scss';\n\nexport enum BadgePosition {\n Title,\n SubTitle,\n Labels,\n Package,\n}\n\nexport type TitleBadge = {\n component: ComponentType<any>;\n weight?: number;\n position?: BadgePosition;\n};\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewOptions = () => { queryParams?: string };\n\nexport type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n overviewOptions: OverviewOptionsSlot;\n previewProps?: Partial<ComponentPreviewProps>;\n};\n\nexport function Overview({ titleBadges, overviewOptions, previewProps }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const overviewProps = flatten(overviewOptions.values())[0];\n const showHeader = !component.preview?.legacyHeader;\n const [isLoading, setLoading] = useState(true);\n\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\n if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n return <StatusMessageCard style={{ margin: 'auto' }} status=\"FAILURE\" title=\"failed to get component preview \" />;\n\n const isScaling = component.preview?.isScaling;\n\n const iframeQueryParams = `skipIncludes=${component.preview?.skipIncludes || 'false'}`;\n\n const overviewPropsValues = overviewProps && overviewProps();\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onLoad, style, ...rest } = previewProps || {};\n\n const onPreviewLoad = React.useCallback(\n (e, props) => {\n setLoading(false);\n onLoad?.(e, props);\n },\n [onLoad]\n );\n\n return (\n <div className={styles.overviewWrapper} key={`${component.id.toString()}`}>\n {showHeader && (\n <ComponentOverview\n className={classNames(styles.componentOverviewBlock, !isScaling && styles.legacyPreview)}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description}\n labels={component.labels}\n packageName={component.packageName}\n titleBadges={flatten(titleBadges.values())}\n componentDescriptor={componentDescriptor}\n component={component}\n />\n )}\n\n {/* TODO - @oded replace with new panel card same for compositions. */}\n\n {/* <LinkedHeading size=\"xs\" className={styles.title}>\n <Icon of=\"text\" /> <span>README</span>\n </LinkedHeading> */}\n <div className={styles.readme}>\n {/* {isLoading && <ReadmeSkeleton />} */}\n <ComponentPreview\n onLoad={onPreviewLoad}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams, overviewPropsValues?.queryParams || '']}\n viewport={null}\n fullContentHeight\n disableScroll={true}\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}\n />\n {component.preview?.skipIncludes && <CompositionGallery isLoading={isLoading} component={component} />}\n {component.preview?.skipIncludes && (\n <PropertiesTable className={styles.overviewPropsTable} componentId={component.id.toString()} />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,kBAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,iBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,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9B,iBAAiB,EAAE,CAAAE,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAE4B,WAAW,KAAI,EAAE,CAAE;IACzEC,QAAQ,EAAE,IAAK;IACfC,iBAAiB;IACjBC,aAAa,EAAE;EAAK,GAChB5B,IAAI;IACR5B,SAAS,EAAEA,SAAU;IACrBkB,KAAK,EAAE;MAAEuC,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE,MAAM;MAAEC,SAAS,EAAE,CAACrC,SAAS,GAAG,GAAG,GAAGsC;IAAU;EAAE,EACnF,CAAC,EACD,EAAA9D,mBAAA,GAAAE,SAAS,CAACS,OAAO,cAAAX,mBAAA,uBAAjBA,mBAAA,CAAmB0B,YAAY,kBAAI1F,MAAA,GAAAiB,OAAA,CAAAiE,aAAA,CAACtE,mBAAA,GAAAmH,kBAAkB;IAAClD,SAAS,EAAEA,SAAU;IAACX,SAAS,EAAEA;EAAU,CAAE,CAAC,EACrG,EAAAD,mBAAA,GAAAC,SAAS,CAACS,OAAO,cAAAV,mBAAA,uBAAjBA,mBAAA,CAAmByB,YAAY,kBAC9B1F,MAAA,GAAAiB,OAAA,CAAAiE,aAAA,CAAC3E,YAAA,GAAAyH,eAAe;IAAC5B,SAAS,EAAEC,yBAAM,CAAC4B,kBAAmB;IAACC,WAAW,EAAEhE,SAAS,CAACqC,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAE7F,CACF,CAAC;AAEV"}
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_reactUiDocs","_component","_previewUi","_componentUi","_compositionsPanels","_overviewModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","_component$preview","_component$preview2","_component$preview3","_component$preview4","_component$preview5","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","overviewProps","flatten","values","showHeader","preview","legacyHeader","isLoading","setLoading","useState","EmptyState","buildFailed","buildStatus","host","isScaling","iframeQueryParams","skipIncludes","overviewPropsValues","_ref","onLoad","style","rest","onPreviewLoad","React","useCallback","e","props","createElement","className","styles","overviewWrapper","id","toString","ComponentOverview","classNames","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","PropertiesTable","overviewPropsTable","componentId"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType, useState } from 'react';\nimport classNames from 'classnames';\nimport { flatten } from 'lodash';\n// import { Icon } from '@teambit/design.elements.icon';\nimport { PropertiesTable } from '@teambit/react.ui.docs.properties-table';\n// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';\nimport { ComponentContext, useComponentDescriptor } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\n// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview } from '@teambit/component.ui.component-meta';\nimport { CompositionGallery } from '@teambit/compositions.panels.composition-gallery';\n// import { ReadmeSkeleton } from './readme-skeleton';\nimport styles from './overview.module.scss';\n\nexport enum BadgePosition {\n Title,\n SubTitle,\n Labels,\n Package,\n}\n\nexport type TitleBadge = {\n component: ComponentType<any>;\n weight?: number;\n position?: BadgePosition;\n};\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewOptions = () => { queryParams?: string };\n\nexport type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n overviewOptions: OverviewOptionsSlot;\n previewProps?: Partial<ComponentPreviewProps>;\n getEmptyState?: () => ComponentType|undefined;\n};\n\nexport function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const overviewProps = flatten(overviewOptions.values())[0];\n const showHeader = !component.preview?.legacyHeader;\n const [isLoading, setLoading] = useState(true);\n const EmptyState = getEmptyState && getEmptyState();\n\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\n // if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n // return <StatusMessageCard style={{ margin: 'auto' }} status=\"FAILURE\" title=\"failed to get component preview \" />;\n const buildFailed = component.buildStatus !== 'Succeed' && component?.host === 'teambit.scope/scope';\n\n const isScaling = component.preview?.isScaling;\n\n const iframeQueryParams = `skipIncludes=${component.preview?.skipIncludes || 'false'}`;\n\n const overviewPropsValues = overviewProps && overviewProps();\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onLoad, style, ...rest } = previewProps || {};\n\n const onPreviewLoad = React.useCallback(\n (e, props) => {\n setLoading(false);\n onLoad?.(e, props);\n },\n [onLoad]\n );\n\n return (\n <div className={styles.overviewWrapper} key={`${component.id.toString()}`}>\n {showHeader && (\n <ComponentOverview\n className={classNames(styles.componentOverviewBlock, !isScaling && styles.legacyPreview)}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description}\n labels={component.labels}\n packageName={component.packageName}\n titleBadges={flatten(titleBadges.values())}\n componentDescriptor={componentDescriptor}\n component={component}\n />\n )}\n\n {/* TODO - @oded replace with new panel card same for compositions. */}\n\n {/* <LinkedHeading size=\"xs\" className={styles.title}>\n <Icon of=\"text\" /> <span>README</span>\n </LinkedHeading> */}\n {!buildFailed && <div className={styles.readme}>\n {/* {isLoading && <ReadmeSkeleton />} */}\n <ComponentPreview\n onLoad={onPreviewLoad}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams, overviewPropsValues?.queryParams || '']}\n viewport={null}\n fullContentHeight\n disableScroll={true}\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}\n />\n {component.preview?.skipIncludes && <CompositionGallery isLoading={isLoading} component={component} />}\n {component.preview?.skipIncludes && (\n <PropertiesTable className={styles.overviewPropsTable} componentId={component.id.toString()} />\n )}\n </div>}\n {(buildFailed && EmptyState) && <EmptyState />}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IA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GAAAE,SAAS,CAACS,OAAO,cAAAX,mBAAA,uBAAjBA,mBAAA,CAAmBsB,YAAY,kBAAItF,MAAA,GAAAgB,OAAA,CAAAiF,aAAA,CAACtF,mBAAA,GAAAkH,kBAAkB;IAAChD,SAAS,EAAEA,SAAU;IAACX,SAAS,EAAEA;EAAU,CAAE,CAAC,EACrG,EAAAD,mBAAA,GAAAC,SAAS,CAACS,OAAO,cAAAV,mBAAA,uBAAjBA,mBAAA,CAAmBqB,YAAY,kBAC9BtF,MAAA,GAAAgB,OAAA,CAAAiF,aAAA,CAAC1F,YAAA,GAAAuH,eAAe;IAAC5B,SAAS,EAAEC,yBAAM,CAAC4B,kBAAmB;IAACC,WAAW,EAAE9D,SAAS,CAACmC,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAE7F,CAAC,EACJrB,WAAW,IAAID,UAAU,iBAAKhF,MAAA,GAAAgB,OAAA,CAAAiF,aAAA,CAACjB,UAAU,MAAE,CAC1C,CAAC;AAEV"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
3
|
import { TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
4
|
+
import { DocsUI } from './docs.ui.runtime';
|
|
4
5
|
export declare class OverviewSection implements Section {
|
|
5
6
|
/**
|
|
6
7
|
* title badge slot.
|
|
7
8
|
*/
|
|
8
9
|
private titleBadgeSlot;
|
|
9
10
|
private overviewOptionsSlot;
|
|
11
|
+
private docs;
|
|
10
12
|
constructor(
|
|
11
13
|
/**
|
|
12
14
|
* title badge slot.
|
|
13
15
|
*/
|
|
14
|
-
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot);
|
|
16
|
+
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, docs: DocsUI);
|
|
15
17
|
navigationLink: {
|
|
16
18
|
href: string;
|
|
17
19
|
exact: boolean;
|
package/dist/overview.section.js
CHANGED
|
@@ -27,9 +27,10 @@ class OverviewSection {
|
|
|
27
27
|
/**
|
|
28
28
|
* title badge slot.
|
|
29
29
|
*/
|
|
30
|
-
titleBadgeSlot, overviewOptionsSlot) {
|
|
30
|
+
titleBadgeSlot, overviewOptionsSlot, docs) {
|
|
31
31
|
this.titleBadgeSlot = titleBadgeSlot;
|
|
32
32
|
this.overviewOptionsSlot = overviewOptionsSlot;
|
|
33
|
+
this.docs = docs;
|
|
33
34
|
_defineProperty(this, "navigationLink", {
|
|
34
35
|
href: '.',
|
|
35
36
|
exact: true,
|
|
@@ -39,7 +40,8 @@ class OverviewSection {
|
|
|
39
40
|
index: true,
|
|
40
41
|
element: /*#__PURE__*/_react().default.createElement(_overview().Overview, {
|
|
41
42
|
titleBadges: this.titleBadgeSlot,
|
|
42
|
-
overviewOptions: this.overviewOptionsSlot
|
|
43
|
+
overviewOptions: this.overviewOptionsSlot,
|
|
44
|
+
getEmptyState: this.docs.getEmptyState.bind(this.docs)
|
|
43
45
|
})
|
|
44
46
|
});
|
|
45
47
|
_defineProperty(this, "order", 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","OverviewSection","constructor","titleBadgeSlot","overviewOptionsSlot","href","exact","children","index","element","createElement","Overview","titleBadges","overviewOptions","exports"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * title badge slot.\n */\n private titleBadgeSlot: TitleBadgeSlot,\n private overviewOptionsSlot: OverviewOptionsSlot\n ) {}\n\n navigationLink = {\n href: '.',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n index: true,\n element: <Overview
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","OverviewSection","constructor","titleBadgeSlot","overviewOptionsSlot","docs","href","exact","children","index","element","createElement","Overview","titleBadges","overviewOptions","getEmptyState","bind","exports"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';\nimport { DocsUI } from './docs.ui.runtime';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * title badge slot.\n */\n private titleBadgeSlot: TitleBadgeSlot,\n private overviewOptionsSlot: OverviewOptionsSlot,\n private docs: DocsUI\n ) {}\n\n navigationLink = {\n href: '.',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n index: true,\n element: (\n <Overview\n titleBadges={this.titleBadgeSlot}\n overviewOptions={this.overviewOptionsSlot}\n getEmptyState={this.docs.getEmptyState.bind(this.docs)}\n />\n ),\n };\n\n order = 10;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2E,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ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,IAAI;MAAE,CACxD;IAEL,CAAC;IAAA1B,eAAA,gBAEO,EAAE;EAnBP;AAoBL;AAACsC,OAAA,CAAAhB,eAAA,GAAAA,eAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.9/dist/docs.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.9/dist/docs.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/docs.ui.runtime.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
2
|
import { flatten } from 'lodash';
|
|
3
3
|
import { ComponentAspect, ComponentUI } from '@teambit/component';
|
|
4
4
|
import { Slot } from '@teambit/harmony';
|
|
@@ -29,6 +29,16 @@ export class DocsUI {
|
|
|
29
29
|
return flatten(this.titleBadgeSlot.values());
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
private _emptyState?: ComponentType;
|
|
33
|
+
|
|
34
|
+
registerEmptyState(emptyState: ComponentType) {
|
|
35
|
+
return this._emptyState = emptyState;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getEmptyState() {
|
|
39
|
+
return this._emptyState;
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
getDocsCompare() {
|
|
33
43
|
return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;
|
|
34
44
|
}
|
|
@@ -49,7 +59,7 @@ export class DocsUI {
|
|
|
49
59
|
[titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]
|
|
50
60
|
) {
|
|
51
61
|
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
52
|
-
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot);
|
|
62
|
+
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs);
|
|
53
63
|
const compareSection = new OverviewCompareSection(docs);
|
|
54
64
|
|
|
55
65
|
component.registerRoute(section.route);
|
package/overview/overview.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { PropertiesTable } from '@teambit/react.ui.docs.properties-table';
|
|
|
7
7
|
import { ComponentContext, useComponentDescriptor } from '@teambit/component';
|
|
8
8
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
9
9
|
import { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';
|
|
10
|
-
import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
10
|
+
// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
11
11
|
import { ComponentOverview } from '@teambit/component.ui.component-meta';
|
|
12
12
|
import { CompositionGallery } from '@teambit/compositions.panels.composition-gallery';
|
|
13
13
|
// import { ReadmeSkeleton } from './readme-skeleton';
|
|
@@ -36,24 +36,27 @@ export type OverviewProps = {
|
|
|
36
36
|
titleBadges: TitleBadgeSlot;
|
|
37
37
|
overviewOptions: OverviewOptionsSlot;
|
|
38
38
|
previewProps?: Partial<ComponentPreviewProps>;
|
|
39
|
+
getEmptyState?: () => ComponentType|undefined;
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
export function Overview({ titleBadges, overviewOptions, previewProps }: OverviewProps) {
|
|
42
|
+
export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps) {
|
|
42
43
|
const component = useContext(ComponentContext);
|
|
43
44
|
const componentDescriptor = useComponentDescriptor();
|
|
44
45
|
const overviewProps = flatten(overviewOptions.values())[0];
|
|
45
46
|
const showHeader = !component.preview?.legacyHeader;
|
|
46
47
|
const [isLoading, setLoading] = useState(true);
|
|
48
|
+
const EmptyState = getEmptyState && getEmptyState();
|
|
47
49
|
|
|
48
|
-
if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
// if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')
|
|
51
|
+
// return (
|
|
52
|
+
// <StatusMessageCard style={{ margin: 'auto' }} status="PROCESSING" title="component preview pending">
|
|
53
|
+
// this might take some time
|
|
54
|
+
// </StatusMessageCard>
|
|
55
|
+
// );
|
|
54
56
|
|
|
55
|
-
if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')
|
|
56
|
-
|
|
57
|
+
// if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')
|
|
58
|
+
// return <StatusMessageCard style={{ margin: 'auto' }} status="FAILURE" title="failed to get component preview " />;
|
|
59
|
+
const buildFailed = component.buildStatus !== 'Succeed' && component?.host === 'teambit.scope/scope';
|
|
57
60
|
|
|
58
61
|
const isScaling = component.preview?.isScaling;
|
|
59
62
|
|
|
@@ -93,7 +96,7 @@ export function Overview({ titleBadges, overviewOptions, previewProps }: Overvie
|
|
|
93
96
|
{/* <LinkedHeading size="xs" className={styles.title}>
|
|
94
97
|
<Icon of="text" /> <span>README</span>
|
|
95
98
|
</LinkedHeading> */}
|
|
96
|
-
<div className={styles.readme}>
|
|
99
|
+
{!buildFailed && <div className={styles.readme}>
|
|
97
100
|
{/* {isLoading && <ReadmeSkeleton />} */}
|
|
98
101
|
<ComponentPreview
|
|
99
102
|
onLoad={onPreviewLoad}
|
|
@@ -111,7 +114,8 @@ export function Overview({ titleBadges, overviewOptions, previewProps }: Overvie
|
|
|
111
114
|
{component.preview?.skipIncludes && (
|
|
112
115
|
<PropertiesTable className={styles.overviewPropsTable} componentId={component.id.toString()} />
|
|
113
116
|
)}
|
|
114
|
-
</div>
|
|
117
|
+
</div>}
|
|
118
|
+
{(buildFailed && EmptyState) && <EmptyState />}
|
|
115
119
|
</div>
|
|
116
120
|
);
|
|
117
121
|
}
|
package/overview.section.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
3
|
import { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
4
|
+
import { DocsUI } from './docs.ui.runtime';
|
|
4
5
|
|
|
5
6
|
export class OverviewSection implements Section {
|
|
6
7
|
constructor(
|
|
@@ -8,7 +9,8 @@ export class OverviewSection implements Section {
|
|
|
8
9
|
* title badge slot.
|
|
9
10
|
*/
|
|
10
11
|
private titleBadgeSlot: TitleBadgeSlot,
|
|
11
|
-
private overviewOptionsSlot: OverviewOptionsSlot
|
|
12
|
+
private overviewOptionsSlot: OverviewOptionsSlot,
|
|
13
|
+
private docs: DocsUI
|
|
12
14
|
) {}
|
|
13
15
|
|
|
14
16
|
navigationLink = {
|
|
@@ -19,7 +21,13 @@ export class OverviewSection implements Section {
|
|
|
19
21
|
|
|
20
22
|
route = {
|
|
21
23
|
index: true,
|
|
22
|
-
element:
|
|
24
|
+
element: (
|
|
25
|
+
<Overview
|
|
26
|
+
titleBadges={this.titleBadgeSlot}
|
|
27
|
+
overviewOptions={this.overviewOptionsSlot}
|
|
28
|
+
getEmptyState={this.docs.getEmptyState.bind(this.docs)}
|
|
29
|
+
/>
|
|
30
|
+
),
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
order = 10;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/docs/docs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.docs",
|
|
8
8
|
"name": "docs",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.9"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -17,25 +17,24 @@
|
|
|
17
17
|
"@teambit/docs.entities.doc": "0.0.12",
|
|
18
18
|
"@teambit/harmony": "0.4.6",
|
|
19
19
|
"@teambit/component-id": "0.0.427",
|
|
20
|
-
"@teambit/design.ui.surfaces.status-message-card": "0.0.17",
|
|
21
20
|
"@teambit/base-ui.loaders.skeleton": "1.0.1",
|
|
22
|
-
"@teambit/compiler": "1.0.
|
|
23
|
-
"@teambit/component": "1.0.
|
|
24
|
-
"@teambit/pkg": "1.0.
|
|
25
|
-
"@teambit/workspace": "1.0.
|
|
26
|
-
"@teambit/cli": "0.0.
|
|
27
|
-
"@teambit/dev-files": "1.0.
|
|
28
|
-
"@teambit/envs": "1.0.
|
|
29
|
-
"@teambit/graphql": "1.0.
|
|
30
|
-
"@teambit/logger": "0.0.
|
|
31
|
-
"@teambit/preview": "1.0.
|
|
32
|
-
"@teambit/component-compare": "1.0.
|
|
33
|
-
"@teambit/docs.ui.overview-compare-section": "0.0.
|
|
34
|
-
"@teambit/docs.ui.overview-compare": "1.0.
|
|
35
|
-
"@teambit/ui": "1.0.
|
|
36
|
-
"@teambit/pubsub": "1.0.
|
|
37
|
-
"@teambit/component.ui.component-meta": "0.0.
|
|
38
|
-
"@teambit/compositions.panels.composition-gallery": "0.0.
|
|
21
|
+
"@teambit/compiler": "1.0.9",
|
|
22
|
+
"@teambit/component": "1.0.9",
|
|
23
|
+
"@teambit/pkg": "1.0.9",
|
|
24
|
+
"@teambit/workspace": "1.0.9",
|
|
25
|
+
"@teambit/cli": "0.0.791",
|
|
26
|
+
"@teambit/dev-files": "1.0.9",
|
|
27
|
+
"@teambit/envs": "1.0.9",
|
|
28
|
+
"@teambit/graphql": "1.0.9",
|
|
29
|
+
"@teambit/logger": "0.0.884",
|
|
30
|
+
"@teambit/preview": "1.0.9",
|
|
31
|
+
"@teambit/component-compare": "1.0.9",
|
|
32
|
+
"@teambit/docs.ui.overview-compare-section": "0.0.99",
|
|
33
|
+
"@teambit/docs.ui.overview-compare": "1.0.9",
|
|
34
|
+
"@teambit/ui": "1.0.9",
|
|
35
|
+
"@teambit/pubsub": "1.0.9",
|
|
36
|
+
"@teambit/component.ui.component-meta": "0.0.356",
|
|
37
|
+
"@teambit/compositions.panels.composition-gallery": "0.0.151",
|
|
39
38
|
"@teambit/preview.ui.component-preview": "1.0.0",
|
|
40
39
|
"@teambit/react.ui.docs.properties-table": "0.0.18"
|
|
41
40
|
},
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
"@teambit/docs.content.docs-overview": "1.95.9"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
|
-
"@teambit/legacy": "1.0.
|
|
53
|
+
"@teambit/legacy": "1.0.571",
|
|
55
54
|
"react": "^16.8.0 || ^17.0.0",
|
|
56
55
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
57
56
|
},
|