File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
packages/ui/src/lib/internal Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 5959 }
6060 }
6161 };
62+
63+ const groupedCommands = $derived (
64+ commandPaletteManager .results .reduce (
65+ (acc , { provider : { name = ' unnamed' }, items }) => {
66+ if (acc [name ]) {
67+ acc [name ].push (... items );
68+ } else {
69+ acc [name ] = items ;
70+ }
71+ return acc ;
72+ },
73+ {} as Record <string , Array <ActionItem & { id: string }>>,
74+ ),
75+ );
6276 </script >
6377
6478<svelte:window
97111 <Text >{t (' command_palette_prompt_default' , translations )}</Text >
98112 {/if }
99113
100- {#each commandPaletteManager . results as result , groupIndex ( result . provider . name ?? groupIndex )}
101- {#if result . provider . name }
102- <Heading size ="tiny" class ="pt-2" >{result . provider . name }</Heading >
114+ {#each Object . entries ( groupedCommands ) as [name, items] ( name )}
115+ {#if name !== ' unnamed ' }
116+ <Heading size ="tiny" class ="pt-2" >{name }</Heading >
103117 {/if }
104118 {#if commandPaletteManager .results .length > 0 }
105119 <div class =" flex flex-col" >
106- {#each result . items as item (item .id )}
120+ {#each items as item (item .id )}
107121 <CommandPaletteItem
108122 {item }
109123 selected ={commandPaletteManager .isSelected (item )}
You can’t perform that action at this time.
0 commit comments