UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

2 lines (1 loc) 921 B
import{indexMenuGroupingConfig as l}from"./config/index.js";import{validateMenuConfig as m}from"./config/validate-menu-config.js";import{groupAndIndexSchema as d}from"./grouping/index.js";import{groupsToSidebarItems as I}from"./grouping/groups-to-sidebar-items.js";import{orderMenuGroups as f}from"./order-menu-groups.js";class y{groups;typeGroupIndex;sidebarItems;overviewLabel;constructor(e,o){const{menu:r,baseUrlPath:i="/",showBuiltInScalars:s=!1,showBuiltInDirectives:n=!1,info:u}=o||{},p="item";m(e,r);const t=l(r),{groups:a,typeGroupIndex:g}=d(e,t,s,n);this.groups=f(a,t),this.sidebarItems=I(this.groups,p,i,e),this.typeGroupIndex=g,this.overviewLabel=u?.title??"Overview"}getGroups(){return this.groups}getGroupIdByTypeName(e){return this.typeGroupIndex.get(e)}getSidebarItems(){return[{type:"link",label:this.overviewLabel,link:"/",slug:"/",routeSlug:"/",items:[]},...this.sidebarItems]}}export{y as MenuStore};