@teambit/component 1.0.135 → 1.0.137

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.
@@ -21,7 +21,15 @@ import { ComponentAspect } from './component.aspect';
21
21
  import { ComponentModel } from './ui';
22
22
  import { Component, ComponentPageElement, ComponentPageSlot } from './ui/component';
23
23
  import { ComponentResultPlugin, ComponentSearcher } from './ui/component-searcher';
24
- import { ConsumeMethodSlot, ConsumePlugin, ComponentMenu, NavPlugin, OrderedNavigationSlot } from './ui/menu';
24
+ import {
25
+ ConsumeMethodSlot,
26
+ ConsumePlugin,
27
+ ComponentMenu,
28
+ NavPlugin,
29
+ OrderedNavigationSlot,
30
+ RightSideMenuItem,
31
+ RightSideMenuSlot,
32
+ } from './ui/menu';
25
33
  import { GetComponentsOptions } from './get-component-opts';
26
34
 
27
35
  export type ComponentSearchResultSlot = SlotRegistry<ComponentResultPlugin[]>;
@@ -59,6 +67,10 @@ export class ComponentUI {
59
67
  * slot for registering a new widget to the menu.
60
68
  */
61
69
  private widgetSlot: OrderedNavigationSlot,
70
+ /**
71
+ * slot for registering the right section of the menu
72
+ */
73
+ private rightSideMenuSlot: RightSideMenuSlot,
62
74
 
63
75
  private menuItemSlot: MenuItemSlot,
64
76
 
@@ -215,6 +227,7 @@ export class ComponentUI {
215
227
  skipRightSide={options.skipRightSide}
216
228
  navigationSlot={this.navSlot}
217
229
  consumeMethodSlot={this.consumeMethodSlot}
230
+ rightSideMenuSlot={this.rightSideMenuSlot}
218
231
  widgetSlot={this.widgetSlot}
219
232
  host={host}
220
233
  menuItemSlot={this.menuItemSlot}
@@ -252,6 +265,10 @@ export class ComponentUI {
252
265
  this.widgetSlot.register({ props: widget, order });
253
266
  }
254
267
 
268
+ registerRightSideMenuItem(...rightSideMenuItem: RightSideMenuItem[]) {
269
+ this.rightSideMenuSlot.register(rightSideMenuItem);
270
+ }
271
+
255
272
  registerMenuItem = (menuItems: MenuItem[]) => {
256
273
  this.menuItemSlot.register(menuItems);
257
274
  };
@@ -284,6 +301,7 @@ export class ComponentUI {
284
301
  Slot.withType<MenuItemSlot>(),
285
302
  Slot.withType<ComponentPageSlot>(),
286
303
  Slot.withType<ComponentSearchResultSlot>(),
304
+ Slot.withType<RightSideMenuSlot>(),
287
305
  ];
288
306
  static defaultConfig: ComponentUIConfig = {
289
307
  commandBar: true,
@@ -292,14 +310,24 @@ export class ComponentUI {
292
310
  static async provider(
293
311
  [pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI],
294
312
  config: ComponentUIConfig,
295
- [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot]: [
313
+ [
314
+ routeSlot,
315
+ navSlot,
316
+ consumeMethodSlot,
317
+ widgetSlot,
318
+ menuItemSlot,
319
+ pageSlot,
320
+ componentSearchResultSlot,
321
+ rightSideMenuSlot,
322
+ ]: [
296
323
  RouteSlot,
297
324
  OrderedNavigationSlot,
298
325
  ConsumeMethodSlot,
299
326
  OrderedNavigationSlot,
300
327
  MenuItemSlot,
301
328
  ComponentPageSlot,
302
- ComponentSearchResultSlot
329
+ ComponentSearchResultSlot,
330
+ RightSideMenuSlot
303
331
  ]
304
332
  ) {
305
333
  // TODO: refactor ComponentHost to a separate extension (including sidebar, host, graphql, etc.)
@@ -310,6 +338,7 @@ export class ComponentUI {
310
338
  navSlot,
311
339
  consumeMethodSlot,
312
340
  widgetSlot,
341
+ rightSideMenuSlot,
313
342
  menuItemSlot,
314
343
  pageSlot,
315
344
  componentSearchResultSlot,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Section } from './section';
3
2
  export declare class AspectSection implements Section {
4
3
  route: {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Logo: () => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /// <reference types="lodash" />
3
2
  import type { RouteProps } from 'react-router-dom';
4
3
  import type { LinkProps } from '@teambit/base-react.navigation.link';
@@ -11,7 +10,7 @@ import { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-route
11
10
  import { ComponentModel } from './ui';
12
11
  import { ComponentPageElement, ComponentPageSlot } from './ui/component';
13
12
  import { ComponentResultPlugin } from './ui/component-searcher';
14
- import { ConsumeMethodSlot, ConsumePlugin, NavPlugin, OrderedNavigationSlot } from './ui/menu';
13
+ import { ConsumeMethodSlot, ConsumePlugin, NavPlugin, OrderedNavigationSlot, RightSideMenuItem, RightSideMenuSlot } from './ui/menu';
15
14
  import { GetComponentsOptions } from './get-component-opts';
16
15
  export type ComponentSearchResultSlot = SlotRegistry<ComponentResultPlugin[]>;
17
16
  export type ComponentUIConfig = {
@@ -36,6 +35,10 @@ export declare class ComponentUI {
36
35
  * slot for registering a new widget to the menu.
37
36
  */
38
37
  private widgetSlot;
38
+ /**
39
+ * slot for registering the right section of the menu
40
+ */
41
+ private rightSideMenuSlot;
39
42
  private menuItemSlot;
40
43
  private pageItemSlot;
41
44
  private componentSearchResultSlot;
@@ -50,7 +53,11 @@ export declare class ComponentUI {
50
53
  /**
51
54
  * slot for registering a new widget to the menu.
52
55
  */
53
- widgetSlot: OrderedNavigationSlot, menuItemSlot: MenuItemSlot, pageItemSlot: ComponentPageSlot, componentSearchResultSlot: ComponentSearchResultSlot, commandBarUI: CommandBarUI, reactRouterUi: ReactRouterUI);
56
+ widgetSlot: OrderedNavigationSlot,
57
+ /**
58
+ * slot for registering the right section of the menu
59
+ */
60
+ rightSideMenuSlot: RightSideMenuSlot, menuItemSlot: MenuItemSlot, pageItemSlot: ComponentPageSlot, componentSearchResultSlot: ComponentSearchResultSlot, commandBarUI: CommandBarUI, reactRouterUi: ReactRouterUI);
54
61
  get routes(): [string, RouteProps[]][];
55
62
  /**
56
63
  * the current visible component
@@ -73,6 +80,7 @@ export declare class ComponentUI {
73
80
  registerNavigation(nav: LinkProps, order?: number): void;
74
81
  registerConsumeMethod(...consumeMethods: ConsumePlugin[]): void;
75
82
  registerWidget(widget: LinkProps, order?: number): void;
83
+ registerRightSideMenuItem(...rightSideMenuItem: RightSideMenuItem[]): void;
76
84
  registerMenuItem: (menuItems: MenuItem[]) => void;
77
85
  registerPageItem: (...items: ComponentPageElement[]) => void;
78
86
  /** register widgets to the components listed in the command bar */
@@ -80,16 +88,17 @@ export declare class ComponentUI {
80
88
  updateComponents: (components: ComponentModel[]) => void;
81
89
  static dependencies: import("@teambit/harmony").Aspect[];
82
90
  static runtime: import("@teambit/harmony").RuntimeDefinition;
83
- static slots: (((registerFn: () => string) => SlotRegistry<RouteProps>) | ((registerFn: () => string) => SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => SlotRegistry<MenuItemSlot>) | ((registerFn: () => string) => SlotRegistry<NavPlugin>) | ((registerFn: () => string) => SlotRegistry<ConsumeMethodSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentPageSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentSearchResultSlot>))[];
91
+ static slots: (((registerFn: () => string) => SlotRegistry<RouteProps>) | ((registerFn: () => string) => SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => SlotRegistry<MenuItemSlot>) | ((registerFn: () => string) => SlotRegistry<NavPlugin>) | ((registerFn: () => string) => SlotRegistry<ConsumeMethodSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentPageSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentSearchResultSlot>) | ((registerFn: () => string) => SlotRegistry<RightSideMenuSlot>))[];
84
92
  static defaultConfig: ComponentUIConfig;
85
- static provider([pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI], config: ComponentUIConfig, [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot]: [
93
+ static provider([pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI], config: ComponentUIConfig, [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot, rightSideMenuSlot,]: [
86
94
  RouteSlot,
87
95
  OrderedNavigationSlot,
88
96
  ConsumeMethodSlot,
89
97
  OrderedNavigationSlot,
90
98
  MenuItemSlot,
91
99
  ComponentPageSlot,
92
- ComponentSearchResultSlot
100
+ ComponentSearchResultSlot,
101
+ RightSideMenuSlot
93
102
  ]): Promise<ComponentUI>;
94
103
  }
95
104
  export default ComponentUI;
@@ -152,12 +152,17 @@ class ComponentUI {
152
152
  /**
153
153
  * slot for registering a new widget to the menu.
154
154
  */
155
- widgetSlot, menuItemSlot, pageItemSlot, componentSearchResultSlot, commandBarUI, reactRouterUi) {
155
+ widgetSlot,
156
+ /**
157
+ * slot for registering the right section of the menu
158
+ */
159
+ rightSideMenuSlot, menuItemSlot, pageItemSlot, componentSearchResultSlot, commandBarUI, reactRouterUi) {
156
160
  this.pubsub = pubsub;
157
161
  this.routeSlot = routeSlot;
158
162
  this.navSlot = navSlot;
159
163
  this.consumeMethodSlot = consumeMethodSlot;
160
164
  this.widgetSlot = widgetSlot;
165
+ this.rightSideMenuSlot = rightSideMenuSlot;
161
166
  this.menuItemSlot = menuItemSlot;
162
167
  this.pageItemSlot = pageItemSlot;
163
168
  this.componentSearchResultSlot = componentSearchResultSlot;
@@ -305,6 +310,7 @@ class ComponentUI {
305
310
  skipRightSide: options.skipRightSide,
306
311
  navigationSlot: this.navSlot,
307
312
  consumeMethodSlot: this.consumeMethodSlot,
313
+ rightSideMenuSlot: this.rightSideMenuSlot,
308
314
  widgetSlot: this.widgetSlot,
309
315
  host: host,
310
316
  menuItemSlot: this.menuItemSlot,
@@ -338,10 +344,13 @@ class ComponentUI {
338
344
  order
339
345
  });
340
346
  }
341
- static async provider([pubsub, commandBarUI, reactRouterUI], config, [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot]) {
347
+ registerRightSideMenuItem(...rightSideMenuItem) {
348
+ this.rightSideMenuSlot.register(rightSideMenuItem);
349
+ }
350
+ static async provider([pubsub, commandBarUI, reactRouterUI], config, [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot, rightSideMenuSlot]) {
342
351
  // TODO: refactor ComponentHost to a separate extension (including sidebar, host, graphql, etc.)
343
352
  // TODO: add contextual hook for ComponentHost @uri/@oded
344
- const componentUI = new ComponentUI(pubsub, routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot, commandBarUI, reactRouterUI);
353
+ const componentUI = new ComponentUI(pubsub, routeSlot, navSlot, consumeMethodSlot, widgetSlot, rightSideMenuSlot, menuItemSlot, pageSlot, componentSearchResultSlot, commandBarUI, reactRouterUI);
345
354
  const aspectSection = new (_aspect().AspectSection)();
346
355
  // @ts-ignore
347
356
  componentUI.registerSearchResultWidget({
@@ -362,7 +371,7 @@ class ComponentUI {
362
371
  exports.ComponentUI = ComponentUI;
363
372
  _defineProperty(ComponentUI, "dependencies", [_pubsub().default, _commandBar().default, _reactRouter().default]);
364
373
  _defineProperty(ComponentUI, "runtime", _ui().UIRuntime);
365
- _defineProperty(ComponentUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
374
+ _defineProperty(ComponentUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
366
375
  _defineProperty(ComponentUI, "defaultConfig", {
367
376
  commandBar: true
368
377
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_copyToClipboard","_commandBar","_componentUi","_harmony","_preview","_interopRequireWildcard","_pubsub","_reactRouter","_ui","_lodash2","_uiFoundationUi","_uiFoundationUiUseBox","_componentPackageVersion","_aspect","_component","_component2","_componentSearcher","_menu","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","ComponentUI","constructor","pubsub","routeSlot","navSlot","consumeMethodSlot","widgetSlot","menuItemSlot","pageItemSlot","componentSearchResultSlot","commandBarUI","reactRouterUi","packageName","activeComponent","version","id","versionString","formatToInstallableVersion","copy","action","toString","displayName","keybinding","copyNpmId","category","title","keyChar","handler","run","options","componentId","packageNameFromProps","latest","latestFromProps","componentModel","packageVersion","Title","createElement","style","width","src","Component","hide","Import","ignoreVersion","componentName","name","showInstallMethod","disableInstall","order","menuItems","register","items","totalPlugins","flatten","values","componentSearcher","updatePlugins","components","update","ComponentSearcher","navigate","navigateTo","isBrowser","registerPubSub","routes","toArray","map","Array","isArray","snapToSemver","sub","PreviewAspect","be","type","ClickInsideAnIframeEvent","TYPE","event","MouseEvent","view","window","bubbles","cancelable","body","document","dispatchEvent","getComponentUI","host","containerSlot","onComponentChange","handleComponentChange","path","useComponent","componentIdStr","useComponentFilters","overriddenRoutes","getMenu","ComponentMenu","className","skipRightSide","navigationSlot","RightNode","listMenuItems","mainMenuItems","groupBy","registerRoute","registerNavigation","nav","props","registerConsumeMethod","consumeMethods","registerWidget","widget","provider","reactRouterUI","config","pageSlot","componentUI","aspectSection","AspectSection","registerSearchResultWidget","end","DeprecationIcon","commandBar","addCommand","keyBindings","addSearcher","registerMenuItem","route","navigationLink","bitMethod","exports","PubsubAspect","CommandBarAspect","ReactRouterAspect","UIRuntime","Slot","withType","_default","ComponentAspect","addRuntime"],"sources":["component.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport flatten from 'lodash.flatten';\nimport copy from 'copy-to-clipboard';\nimport type { RouteProps } from 'react-router-dom';\nimport type { LinkProps } from '@teambit/base-react.navigation.link';\nimport CommandBarAspect, { CommandBarUI, CommandEntry } from '@teambit/command-bar';\nimport { DeprecationIcon } from '@teambit/component.ui.deprecation-icon';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport PreviewAspect, { ClickInsideAnIframeEvent } from '@teambit/preview';\nimport PubsubAspect, { BitBaseEvent, PubsubUI } from '@teambit/pubsub';\nimport ReactRouterAspect, { ReactRouterUI } from '@teambit/react-router';\nimport { UIRuntime } from '@teambit/ui';\nimport { groupBy } from 'lodash';\nimport { isBrowser } from '@teambit/ui-foundation.ui.is-browser';\nimport { MenuItem, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Import } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { snapToSemver } from '@teambit/component-package-version';\nimport { AspectSection } from './aspect.section';\nimport { ComponentAspect } from './component.aspect';\nimport { ComponentModel } from './ui';\nimport { Component, ComponentPageElement, ComponentPageSlot } from './ui/component';\nimport { ComponentResultPlugin, ComponentSearcher } from './ui/component-searcher';\nimport { ConsumeMethodSlot, ConsumePlugin, ComponentMenu, NavPlugin, OrderedNavigationSlot } from './ui/menu';\nimport { GetComponentsOptions } from './get-component-opts';\n\nexport type ComponentSearchResultSlot = SlotRegistry<ComponentResultPlugin[]>;\n\nexport type ComponentUIConfig = {\n commandBar: boolean;\n};\n\nexport type Server = {\n env: string;\n url: string;\n};\n\nexport type ComponentMeta = {\n id: string;\n};\n\nexport class ComponentUI {\n readonly routePath = `/*`;\n private componentSearcher: ComponentSearcher;\n\n constructor(\n /**\n * Pubsub aspects\n */\n private pubsub: PubsubUI,\n\n private routeSlot: RouteSlot,\n\n private navSlot: OrderedNavigationSlot,\n\n readonly consumeMethodSlot: ConsumeMethodSlot,\n\n /**\n * slot for registering a new widget to the menu.\n */\n private widgetSlot: OrderedNavigationSlot,\n\n private menuItemSlot: MenuItemSlot,\n\n private pageItemSlot: ComponentPageSlot,\n\n private componentSearchResultSlot: ComponentSearchResultSlot,\n\n private commandBarUI: CommandBarUI,\n\n reactRouterUi: ReactRouterUI\n ) {\n this.componentSearcher = new ComponentSearcher({ navigate: reactRouterUi.navigateTo });\n if (isBrowser) this.registerPubSub();\n }\n\n get routes() {\n return this.routeSlot\n .toArray()\n .map(([key, routes]) => [key, Array.isArray(routes) ? [...flatten(routes)] : [routes]] as [string, RouteProps[]]);\n }\n\n /**\n * the current visible component\n */\n private activeComponent?: ComponentModel;\n\n formatToInstallableVersion(version: string) {\n return snapToSemver(version);\n }\n\n private copyNpmId = () => {\n const packageName = this.activeComponent?.packageName;\n if (packageName) {\n const version = this.activeComponent?.id.version;\n const versionString = version ? `@${this.formatToInstallableVersion(version)}` : '';\n copy(`${packageName}${versionString}`);\n }\n };\n\n /**\n * key bindings used by component aspect\n */\n private keyBindings: CommandEntry[] = [\n {\n id: 'component.copyBitId', // TODO - extract to a component!\n action: () => {\n copy(this.activeComponent?.id.toString() || '');\n },\n displayName: 'Copy component ID',\n keybinding: '.',\n },\n {\n id: 'component.copyNpmId', // TODO - extract to a component!\n action: this.copyNpmId,\n displayName: 'Copy component package name',\n keybinding: ',',\n },\n ];\n\n private menuItems: MenuItem[] = [\n {\n category: 'general',\n title: 'Open command bar',\n keyChar: 'mod+k',\n handler: () => this.commandBarUI?.run('command-bar.open'),\n },\n {\n category: 'general',\n title: 'Toggle component list',\n keyChar: 'alt+s',\n handler: () => this.commandBarUI?.run('sidebar.toggle'),\n },\n {\n category: 'workflow',\n title: 'Copy component ID',\n keyChar: '.',\n handler: () => this.commandBarUI?.run('component.copyBitId'),\n },\n {\n category: 'workflow',\n title: 'Copy component package name',\n keyChar: ',',\n handler: () => this.commandBarUI?.run('component.copyNpmId'),\n },\n ];\n\n private bitMethod: ConsumePlugin = ({\n options,\n id: componentId,\n packageName: packageNameFromProps,\n latest: latestFromProps,\n componentModel,\n }) => {\n const packageName = packageNameFromProps || componentModel?.packageName;\n const latest = latestFromProps || componentModel?.id.version;\n\n const version = componentId.version === latest ? '' : `@${componentId.version}`;\n const packageVersion =\n componentId.version === latest ? '' : `@${this.formatToInstallableVersion(componentId.version as string)}`;\n\n return {\n Title: <img style={{ width: '20px' }} src=\"https://static.bit.dev/brands/bit-logo-text.svg\" />,\n Component: !options?.hide ? (\n <Import\n componentId={`${componentId.toString({ ignoreVersion: true })}${version}`}\n packageName={`${packageName}${packageVersion}`}\n componentName={componentId.name}\n showInstallMethod={!options?.disableInstall}\n />\n ) : null,\n order: 0,\n };\n };\n\n registerPubSub() {\n this.pubsub.sub(PreviewAspect.id, (be: BitBaseEvent<any>) => {\n if (be.type === ClickInsideAnIframeEvent.TYPE) {\n const event = new MouseEvent('mousedown', {\n view: window,\n bubbles: true,\n cancelable: true,\n });\n\n const body = document.body;\n body?.dispatchEvent(event);\n }\n });\n }\n\n handleComponentChange = (activeComponent?: ComponentModel) => {\n this.activeComponent = activeComponent;\n };\n\n getComponentUI(host: string, options: GetComponentsOptions = {}) {\n return (\n <Component\n routeSlot={this.routeSlot}\n containerSlot={this.pageItemSlot}\n onComponentChange={this.handleComponentChange}\n host={host}\n path={options.path}\n useComponent={options.useComponent}\n componentIdStr={options.componentId}\n useComponentFilters={options.useComponentFilters}\n overriddenRoutes={options.routes}\n />\n );\n }\n\n getMenu(host: string, options: GetComponentsOptions = {}) {\n return (\n <ComponentMenu\n className={options.className}\n skipRightSide={options.skipRightSide}\n navigationSlot={this.navSlot}\n consumeMethodSlot={this.consumeMethodSlot}\n widgetSlot={this.widgetSlot}\n host={host}\n menuItemSlot={this.menuItemSlot}\n useComponent={options.useComponent}\n path={options.path}\n componentIdStr={options.componentId}\n useComponentFilters={options.useComponentFilters}\n RightNode={options.RightNode}\n />\n );\n }\n\n listMenuItems() {\n const mainMenuItems = groupBy(flatten(this.menuItemSlot.values()), 'category');\n return mainMenuItems;\n }\n\n registerRoute(routes: RouteProps[] | RouteProps) {\n this.routeSlot.register(routes);\n return this;\n }\n\n registerNavigation(nav: LinkProps, order?: number) {\n this.navSlot.register({\n props: nav,\n order,\n });\n }\n\n registerConsumeMethod(...consumeMethods: ConsumePlugin[]) {\n this.consumeMethodSlot.register(consumeMethods);\n }\n\n registerWidget(widget: LinkProps, order?: number) {\n this.widgetSlot.register({ props: widget, order });\n }\n\n registerMenuItem = (menuItems: MenuItem[]) => {\n this.menuItemSlot.register(menuItems);\n };\n\n registerPageItem = (...items: ComponentPageElement[]) => {\n this.pageItemSlot.register(items);\n };\n\n /** register widgets to the components listed in the command bar */\n registerSearchResultWidget = (...items: ComponentResultPlugin[]) => {\n this.componentSearchResultSlot.register(items);\n const totalPlugins = flatten(this.componentSearchResultSlot.values());\n\n this.componentSearcher.updatePlugins(totalPlugins);\n };\n\n updateComponents = (components: ComponentModel[]) => {\n this.componentSearcher.update(components || []);\n };\n\n static dependencies = [PubsubAspect, CommandBarAspect, ReactRouterAspect];\n\n static runtime = UIRuntime;\n\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<NavPlugin>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<ConsumeMethodSlot>(),\n Slot.withType<MenuItemSlot>(),\n Slot.withType<ComponentPageSlot>(),\n Slot.withType<ComponentSearchResultSlot>(),\n ];\n static defaultConfig: ComponentUIConfig = {\n commandBar: true,\n };\n\n static async provider(\n [pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI],\n config: ComponentUIConfig,\n [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot]: [\n RouteSlot,\n OrderedNavigationSlot,\n ConsumeMethodSlot,\n OrderedNavigationSlot,\n MenuItemSlot,\n ComponentPageSlot,\n ComponentSearchResultSlot\n ]\n ) {\n // TODO: refactor ComponentHost to a separate extension (including sidebar, host, graphql, etc.)\n // TODO: add contextual hook for ComponentHost @uri/@oded\n const componentUI = new ComponentUI(\n pubsub,\n routeSlot,\n navSlot,\n consumeMethodSlot,\n widgetSlot,\n menuItemSlot,\n pageSlot,\n componentSearchResultSlot,\n commandBarUI,\n reactRouterUI\n );\n const aspectSection = new AspectSection();\n // @ts-ignore\n componentUI.registerSearchResultWidget({ key: 'deprecation', end: DeprecationIcon });\n\n if (componentUI.commandBarUI && config.commandBar) {\n componentUI.commandBarUI.addCommand(...componentUI.keyBindings);\n commandBarUI.addSearcher(componentUI.componentSearcher);\n }\n\n componentUI.registerMenuItem(componentUI.menuItems);\n componentUI.registerRoute(aspectSection.route);\n componentUI.registerWidget(aspectSection.navigationLink, aspectSection.order);\n componentUI.registerConsumeMethod(componentUI.bitMethod);\n return componentUI;\n }\n}\n\nexport default ComponentUI;\n\nComponentAspect.addRuntime(ComponentUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,iBAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EA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;AAAA,IAAAe,QAAA,GAAAP,OAAA,CAAAhK,OAAA,GA8CY6B,WAAW;AAE1B2I,4BAAe,CAACC,UAAU,CAAC5I,WAAW,CAAC"}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_copyToClipboard","_commandBar","_componentUi","_harmony","_preview","_interopRequireWildcard","_pubsub","_reactRouter","_ui","_lodash2","_uiFoundationUi","_uiFoundationUiUseBox","_componentPackageVersion","_aspect","_component","_component2","_componentSearcher","_menu","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","ComponentUI","constructor","pubsub","routeSlot","navSlot","consumeMethodSlot","widgetSlot","rightSideMenuSlot","menuItemSlot","pageItemSlot","componentSearchResultSlot","commandBarUI","reactRouterUi","packageName","activeComponent","version","id","versionString","formatToInstallableVersion","copy","action","toString","displayName","keybinding","copyNpmId","category","title","keyChar","handler","run","options","componentId","packageNameFromProps","latest","latestFromProps","componentModel","packageVersion","Title","createElement","style","width","src","Component","hide","Import","ignoreVersion","componentName","name","showInstallMethod","disableInstall","order","menuItems","register","items","totalPlugins","flatten","values","componentSearcher","updatePlugins","components","update","ComponentSearcher","navigate","navigateTo","isBrowser","registerPubSub","routes","toArray","map","Array","isArray","snapToSemver","sub","PreviewAspect","be","type","ClickInsideAnIframeEvent","TYPE","event","MouseEvent","view","window","bubbles","cancelable","body","document","dispatchEvent","getComponentUI","host","containerSlot","onComponentChange","handleComponentChange","path","useComponent","componentIdStr","useComponentFilters","overriddenRoutes","getMenu","ComponentMenu","className","skipRightSide","navigationSlot","RightNode","listMenuItems","mainMenuItems","groupBy","registerRoute","registerNavigation","nav","props","registerConsumeMethod","consumeMethods","registerWidget","widget","registerRightSideMenuItem","rightSideMenuItem","provider","reactRouterUI","config","pageSlot","componentUI","aspectSection","AspectSection","registerSearchResultWidget","end","DeprecationIcon","commandBar","addCommand","keyBindings","addSearcher","registerMenuItem","route","navigationLink","bitMethod","exports","PubsubAspect","CommandBarAspect","ReactRouterAspect","UIRuntime","Slot","withType","_default","ComponentAspect","addRuntime"],"sources":["component.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport flatten from 'lodash.flatten';\nimport copy from 'copy-to-clipboard';\nimport type { RouteProps } from 'react-router-dom';\nimport type { LinkProps } from '@teambit/base-react.navigation.link';\nimport CommandBarAspect, { CommandBarUI, CommandEntry } from '@teambit/command-bar';\nimport { DeprecationIcon } from '@teambit/component.ui.deprecation-icon';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport PreviewAspect, { ClickInsideAnIframeEvent } from '@teambit/preview';\nimport PubsubAspect, { BitBaseEvent, PubsubUI } from '@teambit/pubsub';\nimport ReactRouterAspect, { ReactRouterUI } from '@teambit/react-router';\nimport { UIRuntime } from '@teambit/ui';\nimport { groupBy } from 'lodash';\nimport { isBrowser } from '@teambit/ui-foundation.ui.is-browser';\nimport { MenuItem, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Import } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { snapToSemver } from '@teambit/component-package-version';\nimport { AspectSection } from './aspect.section';\nimport { ComponentAspect } from './component.aspect';\nimport { ComponentModel } from './ui';\nimport { Component, ComponentPageElement, ComponentPageSlot } from './ui/component';\nimport { ComponentResultPlugin, ComponentSearcher } from './ui/component-searcher';\nimport {\n ConsumeMethodSlot,\n ConsumePlugin,\n ComponentMenu,\n NavPlugin,\n OrderedNavigationSlot,\n RightSideMenuItem,\n RightSideMenuSlot,\n} from './ui/menu';\nimport { GetComponentsOptions } from './get-component-opts';\n\nexport type ComponentSearchResultSlot = SlotRegistry<ComponentResultPlugin[]>;\n\nexport type ComponentUIConfig = {\n commandBar: boolean;\n};\n\nexport type Server = {\n env: string;\n url: string;\n};\n\nexport type ComponentMeta = {\n id: string;\n};\n\nexport class ComponentUI {\n readonly routePath = `/*`;\n private componentSearcher: ComponentSearcher;\n\n constructor(\n /**\n * Pubsub aspects\n */\n private pubsub: PubsubUI,\n\n private routeSlot: RouteSlot,\n\n private navSlot: OrderedNavigationSlot,\n\n readonly consumeMethodSlot: ConsumeMethodSlot,\n\n /**\n * slot for registering a new widget to the menu.\n */\n private widgetSlot: OrderedNavigationSlot,\n /**\n * slot for registering the right section of the menu\n */\n private rightSideMenuSlot: RightSideMenuSlot,\n\n private menuItemSlot: MenuItemSlot,\n\n private pageItemSlot: ComponentPageSlot,\n\n private componentSearchResultSlot: ComponentSearchResultSlot,\n\n private commandBarUI: CommandBarUI,\n\n reactRouterUi: ReactRouterUI\n ) {\n this.componentSearcher = new ComponentSearcher({ navigate: reactRouterUi.navigateTo });\n if (isBrowser) this.registerPubSub();\n }\n\n get routes() {\n return this.routeSlot\n .toArray()\n .map(([key, routes]) => [key, Array.isArray(routes) ? [...flatten(routes)] : [routes]] as [string, RouteProps[]]);\n }\n\n /**\n * the current visible component\n */\n private activeComponent?: ComponentModel;\n\n formatToInstallableVersion(version: string) {\n return snapToSemver(version);\n }\n\n private copyNpmId = () => {\n const packageName = this.activeComponent?.packageName;\n if (packageName) {\n const version = this.activeComponent?.id.version;\n const versionString = version ? `@${this.formatToInstallableVersion(version)}` : '';\n copy(`${packageName}${versionString}`);\n }\n };\n\n /**\n * key bindings used by component aspect\n */\n private keyBindings: CommandEntry[] = [\n {\n id: 'component.copyBitId', // TODO - extract to a component!\n action: () => {\n copy(this.activeComponent?.id.toString() || '');\n },\n displayName: 'Copy component ID',\n keybinding: '.',\n },\n {\n id: 'component.copyNpmId', // TODO - extract to a component!\n action: this.copyNpmId,\n displayName: 'Copy component package name',\n keybinding: ',',\n },\n ];\n\n private menuItems: MenuItem[] = [\n {\n category: 'general',\n title: 'Open command bar',\n keyChar: 'mod+k',\n handler: () => this.commandBarUI?.run('command-bar.open'),\n },\n {\n category: 'general',\n title: 'Toggle component list',\n keyChar: 'alt+s',\n handler: () => this.commandBarUI?.run('sidebar.toggle'),\n },\n {\n category: 'workflow',\n title: 'Copy component ID',\n keyChar: '.',\n handler: () => this.commandBarUI?.run('component.copyBitId'),\n },\n {\n category: 'workflow',\n title: 'Copy component package name',\n keyChar: ',',\n handler: () => this.commandBarUI?.run('component.copyNpmId'),\n },\n ];\n\n private bitMethod: ConsumePlugin = ({\n options,\n id: componentId,\n packageName: packageNameFromProps,\n latest: latestFromProps,\n componentModel,\n }) => {\n const packageName = packageNameFromProps || componentModel?.packageName;\n const latest = latestFromProps || componentModel?.id.version;\n\n const version = componentId.version === latest ? '' : `@${componentId.version}`;\n const packageVersion =\n componentId.version === latest ? '' : `@${this.formatToInstallableVersion(componentId.version as string)}`;\n\n return {\n Title: <img style={{ width: '20px' }} src=\"https://static.bit.dev/brands/bit-logo-text.svg\" />,\n Component: !options?.hide ? (\n <Import\n componentId={`${componentId.toString({ ignoreVersion: true })}${version}`}\n packageName={`${packageName}${packageVersion}`}\n componentName={componentId.name}\n showInstallMethod={!options?.disableInstall}\n />\n ) : null,\n order: 0,\n };\n };\n\n registerPubSub() {\n this.pubsub.sub(PreviewAspect.id, (be: BitBaseEvent<any>) => {\n if (be.type === ClickInsideAnIframeEvent.TYPE) {\n const event = new MouseEvent('mousedown', {\n view: window,\n bubbles: true,\n cancelable: true,\n });\n\n const body = document.body;\n body?.dispatchEvent(event);\n }\n });\n }\n\n handleComponentChange = (activeComponent?: ComponentModel) => {\n this.activeComponent = activeComponent;\n };\n\n getComponentUI(host: string, options: GetComponentsOptions = {}) {\n return (\n <Component\n routeSlot={this.routeSlot}\n containerSlot={this.pageItemSlot}\n onComponentChange={this.handleComponentChange}\n host={host}\n path={options.path}\n useComponent={options.useComponent}\n componentIdStr={options.componentId}\n useComponentFilters={options.useComponentFilters}\n overriddenRoutes={options.routes}\n />\n );\n }\n\n getMenu(host: string, options: GetComponentsOptions = {}) {\n return (\n <ComponentMenu\n className={options.className}\n skipRightSide={options.skipRightSide}\n navigationSlot={this.navSlot}\n consumeMethodSlot={this.consumeMethodSlot}\n rightSideMenuSlot={this.rightSideMenuSlot}\n widgetSlot={this.widgetSlot}\n host={host}\n menuItemSlot={this.menuItemSlot}\n useComponent={options.useComponent}\n path={options.path}\n componentIdStr={options.componentId}\n useComponentFilters={options.useComponentFilters}\n RightNode={options.RightNode}\n />\n );\n }\n\n listMenuItems() {\n const mainMenuItems = groupBy(flatten(this.menuItemSlot.values()), 'category');\n return mainMenuItems;\n }\n\n registerRoute(routes: RouteProps[] | RouteProps) {\n this.routeSlot.register(routes);\n return this;\n }\n\n registerNavigation(nav: LinkProps, order?: number) {\n this.navSlot.register({\n props: nav,\n order,\n });\n }\n\n registerConsumeMethod(...consumeMethods: ConsumePlugin[]) {\n this.consumeMethodSlot.register(consumeMethods);\n }\n\n registerWidget(widget: LinkProps, order?: number) {\n this.widgetSlot.register({ props: widget, order });\n }\n\n registerRightSideMenuItem(...rightSideMenuItem: RightSideMenuItem[]) {\n this.rightSideMenuSlot.register(rightSideMenuItem);\n }\n\n registerMenuItem = (menuItems: MenuItem[]) => {\n this.menuItemSlot.register(menuItems);\n };\n\n registerPageItem = (...items: ComponentPageElement[]) => {\n this.pageItemSlot.register(items);\n };\n\n /** register widgets to the components listed in the command bar */\n registerSearchResultWidget = (...items: ComponentResultPlugin[]) => {\n this.componentSearchResultSlot.register(items);\n const totalPlugins = flatten(this.componentSearchResultSlot.values());\n\n this.componentSearcher.updatePlugins(totalPlugins);\n };\n\n updateComponents = (components: ComponentModel[]) => {\n this.componentSearcher.update(components || []);\n };\n\n static dependencies = [PubsubAspect, CommandBarAspect, ReactRouterAspect];\n\n static runtime = UIRuntime;\n\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<NavPlugin>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<ConsumeMethodSlot>(),\n Slot.withType<MenuItemSlot>(),\n Slot.withType<ComponentPageSlot>(),\n Slot.withType<ComponentSearchResultSlot>(),\n Slot.withType<RightSideMenuSlot>(),\n ];\n static defaultConfig: ComponentUIConfig = {\n commandBar: true,\n };\n\n static async provider(\n [pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI],\n config: ComponentUIConfig,\n [\n routeSlot,\n navSlot,\n consumeMethodSlot,\n widgetSlot,\n menuItemSlot,\n pageSlot,\n componentSearchResultSlot,\n rightSideMenuSlot,\n ]: [\n RouteSlot,\n OrderedNavigationSlot,\n ConsumeMethodSlot,\n OrderedNavigationSlot,\n MenuItemSlot,\n ComponentPageSlot,\n ComponentSearchResultSlot,\n RightSideMenuSlot\n ]\n ) {\n // TODO: refactor ComponentHost to a separate extension (including sidebar, host, graphql, etc.)\n // TODO: add contextual hook for ComponentHost @uri/@oded\n const componentUI = new ComponentUI(\n pubsub,\n routeSlot,\n navSlot,\n consumeMethodSlot,\n widgetSlot,\n rightSideMenuSlot,\n menuItemSlot,\n pageSlot,\n componentSearchResultSlot,\n commandBarUI,\n reactRouterUI\n );\n const aspectSection = new AspectSection();\n // @ts-ignore\n componentUI.registerSearchResultWidget({ key: 'deprecation', end: DeprecationIcon });\n\n if (componentUI.commandBarUI && config.commandBar) {\n componentUI.commandBarUI.addCommand(...componentUI.keyBindings);\n commandBarUI.addSearcher(componentUI.componentSearcher);\n }\n\n componentUI.registerMenuItem(componentUI.menuItems);\n componentUI.registerRoute(aspectSection.route);\n componentUI.registerWidget(aspectSection.navigationLink, aspectSection.order);\n componentUI.registerConsumeMethod(componentUI.bitMethod);\n return componentUI;\n }\n}\n\nexport default ComponentUI;\n\nComponentAspect.addRuntime(ComponentUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAA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,WAAW,CAACT,WAAW,CAAC/D,iBAAiB,CAAC;IACzD;IAEA+D,WAAW,CAACU,gBAAgB,CAACV,WAAW,CAACrE,SAAS,CAAC;IACnDqE,WAAW,CAACd,aAAa,CAACe,aAAa,CAACU,KAAK,CAAC;IAC9CX,WAAW,CAACR,cAAc,CAACS,aAAa,CAACW,cAAc,EAAEX,aAAa,CAACvE,KAAK,CAAC;IAC7EsE,WAAW,CAACV,qBAAqB,CAACU,WAAW,CAACa,SAAS,CAAC;IACxD,OAAOb,WAAW;EACpB;AACF;AAACc,OAAA,CAAAtI,WAAA,GAAAA,WAAA;AAAAb,eAAA,CAzTYa,WAAW,kBAkPA,CAACuI,iBAAY,EAAEC,qBAAgB,EAAEC,sBAAiB,CAAC;AAAAtJ,eAAA,CAlP9Da,WAAW,aAoPL0I,eAAS;AAAAvJ,eAAA,CApPfa,WAAW,WAsPP,CACb2I,eAAI,CAACC,QAAQ,CAAa,CAAC,EAC3BD,eAAI,CAACC,QAAQ,CAAY,CAAC,EAC1BD,eAAI,CAACC,QAAQ,CAAiB,CAAC,EAC/BD,eAAI,CAACC,QAAQ,CAAoB,CAAC,EAClCD,eAAI,CAACC,QAAQ,CAAe,CAAC,EAC7BD,eAAI,CAACC,QAAQ,CAAoB,CAAC,EAClCD,eAAI,CAACC,QAAQ,CAA4B,CAAC,EAC1CD,eAAI,CAACC,QAAQ,CAAoB,CAAC,CACnC;AAAAzJ,eAAA,CA/PUa,WAAW,mBAgQoB;EACxC8H,UAAU,EAAE;AACd,CAAC;AAAA,IAAAe,QAAA,GAAAP,OAAA,CAAAnK,OAAA,GAyDY6B,WAAW;AAE1B8I,4BAAe,CAACC,UAAU,CAAC/I,WAAW,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.135/dist/component.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.135/dist/component.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.137/dist/component.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.137/dist/component.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare function AspectPage(): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare class ComponentError {
3
2
  /**
4
3
  * http status code of error
@@ -95,6 +95,7 @@ function Component({
95
95
  useComponentFilters
96
96
  }) {
97
97
  const idFromLocation = (0, _useComponentFromLocation().useIdFromLocation)();
98
+ const componentIdStrWithScopeFromLocation = (0, _useComponentFromLocation().useIdFromLocation)(undefined, true);
98
99
  const _componentIdStr = getComponentIdStr(componentIdStr);
99
100
  const componentId = _componentIdStr ? _().ComponentID.fromString(_componentIdStr) : undefined;
100
101
  const resolvedComponentIdStr = path || idFromLocation;
@@ -109,7 +110,7 @@ function Component({
109
110
  component,
110
111
  componentDescriptor,
111
112
  error
112
- } = (0, _useComponent().useComponent)(host, componentId?.toString() || idFromLocation, useComponentOptions);
113
+ } = (0, _useComponent().useComponent)(host, componentId?.toString() || componentIdStrWithScopeFromLocation, useComponentOptions);
113
114
 
114
115
  // trigger onComponentChange when component changes
115
116
  (0, _react().useEffect)(() => onComponentChange?.(component), [component]);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_lodash","_interopRequireDefault","_uiFoundationUiReactRouter","_lodash2","_context","_useComponent","_useComponentFromLocation","_","_componentModule","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","getComponentIdStr","componentIdStr","isFunction","Component","routeSlot","overriddenRoutes","containerSlot","host","onComponentChange","useComponent","path","useComponentFilters","idFromLocation","useIdFromLocation","_componentIdStr","componentId","ComponentID","fromString","undefined","resolvedComponentIdStr","componentFiltersFromProps","useComponentOptions","logFilters","loading","log","customUseComponent","component","componentDescriptor","error","useComponentQuery","toString","useEffect","pageItems","useMemo","flatten","values","before","x","type","map","content","after","renderError","createElement","ComponentDescriptorProvider","ComponentProvider","className","styles","container","SlotRouter","parentPath","slot","routes"],"sources":["component.tsx"],"sourcesContent":["import React, { useEffect, ReactNode, useMemo } from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport flatten from 'lodash.flatten';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SlotRegistry } from '@teambit/harmony';\nimport { isFunction } from 'lodash';\nimport { ComponentProvider, ComponentDescriptorProvider } from './context';\nimport { useComponent as useComponentQuery, UseComponentType, Filters } from './use-component';\nimport { ComponentModel } from './component-model';\nimport { useIdFromLocation } from './use-component-from-location';\nimport { ComponentID } from '..';\n\nimport styles from './component.module.scss';\n\nexport type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;\nexport type ComponentPageElement = {\n type: 'before' | 'after';\n content: ReactNode;\n};\n\nexport type ComponentProps = {\n containerSlot?: ComponentPageSlot;\n routeSlot: RouteSlot;\n overriddenRoutes?: RouteProps[];\n host: string;\n onComponentChange?: (activeComponent?: ComponentModel) => void;\n useComponent?: UseComponentType;\n useComponentFilters?: () => Filters;\n path?: string;\n componentIdStr?: string | (() => string | undefined);\n};\n\nfunction getComponentIdStr(componentIdStr?: string | (() => string | undefined)): string | undefined {\n if (isFunction(componentIdStr)) return componentIdStr();\n return componentIdStr;\n}\n\n/**\n * main UI component of the Component extension.\n */\nexport function Component({\n routeSlot,\n overriddenRoutes,\n containerSlot,\n host,\n onComponentChange,\n componentIdStr,\n useComponent,\n path,\n useComponentFilters,\n}: ComponentProps) {\n const idFromLocation = useIdFromLocation();\n const _componentIdStr = getComponentIdStr(componentIdStr);\n const componentId = _componentIdStr ? ComponentID.fromString(_componentIdStr) : undefined;\n const resolvedComponentIdStr = path || idFromLocation;\n const componentFiltersFromProps = useComponentFilters?.() || {};\n\n const useComponentOptions = {\n logFilters: {\n ...componentFiltersFromProps,\n ...(componentFiltersFromProps.loading\n ? {}\n : {\n log: {\n // @todo - enable this when we have lazy loading of logs\n // limit: 3,\n ...componentFiltersFromProps.log,\n },\n }),\n },\n customUseComponent: useComponent,\n };\n\n const { component, componentDescriptor, error } = useComponentQuery(\n host,\n componentId?.toString() || idFromLocation,\n useComponentOptions\n );\n\n // trigger onComponentChange when component changes\n useEffect(() => onComponentChange?.(component), [component]);\n // cleanup when unmounting component\n useEffect(() => () => onComponentChange?.(undefined), []);\n\n const pageItems = useMemo(() => flatten(containerSlot?.values()), [containerSlot]);\n const before = useMemo(() => pageItems.filter((x) => x.type === 'before').map((x) => x.content), [pageItems]);\n const after = useMemo(() => pageItems.filter((x) => x.type === 'after').map((x) => x.content), [pageItems]);\n\n if (error) return error?.renderError();\n if (!component) return <div></div>;\n\n return (\n <ComponentDescriptorProvider componentDescriptor={componentDescriptor}>\n <ComponentProvider component={component}>\n {before}\n <div className={styles.container}>\n {routeSlot && (\n <SlotRouter parentPath={`${resolvedComponentIdStr}/*`} slot={routeSlot} routes={overriddenRoutes} />\n )}\n </div>\n {after}\n </ComponentProvider>\n </ComponentDescriptorProvider>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA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gBACpExF,MAAA,GAAAe,OAAA,CAAAyF,aAAA,CAAChG,QAAA,GAAAkG,iBAAiB;IAACnB,SAAS,EAAEA;EAAU,GACrCU,MAAM,eACPjG,MAAA,GAAAe,OAAA,CAAAyF,aAAA;IAAKG,SAAS,EAAEC,0BAAM,CAACC;EAAU,GAC9B5C,SAAS,iBACRjE,MAAA,GAAAe,OAAA,CAAAyF,aAAA,CAAClG,0BAAA,GAAAwG,UAAU;IAACC,UAAU,EAAG,GAAE/B,sBAAuB,IAAI;IAACgC,IAAI,EAAE/C,SAAU;IAACgD,MAAM,EAAE/C;EAAiB,CAAE,CAElG,CAAC,EACLoC,KACgB,CACQ,CAAC;AAElC"}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_lodash","_interopRequireDefault","_uiFoundationUiReactRouter","_lodash2","_context","_useComponent","_useComponentFromLocation","_","_componentModule","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","getComponentIdStr","componentIdStr","isFunction","Component","routeSlot","overriddenRoutes","containerSlot","host","onComponentChange","useComponent","path","useComponentFilters","idFromLocation","useIdFromLocation","componentIdStrWithScopeFromLocation","undefined","_componentIdStr","componentId","ComponentID","fromString","resolvedComponentIdStr","componentFiltersFromProps","useComponentOptions","logFilters","loading","log","customUseComponent","component","componentDescriptor","error","useComponentQuery","toString","useEffect","pageItems","useMemo","flatten","values","before","x","type","map","content","after","renderError","createElement","ComponentDescriptorProvider","ComponentProvider","className","styles","container","SlotRouter","parentPath","slot","routes"],"sources":["component.tsx"],"sourcesContent":["import React, { useEffect, ReactNode, useMemo } from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport flatten from 'lodash.flatten';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SlotRegistry } from '@teambit/harmony';\nimport { isFunction } from 'lodash';\nimport { ComponentProvider, ComponentDescriptorProvider } from './context';\nimport { useComponent as useComponentQuery, UseComponentType, Filters } from './use-component';\nimport { ComponentModel } from './component-model';\nimport { useIdFromLocation } from './use-component-from-location';\nimport { ComponentID } from '..';\n\nimport styles from './component.module.scss';\n\nexport type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;\nexport type ComponentPageElement = {\n type: 'before' | 'after';\n content: ReactNode;\n};\n\nexport type ComponentProps = {\n containerSlot?: ComponentPageSlot;\n routeSlot: RouteSlot;\n overriddenRoutes?: RouteProps[];\n host: string;\n onComponentChange?: (activeComponent?: ComponentModel) => void;\n useComponent?: UseComponentType;\n useComponentFilters?: () => Filters;\n path?: string;\n componentIdStr?: string | (() => string | undefined);\n};\n\nfunction getComponentIdStr(componentIdStr?: string | (() => string | undefined)): string | undefined {\n if (isFunction(componentIdStr)) return componentIdStr();\n return componentIdStr;\n}\n\n/**\n * main UI component of the Component extension.\n */\nexport function Component({\n routeSlot,\n overriddenRoutes,\n containerSlot,\n host,\n onComponentChange,\n componentIdStr,\n useComponent,\n path,\n useComponentFilters,\n}: ComponentProps) {\n const idFromLocation = useIdFromLocation();\n const componentIdStrWithScopeFromLocation = useIdFromLocation(undefined, true);\n const _componentIdStr = getComponentIdStr(componentIdStr);\n const componentId = _componentIdStr ? ComponentID.fromString(_componentIdStr) : undefined;\n const resolvedComponentIdStr = path || idFromLocation;\n const componentFiltersFromProps = useComponentFilters?.() || {};\n\n const useComponentOptions = {\n logFilters: {\n ...componentFiltersFromProps,\n ...(componentFiltersFromProps.loading\n ? {}\n : {\n log: {\n // @todo - enable this when we have lazy loading of logs\n // limit: 3,\n ...componentFiltersFromProps.log,\n },\n }),\n },\n customUseComponent: useComponent,\n };\n\n const { component, componentDescriptor, error } = useComponentQuery(\n host,\n componentId?.toString() || componentIdStrWithScopeFromLocation,\n useComponentOptions\n );\n\n // trigger onComponentChange when component changes\n useEffect(() => onComponentChange?.(component), [component]);\n // cleanup when unmounting component\n useEffect(() => () => onComponentChange?.(undefined), []);\n\n const pageItems = useMemo(() => flatten(containerSlot?.values()), [containerSlot]);\n const before = useMemo(() => pageItems.filter((x) => x.type === 'before').map((x) => x.content), [pageItems]);\n const after = useMemo(() => pageItems.filter((x) => x.type === 'after').map((x) => x.content), [pageItems]);\n\n if (error) return error?.renderError();\n if (!component) return <div></div>;\n\n return (\n <ComponentDescriptorProvider componentDescriptor={componentDescriptor}>\n <ComponentProvider component={component}>\n {before}\n <div className={styles.container}>\n {routeSlot && (\n <SlotRouter parentPath={`${resolvedComponentIdStr}/*`} slot={routeSlot} routes={overriddenRoutes} />\n )}\n </div>\n {after}\n </ComponentProvider>\n </ComponentDescriptorProvider>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,2BAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,0BAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EA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CollapsibleMenuNav, MenuNavProps } from './menu-nav';
2
- export { ComponentMenu, VersionRelatedDropdowns } from './menu';
2
+ export { ComponentMenu, VersionRelatedDropdowns, RightSideMenuItem, RightSideMenuSlot } from './menu';
3
3
  export type { NavPlugin, OrderedNavigationSlot, ConsumePlugin, ConsumeMethodSlot, ConsumePluginProps, } from './nav-plugin';
@@ -21,6 +21,18 @@ Object.defineProperty(exports, "MenuNavProps", {
21
21
  return _menuNav().MenuNavProps;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "RightSideMenuItem", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _menu().RightSideMenuItem;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "RightSideMenuSlot", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _menu().RightSideMenuSlot;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "VersionRelatedDropdowns", {
25
37
  enumerable: true,
26
38
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_menuNav","data","require","_menu"],"sources":["index.ts"],"sourcesContent":["export { CollapsibleMenuNav, MenuNavProps } from './menu-nav';\nexport { ComponentMenu, VersionRelatedDropdowns } from './menu';\nexport type {\n NavPlugin,\n OrderedNavigationSlot,\n ConsumePlugin,\n ConsumeMethodSlot,\n ConsumePluginProps,\n} from './nav-plugin';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
1
+ {"version":3,"names":["_menuNav","data","require","_menu"],"sources":["index.ts"],"sourcesContent":["export { CollapsibleMenuNav, MenuNavProps } from './menu-nav';\nexport { ComponentMenu, VersionRelatedDropdowns, RightSideMenuItem, RightSideMenuSlot } from './menu';\nexport type {\n NavPlugin,\n OrderedNavigationSlot,\n ConsumePlugin,\n ConsumeMethodSlot,\n ConsumePluginProps,\n} from './nav-plugin';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
@@ -1,10 +1,16 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
+ import { SlotRegistry } from '@teambit/harmony';
2
3
  import { DropdownComponentVersion, GetActiveTabIndex } from '@teambit/component.ui.version-dropdown';
3
4
  import { MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';
4
5
  import { LanesModel } from '@teambit/lanes.ui.models.lanes-model';
5
6
  import { UseComponentType, Filters } from '../use-component';
6
7
  import { OrderedNavigationSlot, ConsumeMethodSlot } from './nav-plugin';
7
8
  import { ComponentID } from '../..';
9
+ export type RightSideMenuItem = {
10
+ item: ReactNode;
11
+ order: number;
12
+ };
13
+ export type RightSideMenuSlot = SlotRegistry<RightSideMenuItem[]>;
8
14
  export type MenuProps = {
9
15
  className?: string;
10
16
  /**
@@ -20,9 +26,13 @@ export type MenuProps = {
20
26
  */
21
27
  navigationSlot: OrderedNavigationSlot;
22
28
  /**
23
- * right side menu item slot
29
+ * right side navigation menu item slot
24
30
  */
25
31
  widgetSlot: OrderedNavigationSlot;
32
+ /**
33
+ * right side menu item slot
34
+ */
35
+ rightSideMenuSlot: RightSideMenuSlot;
26
36
  /**
27
37
  * workspace or scope
28
38
  */
@@ -44,7 +54,7 @@ export type MenuProps = {
44
54
  /**
45
55
  * top bar menu.
46
56
  */
47
- export declare function ComponentMenu({ navigationSlot, widgetSlot, className, host, menuItemSlot, consumeMethodSlot, componentIdStr, skipRightSide, RightNode, useComponent, path, useComponentFilters, }: MenuProps): JSX.Element;
57
+ export declare function ComponentMenu({ navigationSlot, widgetSlot, className, host, menuItemSlot, consumeMethodSlot, rightSideMenuSlot, componentIdStr, skipRightSide, RightNode, useComponent, path, useComponentFilters, }: MenuProps): JSX.Element;
48
58
  export type VersionRelatedDropdownsProps = {
49
59
  componentId?: string;
50
60
  consumeMethods?: ConsumeMethodSlot;
@@ -141,6 +141,7 @@ function ComponentMenu({
141
141
  host,
142
142
  menuItemSlot,
143
143
  consumeMethodSlot,
144
+ rightSideMenuSlot,
144
145
  componentIdStr,
145
146
  skipRightSide,
146
147
  RightNode,
@@ -149,12 +150,14 @@ function ComponentMenu({
149
150
  useComponentFilters
150
151
  }) {
151
152
  const idFromLocation = (0, _useComponentFromLocation().useIdFromLocation)();
153
+ const componentIdStrWithScopeFromLocation = (0, _useComponentFromLocation().useIdFromLocation)(undefined, true);
152
154
  const _componentIdStr = getComponentIdStr(componentIdStr);
153
155
  const componentId = _componentIdStr ? _().ComponentID.fromString(_componentIdStr) : undefined;
154
156
  const resolvedComponentIdStr = path || idFromLocation;
155
157
  const mainMenuItems = (0, _react().useMemo)(() => (0, _lodash().groupBy)((0, _lodash().flatten)(menuItemSlot.values()), 'category'), [menuItemSlot]);
158
+ const rightSideItems = (0, _react().useMemo)(() => (0, _lodash().orderBy)((0, _lodash().flatten)(rightSideMenuSlot.values()), 'order'), [rightSideMenuSlot]);
156
159
  const componentFilters = useComponentFilters?.() || {};
157
- const useComponentVersions = defaultLoadVersions(host, componentId?.toString() || idFromLocation, componentFilters, useComponent);
160
+ const useComponentVersions = defaultLoadVersions(host, componentId?.toString() || componentIdStrWithScopeFromLocation, componentFilters, useComponent);
158
161
  const RightSide = /*#__PURE__*/_react().default.createElement("div", {
159
162
  className: _menuModule().default.rightSide
160
163
  }, RightNode || /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, /*#__PURE__*/_react().default.createElement(VersionRelatedDropdowns, {
@@ -164,7 +167,9 @@ function ComponentMenu({
164
167
  useComponent: useComponentVersions,
165
168
  componentFilters: componentFilters
166
169
  // loading={loading}
167
- }), /*#__PURE__*/_react().default.createElement(_uiFoundationUi().MainDropdown, {
170
+ }), rightSideItems.map(({
171
+ item
172
+ }) => item), /*#__PURE__*/_react().default.createElement(_uiFoundationUi().MainDropdown, {
168
173
  className: _menuModule().default.hideOnMobile,
169
174
  menuItems: mainMenuItems
170
175
  })));