@teambit/scope 0.0.843 → 0.0.846
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/exceptions/index.d.ts +1 -0
- package/dist/exceptions/index.js +16 -0
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/no-id-match-pattern.d.ts +4 -0
- package/dist/exceptions/no-id-match-pattern.js +27 -0
- package/dist/exceptions/no-id-match-pattern.js.map +1 -0
- package/dist/get-scope-options.d.ts +2 -0
- package/dist/get-scope-options.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/scope.main.runtime.d.ts +6 -3
- package/dist/scope.main.runtime.js +55 -10
- package/dist/scope.main.runtime.js.map +1 -1
- package/dist/scope.ui.runtime.d.ts +2 -1
- package/dist/scope.ui.runtime.js +30 -10
- package/dist/scope.ui.runtime.js.map +1 -1
- package/dist/ui/scope-overview/scope-overview.d.ts +3 -2
- package/dist/ui/scope-overview/scope-overview.js +3 -2
- package/dist/ui/scope-overview/scope-overview.js.map +1 -1
- package/dist/ui/scope.d.ts +3 -1
- package/dist/ui/scope.js +7 -2
- package/dist/ui/scope.js.map +1 -1
- package/exceptions/index.ts +1 -0
- package/exceptions/no-id-match-pattern.ts +7 -0
- package/package-tar/teambit-scope-0.0.846.tgz +0 -0
- package/package.json +28 -30
- package/{preview-1662089982043.js → preview-1662608124038.js} +2 -2
- package/scope.ui.runtime.tsx +27 -8
- package/ui/scope-overview/scope-overview.tsx +17 -12
- package/ui/scope.tsx +15 -2
- package/package-tar/teambit-scope-0.0.843.tgz +0 -0
|
@@ -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","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 } 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 { 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;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M,+BAAC,mBAAD,OAAjC;IACA,IAAIiC,MAAM,CAACU,WAAX,EACER,OAAO,CAACS,mBAAR,CAA4B,mBAC1B,+BAAC,oCAAD;MAAc,KAAK,MAAnB;MAAoB,IAAI,EAAC,GAAzB;MAA6B,IAAI,EAAC;IAAlC,aADF;IAKF,IAAIZ,EAAJ,EAAQG,OAAO,CAACrC,sBAAR;IAER,OAAOqC,OAAP;EACD;;AArXkB;;;gCAAR5F,O,kBA8RW,CAACsG,cAAD,EAAWC,4BAAX,EAA4BC,wBAA5B,EAA2CC,qBAA3C,C;gCA9RXzG,O,aA+RM0G,e;gCA/RN1G,O,WAgSI,CACb2G,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;gCAhSJ5G,O,mBAgTY;EACrBoG,WAAW,EAAE;AADQ,C;eAwEVpG,O;;;AAEfoD,oBAAA,CAAYyD,UAAZ,CAAuB7G,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","TargetScopeOverview","Corner","listSidebarLinks","useScope","getContext","setSidebarToggle","paneClassName","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","sorted","sort","a","b","aWeight","weight","bWeight","compact","link","component","provider","ui","config","componentFiltersSlot","scopeUi","registerDrawerComponentFilters","DeprecateFilter","EnvsFilter","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 { 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 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 />\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 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(sorted.map((link) => {\n return link.component;\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 component: function Gallery() {\n return (\n <MenuLinkItem exact href=\"/\" icon=\"comps\">\n Gallery\n </MenuLinkItem>\n );\n },\n });\n if (ui) scopeUi.registerExplicitR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CAACoH,cAAD,EAAWC,4BAAX,EAA4BC,wBAA5B,EAA2CC,qBAA3C,C;gCA7SXvH,O,aA8SMwH,e;gCA9SNxH,O,WA+SI,CACbyH,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;gCA/SJ1H,O,mBA+TY;EACrBiH,WAAW,EAAE;AADQ,C;eA4EVjH,O;;;AAEfuD,oBAAA,CAAYoE,UAAZ,CAAuB3H,OAAvB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import { ComponentModel } from '@teambit/component';
|
|
3
3
|
import type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';
|
|
4
4
|
export declare type ScopeOverviewProps = {
|
|
5
5
|
badgeSlot: ScopeBadgeSlot;
|
|
6
6
|
overviewSlot: OverviewLineSlot;
|
|
7
|
+
TargetOverview?: ComponentType;
|
|
7
8
|
};
|
|
8
|
-
export declare function ScopeOverview({ badgeSlot, overviewSlot }: ScopeOverviewProps): JSX.Element;
|
|
9
|
+
export declare function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps): JSX.Element;
|
|
9
10
|
declare type ScopeComponentCardProps = {
|
|
10
11
|
component: ComponentModel;
|
|
11
12
|
componentUrl?: string;
|
|
@@ -96,7 +96,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
96
96
|
|
|
97
97
|
function ScopeOverview({
|
|
98
98
|
badgeSlot,
|
|
99
|
-
overviewSlot
|
|
99
|
+
overviewSlot,
|
|
100
|
+
TargetOverview
|
|
100
101
|
}) {
|
|
101
102
|
const scope = (0, _react().useContext)(_scopeUiHooks().ScopeContext);
|
|
102
103
|
const {
|
|
@@ -115,7 +116,7 @@ function ScopeOverview({
|
|
|
115
116
|
overviewSlot: overviewSlot,
|
|
116
117
|
description: scope.description,
|
|
117
118
|
componentCount: scope.components.length
|
|
118
|
-
}), /*#__PURE__*/_react().default.createElement(_explorerUiGallery2().ComponentGrid, null, components.map((component, index) => {
|
|
119
|
+
}), TargetOverview ? /*#__PURE__*/_react().default.createElement(TargetOverview, null) : /*#__PURE__*/_react().default.createElement(_explorerUiGallery2().ComponentGrid, null, components.map((component, index) => {
|
|
119
120
|
var _component$deprecatio;
|
|
120
121
|
|
|
121
122
|
if ((_component$deprecatio = component.deprecation) !== null && _component$deprecatio !== void 0 && _component$deprecatio.isDeprecate) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScopeOverview","badgeSlot","overviewSlot","scope","useContext","ScopeContext","components","length","name","styles","container","icon","backgroundIconColor","description","map","component","index","deprecation","isDeprecate","ScopeComponentCard","componentUrl","shouldShowPreview","compositions","id","fullName","environment","version"],"sources":["scope-overview.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { ComponentCard } from '@teambit/explorer.ui.gallery.component-card';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { ScopeDetails } from '@teambit/scope.ui.scope-details';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { EmptyScope } from '@teambit/scope.ui.empty-scope';\nimport { ComponentModel } from '@teambit/component';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport styles from './scope-overview.module.scss';\nimport type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';\n\nexport type ScopeOverviewProps = {\n badgeSlot: ScopeBadgeSlot;\n overviewSlot: OverviewLineSlot;\n};\n\nexport function ScopeOverview({ badgeSlot, overviewSlot }: ScopeOverviewProps) {\n const scope = useContext(ScopeContext);\n const { components } = scope;\n if (!components || components.length === 0) return <EmptyScope name={scope.name} />;\n\n return (\n <div className={styles.container}>\n <ScopeDetails\n scopeName={scope.name}\n icon={scope.icon}\n backgroundIconColor={scope.backgroundIconColor}\n badgeSlot={badgeSlot}\n overviewSlot={overviewSlot}\n description={scope.description}\n componentCount={scope.components.length}\n />\n <ComponentGrid>\n
|
|
1
|
+
{"version":3,"names":["ScopeOverview","badgeSlot","overviewSlot","TargetOverview","scope","useContext","ScopeContext","components","length","name","styles","container","icon","backgroundIconColor","description","map","component","index","deprecation","isDeprecate","ScopeComponentCard","componentUrl","shouldShowPreview","compositions","id","fullName","environment","version"],"sources":["scope-overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType } from 'react';\nimport { ComponentCard } from '@teambit/explorer.ui.gallery.component-card';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { ScopeDetails } from '@teambit/scope.ui.scope-details';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { EmptyScope } from '@teambit/scope.ui.empty-scope';\nimport { ComponentModel } from '@teambit/component';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport styles from './scope-overview.module.scss';\nimport type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';\n\nexport type ScopeOverviewProps = {\n badgeSlot: ScopeBadgeSlot;\n overviewSlot: OverviewLineSlot;\n TargetOverview?: ComponentType;\n};\n\nexport function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps) {\n const scope = useContext(ScopeContext);\n const { components } = scope;\n if (!components || components.length === 0) return <EmptyScope name={scope.name} />;\n\n return (\n <div className={styles.container}>\n <ScopeDetails\n scopeName={scope.name}\n icon={scope.icon}\n backgroundIconColor={scope.backgroundIconColor}\n badgeSlot={badgeSlot}\n overviewSlot={overviewSlot}\n description={scope.description}\n componentCount={scope.components.length}\n />\n {TargetOverview ? (\n <TargetOverview />\n ) : (\n <ComponentGrid>\n {components.map((component, index) => {\n if (component.deprecation?.isDeprecate) return null;\n return (\n <div key={index}>\n <ScopeComponentCard component={component} />\n </div>\n );\n })}\n </ComponentGrid>\n )}\n </div>\n );\n}\n\ntype ScopeComponentCardProps = {\n component: ComponentModel;\n componentUrl?: string;\n};\n\nexport function ScopeComponentCard({ component, componentUrl }: ScopeComponentCardProps) {\n const shouldShowPreview = component.compositions.length > 0;\n return (\n <ComponentCard\n id={component.id.fullName}\n envIcon={component.environment?.icon}\n description={component.description}\n version={component.version}\n href={componentUrl}\n preview={<PreviewPlaceholder component={component} shouldShowPreview={shouldShowPreview} />}\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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AASO,SAASA,aAAT,CAAuB;EAAEC,SAAF;EAAaC,YAAb;EAA2BC;AAA3B,CAAvB,EAAwF;EAC7F,MAAMC,KAAK,GAAG,IAAAC,mBAAA,EAAWC,4BAAX,CAAd;EACA,MAAM;IAAEC;EAAF,IAAiBH,KAAvB;EACA,IAAI,CAACG,UAAD,IAAeA,UAAU,CAACC,MAAX,KAAsB,CAAzC,EAA4C,oBAAO,+BAAC,sBAAD;IAAY,IAAI,EAAEJ,KAAK,CAACK;EAAx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export declare type ScopeProps = {
|
|
|
12
12
|
overviewLineSlot: OverviewLineSlot;
|
|
13
13
|
cornerSlot: CornerSlot;
|
|
14
14
|
context: ScopeContextType[];
|
|
15
|
+
TargetScopeOverview?: ComponentType;
|
|
15
16
|
userUseScopeQuery?: () => {
|
|
16
17
|
scope: ScopeModel | undefined;
|
|
17
18
|
};
|
|
18
19
|
onSidebarTogglerChange: (callback: () => void) => void;
|
|
19
20
|
TargetCorner?: ComponentType;
|
|
21
|
+
paneClassName?: string;
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
22
24
|
* root component of the scope
|
|
23
25
|
*/
|
|
24
|
-
export declare function Scope({ routeSlot, menuSlot, sidebar, scopeUi, badgeSlot, overviewLineSlot, cornerSlot, context, TargetCorner, onSidebarTogglerChange, userUseScopeQuery, }: ScopeProps): JSX.Element;
|
|
26
|
+
export declare function Scope({ routeSlot, menuSlot, sidebar, scopeUi, badgeSlot, overviewLineSlot, cornerSlot, context, paneClassName, TargetScopeOverview, TargetCorner, onSidebarTogglerChange, userUseScopeQuery, }: ScopeProps): JSX.Element;
|
package/dist/ui/scope.js
CHANGED
|
@@ -177,6 +177,8 @@ function Scope({
|
|
|
177
177
|
overviewLineSlot,
|
|
178
178
|
cornerSlot,
|
|
179
179
|
context = [],
|
|
180
|
+
paneClassName,
|
|
181
|
+
TargetScopeOverview,
|
|
180
182
|
TargetCorner,
|
|
181
183
|
onSidebarTogglerChange,
|
|
182
184
|
userUseScopeQuery
|
|
@@ -228,13 +230,16 @@ function Scope({
|
|
|
228
230
|
,
|
|
229
231
|
onClick: handleSidebarToggle,
|
|
230
232
|
tooltipContent: `${isSidebarOpen ? 'Hide' : 'Show'} side panel`
|
|
231
|
-
})), /*#__PURE__*/_react().default.createElement(_baseUiSurfacesSplitPane().Pane,
|
|
233
|
+
})), /*#__PURE__*/_react().default.createElement(_baseUiSurfacesSplitPane().Pane, {
|
|
234
|
+
className: paneClassName
|
|
235
|
+
}, /*#__PURE__*/_react().default.createElement(_uiFoundationUiReactRouter().SlotRouter, {
|
|
232
236
|
slot: routeSlot
|
|
233
237
|
}, /*#__PURE__*/_react().default.createElement(_reactRouterDom().Route, {
|
|
234
238
|
index: true,
|
|
235
239
|
element: /*#__PURE__*/_react().default.createElement(_scopeOverview().ScopeOverview, {
|
|
236
240
|
badgeSlot: badgeSlot,
|
|
237
|
-
overviewSlot: overviewLineSlot
|
|
241
|
+
overviewSlot: overviewLineSlot,
|
|
242
|
+
TargetOverview: TargetScopeOverview
|
|
238
243
|
})
|
|
239
244
|
})))))));
|
|
240
245
|
}
|
package/dist/ui/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Scope","routeSlot","menuSlot","sidebar","scopeUi","badgeSlot","overviewLineSlot","cornerSlot","context","TargetCorner","onSidebarTogglerChange","userUseScopeQuery","scope","useScopeQuery","isMobile","useIsMobile","isSidebarOpen","handleSidebarToggle","useReducer","x","sidebarOpenness","Layout","row","right","CornerOverride","values","setComponents","components","Context","map","ctx","styles","topbar","name","whiteCorner","main","splitter","e","stopPropagation"],"sources":["scope.tsx"],"sourcesContent":["import 'reset-css';\nimport { SplitPane, Pane, Layout } from '@teambit/base-ui.surfaces.split-pane.split-pane';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Corner } from '@teambit/ui-foundation.ui.corner';\nimport { Collapser } from '@teambit/ui-foundation.ui.buttons.collapser';\nimport { HoverSplitter } from '@teambit/base-ui.surfaces.split-pane.hover-splitter';\nimport { TopBar } from '@teambit/ui-foundation.ui.top-bar';\nimport { Composer, ComponentTuple } from '@teambit/base-ui.utils.composer';\nimport { FullLoader } from '@teambit/ui-foundation.ui.full-loader';\nimport React, { useReducer, ComponentType } from 'react';\nimport { Route } from 'react-router-dom';\nimport { useIsMobile } from '@teambit/ui-foundation.ui.hooks.use-is-mobile';\nimport { ScopeProvider } from '@teambit/scope.ui.hooks.scope-context';\nimport { useScopeQuery } from '@teambit/scope.ui.hooks.use-scope';\nimport { ScopeOverview } from './scope-overview';\nimport styles from './scope.module.scss';\nimport ScopeUI, { ScopeBadgeSlot, ScopeContextType, CornerSlot, OverviewLineSlot } from '../scope.ui.runtime';\nimport { ScopeModel } from '..';\n\nexport type ScopeProps = {\n routeSlot: RouteSlot;\n menuSlot: RouteSlot;\n sidebar: JSX.Element;\n scopeUi: ScopeUI;\n badgeSlot: ScopeBadgeSlot;\n overviewLineSlot: OverviewLineSlot;\n cornerSlot: CornerSlot;\n context: ScopeContextType[];\n userUseScopeQuery?: () => { scope: ScopeModel | undefined };\n onSidebarTogglerChange: (callback: () => void) => void;\n TargetCorner?: ComponentType;\n};\n\n/**\n * root component of the scope\n */\nexport function Scope({\n routeSlot,\n menuSlot,\n sidebar,\n scopeUi,\n badgeSlot,\n overviewLineSlot,\n cornerSlot,\n context = [],\n TargetCorner,\n onSidebarTogglerChange,\n userUseScopeQuery,\n}: ScopeProps) {\n const { scope } = userUseScopeQuery ? userUseScopeQuery() : useScopeQuery();\n const isMobile = useIsMobile();\n const [isSidebarOpen, handleSidebarToggle] = useReducer((x) => !x, !isMobile);\n const sidebarOpenness = isSidebarOpen ? Layout.row : Layout.right;\n if (!scope) {\n return <FullLoader />;\n }\n const CornerOverride = TargetCorner || cornerSlot?.values()[0];\n scopeUi.setComponents(scope.components);\n const Context = context.map((ctx) => [ctx, { scope }] as ComponentTuple);\n\n onSidebarTogglerChange(handleSidebarToggle);\n\n return (\n <ScopeProvider scope={scope}>\n <Composer components={Context}>\n <div className={styles.scope}>\n <TopBar\n className={styles.topbar}\n Corner={() => {\n if (CornerOverride) return <CornerOverride />;\n return <Corner name={scope.name} className={styles.whiteCorner} />;\n }}\n menu={menuSlot}\n />\n\n <SplitPane className={styles.main} size={264} layout={sidebarOpenness}>\n <Pane className={styles.sidebar}>{sidebar}</Pane>\n <HoverSplitter className={styles.splitter}>\n <Collapser\n isOpen={isSidebarOpen}\n onMouseDown={(e) => e.stopPropagation()} // avoid split-pane drag\n onClick={handleSidebarToggle}\n tooltipContent={`${isSidebarOpen ? 'Hide' : 'Show'} side panel`}\n />\n </HoverSplitter>\n <Pane>\n <SlotRouter slot={routeSlot}>\n <Route
|
|
1
|
+
{"version":3,"names":["Scope","routeSlot","menuSlot","sidebar","scopeUi","badgeSlot","overviewLineSlot","cornerSlot","context","paneClassName","TargetScopeOverview","TargetCorner","onSidebarTogglerChange","userUseScopeQuery","scope","useScopeQuery","isMobile","useIsMobile","isSidebarOpen","handleSidebarToggle","useReducer","x","sidebarOpenness","Layout","row","right","CornerOverride","values","setComponents","components","Context","map","ctx","styles","topbar","name","whiteCorner","main","splitter","e","stopPropagation"],"sources":["scope.tsx"],"sourcesContent":["import 'reset-css';\nimport { SplitPane, Pane, Layout } from '@teambit/base-ui.surfaces.split-pane.split-pane';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Corner } from '@teambit/ui-foundation.ui.corner';\nimport { Collapser } from '@teambit/ui-foundation.ui.buttons.collapser';\nimport { HoverSplitter } from '@teambit/base-ui.surfaces.split-pane.hover-splitter';\nimport { TopBar } from '@teambit/ui-foundation.ui.top-bar';\nimport { Composer, ComponentTuple } from '@teambit/base-ui.utils.composer';\nimport { FullLoader } from '@teambit/ui-foundation.ui.full-loader';\nimport React, { useReducer, ComponentType } from 'react';\nimport { Route } from 'react-router-dom';\nimport { useIsMobile } from '@teambit/ui-foundation.ui.hooks.use-is-mobile';\nimport { ScopeProvider } from '@teambit/scope.ui.hooks.scope-context';\nimport { useScopeQuery } from '@teambit/scope.ui.hooks.use-scope';\nimport { ScopeOverview } from './scope-overview';\nimport styles from './scope.module.scss';\nimport ScopeUI, { ScopeBadgeSlot, ScopeContextType, CornerSlot, OverviewLineSlot } from '../scope.ui.runtime';\nimport { ScopeModel } from '..';\n\nexport type ScopeProps = {\n routeSlot: RouteSlot;\n menuSlot: RouteSlot;\n sidebar: JSX.Element;\n scopeUi: ScopeUI;\n badgeSlot: ScopeBadgeSlot;\n overviewLineSlot: OverviewLineSlot;\n cornerSlot: CornerSlot;\n context: ScopeContextType[];\n TargetScopeOverview?: ComponentType;\n userUseScopeQuery?: () => { scope: ScopeModel | undefined };\n onSidebarTogglerChange: (callback: () => void) => void;\n TargetCorner?: ComponentType;\n paneClassName?: string;\n};\n\n/**\n * root component of the scope\n */\nexport function Scope({\n routeSlot,\n menuSlot,\n sidebar,\n scopeUi,\n badgeSlot,\n overviewLineSlot,\n cornerSlot,\n context = [],\n paneClassName,\nTargetScopeOverview,\n TargetCorner,\n onSidebarTogglerChange,\n userUseScopeQuery,\n}: ScopeProps) {\n const { scope } = userUseScopeQuery ? userUseScopeQuery() : useScopeQuery();\n const isMobile = useIsMobile();\n const [isSidebarOpen, handleSidebarToggle] = useReducer((x) => !x, !isMobile);\n const sidebarOpenness = isSidebarOpen ? Layout.row : Layout.right;\n if (!scope) {\n return <FullLoader />;\n }\n const CornerOverride = TargetCorner || cornerSlot?.values()[0];\n scopeUi.setComponents(scope.components);\n const Context = context.map((ctx) => [ctx, { scope }] as ComponentTuple);\n\n onSidebarTogglerChange(handleSidebarToggle);\n\n return (\n <ScopeProvider scope={scope}>\n <Composer components={Context}>\n <div className={styles.scope}>\n <TopBar\n className={styles.topbar}\n Corner={() => {\n if (CornerOverride) return <CornerOverride />;\n return <Corner name={scope.name} className={styles.whiteCorner} />;\n }}\n menu={menuSlot}\n />\n\n <SplitPane className={styles.main} size={264} layout={sidebarOpenness}>\n <Pane className={styles.sidebar}>{sidebar}</Pane>\n <HoverSplitter className={styles.splitter}>\n <Collapser\n isOpen={isSidebarOpen}\n onMouseDown={(e) => e.stopPropagation()} // avoid split-pane drag\n onClick={handleSidebarToggle}\n tooltipContent={`${isSidebarOpen ? 'Hide' : 'Show'} side panel`}\n />\n </HoverSplitter>\n <Pane className={paneClassName}>\n <SlotRouter slot={routeSlot}>\n <Route\n index\n element={\n <ScopeOverview\n badgeSlot={badgeSlot}\n overviewSlot={overviewLineSlot}\n T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IAAe,SAAS,EAAE8B,sBAAA,CAAOK;EAAjC,gBACE,+BAAC,kCAAD;IACE,MAAM,EAAEpB,aADV;IAEE,WAAW,EAAGqB,CAAD,IAAOA,CAAC,CAACC,eAAF,EAFtB,CAE2C;IAF3C;IAGE,OAAO,EAAErB,mBAHX;IAIE,cAAc,EAAG,GAAED,aAAa,GAAG,MAAH,GAAY,MAAO;EAJrD,EADF,CAFF,eAUE,+BAAC,+BAAD;IAAM,SAAS,EAAET;EAAjB,gBACE,+BAAC,uCAAD;IAAY,IAAI,EAAER;EAAlB,gBACE,+BAAC,uBAAD;IACE,KAAK,MADP;IAEE,OAAO,eACL,+BAAC,8BAAD;MACE,SAAS,EAAEI,SADb;MAEE,YAAY,EAAEC,gBAFhB;MAGE,cAAc,EAAEI;IAHlB;EAHJ,EADF,CADF,CAVF,CAVF,CADF,CADF,CADF;AA0CD"}
|
package/exceptions/index.ts
CHANGED
|
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.846",
|
|
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.846"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -16,51 +16,50 @@
|
|
|
16
16
|
"fs-extra": "10.0.0",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"multimatch": "5.0.0",
|
|
19
|
-
"lodash.flatten": "4.4.0",
|
|
20
19
|
"reset-css": "5.0.1",
|
|
21
20
|
"classnames": "2.2.6",
|
|
22
21
|
"@babel/runtime": "7.12.18",
|
|
23
22
|
"core-js": "^3.0.0",
|
|
23
|
+
"@teambit/scope.models.scope-model": "0.0.222",
|
|
24
|
+
"@teambit/scope.ui.hooks.scope-context": "0.0.222",
|
|
25
|
+
"@teambit/cli": "0.0.564",
|
|
26
|
+
"@teambit/component": "0.0.846",
|
|
27
|
+
"@teambit/logger": "0.0.657",
|
|
24
28
|
"@teambit/harmony": "0.3.3",
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
|
|
27
|
-
"@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
|
|
28
|
-
"@teambit/base-ui.utils.composer": "1.0.0",
|
|
29
|
-
"@teambit/scope.models.scope-model": "0.0.220",
|
|
30
|
-
"@teambit/scope.ui.hooks.scope-context": "0.0.220",
|
|
31
|
-
"@teambit/cli": "0.0.562",
|
|
32
|
-
"@teambit/component": "0.0.843",
|
|
33
|
-
"@teambit/logger": "0.0.655",
|
|
34
|
-
"@teambit/aspect-loader": "0.0.843",
|
|
29
|
+
"@teambit/aspect-loader": "0.0.846",
|
|
35
30
|
"@teambit/bit-error": "0.0.400",
|
|
36
|
-
"@teambit/builder": "0.0.
|
|
37
|
-
"@teambit/compiler": "0.0.
|
|
38
|
-
"@teambit/envs": "0.0.
|
|
39
|
-
"@teambit/express": "0.0.
|
|
40
|
-
"@teambit/graphql": "0.0.
|
|
31
|
+
"@teambit/builder": "0.0.846",
|
|
32
|
+
"@teambit/compiler": "0.0.846",
|
|
33
|
+
"@teambit/envs": "0.0.846",
|
|
34
|
+
"@teambit/express": "0.0.662",
|
|
35
|
+
"@teambit/graphql": "0.0.846",
|
|
41
36
|
"@teambit/harmony.modules.requireable-component": "0.0.490",
|
|
42
|
-
"@teambit/isolator": "0.0.
|
|
37
|
+
"@teambit/isolator": "0.0.846",
|
|
43
38
|
"@teambit/legacy-bit-id": "0.0.414",
|
|
44
|
-
"@teambit/ui": "0.0.
|
|
39
|
+
"@teambit/ui": "0.0.846",
|
|
45
40
|
"@teambit/workspace.modules.match-pattern": "0.0.495",
|
|
46
41
|
"@teambit/component-id": "0.0.417",
|
|
47
|
-
"@teambit/component.ui.component-drawer": "0.0.
|
|
42
|
+
"@teambit/component.ui.component-drawer": "0.0.119",
|
|
48
43
|
"@teambit/design.ui.tree": "0.0.12",
|
|
49
|
-
"@teambit/ui-foundation.ui.side-bar": "0.0.
|
|
50
|
-
"@teambit/command-bar": "0.0.
|
|
51
|
-
"@teambit/component-tree": "0.0.
|
|
44
|
+
"@teambit/ui-foundation.ui.side-bar": "0.0.636",
|
|
45
|
+
"@teambit/command-bar": "0.0.846",
|
|
46
|
+
"@teambit/component-tree": "0.0.634",
|
|
52
47
|
"@teambit/component.modules.component-url": "0.0.140",
|
|
53
48
|
"@teambit/component.ui.component-filters.component-filter-context": "0.0.7",
|
|
54
49
|
"@teambit/component.ui.component-filters.deprecate-filter": "0.0.7",
|
|
55
50
|
"@teambit/component.ui.component-filters.env-filter": "0.0.13",
|
|
56
|
-
"@teambit/
|
|
51
|
+
"@teambit/design.ui.surfaces.menu.link-item": "1.0.0",
|
|
52
|
+
"@teambit/sidebar": "0.0.846",
|
|
57
53
|
"@teambit/ui-foundation.ui.main-dropdown": "0.0.493",
|
|
58
54
|
"@teambit/ui-foundation.ui.menu": "0.0.493",
|
|
59
55
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.496",
|
|
60
56
|
"@teambit/ui-foundation.ui.tree.drawer": "0.0.505",
|
|
61
|
-
"@teambit/lane-id": "0.0.
|
|
57
|
+
"@teambit/lane-id": "0.0.83",
|
|
62
58
|
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.494",
|
|
63
|
-
"@teambit/
|
|
59
|
+
"@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
|
|
60
|
+
"@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
|
|
61
|
+
"@teambit/base-ui.utils.composer": "1.0.0",
|
|
62
|
+
"@teambit/scope.ui.hooks.use-scope": "0.0.227",
|
|
64
63
|
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.201",
|
|
65
64
|
"@teambit/ui-foundation.ui.corner": "0.0.504",
|
|
66
65
|
"@teambit/ui-foundation.ui.full-loader": "0.0.492",
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
"@teambit/ui-foundation.ui.top-bar": "0.0.499",
|
|
69
68
|
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.122",
|
|
70
69
|
"@teambit/ui-foundation.ui.use-box.scope-menu": "0.0.122",
|
|
71
|
-
"@teambit/explorer.ui.gallery.component-card": "0.0.
|
|
70
|
+
"@teambit/explorer.ui.gallery.component-card": "0.0.503",
|
|
72
71
|
"@teambit/explorer.ui.gallery.component-grid": "0.0.492",
|
|
73
72
|
"@teambit/preview.ui.preview-placeholder": "0.0.493",
|
|
74
73
|
"@teambit/scope.ui.empty-scope": "0.0.500",
|
|
@@ -79,7 +78,6 @@
|
|
|
79
78
|
"@types/semver": "7.3.4",
|
|
80
79
|
"@types/fs-extra": "9.0.7",
|
|
81
80
|
"@types/lodash": "4.14.165",
|
|
82
|
-
"@types/lodash.flatten": "4.4.6",
|
|
83
81
|
"@types/classnames": "2.2.11",
|
|
84
82
|
"@types/mocha": "9.1.0",
|
|
85
83
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
@@ -90,7 +88,7 @@
|
|
|
90
88
|
},
|
|
91
89
|
"peerDependencies": {
|
|
92
90
|
"react-router-dom": "^6.0.0",
|
|
93
|
-
"@teambit/legacy": "1.0.
|
|
91
|
+
"@teambit/legacy": "1.0.345",
|
|
94
92
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
95
93
|
"react": "^16.8.0 || ^17.0.0"
|
|
96
94
|
},
|
|
@@ -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.846/dist/scope.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@0.0.846/dist/scope.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/scope.ui.runtime.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import flatten from 'lodash.flatten';
|
|
2
1
|
import type { ComponentUI, ComponentModel } from '@teambit/component';
|
|
2
|
+
import { compact, flatten } from 'lodash';
|
|
3
3
|
import { ComponentAspect } from '@teambit/component';
|
|
4
4
|
import { Slot, SlotRegistry } from '@teambit/harmony';
|
|
5
5
|
import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
@@ -123,10 +123,11 @@ export class ScopeUI {
|
|
|
123
123
|
getScope(options: GetScopeOptions) {
|
|
124
124
|
return (
|
|
125
125
|
<Scope
|
|
126
|
+
TargetScopeOverview={options.TargetScopeOverview}
|
|
126
127
|
TargetCorner={options.Corner}
|
|
127
128
|
routeSlot={this.routeSlot}
|
|
128
129
|
menuSlot={this.menuSlot}
|
|
129
|
-
sidebar={<this.sidebar.render
|
|
130
|
+
sidebar={<this.sidebar.render items={this.listSidebarLinks()} />}
|
|
130
131
|
scopeUi={this}
|
|
131
132
|
userUseScopeQuery={options.useScope}
|
|
132
133
|
badgeSlot={this.scopeBadgeSlot}
|
|
@@ -134,6 +135,7 @@ export class ScopeUI {
|
|
|
134
135
|
context={this.getContext()}
|
|
135
136
|
onSidebarTogglerChange={this.setSidebarToggle}
|
|
136
137
|
cornerSlot={this.cornerSlot}
|
|
138
|
+
paneClassName={options.paneClassName}
|
|
137
139
|
/>
|
|
138
140
|
);
|
|
139
141
|
}
|
|
@@ -308,7 +310,7 @@ export class ScopeUI {
|
|
|
308
310
|
<Scope
|
|
309
311
|
routeSlot={this.routeSlot}
|
|
310
312
|
menuSlot={this.menuSlot}
|
|
311
|
-
sidebar={<this.sidebar.render
|
|
313
|
+
sidebar={<this.sidebar.render items={this.listSidebarLinks()} />}
|
|
312
314
|
scopeUi={this}
|
|
313
315
|
badgeSlot={this.scopeBadgeSlot}
|
|
314
316
|
overviewLineSlot={this.overviewSlot}
|
|
@@ -322,6 +324,19 @@ export class ScopeUI {
|
|
|
322
324
|
};
|
|
323
325
|
}
|
|
324
326
|
|
|
327
|
+
listSidebarLinks() {
|
|
328
|
+
const links = flatten(this.sidebarItemSlot.values());
|
|
329
|
+
const sorted = links.sort((a, b) => {
|
|
330
|
+
const aWeight = a?.weight || 0;
|
|
331
|
+
const bWeight = b?.weight || 0;
|
|
332
|
+
return aWeight - bWeight;
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return compact(sorted.map((link) => {
|
|
336
|
+
return link.component;
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
|
|
325
340
|
/** registers available components */
|
|
326
341
|
setComponents = (components: ComponentModel[]) => {
|
|
327
342
|
this.componentUi.updateComponents(components);
|
|
@@ -421,11 +436,15 @@ export class ScopeUI {
|
|
|
421
436
|
scopeUi.registerMenuItem(scopeUi.menuItems);
|
|
422
437
|
scopeUi.registerMenuWidget(() => <ScopeUseBox />);
|
|
423
438
|
if (config.showGallery)
|
|
424
|
-
scopeUi.registerSidebarLink(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
439
|
+
scopeUi.registerSidebarLink({
|
|
440
|
+
component: function Gallery() {
|
|
441
|
+
return (
|
|
442
|
+
<MenuLinkItem exact href="/" icon="comps">
|
|
443
|
+
Gallery
|
|
444
|
+
</MenuLinkItem>
|
|
445
|
+
);
|
|
446
|
+
},
|
|
447
|
+
});
|
|
429
448
|
if (ui) scopeUi.registerExplicitRoutes();
|
|
430
449
|
|
|
431
450
|
return scopeUi;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, ComponentType } from 'react';
|
|
2
2
|
import { ComponentCard } from '@teambit/explorer.ui.gallery.component-card';
|
|
3
3
|
import { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';
|
|
4
4
|
import { ScopeDetails } from '@teambit/scope.ui.scope-details';
|
|
@@ -12,9 +12,10 @@ import type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';
|
|
|
12
12
|
export type ScopeOverviewProps = {
|
|
13
13
|
badgeSlot: ScopeBadgeSlot;
|
|
14
14
|
overviewSlot: OverviewLineSlot;
|
|
15
|
+
TargetOverview?: ComponentType;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export function ScopeOverview({ badgeSlot, overviewSlot }: ScopeOverviewProps) {
|
|
18
|
+
export function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps) {
|
|
18
19
|
const scope = useContext(ScopeContext);
|
|
19
20
|
const { components } = scope;
|
|
20
21
|
if (!components || components.length === 0) return <EmptyScope name={scope.name} />;
|
|
@@ -30,16 +31,20 @@ export function ScopeOverview({ badgeSlot, overviewSlot }: ScopeOverviewProps) {
|
|
|
30
31
|
description={scope.description}
|
|
31
32
|
componentCount={scope.components.length}
|
|
32
33
|
/>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
{TargetOverview ? (
|
|
35
|
+
<TargetOverview />
|
|
36
|
+
) : (
|
|
37
|
+
<ComponentGrid>
|
|
38
|
+
{components.map((component, index) => {
|
|
39
|
+
if (component.deprecation?.isDeprecate) return null;
|
|
40
|
+
return (
|
|
41
|
+
<div key={index}>
|
|
42
|
+
<ScopeComponentCard component={component} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</ComponentGrid>
|
|
47
|
+
)}
|
|
43
48
|
</div>
|
|
44
49
|
);
|
|
45
50
|
}
|
package/ui/scope.tsx
CHANGED
|
@@ -26,9 +26,11 @@ export type ScopeProps = {
|
|
|
26
26
|
overviewLineSlot: OverviewLineSlot;
|
|
27
27
|
cornerSlot: CornerSlot;
|
|
28
28
|
context: ScopeContextType[];
|
|
29
|
+
TargetScopeOverview?: ComponentType;
|
|
29
30
|
userUseScopeQuery?: () => { scope: ScopeModel | undefined };
|
|
30
31
|
onSidebarTogglerChange: (callback: () => void) => void;
|
|
31
32
|
TargetCorner?: ComponentType;
|
|
33
|
+
paneClassName?: string;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
/**
|
|
@@ -43,6 +45,8 @@ export function Scope({
|
|
|
43
45
|
overviewLineSlot,
|
|
44
46
|
cornerSlot,
|
|
45
47
|
context = [],
|
|
48
|
+
paneClassName,
|
|
49
|
+
TargetScopeOverview,
|
|
46
50
|
TargetCorner,
|
|
47
51
|
onSidebarTogglerChange,
|
|
48
52
|
userUseScopeQuery,
|
|
@@ -83,9 +87,18 @@ export function Scope({
|
|
|
83
87
|
tooltipContent={`${isSidebarOpen ? 'Hide' : 'Show'} side panel`}
|
|
84
88
|
/>
|
|
85
89
|
</HoverSplitter>
|
|
86
|
-
<Pane>
|
|
90
|
+
<Pane className={paneClassName}>
|
|
87
91
|
<SlotRouter slot={routeSlot}>
|
|
88
|
-
<Route
|
|
92
|
+
<Route
|
|
93
|
+
index
|
|
94
|
+
element={
|
|
95
|
+
<ScopeOverview
|
|
96
|
+
badgeSlot={badgeSlot}
|
|
97
|
+
overviewSlot={overviewLineSlot}
|
|
98
|
+
TargetOverview={TargetScopeOverview}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
101
|
+
/>
|
|
89
102
|
</SlotRouter>
|
|
90
103
|
</Pane>
|
|
91
104
|
</SplitPane>
|
|
Binary file
|