代理修改
This commit is contained in:
@@ -24,6 +24,7 @@ defineProps<{
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
key="empty"
|
||||
class="h-full w-full flex items-center justify-center text-muted-foreground"
|
||||
>
|
||||
<p>未找到模块</p>
|
||||
|
||||
@@ -65,10 +65,43 @@ const maximize = async () => {
|
||||
await tauriWindow?.toggleMaximize()
|
||||
}
|
||||
|
||||
// hover 抑制标志:窗口隐藏时设为 true,重新显示后短暂保持 true 再恢复
|
||||
// 期间用 CSS 覆盖 :hover 样式,避免按钮残留高亮(webview 隐藏时 mouseleave 不触发)
|
||||
const hoverSuppressed = ref(true)
|
||||
|
||||
const close = async () => {
|
||||
// 隐藏前立即抑制 hover,避免冻结的 :hover 状态残留到下次显示
|
||||
hoverSuppressed.value = true
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur()
|
||||
}
|
||||
await tauriWindow?.hide()
|
||||
}
|
||||
|
||||
// 窗口重新获得焦点时,先保持抑制(防止冻结的 hover 显示),
|
||||
// 短暂延迟后恢复 hover(让真实鼠标位置重新接管)
|
||||
if (tauriWindow) {
|
||||
tauriWindow.onFocusChanged(({ payload: focused }) => {
|
||||
if (focused) {
|
||||
hoverSuppressed.value = true
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur()
|
||||
}
|
||||
// 100ms 后恢复 hover,足够让浏览器重置伪类状态
|
||||
setTimeout(() => {
|
||||
hoverSuppressed.value = false
|
||||
}, 100)
|
||||
} else {
|
||||
hoverSuppressed.value = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 初始时窗口已显示,恢复 hover
|
||||
setTimeout(() => {
|
||||
hoverSuppressed.value = false
|
||||
}, 200)
|
||||
|
||||
const handleBlur = () => {
|
||||
setTimeout(() => {
|
||||
isSearchFocused.value = false
|
||||
@@ -147,22 +180,22 @@ const handleBlur = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center pointer-events-auto">
|
||||
<button
|
||||
<div class="flex items-center pointer-events-auto" :class="{ 'hover-suppressed': hoverSuppressed }">
|
||||
<button
|
||||
class="h-10 w-10 flex items-center justify-center hover:bg-secondary/50 transition-colors rounded-sm"
|
||||
@click="minimize"
|
||||
@mousedown.stop
|
||||
>
|
||||
<Minus class="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
class="h-10 w-10 flex items-center justify-center hover:bg-secondary/50 transition-colors rounded-sm"
|
||||
@click="maximize"
|
||||
@mousedown.stop
|
||||
>
|
||||
<Square class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
class="h-10 w-10 flex items-center justify-center hover:bg-destructive/20 transition-colors rounded-sm text-destructive"
|
||||
@click="close"
|
||||
@mousedown.stop
|
||||
@@ -171,4 +204,11 @@ const handleBlur = () => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 窗口隐藏/重新显示瞬间,抑制按钮 hover 样式,避免冻结的 :hover 残留 */
|
||||
.hover-suppressed button:hover {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import type { ProgressRootProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
ProgressIndicator,
|
||||
ProgressRoot,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<ProgressRootProps & { class?: HTMLAttributes["class"] }>(),
|
||||
{
|
||||
modelValue: 0,
|
||||
},
|
||||
)
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProgressRoot
|
||||
data-slot="progress"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<ProgressIndicator
|
||||
data-slot="progress-indicator"
|
||||
class="bg-primary h-full w-full flex-1 transition-all"
|
||||
:style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`"
|
||||
/>
|
||||
</ProgressRoot>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as Progress } from "./Progress.vue"
|
||||
Reference in New Issue
Block a user