@teambit/scope 0.0.951 → 0.0.952
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.
- package/dist/{preview-1672802758290.js → preview-1672889151191.js} +2 -2
- package/dist/scope.ui.runtime.d.ts +2 -0
- package/dist/scope.ui.runtime.js +4 -1
- package/dist/scope.ui.runtime.js.map +1 -1
- package/dist/ui/menu/menu.d.ts +5 -1
- package/dist/ui/menu/menu.js +6 -1
- package/dist/ui/menu/menu.js.map +1 -1
- package/package-tar/teambit-scope-0.0.952.tgz +0 -0
- package/package.json +33 -33
- package/scope.ui.runtime.tsx +3 -1
- package/ui/menu/menu.tsx +13 -2
- package/package-tar/teambit-scope-0.0.951.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.952/dist/scope.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.952/dist/scope.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -31,6 +31,8 @@ export declare type OverviewLine = ComponentType;
|
|
|
31
31
|
export declare type OverviewLineSlot = SlotRegistry<OverviewLine[]>;
|
|
32
32
|
export declare type ScopeUIConfig = {
|
|
33
33
|
showGallery: boolean;
|
|
34
|
+
useBoxAction?: string;
|
|
35
|
+
useBoxIcon?: string;
|
|
34
36
|
};
|
|
35
37
|
export declare class ScopeUI {
|
|
36
38
|
/**
|
package/dist/scope.ui.runtime.js
CHANGED
|
@@ -411,7 +411,10 @@ class ScopeUI {
|
|
|
411
411
|
})]);
|
|
412
412
|
if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));
|
|
413
413
|
scopeUi.registerMenuItem(scopeUi.menuItems);
|
|
414
|
-
scopeUi.registerMenuWidget(() => /*#__PURE__*/_react().default.createElement(_menu().ScopeUseBox,
|
|
414
|
+
scopeUi.registerMenuWidget(() => /*#__PURE__*/_react().default.createElement(_menu().ScopeUseBox, {
|
|
415
|
+
actionName: config.useBoxAction,
|
|
416
|
+
actionIcon: config.useBoxIcon
|
|
417
|
+
}));
|
|
415
418
|
if (config.showGallery) scopeUi.registerSidebarLink({
|
|
416
419
|
component: function Gallery() {
|
|
417
420
|
return /*#__PURE__*/_react().default.createElement(_designUiSurfacesMenu().MenuLinkItem, {
|
|
@@ -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","TargetScopeOverview","scopeClassName","Corner","listSidebarLinks","useScope","getContext","setSidebarToggle","paneClassName","PaneWrapper","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","overrideUseComponents","scopeDrawer","treeWidgets","filtersSlot","uiRoot","setKeyBindHandler","addCommand","action","displayName","keybinding","sorted","sort","a","b","aWeight","weight","bWeight","compact","link","component","provider","ui","config","componentFiltersSlot","scopeUi","registerDrawerComponentFilters","DeprecateFilter","EnvsFilter","ShowMainFilter","registerDrawerWidgets","registerRoot","bind","registerMenuItem","showGallery","registerSidebarLink","Gallery","UIAspect","ComponentAspect","SidebarAspect","CommandBarAspect","UIRuntime","Slot","withType","addRuntime"],"sources":["scope.ui.runtime.tsx"],"sourcesContent":["import type { ComponentUI, ComponentModel } from '@teambit/component';\nimport { compact, flatten } from 'lodash';\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 } from '@teambit/component.ui.component-filters.component-filter-context';\nimport { DeprecateFilter } from '@teambit/component.ui.component-filters.deprecate-filter';\nimport { EnvsFilter } from '@teambit/component.ui.component-filters.env-filter';\nimport { ComponentUrlResolver, ComponentUrlProvider } from '@teambit/component.modules.component-url';\nimport { ShowMainFilter } from '@teambit/component.ui.component-filters.show-main-filter';\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 TargetScopeOverview={options.TargetScopeOverview}\n scopeClassName={options.scopeClassName}\n TargetCorner={options.Corner}\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render items={this.listSidebarLinks()} />}\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 paneClassName={options.paneClassName}\n PaneWrapper={options.PaneWrapper}\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, overrideUseComponents?: () => { components: ComponentModel[] }) {\n this.sidebar.registerDrawer(\n scopeDrawer({\n treeWidgets: this.sidebarSlot,\n filtersSlot: this.drawerComponentsFiltersSlot,\n drawerWidgetSlot: this.drawerWidgetSlot,\n assumeScopeInUrl,\n overrideUseComponents,\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 items={this.listSidebarLinks()} />}\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 listSidebarLinks() {\n const links = flatten(this.sidebarItemSlot.values());\n const sorted = links.sort((a, b) => {\n const aWeight = a?.weight || 0;\n const bWeight = b?.weight || 0;\n return aWeight - bWeight;\n });\n\n return compact(\n sorted.map((link) => {\n return link.component;\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, ShowMainFilter(false)]);\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 component: function Gallery() {\n return (\n <MenuLinkItem exact href=\"/\" icon=\"comps\">\n Overview\n </MenuLinkItem>\n );\n },\n });\n if (ui) scopeUi.registerExplicitRoutes();\n\n return scopeUi;\n }\n}\n\nexport default ScopeUI;\n\nScopeAspect.addRuntime(ScopeUI);\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA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AO,GAAG;QAC5B,oBACE,+BAAC,oCAAY;UAAC,KAAK;UAAC,IAAI,EAAC,GAAG;UAAC,IAAI,EAAC;QAAO,cAE1B;MAEnB;IACF,CAAC,CAAC;IACJ,IAAId,EAAE,EAAEG,OAAO,CAAChD,sBAAsB,EAAE;IAExC,OAAOgD,OAAO;EAChB;AACF;AAAC;AAAA,gCA9YY5G,OAAO,kBAkTI,CAACwH,cAAQ,EAAEC,4BAAe,EAAEC,wBAAa,EAAEC,qBAAgB,CAAC;AAAA,gCAlTvE3H,OAAO,aAmTD4H,eAAS;AAAA,gCAnTf5H,OAAO,WAoTH,CACb6H,eAAI,CAACC,QAAQ,EAAc,EAC3BD,eAAI,CAACC,QAAQ,EAAc,EAC3BD,eAAI,CAACC,QAAQ,EAAqB,EAClCD,eAAI,CAACC,QAAQ,EAAc,EAC3BD,eAAI,CAACC,QAAQ,EAAiB,EAC9BD,eAAI,CAACC,QAAQ,EAAgB,EAC7BD,eAAI,CAACC,QAAQ,EAAgB,EAC7BD,eAAI,CAACC,QAAQ,EAAc,EAC3BD,eAAI,CAACC,QAAQ,EAAoB,EACjCD,eAAI,CAACC,QAAQ,EAAmB,EAChCD,eAAI,CAACC,QAAQ,EAAe,EAC5BD,eAAI,CAACC,QAAQ,EAAoB,EACjCD,eAAI,CAACC,QAAQ,EAAwB,CACtC;AAAA,gCAlUU9H,OAAO,mBAoUK;EACrBqH,WAAW,EAAE;AACf,CAAC;AAAA,eA0EYrH,OAAO;AAAA;AAEtByD,oBAAW,CAACsE,UAAU,CAAC/H,OAAO,CAAC"}
|
|
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","TargetScopeOverview","scopeClassName","Corner","listSidebarLinks","useScope","getContext","setSidebarToggle","paneClassName","PaneWrapper","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","overrideUseComponents","scopeDrawer","treeWidgets","filtersSlot","uiRoot","setKeyBindHandler","addCommand","action","displayName","keybinding","sorted","sort","a","b","aWeight","weight","bWeight","compact","link","component","provider","ui","config","componentFiltersSlot","scopeUi","registerDrawerComponentFilters","DeprecateFilter","EnvsFilter","ShowMainFilter","registerDrawerWidgets","registerRoot","bind","registerMenuItem","useBoxAction","useBoxIcon","showGallery","registerSidebarLink","Gallery","UIAspect","ComponentAspect","SidebarAspect","CommandBarAspect","UIRuntime","Slot","withType","addRuntime"],"sources":["scope.ui.runtime.tsx"],"sourcesContent":["import type { ComponentUI, ComponentModel } from '@teambit/component';\nimport { compact, flatten } from 'lodash';\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 } from '@teambit/component.ui.component-filters.component-filter-context';\nimport { DeprecateFilter } from '@teambit/component.ui.component-filters.deprecate-filter';\nimport { EnvsFilter } from '@teambit/component.ui.component-filters.env-filter';\nimport { ComponentUrlResolver, ComponentUrlProvider } from '@teambit/component.modules.component-url';\nimport { ShowMainFilter } from '@teambit/component.ui.component-filters.show-main-filter';\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 useBoxAction?: string;\n useBoxIcon?: string;\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 TargetScopeOverview={options.TargetScopeOverview}\n scopeClassName={options.scopeClassName}\n TargetCorner={options.Corner}\n routeSlot={this.routeSlot}\n menuSlot={this.menuSlot}\n sidebar={<this.sidebar.render items={this.listSidebarLinks()} />}\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 paneClassName={options.paneClassName}\n PaneWrapper={options.PaneWrapper}\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, overrideUseComponents?: () => { components: ComponentModel[] }) {\n this.sidebar.registerDrawer(\n scopeDrawer({\n treeWidgets: this.sidebarSlot,\n filtersSlot: this.drawerComponentsFiltersSlot,\n drawerWidgetSlot: this.drawerWidgetSlot,\n assumeScopeInUrl,\n overrideUseComponents,\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 items={this.listSidebarLinks()} />}\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 listSidebarLinks() {\n const links = flatten(this.sidebarItemSlot.values());\n const sorted = links.sort((a, b) => {\n const aWeight = a?.weight || 0;\n const bWeight = b?.weight || 0;\n return aWeight - bWeight;\n });\n\n return compact(\n sorted.map((link) => {\n return link.component;\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, ShowMainFilter(false)]);\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 actionName={config.useBoxAction} actionIcon={config.useBoxIcon} />);\n if (config.showGallery)\n scopeUi.registerSidebarLink({\n component: function Gallery() {\n return (\n <MenuLinkItem exact href=\"/\" icon=\"comps\">\n Overview\n </MenuLinkItem>\n );\n },\n });\n if (ui) scopeUi.registerExplicitRoutes();\n\n return scopeUi;\n }\n}\n\nexport default ScopeUI;\n\nScopeAspect.addRuntime(ScopeUI);\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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;AAOA;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;AACA;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;AA+BO,MAAMA,OAAO,CAAC;EACnBC,WAAW;EACT;AACJ;AACA;EACYC,SAAoB;EAE5B;AACJ;AACA;EACYC,WAAwB;EAChC;AACJ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EACjCD,eAAI,CAACC,QAAQ,EAAmB,EAChCD,eAAI,CAACC,QAAQ,EAAe,EAC5BD,eAAI,CAACC,QAAQ,EAAoB,EACjCD,eAAI,CAACC,QAAQ,EAAwB,CACtC;AAAA,gCAlUUhI,OAAO,mBAoUK;EACrBuH,WAAW,EAAE;AACf,CAAC;AAAA,eA0EYvH,OAAO;AAAA;AAEtByD,oBAAW,CAACwE,UAAU,CAACjI,OAAO,CAAC"}
|
package/dist/ui/menu/menu.d.ts
CHANGED
|
@@ -4,4 +4,8 @@ import { MenuProps } from '@teambit/ui-foundation.ui.menu';
|
|
|
4
4
|
* scope menu.
|
|
5
5
|
*/
|
|
6
6
|
export declare function ScopeMenu({ className, ...rest }: MenuProps): JSX.Element;
|
|
7
|
-
export declare
|
|
7
|
+
export declare type ScopeUseBoxProps = {
|
|
8
|
+
actionName?: string;
|
|
9
|
+
actionIcon?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function ScopeUseBox({ actionName, actionIcon }: ScopeUseBoxProps): JSX.Element;
|
package/dist/ui/menu/menu.js
CHANGED
|
@@ -83,11 +83,16 @@ function ScopeMenu(_ref) {
|
|
|
83
83
|
className: (0, _classnames().default)(_menuModule().default.scopMenu, className)
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
|
-
function ScopeUseBox(
|
|
86
|
+
function ScopeUseBox({
|
|
87
|
+
actionName,
|
|
88
|
+
actionIcon
|
|
89
|
+
}) {
|
|
87
90
|
const scope = (0, _react().useContext)(_scopeUiHooks().ScopeContext);
|
|
88
91
|
return /*#__PURE__*/_react().default.createElement(_uiFoundationUiUseBox().UseBoxDropdown, {
|
|
89
92
|
position: "bottom-end",
|
|
90
93
|
className: _menuModule().default.useBox,
|
|
94
|
+
actionIcon: actionIcon,
|
|
95
|
+
actionName: actionName,
|
|
91
96
|
Menu: /*#__PURE__*/_react().default.createElement(_uiFoundationUiUseBox2().Menu, {
|
|
92
97
|
scopeName: scope.name
|
|
93
98
|
})
|
package/dist/ui/menu/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScopeMenu","className","rest","classNames","styles","scopMenu","ScopeUseBox","scope","useContext","ScopeContext","useBox","name"],"sources":["menu.tsx"],"sourcesContent":["import { Menu, MenuProps } from '@teambit/ui-foundation.ui.menu';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport { UseBoxDropdown } from '@teambit/ui-foundation.ui.use-box.dropdown';\nimport { Menu as ScopeUseBoxMenu } from '@teambit/ui-foundation.ui.use-box.scope-menu';\nimport styles from './menu.module.scss';\n\n/**\n * scope menu.\n */\nexport function ScopeMenu({ className, ...rest }: MenuProps) {\n return <Menu {...rest} className={classNames(styles.scopMenu, className)} />;\n}\n\nexport function ScopeUseBox() {\n const scope = useContext(ScopeContext);\n return (\n <UseBoxDropdown
|
|
1
|
+
{"version":3,"names":["ScopeMenu","className","rest","classNames","styles","scopMenu","ScopeUseBox","actionName","actionIcon","scope","useContext","ScopeContext","useBox","name"],"sources":["menu.tsx"],"sourcesContent":["import { Menu, MenuProps } from '@teambit/ui-foundation.ui.menu';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport { UseBoxDropdown } from '@teambit/ui-foundation.ui.use-box.dropdown';\nimport { Menu as ScopeUseBoxMenu } from '@teambit/ui-foundation.ui.use-box.scope-menu';\nimport styles from './menu.module.scss';\n\n/**\n * scope menu.\n */\nexport function ScopeMenu({ className, ...rest }: MenuProps) {\n return <Menu {...rest} className={classNames(styles.scopMenu, className)} />;\n}\n\nexport type ScopeUseBoxProps = {\n actionName?: string;\n actionIcon?: string;\n};\n\nexport function ScopeUseBox({ actionName, actionIcon }: ScopeUseBoxProps) {\n const scope = useContext(ScopeContext);\n return (\n <UseBoxDropdown\n position=\"bottom-end\"\n className={styles.useBox}\n actionIcon={actionIcon}\n actionName={actionName}\n Menu={<ScopeUseBoxMenu scopeName={scope.name} />}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwC;AAAA;AAExC;AACA;AACA;AACO,SAASA,SAAS,OAAoC;EAAA,IAAnC;MAAEC;IAA8B,CAAC;IAAjBC,IAAI;EAC5C,oBAAO,+BAAC,sBAAI,+BAAKA,IAAI;IAAE,SAAS,EAAE,IAAAC,qBAAU,EAACC,qBAAM,CAACC,QAAQ,EAAEJ,SAAS;EAAE,GAAG;AAC9E;AAOO,SAASK,WAAW,CAAC;EAAEC,UAAU;EAAEC;AAA6B,CAAC,EAAE;EACxE,MAAMC,KAAK,GAAG,IAAAC,mBAAU,EAACC,4BAAY,CAAC;EACtC,oBACE,+BAAC,sCAAc;IACb,QAAQ,EAAC,YAAY;IACrB,SAAS,EAAEP,qBAAM,CAACQ,MAAO;IACzB,UAAU,EAAEJ,UAAW;IACvB,UAAU,EAAED,UAAW;IACvB,IAAI,eAAE,+BAAC,6BAAe;MAAC,SAAS,EAAEE,KAAK,CAACI;IAAK;EAAI,EACjD;AAEN"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/scope",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.952",
|
|
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.
|
|
9
|
+
"version": "0.0.952"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -26,53 +26,53 @@
|
|
|
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.
|
|
30
|
-
"@teambit/scope.ui.hooks.scope-context": "0.0.
|
|
31
|
-
"@teambit/cli": "0.0.
|
|
32
|
-
"@teambit/component": "0.0.
|
|
33
|
-
"@teambit/logger": "0.0.
|
|
34
|
-
"@teambit/aspect-loader": "0.0.
|
|
29
|
+
"@teambit/scope.models.scope-model": "0.0.297",
|
|
30
|
+
"@teambit/scope.ui.hooks.scope-context": "0.0.297",
|
|
31
|
+
"@teambit/cli": "0.0.638",
|
|
32
|
+
"@teambit/component": "0.0.952",
|
|
33
|
+
"@teambit/logger": "0.0.731",
|
|
34
|
+
"@teambit/aspect-loader": "0.0.952",
|
|
35
35
|
"@teambit/bit-error": "0.0.402",
|
|
36
|
-
"@teambit/builder": "0.0.
|
|
37
|
-
"@teambit/compiler": "0.0.
|
|
38
|
-
"@teambit/dependency-resolver": "0.0.
|
|
39
|
-
"@teambit/envs": "0.0.
|
|
40
|
-
"@teambit/express": "0.0.
|
|
41
|
-
"@teambit/graph": "0.0.
|
|
42
|
-
"@teambit/graphql": "0.0.
|
|
36
|
+
"@teambit/builder": "0.0.952",
|
|
37
|
+
"@teambit/compiler": "0.0.952",
|
|
38
|
+
"@teambit/dependency-resolver": "0.0.952",
|
|
39
|
+
"@teambit/envs": "0.0.952",
|
|
40
|
+
"@teambit/express": "0.0.736",
|
|
41
|
+
"@teambit/graph": "0.0.952",
|
|
42
|
+
"@teambit/graphql": "0.0.952",
|
|
43
43
|
"@teambit/harmony.modules.requireable-component": "0.0.491",
|
|
44
|
-
"@teambit/isolator": "0.0.
|
|
44
|
+
"@teambit/isolator": "0.0.952",
|
|
45
45
|
"@teambit/legacy-bit-id": "0.0.421",
|
|
46
|
-
"@teambit/ui": "0.0.
|
|
46
|
+
"@teambit/ui": "0.0.952",
|
|
47
47
|
"@teambit/workspace.modules.match-pattern": "0.0.498",
|
|
48
48
|
"@teambit/component-id": "0.0.425",
|
|
49
|
-
"@teambit/component.ui.component-drawer": "0.0.
|
|
49
|
+
"@teambit/component.ui.component-drawer": "0.0.196",
|
|
50
50
|
"@teambit/design.ui.tree": "0.0.15",
|
|
51
|
-
"@teambit/lanes.hooks.use-lane-components": "0.0.
|
|
52
|
-
"@teambit/lanes.hooks.use-lanes": "0.0.
|
|
53
|
-
"@teambit/ui-foundation.ui.side-bar": "0.0.
|
|
54
|
-
"@teambit/command-bar": "0.0.
|
|
55
|
-
"@teambit/component-tree": "0.0.
|
|
51
|
+
"@teambit/lanes.hooks.use-lane-components": "0.0.101",
|
|
52
|
+
"@teambit/lanes.hooks.use-lanes": "0.0.102",
|
|
53
|
+
"@teambit/ui-foundation.ui.side-bar": "0.0.713",
|
|
54
|
+
"@teambit/command-bar": "0.0.952",
|
|
55
|
+
"@teambit/component-tree": "0.0.740",
|
|
56
56
|
"@teambit/component.modules.component-url": "0.0.148",
|
|
57
|
-
"@teambit/component.ui.component-filters.component-filter-context": "0.0.
|
|
58
|
-
"@teambit/component.ui.component-filters.deprecate-filter": "0.0.
|
|
59
|
-
"@teambit/component.ui.component-filters.env-filter": "0.0.
|
|
60
|
-
"@teambit/component.ui.component-filters.show-main-filter": "0.0.
|
|
61
|
-
"@teambit/sidebar": "0.0.
|
|
57
|
+
"@teambit/component.ui.component-filters.component-filter-context": "0.0.71",
|
|
58
|
+
"@teambit/component.ui.component-filters.deprecate-filter": "0.0.71",
|
|
59
|
+
"@teambit/component.ui.component-filters.env-filter": "0.0.77",
|
|
60
|
+
"@teambit/component.ui.component-filters.show-main-filter": "0.0.64",
|
|
61
|
+
"@teambit/sidebar": "0.0.952",
|
|
62
62
|
"@teambit/ui-foundation.ui.main-dropdown": "0.0.497",
|
|
63
63
|
"@teambit/ui-foundation.ui.menu": "0.0.497",
|
|
64
64
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
|
|
65
65
|
"@teambit/ui-foundation.ui.tree.drawer": "0.0.510",
|
|
66
|
-
"@teambit/lane-id": "0.0.
|
|
66
|
+
"@teambit/lane-id": "0.0.156",
|
|
67
67
|
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.498",
|
|
68
|
-
"@teambit/scope.ui.hooks.use-scope": "0.0.
|
|
68
|
+
"@teambit/scope.ui.hooks.use-scope": "0.0.302",
|
|
69
69
|
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.206",
|
|
70
70
|
"@teambit/ui-foundation.ui.corner": "0.0.507",
|
|
71
71
|
"@teambit/ui-foundation.ui.full-loader": "0.0.495",
|
|
72
72
|
"@teambit/ui-foundation.ui.hooks.use-is-mobile": "0.0.188",
|
|
73
73
|
"@teambit/ui-foundation.ui.top-bar": "0.0.505",
|
|
74
|
-
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.
|
|
75
|
-
"@teambit/ui-foundation.ui.use-box.scope-menu": "0.0.
|
|
74
|
+
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.131",
|
|
75
|
+
"@teambit/ui-foundation.ui.use-box.scope-menu": "0.0.131",
|
|
76
76
|
"@teambit/explorer.ui.gallery.component-card": "0.0.507",
|
|
77
77
|
"@teambit/explorer.ui.gallery.component-grid": "0.0.496",
|
|
78
78
|
"@teambit/preview.ui.preview-placeholder": "0.0.496",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"react-router-dom": "^6.0.0",
|
|
97
|
-
"@teambit/legacy": "1.0.
|
|
97
|
+
"@teambit/legacy": "1.0.419",
|
|
98
98
|
"react": "^16.8.0 || ^17.0.0",
|
|
99
99
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
100
100
|
},
|
package/scope.ui.runtime.tsx
CHANGED
|
@@ -55,6 +55,8 @@ export type OverviewLineSlot = SlotRegistry<OverviewLine[]>;
|
|
|
55
55
|
|
|
56
56
|
export type ScopeUIConfig = {
|
|
57
57
|
showGallery: boolean;
|
|
58
|
+
useBoxAction?: string;
|
|
59
|
+
useBoxIcon?: string;
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export class ScopeUI {
|
|
@@ -440,7 +442,7 @@ export class ScopeUI {
|
|
|
440
442
|
]);
|
|
441
443
|
if (ui) ui.registerRoot(scopeUi.uiRoot.bind(scopeUi));
|
|
442
444
|
scopeUi.registerMenuItem(scopeUi.menuItems);
|
|
443
|
-
scopeUi.registerMenuWidget(() => <ScopeUseBox />);
|
|
445
|
+
scopeUi.registerMenuWidget(() => <ScopeUseBox actionName={config.useBoxAction} actionIcon={config.useBoxIcon} />);
|
|
444
446
|
if (config.showGallery)
|
|
445
447
|
scopeUi.registerSidebarLink({
|
|
446
448
|
component: function Gallery() {
|
package/ui/menu/menu.tsx
CHANGED
|
@@ -13,9 +13,20 @@ export function ScopeMenu({ className, ...rest }: MenuProps) {
|
|
|
13
13
|
return <Menu {...rest} className={classNames(styles.scopMenu, className)} />;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export type ScopeUseBoxProps = {
|
|
17
|
+
actionName?: string;
|
|
18
|
+
actionIcon?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function ScopeUseBox({ actionName, actionIcon }: ScopeUseBoxProps) {
|
|
17
22
|
const scope = useContext(ScopeContext);
|
|
18
23
|
return (
|
|
19
|
-
<UseBoxDropdown
|
|
24
|
+
<UseBoxDropdown
|
|
25
|
+
position="bottom-end"
|
|
26
|
+
className={styles.useBox}
|
|
27
|
+
actionIcon={actionIcon}
|
|
28
|
+
actionName={actionName}
|
|
29
|
+
Menu={<ScopeUseBoxMenu scopeName={scope.name} />}
|
|
30
|
+
/>
|
|
20
31
|
);
|
|
21
32
|
}
|
|
Binary file
|