@teambit/docs 1.0.114 → 1.0.116
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/artifacts/preview/static/css/teambit.docs/docs-preview.13f9e178.css +317 -0
- package/artifacts/preview/teambit_docs_docs-preview.js +8 -6
- package/dist/docs.composition.d.ts +1 -0
- package/dist/docs.ui.runtime.d.ts +2 -1
- package/dist/docs.ui.runtime.js +10 -3
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/overview/overview.d.ts +5 -2
- package/dist/overview/overview.js +5 -13
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview.section.d.ts +4 -1
- package/dist/overview.section.js +4 -2
- package/dist/overview.section.js.map +1 -1
- package/dist/{preview-1703992959524.js → preview-1704113440840.js} +2 -2
- package/docs.ui.runtime.tsx +4 -3
- package/overview/overview.tsx +8 -6
- package/overview.section.tsx +4 -1
- package/package.json +16 -16
- package/artifacts/preview/static/css/teambit.docs/docs-preview.2007b9db.css +0 -319
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentUI } from '@teambit/component';
|
|
3
3
|
import { ComponentCompareUI } from '@teambit/component-compare';
|
|
4
|
+
import { APIReferenceUI } from '@teambit/api-reference';
|
|
4
5
|
import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
|
|
5
6
|
export declare class DocsUI {
|
|
6
7
|
readonly titleBadgeSlot: TitleBadgeSlot;
|
|
@@ -22,6 +23,6 @@ export declare class DocsUI {
|
|
|
22
23
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
23
24
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
24
25
|
static slots: (((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<TitleBadge>) | ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<OverviewOptions>))[];
|
|
25
|
-
static provider([component, componentCompare]: [ComponentUI, ComponentCompareUI], config: any, [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]): Promise<DocsUI>;
|
|
26
|
+
static provider([component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI], config: any, [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]): Promise<DocsUI>;
|
|
26
27
|
}
|
|
27
28
|
export default DocsUI;
|
package/dist/docs.ui.runtime.js
CHANGED
|
@@ -60,6 +60,13 @@ function _docsUi2() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
+
function _apiReference() {
|
|
64
|
+
const data = _interopRequireDefault(require("@teambit/api-reference"));
|
|
65
|
+
_apiReference = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
63
70
|
function _docs() {
|
|
64
71
|
const data = require("./docs.aspect");
|
|
65
72
|
_docs = function () {
|
|
@@ -115,9 +122,9 @@ class DocsUI {
|
|
|
115
122
|
registerOverviewOptions(options) {
|
|
116
123
|
this.overviewOptionsSlot.register(options);
|
|
117
124
|
}
|
|
118
|
-
static async provider([component, componentCompare], config, [titleBadgeSlot, overviewOptionsSlot]) {
|
|
125
|
+
static async provider([component, componentCompare, apiRef], config, [titleBadgeSlot, overviewOptionsSlot]) {
|
|
119
126
|
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
120
|
-
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs);
|
|
127
|
+
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);
|
|
121
128
|
const compareSection = new (_docsUi2().OverviewCompareSection)(docs);
|
|
122
129
|
component.registerRoute(section.route);
|
|
123
130
|
component.registerNavigation(section.navigationLink, section.order);
|
|
@@ -127,7 +134,7 @@ class DocsUI {
|
|
|
127
134
|
}
|
|
128
135
|
}
|
|
129
136
|
exports.DocsUI = DocsUI;
|
|
130
|
-
_defineProperty(DocsUI, "dependencies", [_component().ComponentAspect, _componentCompare().default]);
|
|
137
|
+
_defineProperty(DocsUI, "dependencies", [_component().ComponentAspect, _componentCompare().default, _apiReference().default]);
|
|
131
138
|
_defineProperty(DocsUI, "runtime", _ui().UIRuntime);
|
|
132
139
|
_defineProperty(DocsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
133
140
|
var _default = exports.default = DocsUI;
|
|
@@ -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","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","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,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,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_component","_harmony","_ui","_componentCompare","_docsUi","_docsUi2","_apiReference","_docs","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","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","apiRef","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","exports","ComponentAspect","ComponentCompareAspect","APIReferenceAspect","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 APIReferenceAspect, { APIReferenceUI } from '@teambit/api-reference';\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, APIReferenceAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];\n\n static async provider(\n [component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI],\n config,\n [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);\n const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);\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,IAA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egistry } from '@teambit/harmony';
|
|
3
3
|
import { ComponentPreviewProps } from '@teambit/preview.ui.component-preview';
|
|
4
4
|
export declare enum BadgePosition {
|
|
@@ -22,5 +22,8 @@ export type OverviewProps = {
|
|
|
22
22
|
overviewOptions: OverviewOptionsSlot;
|
|
23
23
|
previewProps?: Partial<ComponentPreviewProps>;
|
|
24
24
|
getEmptyState?: () => ComponentType | undefined;
|
|
25
|
+
TaggedAPI?: React.ComponentType<{
|
|
26
|
+
componentId: string;
|
|
27
|
+
}>;
|
|
25
28
|
};
|
|
26
|
-
export declare function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps): JSX.Element;
|
|
29
|
+
export declare function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: OverviewProps): JSX.Element;
|
|
@@ -26,13 +26,6 @@ function _lodash() {
|
|
|
26
26
|
};
|
|
27
27
|
return data;
|
|
28
28
|
}
|
|
29
|
-
function _reactUiDocs() {
|
|
30
|
-
const data = require("@teambit/react.ui.docs.properties-table");
|
|
31
|
-
_reactUiDocs = function () {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
29
|
function _component() {
|
|
37
30
|
const data = require("@teambit/component");
|
|
38
31
|
_component = function () {
|
|
@@ -95,7 +88,8 @@ function Overview({
|
|
|
95
88
|
titleBadges,
|
|
96
89
|
overviewOptions,
|
|
97
90
|
previewProps,
|
|
98
|
-
getEmptyState
|
|
91
|
+
getEmptyState,
|
|
92
|
+
TaggedAPI
|
|
99
93
|
}) {
|
|
100
94
|
const component = (0, _react().useContext)(_component().ComponentContext);
|
|
101
95
|
const componentDescriptor = (0, _component().useComponentDescriptor)();
|
|
@@ -109,7 +103,7 @@ function Overview({
|
|
|
109
103
|
return isScaling && !includesEnvTemplate;
|
|
110
104
|
}, [isScaling, includesEnvTemplate]);
|
|
111
105
|
const [isLoading, setLoading] = (0, _react().useState)(defaultLoadingState);
|
|
112
|
-
const iframeQueryParams = `
|
|
106
|
+
const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${component.preview?.skipIncludes || component.preview?.onlyOverview}`;
|
|
113
107
|
const overviewPropsValues = overviewProps && overviewProps();
|
|
114
108
|
|
|
115
109
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -159,11 +153,9 @@ function Overview({
|
|
|
159
153
|
height: '100%',
|
|
160
154
|
minHeight: !isScaling ? 500 : undefined
|
|
161
155
|
}
|
|
162
|
-
})), component.preview?.
|
|
163
|
-
isLoading: isLoading,
|
|
156
|
+
})), component.preview?.onlyOverview && !isLoading && /*#__PURE__*/_react().default.createElement(_compositionsPanels().CompositionGallery, {
|
|
164
157
|
component: component
|
|
165
|
-
}), component.preview?.
|
|
166
|
-
className: _overviewModule().default.overviewPropsTable,
|
|
158
|
+
}), component.preview?.onlyOverview && !isLoading && TaggedAPI && /*#__PURE__*/_react().default.createElement(TaggedAPI, {
|
|
167
159
|
componentId: component.id.toString()
|
|
168
160
|
})), buildFailed && EmptyState && /*#__PURE__*/_react().default.createElement(EmptyState, null));
|
|
169
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_reactUiDocs","_component","_previewUi","_componentUi","_compositionsPanels","_readmeSkeleton","_overviewModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isLoading","setLoading","useState","iframeQueryParams","skipIncludes","overviewPropsValues","_ref","onLoad","style","rest","onPreviewLoad","useCallback","props","useEffect","id","toString","createElement","className","styles","overviewWrapper","ComponentOverview","classNames","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ReadmeSkeleton","CompositionGallerySkeleton","compositionsLength","Math","min","compositions","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, CompositionGallerySkeleton } from '@teambit/compositions.panels.composition-gallery';\nimport { 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 EmptyState = getEmptyState && getEmptyState();\n const buildFailed = component.buildStatus?.toLowerCase() !== 'succeed' && component?.host === 'teambit.scope/scope';\n const isScaling = Boolean(component.preview?.isScaling);\n const includesEnvTemplate = Boolean(component.preview?.includesEnvTemplate);\n const defaultLoadingState = React.useMemo(() => {\n return isScaling && !includesEnvTemplate;\n }, [isScaling, includesEnvTemplate]);\n\n const [isLoading, setLoading] = useState(defaultLoadingState);\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 React.useEffect(() => {\n if (!isLoading && defaultLoadingState) setLoading(true);\n if (isLoading && !defaultLoadingState) setLoading(false);\n }, [component.id.toString(), defaultLoadingState]);\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 {!buildFailed && (\n <div className={styles.readme}>\n {isLoading && (\n <ReadmeSkeleton>\n <CompositionGallerySkeleton compositionsLength={Math.min(component.compositions.length, 3)} />\n </ReadmeSkeleton>\n )}\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 )}\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,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,aAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,YAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,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Ac;IACtB4B,WAAW,EAAC,UAAU;IACtBC,MAAM,EAAE,IAAK;IACbC,WAAW,EAAE,CAACrC,iBAAiB,EAAEE,mBAAmB,EAAEmC,WAAW,IAAI,EAAE,CAAE;IACzEC,QAAQ,EAAE,IAAK;IACfC,iBAAiB;IACjBC,aAAa,EAAE;EAAK,GAChBlC,IAAI;IACR/B,SAAS,EAAEA,SAAU;IACrB8B,KAAK,EAAE;MAAEoC,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE,MAAM;MAAEC,SAAS,EAAE,CAACpD,SAAS,GAAG,GAAG,GAAGqD;IAAU;EAAE,EACnF,CAAC,EACDrE,SAAS,CAACS,OAAO,EAAEiB,YAAY,iBAAIxF,MAAA,GAAAiB,OAAA,CAAAmF,aAAA,CAACzF,mBAAA,GAAAyH,kBAAkB;IAAChD,SAAS,EAAEA,SAAU;IAACtB,SAAS,EAAEA;EAAU,CAAE,CAAC,EACrGA,SAAS,CAACS,OAAO,EAAEiB,YAAY,iBAC9BxF,MAAA,GAAAiB,OAAA,CAAAmF,aAAA,CAAC7F,YAAA,GAAA8H,eAAe;IAAChC,SAAS,EAAEC,yBAAM,CAACgC,kBAAmB;IAACC,WAAW,EAAEzE,SAAS,CAACoC,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAE7F,CACN,EACAzB,WAAW,IAAID,UAAU,iBAAIzE,MAAA,GAAAiB,OAAA,CAAAmF,aAAA,CAAC3B,UAAU,MAAE,CACxC,CAAC;AAEV"}
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_component","_previewUi","_componentUi","_compositionsPanels","_readmeSkeleton","_overviewModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","TaggedAPI","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isLoading","setLoading","useState","iframeQueryParams","onlyOverview","skipIncludes","overviewPropsValues","_ref","onLoad","style","rest","onPreviewLoad","useCallback","props","useEffect","id","toString","createElement","className","styles","overviewWrapper","ComponentOverview","classNames","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ReadmeSkeleton","CompositionGallerySkeleton","compositionsLength","Math","min","compositions","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","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';\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, CompositionGallerySkeleton } from '@teambit/compositions.panels.composition-gallery';\nimport { 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 TaggedAPI?: React.ComponentType<{ componentId: string }>;\n};\n\nexport function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: 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 EmptyState = getEmptyState && getEmptyState();\n const buildFailed = component.buildStatus?.toLowerCase() !== 'succeed' && component?.host === 'teambit.scope/scope';\n const isScaling = Boolean(component.preview?.isScaling);\n const includesEnvTemplate = Boolean(component.preview?.includesEnvTemplate);\n const defaultLoadingState = React.useMemo(() => {\n return isScaling && !includesEnvTemplate;\n }, [isScaling, includesEnvTemplate]);\n\n const [isLoading, setLoading] = useState(defaultLoadingState);\n\n const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${\n component.preview?.skipIncludes || component.preview?.onlyOverview\n }`;\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 React.useEffect(() => {\n if (!isLoading && defaultLoadingState) setLoading(true);\n if (isLoading && !defaultLoadingState) setLoading(false);\n }, [component.id.toString(), defaultLoadingState]);\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 {!buildFailed && (\n <div className={styles.readme}>\n {isLoading && (\n <ReadmeSkeleton>\n <CompositionGallerySkeleton compositionsLength={Math.min(component.compositions.length, 3)} />\n </ReadmeSkeleton>\n )}\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?.onlyOverview && !isLoading && <CompositionGallery component={component} />}\n {component.preview?.onlyOverview && !isLoading && TaggedAPI && (\n <TaggedAPI componentId={component.id.toString()} />\n )}\n </div>\n )}\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;AAGA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,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,aAAA;EAAA,MAAAR,IAAA,G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AAG,CAAC1D,SAAS,CAAC2D,YAAY,CAAChF,MAAM,EAAE,CAAC;EAAE,CAAE,CAC/E,CACjB,eACDzC,MAAA,GAAAgB,OAAA,CAAAqF,aAAA,CAAC7F,UAAA,GAAAkH,gBAAgB,EAAAtF,QAAA;IACfwD,MAAM,EAAEG,aAAc;IACtB4B,WAAW,EAAC,UAAU;IACtBC,MAAM,EAAE,IAAK;IACbC,WAAW,EAAE,CAACtC,iBAAiB,EAAEG,mBAAmB,EAAEmC,WAAW,IAAI,EAAE,CAAE;IACzEC,QAAQ,EAAE,IAAK;IACfC,iBAAiB;IACjBC,aAAa,EAAE;EAAK,GAChBlC,IAAI;IACRhC,SAAS,EAAEA,SAAU;IACrB+B,KAAK,EAAE;MAAEoC,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE,MAAM;MAAEC,SAAS,EAAE,CAACrD,SAAS,GAAG,GAAG,GAAGsD;IAAU;EAAE,EACnF,CAAC,EACDtE,SAAS,CAACS,OAAO,EAAEiB,YAAY,IAAI,CAACJ,SAAS,iBAAIpF,MAAA,GAAAgB,OAAA,CAAAqF,aAAA,CAAC3F,mBAAA,GAAA2H,kBAAkB;IAACvE,SAAS,EAAEA;EAAU,CAAE,CAAC,EAC7FA,SAAS,CAACS,OAAO,EAAEiB,YAAY,IAAI,CAACJ,SAAS,IAAIvB,SAAS,iBACzD7D,MAAA,GAAAgB,OAAA,CAAAqF,aAAA,CAACxC,SAAS;IAACyE,WAAW,EAAExE,SAAS,CAACqC,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAEjD,CACN,EACA1B,WAAW,IAAID,UAAU,iBAAIzE,MAAA,GAAAgB,OAAA,CAAAqF,aAAA,CAAC5B,UAAU,MAAE,CACxC,CAAC;AAEV"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Section } from '@teambit/component';
|
|
3
|
+
import { APIReferenceUI } from '@teambit/api-reference';
|
|
2
4
|
import { TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
3
5
|
import { DocsUI } from './docs.ui.runtime';
|
|
4
6
|
export declare class OverviewSection implements Section {
|
|
@@ -8,11 +10,12 @@ export declare class OverviewSection implements Section {
|
|
|
8
10
|
private titleBadgeSlot;
|
|
9
11
|
private overviewOptionsSlot;
|
|
10
12
|
private docs;
|
|
13
|
+
private apiRef;
|
|
11
14
|
constructor(
|
|
12
15
|
/**
|
|
13
16
|
* title badge slot.
|
|
14
17
|
*/
|
|
15
|
-
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, docs: DocsUI);
|
|
18
|
+
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, docs: DocsUI, apiRef: APIReferenceUI);
|
|
16
19
|
navigationLink: {
|
|
17
20
|
href: string;
|
|
18
21
|
exact: boolean;
|
package/dist/overview.section.js
CHANGED
|
@@ -27,10 +27,11 @@ class OverviewSection {
|
|
|
27
27
|
/**
|
|
28
28
|
* title badge slot.
|
|
29
29
|
*/
|
|
30
|
-
titleBadgeSlot, overviewOptionsSlot, docs) {
|
|
30
|
+
titleBadgeSlot, overviewOptionsSlot, docs, apiRef) {
|
|
31
31
|
this.titleBadgeSlot = titleBadgeSlot;
|
|
32
32
|
this.overviewOptionsSlot = overviewOptionsSlot;
|
|
33
33
|
this.docs = docs;
|
|
34
|
+
this.apiRef = apiRef;
|
|
34
35
|
_defineProperty(this, "navigationLink", {
|
|
35
36
|
href: '.',
|
|
36
37
|
exact: true,
|
|
@@ -41,7 +42,8 @@ class OverviewSection {
|
|
|
41
42
|
element: /*#__PURE__*/_react().default.createElement(_overview().Overview, {
|
|
42
43
|
titleBadges: this.titleBadgeSlot,
|
|
43
44
|
overviewOptions: this.overviewOptionsSlot,
|
|
44
|
-
getEmptyState: this.docs.getEmptyState.bind(this.docs)
|
|
45
|
+
getEmptyState: this.docs.getEmptyState.bind(this.docs),
|
|
46
|
+
TaggedAPI: this.apiRef.TaggedAPIPage
|
|
45
47
|
})
|
|
46
48
|
});
|
|
47
49
|
_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","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","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;
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_overview","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","OverviewSection","constructor","titleBadgeSlot","overviewOptionsSlot","docs","apiRef","href","exact","children","index","element","createElement","Overview","titleBadges","overviewOptions","getEmptyState","bind","TaggedAPI","TaggedAPIPage","exports"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { APIReferenceUI } from '@teambit/api-reference';\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 private apiRef: APIReferenceUI\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 TaggedAPI={this.apiRef.TaggedAPIPage}\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;AAGA,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,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;A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AA,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.116/dist/docs.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.116/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
|
@@ -6,6 +6,7 @@ import { UIRuntime } from '@teambit/ui';
|
|
|
6
6
|
import ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare';
|
|
7
7
|
import { OverviewCompare } from '@teambit/docs.ui.overview-compare';
|
|
8
8
|
import { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';
|
|
9
|
+
import APIReferenceAspect, { APIReferenceUI } from '@teambit/api-reference';
|
|
9
10
|
import { DocsAspect } from './docs.aspect';
|
|
10
11
|
import { OverviewSection } from './overview.section';
|
|
11
12
|
import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
|
|
@@ -47,19 +48,19 @@ export class DocsUI {
|
|
|
47
48
|
this.overviewOptionsSlot.register(options);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
static dependencies = [ComponentAspect, ComponentCompareAspect];
|
|
51
|
+
static dependencies = [ComponentAspect, ComponentCompareAspect, APIReferenceAspect];
|
|
51
52
|
|
|
52
53
|
static runtime = UIRuntime;
|
|
53
54
|
|
|
54
55
|
static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];
|
|
55
56
|
|
|
56
57
|
static async provider(
|
|
57
|
-
[component, componentCompare]: [ComponentUI, ComponentCompareUI],
|
|
58
|
+
[component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI],
|
|
58
59
|
config,
|
|
59
60
|
[titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]
|
|
60
61
|
) {
|
|
61
62
|
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
62
|
-
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs);
|
|
63
|
+
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);
|
|
63
64
|
const compareSection = new OverviewCompareSection(docs);
|
|
64
65
|
|
|
65
66
|
component.registerRoute(section.route);
|
package/overview/overview.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React, { useContext, ComponentType, useState } from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { flatten } from 'lodash';
|
|
4
4
|
// import { Icon } from '@teambit/design.elements.icon';
|
|
5
|
-
import { PropertiesTable } from '@teambit/react.ui.docs.properties-table';
|
|
6
5
|
// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';
|
|
7
6
|
import { ComponentContext, useComponentDescriptor } from '@teambit/component';
|
|
8
7
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
@@ -37,9 +36,10 @@ export type OverviewProps = {
|
|
|
37
36
|
overviewOptions: OverviewOptionsSlot;
|
|
38
37
|
previewProps?: Partial<ComponentPreviewProps>;
|
|
39
38
|
getEmptyState?: () => ComponentType | undefined;
|
|
39
|
+
TaggedAPI?: React.ComponentType<{ componentId: string }>;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState }: OverviewProps) {
|
|
42
|
+
export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: OverviewProps) {
|
|
43
43
|
const component = useContext(ComponentContext);
|
|
44
44
|
const componentDescriptor = useComponentDescriptor();
|
|
45
45
|
const overviewProps = flatten(overviewOptions.values())[0];
|
|
@@ -54,7 +54,9 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
54
54
|
|
|
55
55
|
const [isLoading, setLoading] = useState(defaultLoadingState);
|
|
56
56
|
|
|
57
|
-
const iframeQueryParams = `
|
|
57
|
+
const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${
|
|
58
|
+
component.preview?.skipIncludes || component.preview?.onlyOverview
|
|
59
|
+
}`;
|
|
58
60
|
|
|
59
61
|
const overviewPropsValues = overviewProps && overviewProps();
|
|
60
62
|
|
|
@@ -108,9 +110,9 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
108
110
|
component={component}
|
|
109
111
|
style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}
|
|
110
112
|
/>
|
|
111
|
-
{component.preview?.
|
|
112
|
-
{component.preview?.
|
|
113
|
-
<
|
|
113
|
+
{component.preview?.onlyOverview && !isLoading && <CompositionGallery component={component} />}
|
|
114
|
+
{component.preview?.onlyOverview && !isLoading && TaggedAPI && (
|
|
115
|
+
<TaggedAPI componentId={component.id.toString()} />
|
|
114
116
|
)}
|
|
115
117
|
</div>
|
|
116
118
|
)}
|
package/overview.section.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
|
+
import { APIReferenceUI } from '@teambit/api-reference';
|
|
3
4
|
import { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
4
5
|
import { DocsUI } from './docs.ui.runtime';
|
|
5
6
|
|
|
@@ -10,7 +11,8 @@ export class OverviewSection implements Section {
|
|
|
10
11
|
*/
|
|
11
12
|
private titleBadgeSlot: TitleBadgeSlot,
|
|
12
13
|
private overviewOptionsSlot: OverviewOptionsSlot,
|
|
13
|
-
private docs: DocsUI
|
|
14
|
+
private docs: DocsUI,
|
|
15
|
+
private apiRef: APIReferenceUI
|
|
14
16
|
) {}
|
|
15
17
|
|
|
16
18
|
navigationLink = {
|
|
@@ -26,6 +28,7 @@ export class OverviewSection implements Section {
|
|
|
26
28
|
titleBadges={this.titleBadgeSlot}
|
|
27
29
|
overviewOptions={this.overviewOptionsSlot}
|
|
28
30
|
getEmptyState={this.docs.getEmptyState.bind(this.docs)}
|
|
31
|
+
TaggedAPI={this.apiRef.TaggedAPIPage}
|
|
29
32
|
/>
|
|
30
33
|
),
|
|
31
34
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.116",
|
|
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.116"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -18,22 +18,22 @@
|
|
|
18
18
|
"@teambit/docs.ui.overview-compare": "1.0.10",
|
|
19
19
|
"@teambit/component.ui.component-meta": "0.0.358",
|
|
20
20
|
"@teambit/base-ui.loaders.skeleton": "1.0.1",
|
|
21
|
-
"@teambit/compiler": "1.0.
|
|
22
|
-
"@teambit/component": "1.0.
|
|
23
|
-
"@teambit/pkg": "1.0.
|
|
24
|
-
"@teambit/workspace": "1.0.
|
|
21
|
+
"@teambit/compiler": "1.0.116",
|
|
22
|
+
"@teambit/component": "1.0.116",
|
|
23
|
+
"@teambit/pkg": "1.0.116",
|
|
24
|
+
"@teambit/workspace": "1.0.116",
|
|
25
25
|
"@teambit/cli": "0.0.842",
|
|
26
|
-
"@teambit/dev-files": "1.0.
|
|
27
|
-
"@teambit/envs": "1.0.
|
|
28
|
-
"@teambit/graphql": "1.0.
|
|
26
|
+
"@teambit/dev-files": "1.0.116",
|
|
27
|
+
"@teambit/envs": "1.0.116",
|
|
28
|
+
"@teambit/graphql": "1.0.116",
|
|
29
29
|
"@teambit/logger": "0.0.935",
|
|
30
|
-
"@teambit/preview": "1.0.
|
|
31
|
-
"@teambit/scope": "1.0.
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
30
|
+
"@teambit/preview": "1.0.116",
|
|
31
|
+
"@teambit/scope": "1.0.116",
|
|
32
|
+
"@teambit/api-reference": "1.0.116",
|
|
33
|
+
"@teambit/component-compare": "1.0.116",
|
|
34
|
+
"@teambit/ui": "1.0.116",
|
|
35
|
+
"@teambit/pubsub": "1.0.116",
|
|
36
|
+
"@teambit/compositions.panels.composition-gallery": "0.0.204",
|
|
37
37
|
"@teambit/preview.ui.component-preview": "1.0.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|