diff --git a/packages/core/playground/vite.config.ts b/packages/core/playground/vite.config.ts index 1d4e6c4e..54bd570c 100644 --- a/packages/core/playground/vite.config.ts +++ b/packages/core/playground/vite.config.ts @@ -13,6 +13,7 @@ import { A11yCheckerPlugin } from '../../../examples/plugin-a11y-checker/src/nod import { GitUIPlugin } from '../../../examples/plugin-git-ui/src/node' import { DevTools } from '../../core/src' import { buildCSS } from '../../core/src/client/webcomponents/scripts/build-css' +import { hideDockWhenEmpty } from '../../core/src/node/plugins/auto-hide' // eslint-disable-next-line ts/ban-ts-comment // @ts-ignore ignore the type error import { DevToolsRolldownUI } from '../../rolldown/src/node' @@ -35,12 +36,27 @@ export default defineConfig({ plugins: [ VueRouter(), Vue(), - createPluginFromDevframe(createTerminalsDevframe(), { - dock: { category: '~builtin' }, - }), - createPluginFromDevframe(createMessagesDevframe(), { - dock: { category: '~builtin' }, - }), + ...(() => { + // Mirror the shipped `DevTools()` mounts (the playground runs with + // `builtinDevTools: false`, so it re-creates them by hand): terminals + // and messages auto-hide from the dock bar while empty. + const terminalsDevframe = createTerminalsDevframe() + const messagesDevframe = createMessagesDevframe() + return [ + createPluginFromDevframe(terminalsDevframe, { + dock: { category: '~builtin' }, + setup(ctx) { + hideDockWhenEmpty(ctx, terminalsDevframe.id, () => ctx.terminals.sessions.size === 0) + }, + }), + createPluginFromDevframe(messagesDevframe, { + dock: { category: '~builtin' }, + setup(ctx) { + hideDockWhenEmpty(ctx, messagesDevframe.id, () => ctx.messages.entries.size === 0) + }, + }), + ] + })(), createPluginFromDevframe(createInspectDevframe(), { dock: { category: '~builtin', icon: 'ph:stethoscope-duotone' }, }), diff --git a/packages/core/src/client/webcomponents/components/views-builtin/SettingsAdvanced.vue b/packages/core/src/client/webcomponents/components/views-builtin/SettingsAdvanced.vue index 6c1be72c..5f661b33 100644 --- a/packages/core/src/client/webcomponents/components/views-builtin/SettingsAdvanced.vue +++ b/packages/core/src/client/webcomponents/components/views-builtin/SettingsAdvanced.vue @@ -4,12 +4,14 @@ import type { SharedState } from 'devframe/utils/shared-state' import type { DevToolsDocksUserSettings } from '../../state/dock-settings' import { DEFAULT_STATE_USER_SETTINGS } from '@vitejs/devtools-kit/constants' import { useConfirm } from '../../state/confirm' +import { sharedStateToRef } from '../../state/docks' const props = defineProps<{ context: DocksContext settingsStore: SharedState }>() +const settings = sharedStateToRef(props.settingsStore) const confirm = useConfirm() async function resetAllSettings() { @@ -64,6 +66,26 @@ async function deauthorize() {