@teambit/lanes 0.0.295 → 0.0.296

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.
@@ -2,10 +2,9 @@ import { RouteProps } from 'react-router-dom';
2
2
  import { Harmony } from '@teambit/harmony';
3
3
  import { UiUI } from '@teambit/ui';
4
4
  import { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
5
- import { LanesOrderedNavigationSlot, LaneOverviewLineSlot, LaneOverviewLine } from '@teambit/lanes.ui.lanes';
5
+ import { LanesOrderedNavigationSlot, LaneOverviewLineSlot, LaneOverviewLine, LanesNavPlugin } from '@teambit/lanes.ui.lanes';
6
6
  import { ScopeUI } from '@teambit/scope';
7
7
  import { WorkspaceUI } from '@teambit/workspace';
8
- import { NavLinkProps } from '@teambit/react-router';
9
8
  import { ComponentUI } from '@teambit/component';
10
9
  import { SidebarUI } from '@teambit/sidebar';
11
10
  import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
@@ -43,7 +42,7 @@ export declare class LanesUI {
43
42
  * register a new line beneath the lane overview section.
44
43
  */
45
44
  registerOverviewLine(...lines: LaneOverviewLine[]): this;
46
- registerNavigation(nav: NavLinkProps, order?: number): void;
45
+ registerNavigation(routes: LanesNavPlugin[]): void;
47
46
  static provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI], _: any, [routeSlot, overviewSlot, navSlot, menuWidgetSlot]: [
48
47
  RouteSlot,
49
48
  LaneOverviewLineSlot,
@@ -143,10 +143,26 @@ class LanesUI {
143
143
  path: _lanesUi().LanesModel.laneComponentUrlRegex,
144
144
  children: this.componentUi.getComponentUI(this.host)
145
145
  }, {
146
- path: _lanesUi().LanesModel.laneRouteUrlRegex,
147
- children: /*#__PURE__*/_react().default.createElement(_lanesUi().LanesOverview, {
146
+ path: `${_lanesUi().LanesModel.laneRouteUrlRegex}/~readme`,
147
+ children: /*#__PURE__*/_react().default.createElement(_lanesUi().LaneReadmeOverview, {
148
+ host: this.host,
149
+ overviewSlot: this.overviewSlot,
150
+ routeSlot: this.routeSlot
151
+ })
152
+ }, {
153
+ path: `${_lanesUi().LanesModel.laneRouteUrlRegex}/~gallery`,
154
+ children: /*#__PURE__*/_react().default.createElement(_lanesUi().LaneGallery, {
148
155
  routeSlot: this.routeSlot,
149
- overviewSlot: this.overviewSlot
156
+ overviewSlot: this.overviewSlot,
157
+ host: this.lanesHost
158
+ })
159
+ }, {
160
+ exact: true,
161
+ path: `${_lanesUi().LanesModel.laneRouteUrlRegex}`,
162
+ children: /*#__PURE__*/_react().default.createElement(_lanesUi().LaneReadmeOverview, {
163
+ host: this.host,
164
+ overviewSlot: this.overviewSlot,
165
+ routeSlot: this.routeSlot
150
166
  })
151
167
  }]);
152
168
  this.hostAspect.registerMenuRoutes([{
@@ -166,10 +182,25 @@ class LanesUI {
166
182
  }
167
183
 
168
184
  registerLanesRoutes() {
169
- this.registerNavigation({
170
- href: '',
171
- children: 'Gallery'
172
- });
185
+ this.registerNavigation([{
186
+ props: {
187
+ href: '',
188
+ children: 'README'
189
+ },
190
+ order: 1,
191
+ hide: () => {
192
+ var _lanesContext$viewedL;
193
+
194
+ const lanesContext = (0, _lanesUi().useLanesContext)();
195
+ return !(lanesContext !== null && lanesContext !== void 0 && (_lanesContext$viewedL = lanesContext.viewedLane) !== null && _lanesContext$viewedL !== void 0 && _lanesContext$viewedL.readmeComponent);
196
+ }
197
+ }, {
198
+ props: {
199
+ href: '~gallery',
200
+ children: 'Gallery'
201
+ },
202
+ order: 1
203
+ }]);
173
204
  }
174
205
 
175
206
  registerRoutes() {
@@ -191,11 +222,8 @@ class LanesUI {
191
222
  return this;
192
223
  }
193
224
 
194
- registerNavigation(nav, order) {
195
- this.navSlot.register({
196
- props: nav,
197
- order
198
- });
225
+ registerNavigation(routes) {
226
+ this.navSlot.register(routes);
199
227
  }
200
228
 
201
229
  static async provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi], _, [routeSlot, overviewSlot, navSlot, menuWidgetSlot], harmony) {
@@ -1 +1 @@
1
- {"version":3,"sources":["lanes.ui.runtime.tsx"],"names":["LanesUI","constructor","componentUi","routeSlot","navSlot","menuWidgetSlot","overviewSlot","workspace","scope","children","hostAspect","lanesHost","host","WorkspaceAspect","id","ScopeAspect","registerHostAspectRoutes","registerRoutes","path","LanesModel","laneComponentUrlRegex","getComponentUI","laneRouteUrlRegex","registerMenuRoutes","getMenu","registerMenuWidget","menuItems","register","registerLanesRoutes","registerNavigation","href","registerRoute","route","registerOverviewLine","lines","nav","order","props","provider","uiUi","workspaceUi","scopeUi","sidebarUi","_","harmony","config","String","get","lanesUi","registerRenderHooks","reactContext","renderContext","drawer","LanesDrawer","showScope","registerDrawer","UIAspect","ComponentAspect","SidebarAspect","UIRuntime","Slot","withType","LanesAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYA;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;;AAGO,MAAMA,OAAN,CAAc;AAUnBC,EAAAA,WAAW,CACDC,WADC,EAEDC,SAFC,EAGDC,OAHC,EAIDC,cAJC;AAKT;AACJ;AACA;AACYC,EAAAA,YARC,EASDC,SATC,EAUDC,KAVC,EAWT;AAAA,SAVQN,WAUR,GAVQA,WAUR;AAAA,SATQC,SASR,GATQA,SASR;AA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C,EAA7B,EAAiC;AAC/BP,MAAAA,SAAS,GAAGiC,WAAZ;AACD;;AACD,QAAI5B,IAAI,KAAKG,iBAAYD,EAAzB,EAA6B;AAC3BN,MAAAA,KAAK,GAAGiC,OAAR;AACD;;AACD,UAAMO,OAAO,GAAG,IAAIhD,OAAJ,CAAYE,WAAZ,EAAyBC,SAAzB,EAAoCC,OAApC,EAA6CE,YAA7C,EAA2DD,cAA3D,EAA2EE,SAA3E,EAAsFC,KAAtF,CAAhB;AACA+B,IAAAA,IAAI,CAACU,mBAAL,CAAyB;AAAEC,MAAAA,YAAY,EAAEF,OAAO,CAACG;AAAxB,KAAzB;AACA,UAAMC,MAAM,GAAG,KAAIC,sBAAJ,EAAgB;AAAEC,MAAAA,SAAS,EAAEN,OAAO,CAACrC,SAAR,KAAsB;AAAnC,KAAhB,CAAf;AACA+B,IAAAA,SAAS,CAACa,cAAV,CAAyBH,MAAzB;AACAJ,IAAAA,OAAO,CAAC/B,cAAR;AACA+B,IAAAA,OAAO,CAACvB,kBAAR,CAA2B,mBAAM,+BAAC,sBAAD;AAAa,MAAA,IAAI,EAAEuB,OAAO,CAACrC;AAA3B,MAAjC;AACA,WAAOqC,OAAP;AACD;;AA3HkB;;;gCAARhD,O,kBACW,CAACwD,cAAD,EAAWC,oBAAX,EAA4B5C,oBAA5B,EAA6CE,gBAA7C,EAA0D2C,kBAA1D,C;gCADX1D,O,aAEM2D,e;gCAFN3D,O,WAGI,CACb4D,gBAAKC,QAAL,EADa,EAEbD,gBAAKC,QAAL,EAFa,EAGbD,gBAAKC,QAAL,EAHa,EAIbD,gBAAKC,QAAL,EAJa,C;eA2HF7D,O;;;AAEf8D,qBAAYC,UAAZ,CAAuB/D,OAAvB","sourcesContent":["import React, { ReactNode } from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport { Slot, Harmony } from '@teambit/harmony';\nimport { UIRuntime, UiUI, UIAspect } from '@teambit/ui';\nimport { LanesAspect } from '@teambit/lanes';\nimport { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport {\n LanesDrawer,\n LanesHost,\n LanesOverview,\n LanesOrderedNavigationSlot,\n LanesModel,\n LanesOverviewMenu,\n ViewedLaneFromUrl,\n LaneOverviewLineSlot,\n LaneOverviewLine,\n UseLaneMenu,\n} from '@teambit/lanes.ui.lanes';\nimport ScopeAspect, { ScopeUI } from '@teambit/scope';\nimport WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace';\nimport { NavLinkProps } from '@teambit/react-router';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport SidebarAspect, { SidebarUI } from '@teambit/sidebar';\nimport { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\n\nexport class LanesUI {\n static dependencies = [UIAspect, ComponentAspect, WorkspaceAspect, ScopeAspect, SidebarAspect];\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<LaneOverviewLineSlot>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<MenuWidgetSlot>(),\n ];\n\n constructor(\n private componentUi: ComponentUI,\n private routeSlot: RouteSlot,\n private navSlot: LanesOrderedNavigationSlot,\n private menuWidgetSlot: MenuWidgetSlot,\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: LaneOverviewLineSlot,\n private workspace?: WorkspaceUI,\n private scope?: ScopeUI\n ) {\n this.hostAspect = workspace || scope;\n this.lanesHost = workspace ? 'workspace' : 'scope';\n this.host = workspace ? WorkspaceAspect.id : ScopeAspect.id;\n }\n\n private readonly lanesHost: LanesHost;\n private readonly hostAspect?: WorkspaceUI | ScopeUI;\n private readonly host: string;\n\n private registerHostAspectRoutes() {\n if (!this.hostAspect) return;\n this.hostAspect.registerRoutes([\n {\n path: LanesModel.laneComponentUrlRegex,\n children: this.componentUi.getComponentUI(this.host),\n },\n {\n path: LanesModel.laneRouteUrlRegex,\n children: <LanesOverview routeSlot={this.routeSlot} overviewSlot={this.overviewSlot} />,\n },\n ]);\n this.hostAspect.registerMenuRoutes([\n {\n path: LanesModel.laneComponentUrlRegex,\n children: this.componentUi.getMenu(this.host),\n },\n {\n path: LanesModel.laneRouteUrlRegex,\n children: <LanesOverviewMenu navigationSlot={this.navSlot} widgetSlot={this.menuWidgetSlot} />,\n },\n ]);\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n }\n\n private registerLanesRoutes() {\n this.registerNavigation({\n href: '',\n children: 'Gallery',\n });\n }\n\n private registerRoutes() {\n this.registerHostAspectRoutes();\n this.registerLanesRoutes();\n }\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n return <ViewedLaneFromUrl>{children}</ViewedLaneFromUrl>;\n };\n\n registerRoute(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n /**\n * register a new line beneath the lane overview section.\n */\n registerOverviewLine(...lines: LaneOverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n registerNavigation(nav: NavLinkProps, order?: number) {\n this.navSlot.register({\n props: nav,\n order,\n });\n }\n\n static async provider(\n [uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI],\n _,\n [routeSlot, overviewSlot, navSlot, menuWidgetSlot]: [\n RouteSlot,\n LaneOverviewLineSlot,\n LanesOrderedNavigationSlot,\n MenuWidgetSlot\n ],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n let workspace: WorkspaceUI | undefined;\n let scope: ScopeUI | undefined;\n if (host === WorkspaceAspect.id) {\n workspace = workspaceUi;\n }\n if (host === ScopeAspect.id) {\n scope = scopeUi;\n }\n const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, menuWidgetSlot, workspace, scope);\n uiUi.registerRenderHooks({ reactContext: lanesUi.renderContext });\n const drawer = new LanesDrawer({ showScope: lanesUi.lanesHost === 'workspace' });\n sidebarUi.registerDrawer(drawer);\n lanesUi.registerRoutes();\n lanesUi.registerMenuWidget(() => <UseLaneMenu host={lanesUi.lanesHost} />);\n return lanesUi;\n }\n}\n\nexport default LanesUI;\n\nLanesAspect.addRuntime(LanesUI);\n"]}
1
+ {"version":3,"sources":["lanes.ui.runtime.tsx"],"names":["LanesUI","constructor","componentUi","routeSlot","navSlot","menuWidgetSlot","overviewSlot","workspace","scope","children","hostAspect","lanesHost","host","WorkspaceAspect","id","ScopeAspect","registerHostAspectRoutes","registerRoutes","path","LanesModel","laneComponentUrlRegex","getComponentUI","laneRouteUrlRegex","exact","registerMenuRoutes","getMenu","registerMenuWidget","menuItems","register","registerLanesRoutes","registerNavigation","props","href","order","hide","lanesContext","viewedLane","readmeComponent","registerRoute","route","registerOverviewLine","lines","routes","provider","uiUi","workspaceUi","scopeUi","sidebarUi","_","harmony","config","String","get","lanesUi","registerRenderHooks","reactContext","renderContext","drawer","LanesDrawer","showScope","registerDrawer","UIAspect","ComponentAspect","SidebarAspect","UIRuntime","Slot","withType","LanesAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAEA;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;;AAGO,MAAMA,OAAN,CAAc;AAUnBC,EAAAA,WAAW,CACDC,WADC,EAEDC,SAFC,EAGDC,OAHC,EAIDC,cAJC;AAKT;AACJ;AACA;AACYC,EAAAA,YARC,EASDC,SATC,EAUDC,KAVC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3E,EAAsFC,KAAtF,CAAhB;AACAoC,IAAAA,IAAI,CAACU,mBAAL,CAAyB;AAAEC,MAAAA,YAAY,EAAEF,OAAO,CAACG;AAAxB,KAAzB;AACA,UAAMC,MAAM,GAAG,KAAIC,sBAAJ,EAAgB;AAAEC,MAAAA,SAAS,EAAEN,OAAO,CAAC1C,SAAR,KAAsB;AAAnC,KAAhB,CAAf;AACAoC,IAAAA,SAAS,CAACa,cAAV,CAAyBH,MAAzB;AACAJ,IAAAA,OAAO,CAACpC,cAAR;AACAoC,IAAAA,OAAO,CAAC3B,kBAAR,CAA2B,mBAAM,+BAAC,sBAAD;AAAa,MAAA,IAAI,EAAE2B,OAAO,CAAC1C;AAA3B,MAAjC;AACA,WAAO0C,OAAP;AACD;;AAjJkB;;;gCAARrD,O,kBACW,CAAC6D,cAAD,EAAWC,oBAAX,EAA4BjD,oBAA5B,EAA6CE,gBAA7C,EAA0DgD,kBAA1D,C;gCADX/D,O,aAEMgE,e;gCAFNhE,O,WAGI,CACbiE,gBAAKC,QAAL,EADa,EAEbD,gBAAKC,QAAL,EAFa,EAGbD,gBAAKC,QAAL,EAHa,EAIbD,gBAAKC,QAAL,EAJa,C;eAiJFlE,O;;;AAEfmE,qBAAYC,UAAZ,CAAuBpE,OAAvB","sourcesContent":["import React, { ReactNode } from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport { Slot, Harmony } from '@teambit/harmony';\nimport { UIRuntime, UiUI, UIAspect } from '@teambit/ui';\nimport { LanesAspect } from '@teambit/lanes';\nimport { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport {\n LanesDrawer,\n LanesHost,\n LaneGallery,\n LanesOrderedNavigationSlot,\n LanesModel,\n LanesOverviewMenu,\n ViewedLaneFromUrl,\n LaneOverviewLineSlot,\n LaneOverviewLine,\n UseLaneMenu,\n useLanesContext,\n LanesNavPlugin,\n LaneReadmeOverview,\n} from '@teambit/lanes.ui.lanes';\nimport ScopeAspect, { ScopeUI } from '@teambit/scope';\nimport WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport SidebarAspect, { SidebarUI } from '@teambit/sidebar';\nimport { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\n\nexport class LanesUI {\n static dependencies = [UIAspect, ComponentAspect, WorkspaceAspect, ScopeAspect, SidebarAspect];\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<LaneOverviewLineSlot>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<MenuWidgetSlot>(),\n ];\n\n constructor(\n private componentUi: ComponentUI,\n private routeSlot: RouteSlot,\n private navSlot: LanesOrderedNavigationSlot,\n private menuWidgetSlot: MenuWidgetSlot,\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: LaneOverviewLineSlot,\n private workspace?: WorkspaceUI,\n private scope?: ScopeUI\n ) {\n this.hostAspect = workspace || scope;\n this.lanesHost = workspace ? 'workspace' : 'scope';\n this.host = workspace ? WorkspaceAspect.id : ScopeAspect.id;\n }\n\n private readonly lanesHost: LanesHost;\n private readonly hostAspect?: WorkspaceUI | ScopeUI;\n private readonly host: string;\n\n private registerHostAspectRoutes() {\n if (!this.hostAspect) return;\n this.hostAspect.registerRoutes([\n {\n path: LanesModel.laneComponentUrlRegex,\n children: this.componentUi.getComponentUI(this.host),\n },\n {\n path: `${LanesModel.laneRouteUrlRegex}/~readme`,\n children: <LaneReadmeOverview host={this.host} overviewSlot={this.overviewSlot} routeSlot={this.routeSlot} />,\n },\n {\n path: `${LanesModel.laneRouteUrlRegex}/~gallery`,\n children: <LaneGallery routeSlot={this.routeSlot} overviewSlot={this.overviewSlot} host={this.lanesHost}/>,\n },\n {\n exact: true,\n path: `${LanesModel.laneRouteUrlRegex}`,\n children: <LaneReadmeOverview host={this.host} overviewSlot={this.overviewSlot} routeSlot={this.routeSlot} />,\n },\n ]);\n this.hostAspect.registerMenuRoutes([\n {\n path: LanesModel.laneComponentUrlRegex,\n children: this.componentUi.getMenu(this.host),\n },\n {\n path: LanesModel.laneRouteUrlRegex,\n children: <LanesOverviewMenu navigationSlot={this.navSlot} widgetSlot={this.menuWidgetSlot} />,\n },\n ]);\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n }\n\n private registerLanesRoutes() {\n this.registerNavigation([\n {\n props: {\n href: '',\n children: 'README',\n },\n order: 1,\n hide: () => {\n const lanesContext = useLanesContext();\n return !lanesContext?.viewedLane?.readmeComponent;\n },\n },\n {\n props: {\n href: '~gallery',\n children: 'Gallery',\n },\n order: 1,\n },\n ]);\n }\n\n private registerRoutes() {\n this.registerHostAspectRoutes();\n this.registerLanesRoutes();\n }\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n return <ViewedLaneFromUrl>{children}</ViewedLaneFromUrl>;\n };\n\n registerRoute(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n /**\n * register a new line beneath the lane overview section.\n */\n registerOverviewLine(...lines: LaneOverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n registerNavigation(routes: LanesNavPlugin[]) {\n this.navSlot.register(routes);\n }\n\n static async provider(\n [uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI],\n _,\n [routeSlot, overviewSlot, navSlot, menuWidgetSlot]: [\n RouteSlot,\n LaneOverviewLineSlot,\n LanesOrderedNavigationSlot,\n MenuWidgetSlot\n ],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n let workspace: WorkspaceUI | undefined;\n let scope: ScopeUI | undefined;\n if (host === WorkspaceAspect.id) {\n workspace = workspaceUi;\n }\n if (host === ScopeAspect.id) {\n scope = scopeUi;\n }\n const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, menuWidgetSlot, workspace, scope);\n uiUi.registerRenderHooks({ reactContext: lanesUi.renderContext });\n const drawer = new LanesDrawer({ showScope: lanesUi.lanesHost === 'workspace' });\n sidebarUi.registerDrawer(drawer);\n lanesUi.registerRoutes();\n lanesUi.registerMenuWidget(() => <UseLaneMenu host={lanesUi.lanesHost} />);\n return lanesUi;\n }\n}\n\nexport default LanesUI;\n\nLanesAspect.addRuntime(LanesUI);\n"]}
@@ -7,7 +7,7 @@ import { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-route
7
7
  import {
8
8
  LanesDrawer,
9
9
  LanesHost,
10
- LanesOverview,
10
+ LaneGallery,
11
11
  LanesOrderedNavigationSlot,
12
12
  LanesModel,
13
13
  LanesOverviewMenu,
@@ -15,10 +15,12 @@ import {
15
15
  LaneOverviewLineSlot,
16
16
  LaneOverviewLine,
17
17
  UseLaneMenu,
18
+ useLanesContext,
19
+ LanesNavPlugin,
20
+ LaneReadmeOverview,
18
21
  } from '@teambit/lanes.ui.lanes';
19
22
  import ScopeAspect, { ScopeUI } from '@teambit/scope';
20
23
  import WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace';
21
- import { NavLinkProps } from '@teambit/react-router';
22
24
  import ComponentAspect, { ComponentUI } from '@teambit/component';
23
25
  import SidebarAspect, { SidebarUI } from '@teambit/sidebar';
24
26
  import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
@@ -62,8 +64,17 @@ export class LanesUI {
62
64
  children: this.componentUi.getComponentUI(this.host),
63
65
  },
64
66
  {
65
- path: LanesModel.laneRouteUrlRegex,
66
- children: <LanesOverview routeSlot={this.routeSlot} overviewSlot={this.overviewSlot} />,
67
+ path: `${LanesModel.laneRouteUrlRegex}/~readme`,
68
+ children: <LaneReadmeOverview host={this.host} overviewSlot={this.overviewSlot} routeSlot={this.routeSlot} />,
69
+ },
70
+ {
71
+ path: `${LanesModel.laneRouteUrlRegex}/~gallery`,
72
+ children: <LaneGallery routeSlot={this.routeSlot} overviewSlot={this.overviewSlot} host={this.lanesHost}/>,
73
+ },
74
+ {
75
+ exact: true,
76
+ path: `${LanesModel.laneRouteUrlRegex}`,
77
+ children: <LaneReadmeOverview host={this.host} overviewSlot={this.overviewSlot} routeSlot={this.routeSlot} />,
67
78
  },
68
79
  ]);
69
80
  this.hostAspect.registerMenuRoutes([
@@ -83,10 +94,26 @@ export class LanesUI {
83
94
  }
84
95
 
85
96
  private registerLanesRoutes() {
86
- this.registerNavigation({
87
- href: '',
88
- children: 'Gallery',
89
- });
97
+ this.registerNavigation([
98
+ {
99
+ props: {
100
+ href: '',
101
+ children: 'README',
102
+ },
103
+ order: 1,
104
+ hide: () => {
105
+ const lanesContext = useLanesContext();
106
+ return !lanesContext?.viewedLane?.readmeComponent;
107
+ },
108
+ },
109
+ {
110
+ props: {
111
+ href: '~gallery',
112
+ children: 'Gallery',
113
+ },
114
+ order: 1,
115
+ },
116
+ ]);
90
117
  }
91
118
 
92
119
  private registerRoutes() {
@@ -111,11 +138,8 @@ export class LanesUI {
111
138
  return this;
112
139
  }
113
140
 
114
- registerNavigation(nav: NavLinkProps, order?: number) {
115
- this.navSlot.register({
116
- props: nav,
117
- order,
118
- });
141
+ registerNavigation(routes: LanesNavPlugin[]) {
142
+ this.navSlot.register(routes);
119
143
  }
120
144
 
121
145
  static async provider(
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/lanes",
3
- "version": "0.0.295",
3
+ "version": "0.0.296",
4
4
  "homepage": "https://bit.dev/teambit/lanes/lanes",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.lanes",
8
8
  "name": "lanes",
9
- "version": "0.0.295"
9
+ "version": "0.0.296"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -19,23 +19,22 @@
19
19
  "core-js": "^3.0.0",
20
20
  "@teambit/harmony": "0.3.3",
21
21
  "@teambit/bit-error": "0.0.394",
22
- "@teambit/cli": "0.0.482",
23
- "@teambit/merging": "0.0.38",
24
- "@teambit/scope": "0.0.723",
25
- "@teambit/workspace": "0.0.723",
26
- "@teambit/graphql": "0.0.723",
27
- "@teambit/community": "0.0.30",
28
- "@teambit/component": "0.0.723",
29
- "@teambit/lane-id": "0.0.1",
30
- "@teambit/lanes.modules.diff": "0.0.109",
22
+ "@teambit/cli": "0.0.483",
23
+ "@teambit/merging": "0.0.39",
24
+ "@teambit/scope": "0.0.724",
25
+ "@teambit/workspace": "0.0.724",
26
+ "@teambit/graphql": "0.0.724",
27
+ "@teambit/community": "0.0.31",
28
+ "@teambit/component": "0.0.724",
29
+ "@teambit/lane-id": "0.0.2",
30
+ "@teambit/lanes.modules.diff": "0.0.110",
31
31
  "@teambit/legacy-bit-id": "0.0.399",
32
- "@teambit/logger": "0.0.574",
33
- "@teambit/lanes.ui.lanes": "0.0.48",
34
- "@teambit/react-router": "0.0.723",
35
- "@teambit/sidebar": "0.0.723",
32
+ "@teambit/logger": "0.0.575",
33
+ "@teambit/lanes.ui.lanes": "0.0.49",
34
+ "@teambit/sidebar": "0.0.724",
36
35
  "@teambit/ui-foundation.ui.menu": "0.0.487",
37
36
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.489",
38
- "@teambit/ui": "0.0.723"
37
+ "@teambit/ui": "0.0.724"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@types/react": "^17.0.8",
@@ -51,7 +50,7 @@
51
50
  "@teambit/workspace.testing.mock-workspace": "0.0.5"
52
51
  },
53
52
  "peerDependencies": {
54
- "@teambit/legacy": "1.0.261",
53
+ "@teambit/legacy": "1.0.262",
55
54
  "react-dom": "^16.8.0 || ^17.0.0",
56
55
  "react": "^16.8.0 || ^17.0.0"
57
56
  },
@@ -79,7 +78,7 @@
79
78
  "react": "-"
80
79
  },
81
80
  "peerDependencies": {
82
- "@teambit/legacy": "1.0.261",
81
+ "@teambit/legacy": "1.0.262",
83
82
  "react-dom": "^16.8.0 || ^17.0.0",
84
83
  "react": "^16.8.0 || ^17.0.0"
85
84
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.295/dist/lanes.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.295/dist/lanes.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.296/dist/lanes.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.296/dist/lanes.docs.mdx')]