@teambit/scope 0.0.816 → 0.0.817

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.
@@ -29,6 +29,9 @@ export declare type Corner = ComponentType;
29
29
  export declare type CornerSlot = SlotRegistry<Corner>;
30
30
  export declare type OverviewLine = ComponentType;
31
31
  export declare type OverviewLineSlot = SlotRegistry<OverviewLine[]>;
32
+ export declare type ScopeUIConfig = {
33
+ showGallery: boolean;
34
+ };
32
35
  export declare class ScopeUI {
33
36
  /**
34
37
  * route slot.
@@ -173,7 +176,10 @@ export declare class ScopeUI {
173
176
  static dependencies: import("@teambit/harmony").Aspect[];
174
177
  static runtime: import("@teambit/harmony").RuntimeDefinition;
175
178
  static slots: (((registerFn: () => string) => SlotRegistry<RouteProps>) | ((registerFn: () => string) => SlotRegistry<ComponentTreeNode>) | ((registerFn: () => string) => SlotRegistry<DrawerWidgetSlot>) | ((registerFn: () => string) => SlotRegistry<ScopeBadge>) | ((registerFn: () => string) => SlotRegistry<MenuWidget[]>) | ((registerFn: () => string) => SlotRegistry<CornerSlot>))[];
176
- static provider([ui, componentUi, sidebar, commandBarUI]: [UiUI, ComponentUI, SidebarUI, CommandBarUI], config: any, [routeSlot, menuSlot, sidebarSlot, scopeBadgeSlot, menuWidgetSlot, menuItemSlot, sidebarItemSlot, cornerSlot, overviewSlot, contextSlot, drawerWidgetSlot, componentFiltersSlot,]: [
179
+ static defaultConfig: {
180
+ showGallery: boolean;
181
+ };
182
+ static provider([ui, componentUi, sidebar, commandBarUI]: [UiUI, ComponentUI, SidebarUI, CommandBarUI], config: ScopeUIConfig, [routeSlot, menuSlot, sidebarSlot, scopeBadgeSlot, menuWidgetSlot, menuItemSlot, sidebarItemSlot, cornerSlot, overviewSlot, contextSlot, drawerWidgetSlot, componentFiltersSlot,]: [
177
183
  RouteSlot,
178
184
  RouteSlot,
179
185
  SidebarSlot,
@@ -456,7 +456,7 @@ class ScopeUI {
456
456
  if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));
457
457
  scopeUi.registerMenuItem(scopeUi.menuItems);
458
458
  scopeUi.registerMenuWidget(() => /*#__PURE__*/_react().default.createElement(_menu().ScopeUseBox, null));
459
- scopeUi.registerSidebarLink(() => /*#__PURE__*/_react().default.createElement(_designUiSurfacesMenu().MenuLinkItem, {
459
+ if (config.showGallery) scopeUi.registerSidebarLink(() => /*#__PURE__*/_react().default.createElement(_designUiSurfacesMenu().MenuLinkItem, {
460
460
  exact: true,
461
461
  href: "/",
462
462
  icon: "comps"
@@ -471,6 +471,9 @@ exports.ScopeUI = ScopeUI;
471
471
  (0, _defineProperty2().default)(ScopeUI, "dependencies", [_ui().UIAspect, _component().ComponentAspect, _sidebar().SidebarAspect, _commandBar().default]);
472
472
  (0, _defineProperty2().default)(ScopeUI, "runtime", _ui().UIRuntime);
473
473
  (0, _defineProperty2().default)(ScopeUI, "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(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
474
+ (0, _defineProperty2().default)(ScopeUI, "defaultConfig", {
475
+ showGallery: true
476
+ });
474
477
  var _default = ScopeUI;
475
478
  exports.default = _default;
476
479
 
@@ -1 +1 @@
1
- {"version":3,"names":["ScopeUI","constructor","routeSlot","componentUi","menuSlot","sidebar","sidebarSlot","commandBarUI","scopeBadgeSlot","menuWidgetSlot","sidebarItemSlot","menuItemSlot","cornerSlot","overviewSlot","contextSlot","drawerWidgetSlot","drawerComponentsFiltersSlot","routes","register","menuItems","componentTreeNodes","map","componentTreeNode","links","drawer","registerDrawer","filters","widgets","components","updateComponents","category","title","keyChar","handler","run","registerBadge","badges","getScope","options","Corner","useScope","getContext","setSidebarToggle","registerOverviewLine","lines","registerRoutes","applyMenuRoutes","registerMenuRoutes","path","routePath","element","getMenu","ScopeAspect","id","getScopeMenu","registerExplicitRoutes","getComponentUI","registerMenuWidget","registerCorner","corner","registerComponentUrl","func","componentUrlFunc","replaceOverview","replaceDescription","replaceMetadataSection","registerMetadataItem","replaceComponentGrid","registerMetadata","addContext","context","contexts","values","ComponentUrlFuncProvider","children","flatten","concat","registerDefaultDrawers","assumeScopeInUrl","scopeDrawer","treeWidgets","filtersSlot","uiRoot","setKeyBindHandler","addCommand","action","displayName","keybinding","provider","ui","config","componentFiltersSlot","scopeUi","registerDrawerComponentFilters","DeprecateFilter","EnvsFilter","registerDrawerWidgets","registerRoot","bind","registerMenuItem","registerSidebarLink","UIAspect","ComponentAspect","SidebarAspect","CommandBarAspect","UIRuntime","Slot","withType","addRuntime"],"sources":["scope.ui.runtime.tsx"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport type { ComponentUI, ComponentModel } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SidebarAspect, SidebarUI, SidebarItem, SidebarItemSlot } from '@teambit/sidebar';\nimport { ComponentTreeNode } from '@teambit/component-tree';\nimport { UIAspect, UIRootUI as UIRoot, UIRuntime, UiUI } from '@teambit/ui';\nimport React, { ComponentType, ReactNode } from 'react';\nimport { MenuItemSlot, MenuItem } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { RouteProps } from 'react-router-dom';\nimport { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\nimport { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item';\nimport CommandBarAspect, { CommandBarUI, CommandHandler } from '@teambit/command-bar';\nimport { ScopeModel } from '@teambit/scope.models.scope-model';\nimport { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';\nimport {\n DrawerWidgetSlot,\n FilterWidget,\n TreeToggleWidget,\n ComponentFiltersSlot,\n} from '@teambit/component.ui.component-drawer';\nimport { ComponentFilters, DeprecateFilter, EnvsFilter } from '@teambit/component.ui.component-filters';\nimport { ComponentUrlResolver, ComponentUrlProvider } from '@teambit/component.modules.component-url';\n\nimport { ScopeMenu, ScopeUseBox } from './ui/menu';\nimport { ScopeAspect } from './scope.aspect';\nimport { Scope } from './ui/scope';\nimport { scopeDrawer } from './scope.ui.drawer';\nimport { GetScopeOptions } from './get-scope-options';\n\nexport type ScopeBadge = ComponentType;\n\nexport type ScopeBadgeSlot = SlotRegistry<ScopeBadge[]>;\n\nexport type ContextSlot = SlotRegistry<ScopeContextType[]>;\n\nexport type ScopeContextType = ComponentType<{ scope: ScopeModel; children: ReactNode }>;\n\nexport type SidebarSlot = SlotRegistry<ComponentTreeNode>;\n\nexport type ScopeOverview = ComponentType;\n\nexport type ScopeOverviewSlot = SlotRegistry<ScopeOverview>;\n\nexport type Corner = ComponentType;\n\nexport type CornerSlot = SlotRegistry<Corner>;\n\nexport type OverviewLine = ComponentType;\n\nexport type OverviewLineSlot = SlotRegistry<OverviewLine[]>;\n\nexport class ScopeUI {\n constructor(\n /**\n * route slot.\n */\n private routeSlot: RouteSlot,\n\n /**\n * component ui extension.\n */\n private componentUi: ComponentUI,\n /**\n * menu slot\n */\n private menuSlot: RouteSlot,\n\n private sidebar: SidebarUI,\n\n private sidebarSlot: SidebarSlot,\n\n private commandBarUI: CommandBarUI,\n\n private scopeBadgeSlot: ScopeBadgeSlot,\n\n private menuWidgetSlot: MenuWidgetSlot,\n\n /**\n * sidebar link slot\n */\n private sidebarItemSlot: SidebarItemSlot,\n\n /**\n * main dropdown item slot\n */\n private menuItemSlot: MenuItemSlot,\n\n /**\n * corner slot\n */\n private cornerSlot: CornerSlot,\n\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: OverviewLineSlot,\n\n /**\n * add a new context to ui\n */\n private contextSlot: ContextSlot,\n private drawerWidgetSlot: DrawerWidgetSlot,\n private drawerComponentsFiltersSlot: ComponentFiltersSlot\n ) {}\n\n private setSidebarToggle: (updated: CommandHandler) => void = () => {};\n\n /**\n * register a new badge into the scope overview.\n */\n registerBadge(...badges: ScopeBadge[]) {\n this.scopeBadgeSlot.register(badges);\n return this;\n }\n\n getScope(options: GetScopeOptions) {\n return (\n <Scope\n TargetCorner={options.Corner}\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render itemSlot={this.sidebarItemSlot} />}\n scopeUi={this}\n userUseScopeQuery={options.useScope}\n badgeSlot={this.scopeBadgeSlot}\n overviewLineSlot={this.overviewSlot}\n context={this.getContext()}\n onSidebarTogglerChange={this.setSidebarToggle}\n cornerSlot={this.cornerSlot}\n />\n );\n }\n\n /**\n * register a new line beneath the scope overview section.\n */\n registerOverviewLine(...lines: OverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n /**\n * register a route to the scope.\n */\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\n }\n\n registerMenuRoutes = (routes: RouteProps[]) => {\n this.menuSlot.register(routes);\n return this;\n };\n\n private applyMenuRoutes() {\n this.registerMenuRoutes([\n {\n path: this.componentUi.routePath,\n element: this.componentUi.getMenu(ScopeAspect.id),\n },\n {\n path: '/',\n element: this.getScopeMenu(),\n },\n ]);\n }\n\n getScopeMenu() {\n return <ScopeMenu widgetSlot={this.menuWidgetSlot} menuItemSlot={this.menuItemSlot} />;\n }\n\n private registerExplicitRoutes() {\n this.applyMenuRoutes();\n this.registerRoutes([\n {\n path: this.componentUi.routePath,\n element: this.componentUi.getComponentUI(ScopeAspect.id),\n },\n ]);\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n }\n\n registerCorner(corner: Corner) {\n this.cornerSlot.register(corner);\n }\n\n private componentUrlFunc: ComponentUrlResolver | undefined;\n registerComponentUrl(func: ComponentUrlResolver) {\n this.componentUrlFunc = func;\n }\n\n /**\n * register a scope overview.\n */\n replaceOverview() {}\n\n /**\n * register description.\n */\n replaceDescription() {}\n\n /**\n * register metadata section.\n */\n replaceMetadataSection() {}\n\n /**\n * register a metadata item.\n */\n registerMetadataItem() {}\n\n replaceComponentGrid() {}\n\n /**\n * register metadata.\n */\n registerMetadata() {}\n\n /**\n * add a new context to the scope.\n */\n addContext(...context: ScopeContextType[]) {\n this.contextSlot.register(context);\n return this;\n }\n\n private getContext() {\n const contexts = this.contextSlot.values();\n // eslint-disable-next-line react/prop-types\n const ComponentUrlFuncProvider: ScopeContextType = ({ children }) => (\n <ComponentUrlProvider value={this.componentUrlFunc}>{children}</ComponentUrlProvider>\n );\n\n return flatten(contexts).concat(ComponentUrlFuncProvider);\n }\n\n registerMenuItem = (menuItems: MenuItem[]) => {\n this.menuItemSlot.register(menuItems);\n };\n\n /**\n * register a sidebar Widget for the scope\n */\n registerSidebarWidget = (componentTreeNodes: ComponentTreeNode[]) => {\n componentTreeNodes.map((componentTreeNode) => this.sidebarSlot.register(componentTreeNode));\n return this;\n };\n\n /**\n * register a sidebar link to the section above the drawers\n */\n registerSidebarLink = (...links: SidebarItem[]) => {\n this.sidebarItemSlot.register(links);\n };\n\n registerDrawers = (...drawer: DrawerType[]) => {\n this.sidebar.registerDrawer(...drawer);\n return this;\n };\n\n /**\n * register component filters\n */\n registerDrawerComponentFilters = (filters: ComponentFilters) => {\n this.drawerComponentsFiltersSlot.register(filters);\n };\n\n registerDrawerWidgets = (widgets: ReactNode[]) => {\n this.drawerWidgetSlot.register(widgets);\n };\n\n registerDefaultDrawers(assumeScopeInUrl = false) {\n this.sidebar.registerDrawer(\n scopeDrawer({\n treeWidgets: this.sidebarSlot,\n filtersSlot: this.drawerComponentsFiltersSlot,\n drawerWidgetSlot: this.drawerWidgetSlot,\n assumeScopeInUrl\n })\n );\n }\n\n uiRoot(): UIRoot {\n this.registerDefaultDrawers();\n const [setKeyBindHandler] = this.commandBarUI.addCommand({\n id: 'sidebar.toggle', // TODO - extract to a component!\n action: () => {},\n displayName: 'Toggle component list',\n keybinding: 'alt+s',\n });\n this.setSidebarToggle = setKeyBindHandler;\n\n return {\n routes: [\n {\n path: '/*',\n element: (\n <Scope\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render itemSlot={this.sidebarItemSlot} />}\n scopeUi={this}\n badgeSlot={this.scopeBadgeSlot}\n overviewLineSlot={this.overviewSlot}\n context={this.getContext()}\n onSidebarTogglerChange={this.setSidebarToggle}\n cornerSlot={this.cornerSlot}\n />\n ),\n },\n ],\n };\n }\n\n /** registers available components */\n setComponents = (components: ComponentModel[]) => {\n this.componentUi.updateComponents(components);\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\n static dependencies = [UIAspect, ComponentAspect, SidebarAspect, CommandBarAspect];\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<RouteProps>(),\n Slot.withType<ComponentTreeNode>(),\n Slot.withType<ScopeBadge>(),\n Slot.withType<ScopeOverview>(),\n Slot.withType<MenuWidget[]>(),\n Slot.withType<MenuItemSlot>(),\n Slot.withType<CornerSlot>(),\n Slot.withType<OverviewLineSlot>(),\n Slot.withType<SidebarItemSlot>(),\n Slot.withType<ContextSlot>(),\n Slot.withType<DrawerWidgetSlot>(),\n Slot.withType<ComponentFiltersSlot>(),\n ];\n\n static async provider(\n [ui, componentUi, sidebar, commandBarUI]: [UiUI, ComponentUI, SidebarUI, CommandBarUI],\n config,\n [\n routeSlot,\n menuSlot,\n sidebarSlot,\n scopeBadgeSlot,\n menuWidgetSlot,\n menuItemSlot,\n sidebarItemSlot,\n cornerSlot,\n overviewSlot,\n contextSlot,\n drawerWidgetSlot,\n componentFiltersSlot,\n ]: [\n RouteSlot,\n RouteSlot,\n SidebarSlot,\n ScopeBadgeSlot,\n MenuWidgetSlot,\n MenuItemSlot,\n SidebarItemSlot,\n CornerSlot,\n OverviewLineSlot,\n ContextSlot,\n DrawerWidgetSlot,\n ComponentFiltersSlot\n ]\n ) {\n const scopeUi = new ScopeUI(\n routeSlot,\n componentUi,\n menuSlot,\n sidebar,\n sidebarSlot,\n commandBarUI,\n scopeBadgeSlot,\n menuWidgetSlot,\n sidebarItemSlot,\n menuItemSlot,\n cornerSlot,\n overviewSlot,\n contextSlot,\n drawerWidgetSlot,\n componentFiltersSlot\n );\n scopeUi.registerDrawerComponentFilters([DeprecateFilter, EnvsFilter]);\n scopeUi.registerDrawerWidgets([\n <FilterWidget key={'workspace-filter-widget'} />,\n <TreeToggleWidget key={'workspace-tree-toggle-widget'} />,\n ]);\n if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));\n scopeUi.registerMenuItem(scopeUi.menuItems);\n scopeUi.registerMenuWidget(() => <ScopeUseBox />);\n scopeUi.registerSidebarLink(() => (\n <MenuLinkItem exact href=\"/\" icon=\"comps\">\n Gallery\n </MenuLinkItem>\n ));\n if (ui) scopeUi.registerExplicitRoutes();\n\n return scopeUi;\n }\n}\n\nexport default ScopeUI;\n\nScopeAspect.addRuntime(ScopeUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;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ACb0G,eAAA,CAAKC,QAAL,EADa,EAEbD,eAAA,CAAKC,QAAL,EAFa,EAGbD,eAAA,CAAKC,QAAL,EAHa,EAIbD,eAAA,CAAKC,QAAL,EAJa,EAKbD,eAAA,CAAKC,QAAL,EALa,EAMbD,eAAA,CAAKC,QAAL,EANa,EAObD,eAAA,CAAKC,QAAL,EAPa,EAQbD,eAAA,CAAKC,QAAL,EARa,EASbD,eAAA,CAAKC,QAAL,EATa,EAUbD,eAAA,CAAKC,QAAL,EAVa,EAWbD,eAAA,CAAKC,QAAL,EAXa,EAYbD,eAAA,CAAKC,QAAL,EAZa,EAabD,eAAA,CAAKC,QAAL,EAba,C;eAmFF3G,O;;;AAEfoD,oBAAA,CAAYwD,UAAZ,CAAuB5G,OAAvB"}
1
+ {"version":3,"names":["ScopeUI","constructor","routeSlot","componentUi","menuSlot","sidebar","sidebarSlot","commandBarUI","scopeBadgeSlot","menuWidgetSlot","sidebarItemSlot","menuItemSlot","cornerSlot","overviewSlot","contextSlot","drawerWidgetSlot","drawerComponentsFiltersSlot","routes","register","menuItems","componentTreeNodes","map","componentTreeNode","links","drawer","registerDrawer","filters","widgets","components","updateComponents","category","title","keyChar","handler","run","registerBadge","badges","getScope","options","Corner","useScope","getContext","setSidebarToggle","registerOverviewLine","lines","registerRoutes","applyMenuRoutes","registerMenuRoutes","path","routePath","element","getMenu","ScopeAspect","id","getScopeMenu","registerExplicitRoutes","getComponentUI","registerMenuWidget","registerCorner","corner","registerComponentUrl","func","componentUrlFunc","replaceOverview","replaceDescription","replaceMetadataSection","registerMetadataItem","replaceComponentGrid","registerMetadata","addContext","context","contexts","values","ComponentUrlFuncProvider","children","flatten","concat","registerDefaultDrawers","assumeScopeInUrl","scopeDrawer","treeWidgets","filtersSlot","uiRoot","setKeyBindHandler","addCommand","action","displayName","keybinding","provider","ui","config","componentFiltersSlot","scopeUi","registerDrawerComponentFilters","DeprecateFilter","EnvsFilter","registerDrawerWidgets","registerRoot","bind","registerMenuItem","showGallery","registerSidebarLink","UIAspect","ComponentAspect","SidebarAspect","CommandBarAspect","UIRuntime","Slot","withType","addRuntime"],"sources":["scope.ui.runtime.tsx"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport type { ComponentUI, ComponentModel } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SidebarAspect, SidebarUI, SidebarItem, SidebarItemSlot } from '@teambit/sidebar';\nimport { ComponentTreeNode } from '@teambit/component-tree';\nimport { UIAspect, UIRootUI as UIRoot, UIRuntime, UiUI } from '@teambit/ui';\nimport React, { ComponentType, ReactNode } from 'react';\nimport { MenuItemSlot, MenuItem } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { RouteProps } from 'react-router-dom';\nimport { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\nimport { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item';\nimport CommandBarAspect, { CommandBarUI, CommandHandler } from '@teambit/command-bar';\nimport { ScopeModel } from '@teambit/scope.models.scope-model';\nimport { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';\nimport {\n DrawerWidgetSlot,\n FilterWidget,\n TreeToggleWidget,\n ComponentFiltersSlot,\n} from '@teambit/component.ui.component-drawer';\nimport { ComponentFilters, DeprecateFilter, EnvsFilter } from '@teambit/component.ui.component-filters';\nimport { ComponentUrlResolver, ComponentUrlProvider } from '@teambit/component.modules.component-url';\n\nimport { ScopeMenu, ScopeUseBox } from './ui/menu';\nimport { ScopeAspect } from './scope.aspect';\nimport { Scope } from './ui/scope';\nimport { scopeDrawer } from './scope.ui.drawer';\nimport { GetScopeOptions } from './get-scope-options';\n\nexport type ScopeBadge = ComponentType;\n\nexport type ScopeBadgeSlot = SlotRegistry<ScopeBadge[]>;\n\nexport type ContextSlot = SlotRegistry<ScopeContextType[]>;\n\nexport type ScopeContextType = ComponentType<{ scope: ScopeModel; children: ReactNode }>;\n\nexport type SidebarSlot = SlotRegistry<ComponentTreeNode>;\n\nexport type ScopeOverview = ComponentType;\n\nexport type ScopeOverviewSlot = SlotRegistry<ScopeOverview>;\n\nexport type Corner = ComponentType;\n\nexport type CornerSlot = SlotRegistry<Corner>;\n\nexport type OverviewLine = ComponentType;\n\nexport type OverviewLineSlot = SlotRegistry<OverviewLine[]>;\n\nexport type ScopeUIConfig = {\n showGallery: boolean;\n};\n\nexport class ScopeUI {\n constructor(\n /**\n * route slot.\n */\n private routeSlot: RouteSlot,\n\n /**\n * component ui extension.\n */\n private componentUi: ComponentUI,\n /**\n * menu slot\n */\n private menuSlot: RouteSlot,\n\n private sidebar: SidebarUI,\n\n private sidebarSlot: SidebarSlot,\n\n private commandBarUI: CommandBarUI,\n\n private scopeBadgeSlot: ScopeBadgeSlot,\n\n private menuWidgetSlot: MenuWidgetSlot,\n\n /**\n * sidebar link slot\n */\n private sidebarItemSlot: SidebarItemSlot,\n\n /**\n * main dropdown item slot\n */\n private menuItemSlot: MenuItemSlot,\n\n /**\n * corner slot\n */\n private cornerSlot: CornerSlot,\n\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: OverviewLineSlot,\n\n /**\n * add a new context to ui\n */\n private contextSlot: ContextSlot,\n private drawerWidgetSlot: DrawerWidgetSlot,\n private drawerComponentsFiltersSlot: ComponentFiltersSlot\n ) {}\n\n private setSidebarToggle: (updated: CommandHandler) => void = () => {};\n\n /**\n * register a new badge into the scope overview.\n */\n registerBadge(...badges: ScopeBadge[]) {\n this.scopeBadgeSlot.register(badges);\n return this;\n }\n\n getScope(options: GetScopeOptions) {\n return (\n <Scope\n TargetCorner={options.Corner}\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render itemSlot={this.sidebarItemSlot} />}\n scopeUi={this}\n userUseScopeQuery={options.useScope}\n badgeSlot={this.scopeBadgeSlot}\n overviewLineSlot={this.overviewSlot}\n context={this.getContext()}\n onSidebarTogglerChange={this.setSidebarToggle}\n cornerSlot={this.cornerSlot}\n />\n );\n }\n\n /**\n * register a new line beneath the scope overview section.\n */\n registerOverviewLine(...lines: OverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n /**\n * register a route to the scope.\n */\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\n }\n\n registerMenuRoutes = (routes: RouteProps[]) => {\n this.menuSlot.register(routes);\n return this;\n };\n\n private applyMenuRoutes() {\n this.registerMenuRoutes([\n {\n path: this.componentUi.routePath,\n element: this.componentUi.getMenu(ScopeAspect.id),\n },\n {\n path: '/',\n element: this.getScopeMenu(),\n },\n ]);\n }\n\n getScopeMenu() {\n return <ScopeMenu widgetSlot={this.menuWidgetSlot} menuItemSlot={this.menuItemSlot} />;\n }\n\n private registerExplicitRoutes() {\n this.applyMenuRoutes();\n this.registerRoutes([\n {\n path: this.componentUi.routePath,\n element: this.componentUi.getComponentUI(ScopeAspect.id),\n },\n ]);\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n }\n\n registerCorner(corner: Corner) {\n this.cornerSlot.register(corner);\n }\n\n private componentUrlFunc: ComponentUrlResolver | undefined;\n registerComponentUrl(func: ComponentUrlResolver) {\n this.componentUrlFunc = func;\n }\n\n /**\n * register a scope overview.\n */\n replaceOverview() {}\n\n /**\n * register description.\n */\n replaceDescription() {}\n\n /**\n * register metadata section.\n */\n replaceMetadataSection() {}\n\n /**\n * register a metadata item.\n */\n registerMetadataItem() {}\n\n replaceComponentGrid() {}\n\n /**\n * register metadata.\n */\n registerMetadata() {}\n\n /**\n * add a new context to the scope.\n */\n addContext(...context: ScopeContextType[]) {\n this.contextSlot.register(context);\n return this;\n }\n\n private getContext() {\n const contexts = this.contextSlot.values();\n // eslint-disable-next-line react/prop-types\n const ComponentUrlFuncProvider: ScopeContextType = ({ children }) => (\n <ComponentUrlProvider value={this.componentUrlFunc}>{children}</ComponentUrlProvider>\n );\n\n return flatten(contexts).concat(ComponentUrlFuncProvider);\n }\n\n registerMenuItem = (menuItems: MenuItem[]) => {\n this.menuItemSlot.register(menuItems);\n };\n\n /**\n * register a sidebar Widget for the scope\n */\n registerSidebarWidget = (componentTreeNodes: ComponentTreeNode[]) => {\n componentTreeNodes.map((componentTreeNode) => this.sidebarSlot.register(componentTreeNode));\n return this;\n };\n\n /**\n * register a sidebar link to the section above the drawers\n */\n registerSidebarLink = (...links: SidebarItem[]) => {\n this.sidebarItemSlot.register(links);\n };\n\n registerDrawers = (...drawer: DrawerType[]) => {\n this.sidebar.registerDrawer(...drawer);\n return this;\n };\n\n /**\n * register component filters\n */\n registerDrawerComponentFilters = (filters: ComponentFilters) => {\n this.drawerComponentsFiltersSlot.register(filters);\n };\n\n registerDrawerWidgets = (widgets: ReactNode[]) => {\n this.drawerWidgetSlot.register(widgets);\n };\n\n registerDefaultDrawers(assumeScopeInUrl = false) {\n this.sidebar.registerDrawer(\n scopeDrawer({\n treeWidgets: this.sidebarSlot,\n filtersSlot: this.drawerComponentsFiltersSlot,\n drawerWidgetSlot: this.drawerWidgetSlot,\n assumeScopeInUrl,\n })\n );\n }\n\n uiRoot(): UIRoot {\n this.registerDefaultDrawers();\n const [setKeyBindHandler] = this.commandBarUI.addCommand({\n id: 'sidebar.toggle', // TODO - extract to a component!\n action: () => {},\n displayName: 'Toggle component list',\n keybinding: 'alt+s',\n });\n this.setSidebarToggle = setKeyBindHandler;\n\n return {\n routes: [\n {\n path: '/*',\n element: (\n <Scope\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render itemSlot={this.sidebarItemSlot} />}\n scopeUi={this}\n badgeSlot={this.scopeBadgeSlot}\n overviewLineSlot={this.overviewSlot}\n context={this.getContext()}\n onSidebarTogglerChange={this.setSidebarToggle}\n cornerSlot={this.cornerSlot}\n />\n ),\n },\n ],\n };\n }\n\n /** registers available components */\n setComponents = (components: ComponentModel[]) => {\n this.componentUi.updateComponents(components);\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\n static dependencies = [UIAspect, ComponentAspect, SidebarAspect, CommandBarAspect];\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<RouteProps>(),\n Slot.withType<ComponentTreeNode>(),\n Slot.withType<ScopeBadge>(),\n Slot.withType<ScopeOverview>(),\n Slot.withType<MenuWidget[]>(),\n Slot.withType<MenuItemSlot>(),\n Slot.withType<CornerSlot>(),\n Slot.withType<OverviewLineSlot>(),\n Slot.withType<SidebarItemSlot>(),\n Slot.withType<ContextSlot>(),\n Slot.withType<DrawerWidgetSlot>(),\n Slot.withType<ComponentFiltersSlot>(),\n ];\n\n static defaultConfig = {\n showGallery: true,\n };\n\n static async provider(\n [ui, componentUi, sidebar, commandBarUI]: [UiUI, ComponentUI, SidebarUI, CommandBarUI],\n config: ScopeUIConfig,\n [\n routeSlot,\n menuSlot,\n sidebarSlot,\n scopeBadgeSlot,\n menuWidgetSlot,\n menuItemSlot,\n sidebarItemSlot,\n cornerSlot,\n overviewSlot,\n contextSlot,\n drawerWidgetSlot,\n componentFiltersSlot,\n ]: [\n RouteSlot,\n RouteSlot,\n SidebarSlot,\n ScopeBadgeSlot,\n MenuWidgetSlot,\n MenuItemSlot,\n SidebarItemSlot,\n CornerSlot,\n OverviewLineSlot,\n ContextSlot,\n DrawerWidgetSlot,\n ComponentFiltersSlot\n ]\n ) {\n const scopeUi = new ScopeUI(\n routeSlot,\n componentUi,\n menuSlot,\n sidebar,\n sidebarSlot,\n commandBarUI,\n scopeBadgeSlot,\n menuWidgetSlot,\n sidebarItemSlot,\n menuItemSlot,\n cornerSlot,\n overviewSlot,\n contextSlot,\n drawerWidgetSlot,\n componentFiltersSlot\n );\n scopeUi.registerDrawerComponentFilters([DeprecateFilter, EnvsFilter]);\n scopeUi.registerDrawerWidgets([\n <FilterWidget key={'workspace-filter-widget'} />,\n <TreeToggleWidget key={'workspace-tree-toggle-widget'} />,\n ]);\n if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));\n scopeUi.registerMenuItem(scopeUi.menuItems);\n scopeUi.registerMenuWidget(() => <ScopeUseBox />);\n if (config.showGallery)\n scopeUi.registerSidebarLink(() => (\n <MenuLinkItem exact href=\"/\" icon=\"comps\">\n Gallery\n </MenuLinkItem>\n ));\n if (ui) scopeUi.registerExplicitRoutes();\n\n return scopeUi;\n }\n}\n\nexport default ScopeUI;\n\nScopeAspect.addRuntime(ScopeUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AA6BO,MAAMA,OAAN,CAAc;EACnBC,WAAW;EACT;AAC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,eAAA,CAAKC,QAAL,EAVa,EAWbD,eAAA,CAAKC,QAAL,EAXa,EAYbD,eAAA,CAAKC,QAAL,EAZa,EAabD,eAAA,CAAKC,QAAL,EAba,C;gCAhSJ5G,O,mBAgTY;EACrBoG,WAAW,EAAE;AADQ,C;eAwEVpG,O;;;AAEfoD,oBAAA,CAAYyD,UAAZ,CAAuB7G,OAAvB"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/scope",
3
- "version": "0.0.816",
3
+ "version": "0.0.817",
4
4
  "homepage": "https://bit.dev/teambit/scope/scope",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.scope",
8
8
  "name": "scope",
9
- "version": "0.0.816"
9
+ "version": "0.0.817"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -26,38 +26,38 @@
26
26
  "@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
27
27
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
28
28
  "@teambit/base-ui.utils.composer": "1.0.0",
29
- "@teambit/scope.models.scope-model": "0.0.196",
30
- "@teambit/scope.ui.hooks.scope-context": "0.0.196",
31
- "@teambit/cli": "0.0.544",
32
- "@teambit/component": "0.0.816",
33
- "@teambit/logger": "0.0.637",
34
- "@teambit/aspect-loader": "0.0.816",
29
+ "@teambit/scope.models.scope-model": "0.0.197",
30
+ "@teambit/scope.ui.hooks.scope-context": "0.0.197",
31
+ "@teambit/cli": "0.0.545",
32
+ "@teambit/component": "0.0.817",
33
+ "@teambit/logger": "0.0.638",
34
+ "@teambit/aspect-loader": "0.0.817",
35
35
  "@teambit/bit-error": "0.0.394",
36
- "@teambit/builder": "0.0.816",
37
- "@teambit/compiler": "0.0.816",
38
- "@teambit/envs": "0.0.816",
39
- "@teambit/express": "0.0.642",
40
- "@teambit/graphql": "0.0.816",
36
+ "@teambit/builder": "0.0.817",
37
+ "@teambit/compiler": "0.0.817",
38
+ "@teambit/envs": "0.0.817",
39
+ "@teambit/express": "0.0.643",
40
+ "@teambit/graphql": "0.0.817",
41
41
  "@teambit/harmony.modules.requireable-component": "0.0.484",
42
- "@teambit/isolator": "0.0.816",
42
+ "@teambit/isolator": "0.0.817",
43
43
  "@teambit/legacy-bit-id": "0.0.402",
44
- "@teambit/ui": "0.0.816",
44
+ "@teambit/ui": "0.0.817",
45
45
  "@teambit/workspace.modules.match-pattern": "0.0.489",
46
46
  "@teambit/component-id": "0.0.405",
47
- "@teambit/component.ui.component-drawer": "0.0.93",
47
+ "@teambit/component.ui.component-drawer": "0.0.94",
48
48
  "@teambit/design.ui.tree": "0.0.6",
49
- "@teambit/ui-foundation.ui.side-bar": "0.0.610",
50
- "@teambit/command-bar": "0.0.816",
51
- "@teambit/component-tree": "0.0.604",
49
+ "@teambit/ui-foundation.ui.side-bar": "0.0.611",
50
+ "@teambit/command-bar": "0.0.817",
51
+ "@teambit/component-tree": "0.0.605",
52
52
  "@teambit/component.modules.component-url": "0.0.128",
53
53
  "@teambit/component.ui.component-filters": "0.0.10",
54
- "@teambit/sidebar": "0.0.816",
54
+ "@teambit/sidebar": "0.0.817",
55
55
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.487",
56
56
  "@teambit/ui-foundation.ui.menu": "0.0.487",
57
57
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.490",
58
58
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.499",
59
59
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.488",
60
- "@teambit/scope.ui.hooks.use-scope": "0.0.200",
60
+ "@teambit/scope.ui.hooks.use-scope": "0.0.201",
61
61
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.195",
62
62
  "@teambit/ui-foundation.ui.corner": "0.0.498",
63
63
  "@teambit/ui-foundation.ui.full-loader": "0.0.486",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "react-router-dom": "^6.0.0",
90
- "@teambit/legacy": "1.0.327",
90
+ "@teambit/legacy": "1.0.328",
91
91
  "react-dom": "^16.8.0 || ^17.0.0",
92
92
  "react": "^16.8.0 || ^17.0.0"
93
93
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.816/dist/scope.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.816/dist/scope.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.817/dist/scope.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.817/dist/scope.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -51,6 +51,10 @@ export type OverviewLine = ComponentType;
51
51
 
52
52
  export type OverviewLineSlot = SlotRegistry<OverviewLine[]>;
53
53
 
54
+ export type ScopeUIConfig = {
55
+ showGallery: boolean;
56
+ };
57
+
54
58
  export class ScopeUI {
55
59
  constructor(
56
60
  /**
@@ -280,7 +284,7 @@ export class ScopeUI {
280
284
  treeWidgets: this.sidebarSlot,
281
285
  filtersSlot: this.drawerComponentsFiltersSlot,
282
286
  drawerWidgetSlot: this.drawerWidgetSlot,
283
- assumeScopeInUrl
287
+ assumeScopeInUrl,
284
288
  })
285
289
  );
286
290
  }
@@ -355,9 +359,13 @@ export class ScopeUI {
355
359
  Slot.withType<ComponentFiltersSlot>(),
356
360
  ];
357
361
 
362
+ static defaultConfig = {
363
+ showGallery: true,
364
+ };
365
+
358
366
  static async provider(
359
367
  [ui, componentUi, sidebar, commandBarUI]: [UiUI, ComponentUI, SidebarUI, CommandBarUI],
360
- config,
368
+ config: ScopeUIConfig,
361
369
  [
362
370
  routeSlot,
363
371
  menuSlot,
@@ -411,11 +419,12 @@ export class ScopeUI {
411
419
  if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));
412
420
  scopeUi.registerMenuItem(scopeUi.menuItems);
413
421
  scopeUi.registerMenuWidget(() => <ScopeUseBox />);
414
- scopeUi.registerSidebarLink(() => (
415
- <MenuLinkItem exact href="/" icon="comps">
416
- Gallery
417
- </MenuLinkItem>
418
- ));
422
+ if (config.showGallery)
423
+ scopeUi.registerSidebarLink(() => (
424
+ <MenuLinkItem exact href="/" icon="comps">
425
+ Gallery
426
+ </MenuLinkItem>
427
+ ));
419
428
  if (ui) scopeUi.registerExplicitRoutes();
420
429
 
421
430
  return scopeUi;