mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
新增经典、悬浮和侧栏布局,保存用户偏好,并调整工具栏、状态摘要及窄屏交互。 统一控制台弹层外观、焦点行为和中英文文案。 根据虚拟磁盘文件访问能力显示浏览入口、容量信息和不可用状态。 验证:npm run build 通过(vue-tsc 类型检查和 Vite 生产构建)。
23 lines
892 B
TypeScript
23 lines
892 B
TypeScript
import { inject, provide, type InjectionKey, type Ref } from 'vue'
|
|
import type { ConsoleLayout } from '@/composables/useConsoleLayout'
|
|
|
|
// Injection follows component ownership through portals, without styling settings/login.
|
|
const consoleAppearanceKey: InjectionKey<Readonly<Ref<ConsoleLayout>>> = Symbol('consoleAppearance')
|
|
|
|
export function provideConsoleAppearance(layout: Readonly<Ref<ConsoleLayout>>) {
|
|
provide(consoleAppearanceKey, layout)
|
|
}
|
|
|
|
export function useConsoleAppearance() {
|
|
return inject(consoleAppearanceKey, undefined)
|
|
}
|
|
|
|
// Focus the panel itself so the first help tooltip does not obscure its controls on open.
|
|
// Keyboard users can then Tab into the panel's controls in their normal order.
|
|
export function focusConsolePanel(event: Event) {
|
|
if (event.target instanceof HTMLElement) {
|
|
event.preventDefault()
|
|
event.target.focus({ preventScroll: true })
|
|
}
|
|
}
|