@teambit/docs 0.0.1045 → 0.0.1047

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.
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentUI } from '@teambit/component';
3
3
  import { ComponentCompareUI } from '@teambit/component-compare';
4
- import type { TitleBadgeSlot, TitleBadge } from './overview';
4
+ import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
5
5
  export declare class DocsUI {
6
6
  readonly titleBadgeSlot: TitleBadgeSlot;
7
- constructor(titleBadgeSlot: TitleBadgeSlot);
7
+ readonly overviewOptionsSlot: OverviewOptionsSlot;
8
+ constructor(titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot);
8
9
  /**
9
10
  * register a new title badge into the overview section of a component.
10
11
  */
@@ -14,9 +15,10 @@ export declare class DocsUI {
14
15
  */
15
16
  listTitleBadges(): TitleBadge[];
16
17
  getDocsCompare(): JSX.Element;
18
+ registerOverviewOptions(options: OverviewOptions): void;
17
19
  static dependencies: import("@teambit/harmony").Aspect[];
18
20
  static runtime: import("@teambit/harmony").RuntimeDefinition;
19
- static slots: ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<TitleBadge>)[];
20
- static provider([component, componentCompare]: [ComponentUI, ComponentCompareUI], config: any, [titleBadgeSlot]: [TitleBadgeSlot]): Promise<DocsUI>;
21
+ static slots: (((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<TitleBadge>) | ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<OverviewOptions>))[];
22
+ static provider([component, componentCompare]: [ComponentUI, ComponentCompareUI], config: any, [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]): Promise<DocsUI>;
21
23
  }
22
24
  export default DocsUI;
@@ -85,8 +85,9 @@ function _overview() {
85
85
  return data;
86
86
  }
87
87
  class DocsUI {
88
- constructor(titleBadgeSlot) {
88
+ constructor(titleBadgeSlot, overviewOptionsSlot) {
89
89
  this.titleBadgeSlot = titleBadgeSlot;
90
+ this.overviewOptionsSlot = overviewOptionsSlot;
90
91
  }
91
92
 
92
93
  /**
@@ -106,12 +107,16 @@ class DocsUI {
106
107
  }
107
108
  getDocsCompare() {
108
109
  return /*#__PURE__*/_react().default.createElement(_docsUi().OverviewCompare, {
109
- titleBadges: this.titleBadgeSlot
110
+ titleBadges: this.titleBadgeSlot,
111
+ overviewOptions: this.overviewOptionsSlot
110
112
  });
111
113
  }
112
- static async provider([component, componentCompare], config, [titleBadgeSlot]) {
113
- const docs = new DocsUI(titleBadgeSlot);
114
- const section = new (_overview().OverviewSection)(titleBadgeSlot);
114
+ registerOverviewOptions(options) {
115
+ this.overviewOptionsSlot.register(options);
116
+ }
117
+ static async provider([component, componentCompare], config, [titleBadgeSlot, overviewOptionsSlot]) {
118
+ const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
119
+ const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot);
115
120
  const compareSection = new (_docsUi2().OverviewCompareSection)(docs);
116
121
  component.registerRoute(section.route);
117
122
  component.registerNavigation(section.navigationLink, section.order);
@@ -123,7 +128,7 @@ class DocsUI {
123
128
  exports.DocsUI = DocsUI;
124
129
  (0, _defineProperty2().default)(DocsUI, "dependencies", [_component().ComponentAspect, _componentCompare().default]);
125
130
  (0, _defineProperty2().default)(DocsUI, "runtime", _ui().UIRuntime);
126
- (0, _defineProperty2().default)(DocsUI, "slots", [_harmony().Slot.withType()]);
131
+ (0, _defineProperty2().default)(DocsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
127
132
  var _default = DocsUI;
128
133
  exports.default = _default;
129
134
  _docs().DocsAspect.addRuntime(DocsUI);
@@ -1 +1 @@
1
- {"version":3,"names":["DocsUI","constructor","titleBadgeSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","getDocsCompare","provider","component","componentCompare","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","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 } from './overview';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot) {}\n\n /**\n * register a new title badge into the overview section of a component.\n */\n registerTitleBadge(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} />;\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [titleBadgeSlot]: [TitleBadgeSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot);\n const section = new OverviewSection(titleBadgeSlot);\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"],"m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iCAAsB,EAACJ,IAAI,CAAC;IAEvDH,SAAS,CAACQ,aAAa,CAACJ,OAAO,CAACK,KAAK,CAAC;IACtCT,SAAS,CAACU,kBAAkB,CAACN,OAAO,CAACO,cAAc,EAAEP,OAAO,CAACQ,KAAK,CAAC;IACnEX,gBAAgB,CAACS,kBAAkB,CAACJ,cAAc,CAAC;IACnDL,gBAAgB,CAACY,cAAc,CAAC,CAACP,cAAc,CAACG,KAAK,CAAC,CAAC;IACvD,OAAON,IAAI;EACb;AACF;AAAC;AAAA,gCA5CYjB,MAAM,kBAuBK,CAAC4B,4BAAe,EAAEC,2BAAsB,CAAC;AAAA,gCAvBpD7B,MAAM,aAyBA8B,eAAS;AAAA,gCAzBf9B,MAAM,WA2BF,CAAC+B,eAAI,CAACC,QAAQ,EAAc,CAAC;AAAA,eAmB/BhC,MAAM;AAAA;AAErBiC,kBAAU,CAACC,UAAU,CAAClC,MAAM,CAAC"}
1
+ {"version":3,"names":["DocsUI","constructor","titleBadgeSlot","overviewOptionsSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","getDocsCompare","registerOverviewOptions","options","provider","component","componentCompare","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA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,OAAO,CAACK,KAAK,CAAC;IACtCT,SAAS,CAACU,kBAAkB,CAACN,OAAO,CAACO,cAAc,EAAEP,OAAO,CAACQ,KAAK,CAAC;IACnEX,gBAAgB,CAACS,kBAAkB,CAACJ,cAAc,CAAC;IACnDL,gBAAgB,CAACY,cAAc,CAAC,CAACP,cAAc,CAACG,KAAK,CAAC,CAAC;IACvD,OAAON,IAAI;EACb;AACF;AAAC;AAAA,gCAhDYpB,MAAM,kBA2BK,CAAC+B,4BAAe,EAAEC,2BAAsB,CAAC;AAAA,gCA3BpDhC,MAAM,aA6BAiC,eAAS;AAAA,gCA7BfjC,MAAM,WA+BF,CAACkC,eAAI,CAACC,QAAQ,EAAc,EAAED,eAAI,CAACC,QAAQ,EAAmB,CAAC;AAAA,eAmBjEnC,MAAM;AAAA;AAErBoC,kBAAU,CAACC,UAAU,CAACrC,MAAM,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export type { DocsPreview, DocsRootProps } from './docs.preview.runtime';
10
10
  export type { DocReader } from './doc-reader';
11
11
  export type { Docs, Example } from './docs';
12
12
  export { defaultDocs } from './docs';
13
- export type { TitleBadgeSlot, TitleBadge } from './overview';
13
+ export type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
14
14
  export { Overview, BadgePosition } from './overview';
15
15
  export { DocsAspect };
16
16
  export default DocsAspect;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["DocsAspect"],"sources":["index.ts"],"sourcesContent":["import { DocsAspect } from './docs.aspect';\n\n/**\n * Doc entity.\n * @deprecated - please dont use this. use directly from @teambit/docs.entities.doc.\n */\nexport { Doc, DocProp, DocPropList } from '@teambit/docs.entities.doc';\n\nexport type { DocsMain } from './docs.main.runtime';\nexport type { DocsUI } from './docs.ui.runtime';\nexport type { DocsPreview, DocsRootProps } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\nexport type { Docs, Example } from './docs';\nexport { defaultDocs } from './docs';\n\nexport type { TitleBadgeSlot, TitleBadge } from './overview';\nexport { Overview, BadgePosition } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAdA;AACA;AACA;AACA;AAHA,eAiBeA,kBAAU;AAAA"}
1
+ {"version":3,"names":["DocsAspect"],"sources":["index.ts"],"sourcesContent":["import { DocsAspect } from './docs.aspect';\n\n/**\n * Doc entity.\n * @deprecated - please dont use this. use directly from @teambit/docs.entities.doc.\n */\nexport { Doc, DocProp, DocPropList } from '@teambit/docs.entities.doc';\n\nexport type { DocsMain } from './docs.main.runtime';\nexport type { DocsUI } from './docs.ui.runtime';\nexport type { DocsPreview, DocsRootProps } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\nexport type { Docs, Example } from './docs';\nexport { defaultDocs } from './docs';\n\nexport type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';\nexport { Overview, BadgePosition } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAdA;AACA;AACA;AACA;AAHA,eAiBeA,kBAAU;AAAA"}
@@ -1,2 +1,2 @@
1
1
  export { Overview, BadgePosition } from './overview';
2
- export type { TitleBadgeSlot, TitleBadge } from './overview';
2
+ export type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Overview, BadgePosition } from './overview';\nexport type { TitleBadgeSlot, TitleBadge } from './overview';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Overview, BadgePosition } from './overview';\nexport type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
@@ -12,7 +12,12 @@ export declare type TitleBadge = {
12
12
  position?: BadgePosition;
13
13
  };
14
14
  export declare type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
15
+ export declare type OverviewOptions = () => {
16
+ queryParams?: string;
17
+ };
18
+ export declare type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;
15
19
  export declare type OverviewProps = {
16
20
  titleBadges: TitleBadgeSlot;
21
+ overviewOptions: OverviewOptionsSlot;
17
22
  };
18
- export declare function Overview({ titleBadges }: OverviewProps): JSX.Element;
23
+ export declare function Overview({ titleBadges, overviewOptions }: OverviewProps): JSX.Element;
@@ -92,11 +92,13 @@ exports.BadgePosition = BadgePosition;
92
92
  BadgePosition[BadgePosition["Package"] = 3] = "Package";
93
93
  })(BadgePosition || (exports.BadgePosition = BadgePosition = {}));
94
94
  function Overview({
95
- titleBadges
95
+ titleBadges,
96
+ overviewOptions
96
97
  }) {
97
98
  var _component$preview, _component$preview2, _component$preview3, _component$preview4, _component$preview5;
98
99
  const component = (0, _react().useContext)(_component().ComponentContext);
99
100
  const componentDescriptor = (0, _component().useComponentDescriptor)();
101
+ const overviewProps = (0, _lodash().flatten)(overviewOptions.values())[0];
100
102
  const showHeader = !((_component$preview = component.preview) !== null && _component$preview !== void 0 && _component$preview.legacyHeader);
101
103
  const [isLoading, setLoading] = (0, _react().useState)(true);
102
104
  if ((component === null || component === void 0 ? void 0 : component.buildStatus) === 'pending' && (component === null || component === void 0 ? void 0 : component.host) === 'teambit.scope/scope') return /*#__PURE__*/_react().default.createElement(_designUiSurfaces().StatusMessageCard, {
@@ -115,6 +117,7 @@ function Overview({
115
117
  });
116
118
  const isScaling = (_component$preview2 = component.preview) === null || _component$preview2 === void 0 ? void 0 : _component$preview2.isScaling;
117
119
  const iframeQueryParams = `skipIncludes=${((_component$preview3 = component.preview) === null || _component$preview3 === void 0 ? void 0 : _component$preview3.skipIncludes) || 'false'}`;
120
+ const overviewPropsValues = overviewProps && overviewProps();
118
121
  return /*#__PURE__*/_react().default.createElement("div", {
119
122
  className: _overviewModule().default.overviewWrapper
120
123
  }, showHeader && /*#__PURE__*/_react().default.createElement(_componentUi().ComponentOverview, {
@@ -138,7 +141,7 @@ function Overview({
138
141
  },
139
142
  previewName: "overview",
140
143
  pubsub: true,
141
- queryParams: [iframeQueryParams],
144
+ queryParams: [iframeQueryParams, (overviewPropsValues === null || overviewPropsValues === void 0 ? void 0 : overviewPropsValues.queryParams) || ''],
142
145
  viewport: null,
143
146
  fullContentHeight: true,
144
147
  disableScroll: true
@@ -1 +1 @@
1
- {"version":3,"names":["BadgePosition","Overview","titleBadges","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","showHeader","preview","legacyHeader","isLoading","setLoading","useState","buildStatus","host","margin","isScaling","iframeQueryParams","skipIncludes","styles","overviewWrapper","classNames","componentOverviewBlock","legacyPreview","displayName","version","description","labels","packageName","flatten","values","readme","width","height","overviewPropsTable","id","toString"],"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 } 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 OverviewProps = {\n titleBadges: TitleBadgeSlot;\n};\n\nexport function Overview({ titleBadges }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n\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 return (\n <div className={styles.overviewWrapper}>\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={() => setLoading(false)}\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams]}\n viewport={null}\n fullContentHeight\n disableScroll={true}\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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4C;AAAA;AAV5C;AAEA;AAOA;AAAA,IAGYA,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa;AAmBlB,SAASC,QAAQ,CAAC;EAAEC;AAA2B,CAAC,EAAE;EAAA;EACvD,MAAMC,SAAS,GAAG,IAAAC,mBAAU,EAACC,6BAAgB,CAAC;EAC9C,MAAMC,mBAAmB,GAAG,IAAAC,mCAAsB,GAAE;EAEpD,MAAMC,UAAU,GAAG,wBAACL,SAAS,CAACM,OAAO,+CAAjB,mBAAmB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AAY;IACnC,WAAW,EAAE,IAAAC,iBAAO,EAAC5B,WAAW,CAAC6B,MAAM,EAAE,CAAE;IAC3C,mBAAmB,EAAEzB,mBAAoB;IACzC,SAAS,EAAEH;EAAU,EAExB,eAOD;IAAK,SAAS,EAAEiB,yBAAM,CAACY;EAAO,gBAE5B,+BAAC,6BAAgB;IACf,MAAM,EAAE,MAAMpB,UAAU,CAAC,KAAK,CAAE;IAChC,SAAS,EAAET,SAAU;IACrB,KAAK,EAAE;MAAE8B,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE;IAAO,CAAE;IACzC,WAAW,EAAC,UAAU;IACtB,MAAM,EAAE,IAAK;IACb,WAAW,EAAE,CAAChB,iBAAiB,CAAE;IACjC,QAAQ,EAAE,IAAK;IACf,iBAAiB;IACjB,aAAa,EAAE;EAAK,EACpB,EACD,wBAAAf,SAAS,CAACM,OAAO,wDAAjB,oBAAmBU,YAAY,kBAAI,+BAAC,wCAAkB;IAAC,SAAS,EAAER,SAAU;IAAC,SAAS,EAAER;EAAU,EAAG,EACrG,wBAAAA,SAAS,CAACM,OAAO,wDAAjB,oBAAmBU,YAAY,kBAC9B,+BAAC,8BAAe;IAAC,SAAS,EAAEC,yBAAM,CAACe,kBAAmB;IAAC,WAAW,EAAEhC,SAAS,CAACiC,EAAE,CAACC,QAAQ;EAAG,EAC7F,CACG,CACF;AAEV"}
1
+ {"version":3,"names":["BadgePosition","Overview","titleBadges","overviewOptions","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","overviewProps","flatten","values","showHeader","preview","legacyHeader","isLoading","setLoading","useState","buildStatus","host","margin","isScaling","iframeQueryParams","skipIncludes","overviewPropsValues","styles","overviewWrapper","classNames","componentOverviewBlock","legacyPreview","displayName","version","description","labels","packageName","readme","width","height","queryParams","overviewPropsTable","id","toString"],"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 } 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};\n\nexport function Overview({ titleBadges, overviewOptions }: 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 return (\n <div className={styles.overviewWrapper}>\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={() => setLoading(false)}\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams, overviewPropsValues?.queryParams || '']}\n viewport={null}\n fullContentHeight\n disableScroll={true}\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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4C;AAAA;AAV5C;AAEA;AAOA;AAAA,IAGYA,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;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AO,wDAAjB,oBAAmBU,YAAY,kBAC9B,+BAAC,8BAAe;IAAC,SAAS,EAAEE,yBAAM,CAACc,kBAAmB;IAAC,WAAW,EAAEnC,SAAS,CAACoC,EAAE,CAACC,QAAQ;EAAG,EAC7F,CACG,CACF;AAEV"}
@@ -1,16 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { Section } from '@teambit/component';
3
- import { TitleBadgeSlot } from './overview';
3
+ import { TitleBadgeSlot, OverviewOptionsSlot } from './overview';
4
4
  export declare class OverviewSection implements Section {
5
5
  /**
6
6
  * title badge slot.
7
7
  */
8
8
  private titleBadgeSlot;
9
+ private overviewOptionsSlot;
9
10
  constructor(
10
11
  /**
11
12
  * title badge slot.
12
13
  */
13
- titleBadgeSlot: TitleBadgeSlot);
14
+ titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot);
14
15
  navigationLink: {
15
16
  href: string;
16
17
  exact: boolean;
@@ -31,8 +31,9 @@ class OverviewSection {
31
31
  /**
32
32
  * title badge slot.
33
33
  */
34
- titleBadgeSlot) {
34
+ titleBadgeSlot, overviewOptionsSlot) {
35
35
  this.titleBadgeSlot = titleBadgeSlot;
36
+ this.overviewOptionsSlot = overviewOptionsSlot;
36
37
  (0, _defineProperty2().default)(this, "navigationLink", {
37
38
  href: '.',
38
39
  exact: true,
@@ -41,7 +42,8 @@ class OverviewSection {
41
42
  (0, _defineProperty2().default)(this, "route", {
42
43
  index: true,
43
44
  element: /*#__PURE__*/_react().default.createElement(_overview().Overview, {
44
- titleBadges: this.titleBadgeSlot
45
+ titleBadges: this.titleBadgeSlot,
46
+ overviewOptions: this.overviewOptionsSlot
45
47
  })
46
48
  });
47
49
  (0, _defineProperty2().default)(this, "order", 10);
@@ -1 +1 @@
1
- {"version":3,"names":["OverviewSection","constructor","titleBadgeSlot","href","exact","children","index","element"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { Overview, TitleBadgeSlot } from './overview';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * title badge slot.\n */\n private titleBadgeSlot: TitleBadgeSlot\n ) {}\n\n navigationLink = {\n href: '.',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n index: true,\n element: <Overview titleBadges={this.titleBadgeSlot} />,\n };\n\n order = 10;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,eAAe,CAAoB;EAC9CC,WAAW;EACT;AACJ;AACA;EACYC,cAA8B,EACtC;IAAA,KADQA,cAA8B,GAA9BA,cAA8B;IAAA,wDAGvB;MACfC,IAAI,EAAE,GAAG;MACTC,KAAK,EAAE,IAAI;MACXC,QAAQ,EAAE;IACZ,CAAC;IAAA,+CAEO;MACNC,KAAK,EAAE,IAAI;MACXC,OAAO,eAAE,+BAAC,oBAAQ;QAAC,WAAW,EAAE,IAAI,CAACL;MAAe;IACtD,CAAC;IAAA,+CAEO,EAAE;EAbP;AAcL;AAAC"}
1
+ {"version":3,"names":["OverviewSection","constructor","titleBadgeSlot","overviewOptionsSlot","href","exact","children","index","element"],"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 titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />,\n };\n\n order = 10;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,eAAe,CAAoB;EAC9CC,WAAW;EACT;AACJ;AACA;EACYC,cAA8B,EAC9BC,mBAAwC,EAChD;IAAA,KAFQD,cAA8B,GAA9BA,cAA8B;IAAA,KAC9BC,mBAAwC,GAAxCA,mBAAwC;IAAA,wDAGjC;MACfC,IAAI,EAAE,GAAG;MACTC,KAAK,EAAE,IAAI;MACXC,QAAQ,EAAE;IACZ,CAAC;IAAA,+CAEO;MACNC,KAAK,EAAE,IAAI;MACXC,OAAO,eAAE,+BAAC,oBAAQ;QAAC,WAAW,EAAE,IAAI,CAACN,cAAe;QAAC,eAAe,EAAE,IAAI,CAACC;MAAoB;IACjG,CAAC;IAAA,+CAEO,EAAE;EAbP;AAcL;AAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.1045/dist/docs.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.1045/dist/docs.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.1047/dist/docs.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.1047/dist/docs.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -8,10 +8,10 @@ import { OverviewCompare } from '@teambit/docs.ui.overview-compare';
8
8
  import { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';
9
9
  import { DocsAspect } from './docs.aspect';
10
10
  import { OverviewSection } from './overview.section';
11
- import type { TitleBadgeSlot, TitleBadge } from './overview';
11
+ import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
12
12
 
13
13
  export class DocsUI {
14
- constructor(readonly titleBadgeSlot: TitleBadgeSlot) {}
14
+ constructor(readonly titleBadgeSlot: TitleBadgeSlot, readonly overviewOptionsSlot: OverviewOptionsSlot) {}
15
15
 
16
16
  /**
17
17
  * register a new title badge into the overview section of a component.
@@ -30,22 +30,26 @@ export class DocsUI {
30
30
  }
31
31
 
32
32
  getDocsCompare() {
33
- return <OverviewCompare titleBadges={this.titleBadgeSlot} />;
33
+ return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;
34
+ }
35
+
36
+ registerOverviewOptions(options: OverviewOptions) {
37
+ this.overviewOptionsSlot.register(options);
34
38
  }
35
39
 
36
40
  static dependencies = [ComponentAspect, ComponentCompareAspect];
37
41
 
38
42
  static runtime = UIRuntime;
39
43
 
40
- static slots = [Slot.withType<TitleBadge>()];
44
+ static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];
41
45
 
42
46
  static async provider(
43
47
  [component, componentCompare]: [ComponentUI, ComponentCompareUI],
44
48
  config,
45
- [titleBadgeSlot]: [TitleBadgeSlot]
49
+ [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]
46
50
  ) {
47
- const docs = new DocsUI(titleBadgeSlot);
48
- const section = new OverviewSection(titleBadgeSlot);
51
+ const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
52
+ const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot);
49
53
  const compareSection = new OverviewCompareSection(docs);
50
54
 
51
55
  component.registerRoute(section.route);
package/overview/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { Overview, BadgePosition } from './overview';
2
- export type { TitleBadgeSlot, TitleBadge } from './overview';
2
+ export type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
@@ -28,14 +28,19 @@ export type TitleBadge = {
28
28
 
29
29
  export type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
30
30
 
31
+ export type OverviewOptions = () => { queryParams?: string };
32
+
33
+ export type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;
34
+
31
35
  export type OverviewProps = {
32
36
  titleBadges: TitleBadgeSlot;
37
+ overviewOptions: OverviewOptionsSlot;
33
38
  };
34
39
 
35
- export function Overview({ titleBadges }: OverviewProps) {
40
+ export function Overview({ titleBadges, overviewOptions }: OverviewProps) {
36
41
  const component = useContext(ComponentContext);
37
42
  const componentDescriptor = useComponentDescriptor();
38
-
43
+ const overviewProps = flatten(overviewOptions.values())[0];
39
44
  const showHeader = !component.preview?.legacyHeader;
40
45
  const [isLoading, setLoading] = useState(true);
41
46
 
@@ -53,6 +58,8 @@ export function Overview({ titleBadges }: OverviewProps) {
53
58
 
54
59
  const iframeQueryParams = `skipIncludes=${component.preview?.skipIncludes || 'false'}`;
55
60
 
61
+ const overviewPropsValues = overviewProps && overviewProps();
62
+
56
63
  return (
57
64
  <div className={styles.overviewWrapper}>
58
65
  {showHeader && (
@@ -82,7 +89,7 @@ export function Overview({ titleBadges }: OverviewProps) {
82
89
  style={{ width: '100%', height: '100%' }}
83
90
  previewName="overview"
84
91
  pubsub={true}
85
- queryParams={[iframeQueryParams]}
92
+ queryParams={[iframeQueryParams, overviewPropsValues?.queryParams || '']}
86
93
  viewport={null}
87
94
  fullContentHeight
88
95
  disableScroll={true}
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Section } from '@teambit/component';
3
- import { Overview, TitleBadgeSlot } from './overview';
3
+ import { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';
4
4
 
5
5
  export class OverviewSection implements Section {
6
6
  constructor(
7
7
  /**
8
8
  * title badge slot.
9
9
  */
10
- private titleBadgeSlot: TitleBadgeSlot
10
+ private titleBadgeSlot: TitleBadgeSlot,
11
+ private overviewOptionsSlot: OverviewOptionsSlot
11
12
  ) {}
12
13
 
13
14
  navigationLink = {
@@ -18,7 +19,7 @@ export class OverviewSection implements Section {
18
19
 
19
20
  route = {
20
21
  index: true,
21
- element: <Overview titleBadges={this.titleBadgeSlot} />,
22
+ element: <Overview titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />,
22
23
  };
23
24
 
24
25
  order = 10;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/docs",
3
- "version": "0.0.1045",
3
+ "version": "0.0.1047",
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": "0.0.1045"
9
+ "version": "0.0.1047"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphql-tag": "2.12.1",
@@ -19,24 +19,24 @@
19
19
  "@teambit/component-id": "0.0.427",
20
20
  "@teambit/design.ui.surfaces.status-message-card": "0.0.17",
21
21
  "@teambit/base-ui.loaders.skeleton": "1.0.1",
22
- "@teambit/compiler": "0.0.1045",
23
- "@teambit/component": "0.0.1045",
24
- "@teambit/pkg": "0.0.1045",
25
- "@teambit/workspace": "0.0.1045",
26
- "@teambit/cli": "0.0.703",
27
- "@teambit/dev-files": "0.0.1045",
28
- "@teambit/envs": "0.0.1045",
29
- "@teambit/graphql": "0.0.1045",
30
- "@teambit/logger": "0.0.796",
31
- "@teambit/preview": "0.0.1045",
32
- "@teambit/component-compare": "0.0.293",
33
- "@teambit/docs.ui.overview-compare-section": "0.0.10",
34
- "@teambit/docs.ui.overview-compare": "0.0.222",
35
- "@teambit/ui": "0.0.1045",
36
- "@teambit/pubsub": "0.0.1045",
37
- "@teambit/component.ui.component-meta": "0.0.270",
38
- "@teambit/compositions.panels.composition-gallery": "0.0.65",
39
- "@teambit/preview.ui.component-preview": "0.0.518",
22
+ "@teambit/compiler": "0.0.1047",
23
+ "@teambit/component": "0.0.1047",
24
+ "@teambit/pkg": "0.0.1047",
25
+ "@teambit/workspace": "0.0.1047",
26
+ "@teambit/cli": "0.0.705",
27
+ "@teambit/dev-files": "0.0.1047",
28
+ "@teambit/envs": "0.0.1047",
29
+ "@teambit/graphql": "0.0.1047",
30
+ "@teambit/logger": "0.0.798",
31
+ "@teambit/preview": "0.0.1047",
32
+ "@teambit/component-compare": "0.0.295",
33
+ "@teambit/docs.ui.overview-compare-section": "0.0.12",
34
+ "@teambit/docs.ui.overview-compare": "0.0.224",
35
+ "@teambit/ui": "0.0.1047",
36
+ "@teambit/pubsub": "0.0.1047",
37
+ "@teambit/component.ui.component-meta": "0.0.272",
38
+ "@teambit/compositions.panels.composition-gallery": "0.0.67",
39
+ "@teambit/preview.ui.component-preview": "0.0.519",
40
40
  "@teambit/react.ui.docs.properties-table": "0.0.12"
41
41
  },
42
42
  "devDependencies": {
@@ -51,7 +51,7 @@
51
51
  "@teambit/docs.content.docs-overview": "1.95.9"
52
52
  },
53
53
  "peerDependencies": {
54
- "@teambit/legacy": "1.0.482",
54
+ "@teambit/legacy": "1.0.484",
55
55
  "react": "^16.8.0 || ^17.0.0",
56
56
  "react-dom": "^16.8.0 || ^17.0.0"
57
57
  },