11<script setup lang="ts">
22import { defineInvoke } from ' @moeru/eventa'
3- import { useBroadcastChannel } from ' @vueuse/core'
4- import { onMounted , ref , watch } from ' vue'
3+ import { refDebounced , useBroadcastChannel } from ' @vueuse/core'
4+ import { computed , onMounted , ref , watch } from ' vue'
55
66import { captionGetIsFollowingWindow , captionIsFollowingWindowChanged } from ' ../../shared/eventa'
7- import { useElectronEventaContext } from ' ../composables/electron-vueuse'
7+ import { useElectronEventaContext , useElectronMouseAroundWindowBorder , useElectronMouseInWindow } from ' ../composables/electron-vueuse'
88
99const attached = ref (true )
1010const speakerText = ref (' ' )
1111const assistantText = ref (' ' )
12+ const { isOutside : isOutsideWindow } = useElectronMouseInWindow ()
13+ const isOutsideWindowFor250Ms = refDebounced (isOutsideWindow , 250 )
14+ const shouldFadeOnCursorWithin = computed (() => ! isOutsideWindowFor250Ms .value )
15+ const { isNearAnyBorder : isAroundWindowBorder } = useElectronMouseAroundWindowBorder ({ threshold: 30 })
16+ const isAroundWindowBorderFor250Ms = refDebounced (isAroundWindowBorder , 250 )
1217
1318// Broadcast channel for captions
1419type CaptionChannelEvent
@@ -51,8 +56,14 @@ onMounted(async () => {
5156 </script >
5257
5358<template >
54- <div class =" pointer-events-none h-full w-full flex items-end justify-center" >
55- <div class =" pointer-events-auto relative select-none rounded-xl px-3 py-2" >
59+ <div class =" pointer-events-none relative h-full w-full flex items-end justify-center" >
60+ <div
61+ :class =" [
62+ shouldFadeOnCursorWithin ? 'op-0' : 'op-100',
63+ 'pointer-events-auto relative select-none rounded-xl px-3 py-2',
64+ 'transition-opacity duration-250 ease-in-out',
65+ ]"
66+ >
5667 <div
5768 v-show =" !attached"
5869 class =" [-webkit-app-region:drag] absolute left-1/2 h-[14px] w-[36px] border border-[rgba(125,125,125,0.35)] rounded-[10px] bg-[rgba(125,125,125,0.28)] backdrop-blur-[6px] -top-2 -translate-x-1/2"
@@ -77,6 +88,24 @@ onMounted(async () => {
7788 </div >
7889 </div >
7990 </div >
91+
92+ <Transition
93+ enter-active-class =" transition-opacity duration-250 ease-in-out"
94+ enter-from-class =" opacity-50"
95+ enter-to-class =" opacity-100"
96+ leave-active-class =" transition-opacity duration-250 ease-in-out"
97+ leave-from-class =" opacity-100"
98+ leave-to-class =" opacity-50"
99+ >
100+ <div v-if =" isAroundWindowBorderFor250Ms" class =" pointer-events-none absolute left-0 top-0 z-999 h-full w-full" >
101+ <div
102+ :class =" [
103+ 'b-primary/50',
104+ 'h-full w-full animate-flash animate-duration-3s animate-count-infinite b-4 rounded-2xl',
105+ ]"
106+ />
107+ </div >
108+ </Transition >
80109 </div >
81110</template >
82111
0 commit comments