Skip to content

Commit 4b7d722

Browse files
committed
fix(core): improve docks sorting
1 parent 2d8855d commit 4b7d722

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

packages/core/src/client/webcomponents/components/DockEntriesWithCategories.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const groups = computed(() => {
6262
left = 0
6363
}
6464
else {
65-
left -= entries.length
65+
left -= items.length
6666
visible.push([category, items])
6767
}
6868
}
@@ -88,6 +88,6 @@ const groups = computed(() => {
8888
:selected="selected"
8989
@select="(e) => emit('select', e)"
9090
/>
91-
<slot v-if="groups.overflow.length > 0" name="overflow" :entries="groups.overflow" />
9291
</template>
92+
<slot v-if="groups.overflow.length > 0" name="overflow" :entries="groups.overflow" />
9393
</template>

packages/core/src/client/webcomponents/constants.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ export const BUILTIN_ENTRIES: readonly DevToolsViewBuiltin[] = Object.freeze([
1212
])
1313

1414
export const DEFAULT_CATEGORIES_ORDER: Record<string, number> = {
15-
default: 0,
16-
app: 100,
17-
framework: 200,
18-
web: 300,
19-
advanced: 400,
20-
builtin: 500,
15+
'~viteplus': -1000,
16+
'default': 0,
17+
'app': 100,
18+
'framework': 200,
19+
'web': 300,
20+
'advanced': 400,
21+
'~builtin': 1000,
2122
} satisfies Record<DevToolsDockEntryCategory, number>

packages/core/src/node/host-docks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class DevToolsDockHost implements DevToolsDockHostType {
2222
id: '~terminals',
2323
title: 'Terminals',
2424
icon: 'ph:terminal-duotone',
25-
category: 'builtin',
25+
category: '~builtin',
2626
get isHidden() {
2727
return context.terminals.sessions.size === 0
2828
},
@@ -32,14 +32,14 @@ export class DevToolsDockHost implements DevToolsDockHostType {
3232
id: '~logs',
3333
title: 'Logs',
3434
icon: 'ph:notification-duotone',
35-
category: 'builtin',
35+
category: '~builtin',
3636
isHidden: true, // TODO: implement logs
3737
},
3838
{
3939
type: '~builtin',
4040
id: '~settings',
4141
title: 'Settings',
42-
category: 'builtin',
42+
category: '~builtin',
4343
icon: 'ph:gear-duotone',
4444
},
4545
]

packages/kit/src/types/docks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface DevToolsDockHost {
1414
}
1515

1616
// TODO: refine categories more clearly
17-
export type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | 'builtin'
17+
export type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~viteplus' | '~builtin'
1818

1919
export type DevToolsDockEntryIcon = string | { light: string, dark: string }
2020

packages/vite/src/node/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function DevToolsViteUI(): PluginWithDevTools {
1919
ctx.docks.register({
2020
id: 'vite',
2121
title: 'Vite',
22+
category: '~viteplus',
2223
icon: 'https://vite.dev/logo.svg',
2324
type: 'iframe',
2425
url: '/.devtools-vite/',

0 commit comments

Comments
 (0)