@@ -71,24 +71,20 @@ export function registerCommands(getter: MaybeRefOrGetter<CommandItem[]>) {
71
71
72
72
let _nuxtDocsCommands : CommandItem [ ] | undefined
73
73
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
-
84
74
export async function getNuxtDocsCommands ( ) {
85
75
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
+ } )
87
81
_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' ,
90
86
action : ( ) => {
91
- window . open ( i . url , '_blank' )
87
+ window . open ( `https://nuxt.com/ ${ i . _path } ` , '_blank' )
92
88
} ,
93
89
} ) )
94
90
}
0 commit comments