@teambit/lanes 0.0.264 → 0.0.267

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.
@@ -8,10 +8,12 @@ import { WorkspaceUI } from '@teambit/workspace';
8
8
  import { NavLinkProps } from '@teambit/react-router';
9
9
  import { ComponentUI } from '@teambit/component';
10
10
  import { SidebarUI } from '@teambit/sidebar';
11
+ import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
11
12
  export declare class LanesUI {
12
13
  private componentUi;
13
14
  private routeSlot;
14
15
  private navSlot;
16
+ private menuWidgetSlot;
15
17
  /**
16
18
  * overview line slot to add new lines beneath the overview section
17
19
  */
@@ -23,7 +25,7 @@ export declare class LanesUI {
23
25
  static slots: (((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<RouteProps<string, {
24
26
  [x: string]: string | undefined;
25
27
  }>>) | ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<LaneOverviewLineSlot>))[];
26
- constructor(componentUi: ComponentUI, routeSlot: RouteSlot, navSlot: LanesOrderedNavigationSlot,
28
+ constructor(componentUi: ComponentUI, routeSlot: RouteSlot, navSlot: LanesOrderedNavigationSlot, menuWidgetSlot: MenuWidgetSlot,
27
29
  /**
28
30
  * overview line slot to add new lines beneath the overview section
29
31
  */
@@ -32,6 +34,7 @@ export declare class LanesUI {
32
34
  private readonly hostAspect?;
33
35
  private readonly host;
34
36
  private registerHostAspectRoutes;
37
+ registerMenuWidget(...menuItems: MenuWidget[]): void;
35
38
  private registerLanesRoutes;
36
39
  private registerRoutes;
37
40
  private renderContext;
@@ -41,6 +44,11 @@ export declare class LanesUI {
41
44
  */
42
45
  registerOverviewLine(...lines: LaneOverviewLine[]): this;
43
46
  registerNavigation(nav: NavLinkProps, order?: number): void;
44
- static provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI], _: any, [routeSlot, overviewSlot, navSlot]: [RouteSlot, LaneOverviewLineSlot, LanesOrderedNavigationSlot], harmony: Harmony): Promise<LanesUI>;
47
+ static provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI], _: any, [routeSlot, overviewSlot, navSlot, menuWidgetSlot]: [
48
+ RouteSlot,
49
+ LaneOverviewLineSlot,
50
+ LanesOrderedNavigationSlot,
51
+ MenuWidgetSlot
52
+ ], harmony: Harmony): Promise<LanesUI>;
45
53
  }
46
54
  export default LanesUI;
@@ -112,7 +112,7 @@ function _sidebar() {
112
112
  }
113
113
 
114
114
  class LanesUI {
115
- constructor(componentUi, routeSlot, navSlot,
115
+ constructor(componentUi, routeSlot, navSlot, menuWidgetSlot,
116
116
  /**
117
117
  * overview line slot to add new lines beneath the overview section
118
118
  */
@@ -120,6 +120,7 @@ class LanesUI {
120
120
  this.componentUi = componentUi;
121
121
  this.routeSlot = routeSlot;
122
122
  this.navSlot = navSlot;
123
+ this.menuWidgetSlot = menuWidgetSlot;
123
124
  this.overviewSlot = overviewSlot;
124
125
  this.workspace = workspace;
125
126
  this.scope = scope;
@@ -129,7 +130,7 @@ class LanesUI {
129
130
  (0, _defineProperty2().default)(this, "renderContext", ({
130
131
  children
131
132
  }) => {
132
- return /*#__PURE__*/_react().default.createElement(_lanesUi().CurrentLaneFromUrl, null, children);
133
+ return /*#__PURE__*/_react().default.createElement(_lanesUi().ViewedLaneFromUrl, null, children);
133
134
  });
134
135
  this.hostAspect = workspace || scope;
135
136
  this.lanesHost = workspace ? 'workspace' : 'scope';
@@ -155,11 +156,16 @@ class LanesUI {
155
156
  path: _lanesUi().LanesModel.laneRouteUrlRegex,
156
157
  children: /*#__PURE__*/_react().default.createElement(_lanesUi().LanesOverviewMenu, {
157
158
  navigationSlot: this.navSlot,
158
- host: this.host
159
+ host: this.host,
160
+ widgetSlot: this.menuWidgetSlot
159
161
  })
160
162
  }]);
161
163
  }
162
164
 
165
+ registerMenuWidget(...menuItems) {
166
+ this.menuWidgetSlot.register(menuItems);
167
+ }
168
+
163
169
  registerLanesRoutes() {
164
170
  this.registerNavigation({
165
171
  href: '',
@@ -193,7 +199,7 @@ class LanesUI {
193
199
  });
194
200
  }
195
201
 
196
- static async provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi], _, [routeSlot, overviewSlot, navSlot], harmony) {
202
+ static async provider([uiUi, componentUi, workspaceUi, scopeUi, sidebarUi], _, [routeSlot, overviewSlot, navSlot, menuWidgetSlot], harmony) {
197
203
  const {
198
204
  config
199
205
  } = harmony;
@@ -209,7 +215,7 @@ class LanesUI {
209
215
  scope = scopeUi;
210
216
  }
211
217
 
212
- const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, workspace, scope);
218
+ const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, menuWidgetSlot, workspace, scope);
213
219
  uiUi.registerRenderHooks({
214
220
  reactContext: lanesUi.renderContext
215
221
  });
@@ -218,6 +224,7 @@ class LanesUI {
218
224
  });
219
225
  sidebarUi.registerDrawer(drawer);
220
226
  lanesUi.registerRoutes();
227
+ lanesUi.registerMenuWidget(() => /*#__PURE__*/_react().default.createElement(_lanesUi().UseLaneMenu, null));
221
228
  return lanesUi;
222
229
  }
223
230
 
@@ -226,7 +233,7 @@ class LanesUI {
226
233
  exports.LanesUI = LanesUI;
227
234
  (0, _defineProperty2().default)(LanesUI, "dependencies", [_ui().UIAspect, _component().default, _workspace().default, _scope().default, _sidebar().default]);
228
235
  (0, _defineProperty2().default)(LanesUI, "runtime", _ui().UIRuntime);
229
- (0, _defineProperty2().default)(LanesUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
236
+ (0, _defineProperty2().default)(LanesUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
230
237
  var _default = LanesUI;
231
238
  exports.default = _default;
232
239
 
@@ -1 +1 @@
1
- {"version":3,"sources":["lanes.ui.runtime.tsx"],"names":["LanesUI","constructor","componentUi","routeSlot","navSlot","overviewSlot","workspace","scope","children","hostAspect","lanesHost","host","WorkspaceAspect","id","ScopeAspect","registerHostAspectRoutes","registerRoutes","path","LanesModel","laneComponentUrlRegex","getComponentUI","laneRouteUrlRegex","registerMenuRoutes","getMenu","registerLanesRoutes","registerNavigation","href","registerRoute","route","register","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;;AAWA;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;;AAEO,MAAMA,OAAN,CAAc;AAKnBC,EAAAA,WAAW,CACDC,WADC,EAEDC,SAFC,EAGDC,OAHC;AAIT;AACJ;AACA;AACYC,EAAAA,YAPC,EAQDC,SARC,EASDC,KATC,EAUT;AAAA,SATQL,WASR,GATQA,WASR;AAAA,SARQC,SAQR,GARQA,SAQR;AAAA,SAPQC,OAOR,GAPQA,OAOR;AAAA,SAHQC,YAGR,GAHQA,YAGR;AAAA,SAFQC,SAER,GAFQA,SAER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YAA7C,EAA2DC,SAA3D,EAAsEC,KAAtE,CAAhB;AACA6B,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,CAACnC,SAAR,KAAsB;AAAnC,KAAhB,CAAf;AACA6B,IAAAA,SAAS,CAACa,cAAV,CAAyBH,MAAzB;AACAJ,IAAAA,OAAO,CAAC7B,cAAR;AAEA,WAAO6B,OAAP;AACD;;AA5GkB;;;gCAAR7C,O,kBACW,CAACqD,cAAD,EAAWC,oBAAX,EAA4B1C,oBAA5B,EAA6CE,gBAA7C,EAA0DyC,kBAA1D,C;gCADXvD,O,aAEMwD,e;gCAFNxD,O,WAGI,CAACyD,gBAAKC,QAAL,EAAD,EAA8BD,gBAAKC,QAAL,EAA9B,EAAqED,gBAAKC,QAAL,EAArE,C;eA4GF1D,O;;;AAEf2D,qBAAYC,UAAZ,CAAuB5D,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 CurrentLaneFromUrl,\n LaneOverviewLineSlot,\n LaneOverviewLine,\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';\n\nexport class LanesUI {\n static dependencies = [UIAspect, ComponentAspect, WorkspaceAspect, ScopeAspect, SidebarAspect];\n static runtime = UIRuntime;\n static slots = [Slot.withType<RouteProps>(), Slot.withType<LaneOverviewLineSlot>(), Slot.withType<NavigationSlot>()];\n\n constructor(\n private componentUi: ComponentUI,\n private routeSlot: RouteSlot,\n private navSlot: LanesOrderedNavigationSlot,\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} host={this.host} />,\n },\n ]);\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 <CurrentLaneFromUrl>{children}</CurrentLaneFromUrl>;\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]: [RouteSlot, LaneOverviewLineSlot, LanesOrderedNavigationSlot],\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, 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\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","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;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B,kBAAR,CAA2B,mBAAM,+BAAC,sBAAD,OAAjC;AACA,WAAOuB,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} host={this.host} 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 />);\n return lanesUi;\n }\n}\n\nexport default LanesUI;\n\nLanesAspect.addRuntime(LanesUI);\n"]}
@@ -11,25 +11,33 @@ import {
11
11
  LanesOrderedNavigationSlot,
12
12
  LanesModel,
13
13
  LanesOverviewMenu,
14
- CurrentLaneFromUrl,
14
+ ViewedLaneFromUrl,
15
15
  LaneOverviewLineSlot,
16
16
  LaneOverviewLine,
17
+ UseLaneMenu,
17
18
  } from '@teambit/lanes.ui.lanes';
18
19
  import ScopeAspect, { ScopeUI } from '@teambit/scope';
19
20
  import WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace';
20
21
  import { NavLinkProps } from '@teambit/react-router';
21
22
  import ComponentAspect, { ComponentUI } from '@teambit/component';
22
23
  import SidebarAspect, { SidebarUI } from '@teambit/sidebar';
24
+ import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
23
25
 
24
26
  export class LanesUI {
25
27
  static dependencies = [UIAspect, ComponentAspect, WorkspaceAspect, ScopeAspect, SidebarAspect];
26
28
  static runtime = UIRuntime;
27
- static slots = [Slot.withType<RouteProps>(), Slot.withType<LaneOverviewLineSlot>(), Slot.withType<NavigationSlot>()];
29
+ static slots = [
30
+ Slot.withType<RouteProps>(),
31
+ Slot.withType<LaneOverviewLineSlot>(),
32
+ Slot.withType<NavigationSlot>(),
33
+ Slot.withType<MenuWidgetSlot>(),
34
+ ];
28
35
 
29
36
  constructor(
30
37
  private componentUi: ComponentUI,
31
38
  private routeSlot: RouteSlot,
32
39
  private navSlot: LanesOrderedNavigationSlot,
40
+ private menuWidgetSlot: MenuWidgetSlot,
33
41
  /**
34
42
  * overview line slot to add new lines beneath the overview section
35
43
  */
@@ -65,11 +73,15 @@ export class LanesUI {
65
73
  },
66
74
  {
67
75
  path: LanesModel.laneRouteUrlRegex,
68
- children: <LanesOverviewMenu navigationSlot={this.navSlot} host={this.host} />,
76
+ children: <LanesOverviewMenu navigationSlot={this.navSlot} host={this.host} widgetSlot={this.menuWidgetSlot} />,
69
77
  },
70
78
  ]);
71
79
  }
72
80
 
81
+ registerMenuWidget(...menuItems: MenuWidget[]) {
82
+ this.menuWidgetSlot.register(menuItems);
83
+ }
84
+
73
85
  private registerLanesRoutes() {
74
86
  this.registerNavigation({
75
87
  href: '',
@@ -83,7 +95,7 @@ export class LanesUI {
83
95
  }
84
96
 
85
97
  private renderContext = ({ children }: { children: ReactNode }) => {
86
- return <CurrentLaneFromUrl>{children}</CurrentLaneFromUrl>;
98
+ return <ViewedLaneFromUrl>{children}</ViewedLaneFromUrl>;
87
99
  };
88
100
 
89
101
  registerRoute(route: RouteProps) {
@@ -109,7 +121,12 @@ export class LanesUI {
109
121
  static async provider(
110
122
  [uiUi, componentUi, workspaceUi, scopeUi, sidebarUi]: [UiUI, ComponentUI, WorkspaceUI, ScopeUI, SidebarUI],
111
123
  _,
112
- [routeSlot, overviewSlot, navSlot]: [RouteSlot, LaneOverviewLineSlot, LanesOrderedNavigationSlot],
124
+ [routeSlot, overviewSlot, navSlot, menuWidgetSlot]: [
125
+ RouteSlot,
126
+ LaneOverviewLineSlot,
127
+ LanesOrderedNavigationSlot,
128
+ MenuWidgetSlot
129
+ ],
113
130
  harmony: Harmony
114
131
  ) {
115
132
  const { config } = harmony;
@@ -122,12 +139,12 @@ export class LanesUI {
122
139
  if (host === ScopeAspect.id) {
123
140
  scope = scopeUi;
124
141
  }
125
- const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, workspace, scope);
142
+ const lanesUi = new LanesUI(componentUi, routeSlot, navSlot, overviewSlot, menuWidgetSlot, workspace, scope);
126
143
  uiUi.registerRenderHooks({ reactContext: lanesUi.renderContext });
127
144
  const drawer = new LanesDrawer({ showScope: lanesUi.lanesHost === 'workspace' });
128
145
  sidebarUi.registerDrawer(drawer);
129
146
  lanesUi.registerRoutes();
130
-
147
+ lanesUi.registerMenuWidget(() => <UseLaneMenu />);
131
148
  return lanesUi;
132
149
  }
133
150
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/lanes",
3
- "version": "0.0.264",
3
+ "version": "0.0.267",
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.264"
9
+ "version": "0.0.267"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -18,19 +18,20 @@
18
18
  "@babel/runtime": "7.12.18",
19
19
  "core-js": "^3.0.0",
20
20
  "@teambit/bit-error": "0.0.394",
21
- "@teambit/cli": "0.0.463",
22
- "@teambit/merging": "0.0.7",
23
- "@teambit/scope": "0.0.692",
24
- "@teambit/workspace": "0.0.692",
25
- "@teambit/graphql": "0.0.692",
26
- "@teambit/community": "0.0.11",
21
+ "@teambit/cli": "0.0.464",
22
+ "@teambit/merging": "0.0.10",
23
+ "@teambit/scope": "0.0.695",
24
+ "@teambit/workspace": "0.0.695",
25
+ "@teambit/graphql": "0.0.695",
26
+ "@teambit/community": "0.0.12",
27
27
  "@teambit/lanes.modules.diff": "0.0.107",
28
- "@teambit/component": "0.0.692",
29
- "@teambit/lanes.ui.lanes": "0.0.27",
30
- "@teambit/react-router": "0.0.692",
31
- "@teambit/sidebar": "0.0.692",
28
+ "@teambit/component": "0.0.695",
29
+ "@teambit/lanes.ui.lanes": "0.0.29",
30
+ "@teambit/react-router": "0.0.695",
31
+ "@teambit/sidebar": "0.0.695",
32
+ "@teambit/ui-foundation.ui.menu": "0.0.486",
32
33
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.488",
33
- "@teambit/ui": "0.0.692",
34
+ "@teambit/ui": "0.0.695",
34
35
  "@teambit/legacy-bit-id": "0.0.399"
35
36
  },
36
37
  "devDependencies": {
@@ -46,7 +47,7 @@
46
47
  "@teambit/workspace.testing.mock-workspace": "0.0.4"
47
48
  },
48
49
  "peerDependencies": {
49
- "@teambit/legacy": "1.0.241",
50
+ "@teambit/legacy": "1.0.242",
50
51
  "react-dom": "^16.8.0 || ^17.0.0",
51
52
  "react": "^16.8.0 || ^17.0.0"
52
53
  },
@@ -74,7 +75,7 @@
74
75
  "react": "-"
75
76
  },
76
77
  "peerDependencies": {
77
- "@teambit/legacy": "1.0.241",
78
+ "@teambit/legacy": "1.0.242",
78
79
  "react-dom": "^16.8.0 || ^17.0.0",
79
80
  "react": "^16.8.0 || ^17.0.0"
80
81
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.264/dist/lanes.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.264/dist/lanes.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.267/dist/lanes.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.267/dist/lanes.docs.mdx')]