@@ -71,24 +71,20 @@ export function registerCommands(getter: MaybeRefOrGetter<CommandItem[]>) {
7171
7272let _nuxtDocsCommands : CommandItem [ ] | undefined
7373
74- const docsIcons = [
75- [ ':components:' , 'i-carbon-assembly-cluster' ] ,
76- [ ':modules:' , 'i-carbon-cube' ] ,
77- [ ':commands:' , 'i-carbon-terminal' ] ,
78- [ ':directory-structure:' , 'i-carbon-folder' ] ,
79- [ ':composables:' , 'i-carbon-function' ] ,
80- [ ':getting-started:' , 'i-carbon-idea' ] ,
81- [ ':api:' , 'carbon-api-1' ] ,
82- ]
83-
8474export async function getNuxtDocsCommands ( ) {
8575 if ( ! _nuxtDocsCommands ) {
86- const list = await import ( '../data/nuxt-docs.json' ) . then ( i => i . default )
76+ const list = await $fetch < any [ ] > ( 'https://nuxt.com/api/search.json' , {
77+ query : {
78+ select : '_path,title,description,navigation' ,
79+ } ,
80+ } )
8781 _nuxtDocsCommands = list . map ( i => ( {
88- ...i ,
89- icon : docsIcons . find ( ( [ k ] ) => i . id . includes ( k ) ) ?. [ 1 ] || 'i-carbon-document-multiple-01' ,
82+ id : i . _path ,
83+ title : i . title ,
84+ description : i . description ,
85+ icon : i . navigation ?. icon ?? 'i-carbon-document-multiple-01' ,
9086 action : ( ) => {
91- window . open ( i . url , '_blank' )
87+ window . open ( `https://nuxt.com/ ${ i . _path } ` , '_blank' )
9288 } ,
9389 } ) )
9490 }
0 commit comments