@teambit/docs 0.0.665 → 0.0.668

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,4 +1,5 @@
1
1
  import { RenderingContext, PreviewPreview, PreviewModule } from '@teambit/preview';
2
+ import { ComponentID } from '@teambit/component-id';
2
3
  export declare class DocsPreview {
3
4
  /**
4
5
  * preview extension.
@@ -9,7 +10,7 @@ export declare class DocsPreview {
9
10
  * preview extension.
10
11
  */
11
12
  preview: PreviewPreview);
12
- render: (componentId: string, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => void;
13
+ render: (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => void;
13
14
  selectPreviewModel(componentId: string, modules: PreviewModule): import("@teambit/preview").ModuleFile<any> | undefined;
14
15
  static runtime: import("@teambit/harmony").RuntimeDefinition;
15
16
  static dependencies: import("@teambit/harmony").Aspect[];
@@ -59,8 +59,8 @@ class DocsPreview {
59
59
  preview) {
60
60
  this.preview = preview;
61
61
  (0, _defineProperty2().default)(this, "render", (componentId, modules, [compositions], context) => {
62
- const docsModule = this.selectPreviewModel(componentId, modules);
63
- modules.mainModule.default(NoopProvider, componentId, docsModule, compositions, context);
62
+ const docsModule = this.selectPreviewModel(componentId.fullName, modules);
63
+ modules.mainModule.default(NoopProvider, componentId.toString(), docsModule, compositions, context);
64
64
  });
65
65
  }
66
66
 
@@ -1 +1 @@
1
- {"version":3,"sources":["docs.preview.runtime.tsx"],"names":["DocsPreview","constructor","preview","componentId","modules","compositions","context","docsModule","selectPreviewModel","mainModule","default","NoopProvider","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;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EA,SAASW,YAAT,CAAsB;AAAEe,EAAAA;AAAF,CAAtB,EAA6D;AAC3D,sBAAO,gEAAGA,QAAH,CAAP;AACD","sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\n\nimport { DocsAspect } from './docs.aspect';\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (componentId: string, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {\n const docsModule = this.selectPreviewModel(componentId, modules);\n\n modules.mainModule.default(NoopProvider, componentId, docsModule, compositions, context);\n };\n\n selectPreviewModel(componentId: string, modules: PreviewModule) {\n const relevant = modules.componentMap[componentId];\n if (!relevant) return undefined;\n\n // only one doc file is supported.\n return relevant[0];\n }\n\n static runtime = PreviewRuntime;\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const docsPreview = new DocsPreview(preview);\n preview.registerPreview({\n name: 'overview',\n render: docsPreview.render.bind(docsPreview),\n selectPreviewModel: docsPreview.selectPreviewModel.bind(docsPreview),\n include: ['compositions'],\n });\n\n return docsPreview;\n }\n}\n\nDocsAspect.addRuntime(DocsPreview);\n\nfunction NoopProvider({ children }: { children: ReactNode }) {\n return <>{children}</>;\n}\n"]}
1
+ {"version":3,"sources":["docs.preview.runtime.tsx"],"names":["DocsPreview","constructor","preview","componentId","modules","compositions","context","docsModule","selectPreviewModel","fullName","mainModule","default","NoopProvider","toString","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,WAAN,CAAkB;AACvB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AAsB;AAAEgB,EAAAA;AAAF,CAAtB,EAA6D;AAC3D,sBAAO,gEAAGA,QAAH,CAAP;AACD","sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { DocsAspect } from './docs.aspect';\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n modules.mainModule.default(NoopProvider, componentId.toString(), docsModule, compositions, context);\n };\n\n selectPreviewModel(componentId: string, modules: PreviewModule) {\n const relevant = modules.componentMap[componentId];\n if (!relevant) return undefined;\n\n // only one doc file is supported.\n return relevant[0];\n }\n\n static runtime = PreviewRuntime;\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const docsPreview = new DocsPreview(preview);\n preview.registerPreview({\n name: 'overview',\n render: docsPreview.render.bind(docsPreview),\n selectPreviewModel: docsPreview.selectPreviewModel.bind(docsPreview),\n include: ['compositions'],\n });\n\n return docsPreview;\n }\n}\n\nDocsAspect.addRuntime(DocsPreview);\n\nfunction NoopProvider({ children }: { children: ReactNode }) {\n return <>{children}</>;\n}\n"]}
@@ -121,7 +121,7 @@ function Overview({
121
121
  var _component$preview;
122
122
 
123
123
  const component = (0, _react().useContext)(_component().ComponentContext);
124
- const componentDescriptor = (0, _react().useContext)(_component().ComponentDescriptorContext);
124
+ const componentDescriptor = (0, _component().useComponentDescriptor)();
125
125
  const lanesModel = (0, _lanesUi().useLanesContext)();
126
126
  const currentLane = lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.currentLane;
127
127
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["overview.tsx"],"names":["Overview","titleBadges","component","ComponentContext","componentDescriptor","ComponentDescriptorContext","lanesModel","currentLane","data","id","toString","fetchComponent","buildStatus","host","margin","preview","includesEnvTemplate","labels","length","badges","values","styles","overviewWrapper","componentOverviewBlock","displayName","version","description","packageName","width","height"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAQO,SAASA,QAAT,CAAkB;AAAEC,EAAAA;AAAF,CAAlB,EAAkD;AAAA;;AACvD,QAAMC,SAAS,GAAG,yBAAWC,6BAAX,CAAlB;AACA,QAAMC,mBAAmB,GAAG,yBAAWC,uCAAX,CAA5B;AACA,QAAMC,UAAU,GAAG,iCAAnB;AACA,QAAMC,WAAW,GAAGD,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEC,WAAhC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAW,sCAAaN,SAAS,CAACO,EAAV,CAAaC,QAAb,EAAb,CAAjB;AACA,QAAMC,cAAc,GAAGH,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEN,SAA7B;AACA,MAAI,CAAAA,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEU,WAAX,MAA2B,SAA3B,IAAwC,CAAAV,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEW,IAAX,MAAoB,qBAAhE,EACE,oBACE,+BAAC,qCAAD;AAAmB,IAAA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I,EALpB;AAME,MAAA,WAAW,EAAEf,SAAS,CAACyB,WANzB;AAOE,MAAA,WAAW,EAAER,MAPf;AAQE,MAAA,mBAAmB,EAAEf;AARvB,MAHF,eAaE,+BAAC,6BAAD;AACE,MAAA,SAAS,EAAEF,SADb;AAEE,MAAA,KAAK,EAAE;AAAE0B,QAAAA,KAAK,EAAE,MAAT;AAAiBC,QAAAA,MAAM,EAAE;AAAzB,OAFT;AAGE,MAAA,WAAW,EAAC,UAHd;AAIE,MAAA,iBAAiB,MAJnB;AAKE,MAAA,SAAS,EAAC;AALZ,MAbF,CADF;AAuBD;;AAED,SAAOtB,WAAW,gBAChB;AAAK,IAAA,SAAS,EAAEc,0BAAOC;AAAvB,kBACE,+BAAC,yBAAD;AAAgB,IAAA,IAAI,EAAEf;AAAtB,IADF,eAEE,+BAAC,qBAAD;AAAW,IAAA,gBAAgB;AAA3B,IAFF,eAGE,+BAAC,6BAAD;AACE,IAAA,SAAS,EAAEL,SADb;AAEE,IAAA,KAAK,EAAE;AAAE0B,MAAAA,KAAK,EAAE,MAAT;AAAiBC,MAAAA,MAAM,EAAE;AAAzB,KAFT;AAGE,IAAA,WAAW,EAAC,UAHd;AAIE,IAAA,iBAAiB,MAJnB;AAKE,IAAA,SAAS,EAAC;AALZ,IAHF,CADgB,gBAahB,+BAAC,6BAAD;AACE,IAAA,SAAS,EAAE3B,SADb;AAEE,IAAA,KAAK,EAAE;AAAE0B,MAAAA,KAAK,EAAE,MAAT;AAAiBC,MAAAA,MAAM,EAAE;AAAzB,KAFT;AAGE,IAAA,WAAW,EAAC,UAHd;AAIE,IAAA,iBAAiB;AAJnB,IAbF;AAoBD","sourcesContent":["import React, { useContext } from 'react';\nimport flatten from 'lodash.flatten';\nimport { ComponentContext, ComponentDescriptorContext } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview } from '@teambit/preview.ui.component-preview';\nimport { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview, TitleBadge } from '@teambit/component.ui.component-meta';\nimport { useFetchDocs } from '@teambit/component.ui.hooks.use-fetch-docs';\nimport { LaneBreadcrumb, useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { Separator } from '@teambit/design.ui.separator';\nimport styles from './overview.module.scss';\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n};\n\nexport function Overview({ titleBadges }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useContext(ComponentDescriptorContext);\n const lanesModel = useLanesContext();\n const currentLane = lanesModel?.currentLane;\n const { data } = useFetchDocs(component.id.toString());\n const fetchComponent = data?.component;\n if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard style={{ margin: 'auto' }} status=\"PROCESSING\" title=\"component preview pending\">\n this might take some time\n </StatusMessageCard>\n );\n if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard\n style={{ margin: 'auto' }}\n status=\"FAILURE\"\n title=\"failed to get component preview \"\n ></StatusMessageCard>\n );\n\n if (component.preview?.includesEnvTemplate === false) {\n const labels = component.labels.length > 0 ? component.labels : fetchComponent?.labels;\n const badges = flatten(titleBadges.values());\n\n return (\n <div className={styles.overviewWrapper}>\n <LaneBreadcrumb lane={currentLane} />\n <Separator isPresentational />\n <ComponentOverview\n className={styles.componentOverviewBlock}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description || fetchComponent?.description}\n labels={labels || []}\n packageName={component.packageName}\n titleBadges={badges}\n componentDescriptor={componentDescriptor}\n />\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n scrolling=\"no\"\n />\n </div>\n );\n }\n\n return currentLane ? (\n <div className={styles.overviewWrapper}>\n <LaneBreadcrumb lane={currentLane} />\n <Separator isPresentational />\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n scrolling=\"no\"\n />\n </div>\n ) : (\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["overview.tsx"],"names":["Overview","titleBadges","component","ComponentContext","componentDescriptor","lanesModel","currentLane","data","id","toString","fetchComponent","buildStatus","host","margin","preview","includesEnvTemplate","labels","length","badges","values","styles","overviewWrapper","componentOverviewBlock","displayName","version","description","packageName","width","height"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAQO,SAASA,QAAT,CAAkB;AAAEC,EAAAA;AAAF,CAAlB,EAAkD;AAAA;;AACvD,QAAMC,SAAS,GAAG,yBAAWC,6BAAX,CAAlB;AACA,QAAMC,mBAAmB,GAAG,0CAA5B;AACA,QAAMC,UAAU,GAAG,iCAAnB;AACA,QAAMC,WAAW,GAAGD,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEC,WAAhC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAW,sCAAaL,SAAS,CAACM,EAAV,CAAaC,QAAb,EAAb,CAAjB;AACA,QAAMC,cAAc,GAAGH,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEL,SAA7B;AACA,MAAI,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Content":["import React, { useContext } from 'react';\nimport flatten from 'lodash.flatten';\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, TitleBadge } from '@teambit/component.ui.component-meta';\nimport { useFetchDocs } from '@teambit/component.ui.hooks.use-fetch-docs';\nimport { LaneBreadcrumb, useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { Separator } from '@teambit/design.ui.separator';\nimport styles from './overview.module.scss';\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n};\n\nexport function Overview({ titleBadges }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor()\n const lanesModel = useLanesContext();\n const currentLane = lanesModel?.currentLane;\n const { data } = useFetchDocs(component.id.toString());\n const fetchComponent = data?.component;\n if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard style={{ margin: 'auto' }} status=\"PROCESSING\" title=\"component preview pending\">\n this might take some time\n </StatusMessageCard>\n );\n if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard\n style={{ margin: 'auto' }}\n status=\"FAILURE\"\n title=\"failed to get component preview \"\n ></StatusMessageCard>\n );\n\n if (component.preview?.includesEnvTemplate === false) {\n const labels = component.labels.length > 0 ? component.labels : fetchComponent?.labels;\n const badges = flatten(titleBadges.values());\n\n return (\n <div className={styles.overviewWrapper}>\n <LaneBreadcrumb lane={currentLane} />\n <Separator isPresentational />\n <ComponentOverview\n className={styles.componentOverviewBlock}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description || fetchComponent?.description}\n labels={labels || []}\n packageName={component.packageName}\n titleBadges={badges}\n componentDescriptor={componentDescriptor}\n />\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n scrolling=\"no\"\n />\n </div>\n );\n }\n\n return currentLane ? (\n <div className={styles.overviewWrapper}>\n <LaneBreadcrumb lane={currentLane} />\n <Separator isPresentational />\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n scrolling=\"no\"\n />\n </div>\n ) : (\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n />\n );\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';
3
+ import { ComponentID } from '@teambit/component-id';
3
4
 
4
5
  import { DocsAspect } from './docs.aspect';
5
6
 
@@ -11,10 +12,10 @@ export class DocsPreview {
11
12
  private preview: PreviewPreview
12
13
  ) {}
13
14
 
14
- render = (componentId: string, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {
15
- const docsModule = this.selectPreviewModel(componentId, modules);
15
+ render = (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {
16
+ const docsModule = this.selectPreviewModel(componentId.fullName, modules);
16
17
 
17
- modules.mainModule.default(NoopProvider, componentId, docsModule, compositions, context);
18
+ modules.mainModule.default(NoopProvider, componentId.toString(), docsModule, compositions, context);
18
19
  };
19
20
 
20
21
  selectPreviewModel(componentId: string, modules: PreviewModule) {
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import flatten from 'lodash.flatten';
3
- import { ComponentContext, ComponentDescriptorContext } from '@teambit/component';
3
+ import { ComponentContext, useComponentDescriptor } from '@teambit/component';
4
4
  import type { SlotRegistry } from '@teambit/harmony';
5
5
  import { ComponentPreview } from '@teambit/preview.ui.component-preview';
6
6
  import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
@@ -18,7 +18,7 @@ export type OverviewProps = {
18
18
 
19
19
  export function Overview({ titleBadges }: OverviewProps) {
20
20
  const component = useContext(ComponentContext);
21
- const componentDescriptor = useContext(ComponentDescriptorContext);
21
+ const componentDescriptor = useComponentDescriptor()
22
22
  const lanesModel = useLanesContext();
23
23
  const currentLane = lanesModel?.currentLane;
24
24
  const { data } = useFetchDocs(component.id.toString());
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/docs",
3
- "version": "0.0.665",
3
+ "version": "0.0.668",
4
4
  "homepage": "https://bit.dev/teambit/docs/docs",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.docs",
8
8
  "name": "docs",
9
- "version": "0.0.665"
9
+ "version": "0.0.668"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -14,25 +14,26 @@
14
14
  "lodash.flatten": "4.4.0",
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
- "@teambit/compiler": "0.0.665",
18
- "@teambit/component": "0.0.665",
17
+ "@teambit/compiler": "0.0.668",
18
+ "@teambit/component": "0.0.668",
19
19
  "@teambit/docs.entities.doc": "0.0.2",
20
- "@teambit/pkg": "0.0.665",
21
- "@teambit/workspace": "0.0.665",
22
- "@teambit/cli": "0.0.450",
23
- "@teambit/dev-files": "0.0.665",
24
- "@teambit/envs": "0.0.665",
25
- "@teambit/graphql": "0.0.665",
26
- "@teambit/logger": "0.0.540",
27
- "@teambit/preview": "0.0.665",
28
- "@teambit/component.ui.component-meta": "0.0.8",
29
- "@teambit/ui": "0.0.665",
30
- "@teambit/pubsub": "0.0.665",
20
+ "@teambit/pkg": "0.0.668",
21
+ "@teambit/workspace": "0.0.668",
22
+ "@teambit/cli": "0.0.451",
23
+ "@teambit/dev-files": "0.0.668",
24
+ "@teambit/envs": "0.0.668",
25
+ "@teambit/graphql": "0.0.668",
26
+ "@teambit/logger": "0.0.541",
27
+ "@teambit/preview": "0.0.668",
28
+ "@teambit/component-id": "0.0.401",
29
+ "@teambit/component.ui.component-meta": "0.0.9",
30
+ "@teambit/ui": "0.0.668",
31
+ "@teambit/pubsub": "0.0.668",
31
32
  "@teambit/component.ui.hooks.use-fetch-docs": "0.0.3",
32
33
  "@teambit/design.ui.separator": "0.0.351",
33
34
  "@teambit/design.ui.surfaces.status-message-card": "0.0.7",
34
- "@teambit/lanes.ui.lanes": "0.0.9",
35
- "@teambit/preview.ui.component-preview": "0.0.491"
35
+ "@teambit/lanes.ui.lanes": "0.0.11",
36
+ "@teambit/preview.ui.component-preview": "0.0.492"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/react-dom": "^17.0.5",
@@ -44,7 +45,7 @@
44
45
  "@types/node": "12.20.4"
45
46
  },
46
47
  "peerDependencies": {
47
- "@teambit/legacy": "1.0.229",
48
+ "@teambit/legacy": "1.0.230",
48
49
  "react-dom": "^16.8.0 || ^17.0.0",
49
50
  "react": "^16.8.0 || ^17.0.0"
50
51
  },
@@ -72,7 +73,7 @@
72
73
  "react": "-"
73
74
  },
74
75
  "peerDependencies": {
75
- "@teambit/legacy": "1.0.229",
76
+ "@teambit/legacy": "1.0.230",
76
77
  "react-dom": "^16.8.0 || ^17.0.0",
77
78
  "react": "^16.8.0 || ^17.0.0"
78
79
  }