@@ -85,21 +85,49 @@ const mcpBadgeActiveClass = computed(() =>
8585 isMcpConnected .value ? (selfActive .value ? ' tp-mcp-badge-active' : ' tp-mcp-badge-inactive' ) : null
8686)
8787
88- const showHint = ref (true )
88+ const lowVisibility = ref (false )
8989const initialLock = ref (true )
9090const { idle } = useIdle (HINT_IDLE_MS , {
9191 initialState: true
9292})
9393
94- watch (idle , (isIdle ) => {
95- showHint .value = isIdle || initialLock .value
96- })
94+ function getOverlapWidth(a : DOMRect , b : DOMRect ) {
95+ return Math .max (0 , Math .min (a .right , b .right ) - Math .max (a .left , b .left ))
96+ }
97+
98+ function updateHintOverlap() {
99+ if (! layoutReady .value ) {
100+ lowVisibility .value = false
101+ return
102+ }
103+
104+ const canvas = getCanvas ()
105+ const panel = document .querySelector (' .tp-panel.tp-main' ) as HTMLElement | null
106+ if (! canvas || ! panel ) {
107+ lowVisibility .value = false
108+ return
109+ }
110+
111+ const panelRect = panel .getBoundingClientRect ()
112+ const canvasRect = canvas .getBoundingClientRect ()
113+ const overlapWidth = getOverlapWidth (panelRect , canvasRect )
114+
115+ if (panelRect .width <= 0 ) {
116+ lowVisibility .value = false
117+ return
118+ }
119+
120+ lowVisibility .value = overlapWidth < panelRect .width / 3
121+ }
122+
123+ useIntervalFn (updateHintOverlap , LAYOUT_CHECK_INTERVAL , { immediate: true })
97124
98125useTimeoutFn (() => {
99126 initialLock .value = false
100- showHint .value = idle .value
101127}, 3000 )
102128
129+ const showHint = computed (() => (idle .value || initialLock .value ) && lowVisibility .value )
130+
103131watch (layoutReady , (ready ) => {
104132 if (ready ) {
105133 syncSelection ()
@@ -176,7 +204,7 @@ function activateMcp() {
176204}
177205
178206.tp-main-hint {
179- animation : tp-main-hint-pulse 2 s cubic-bezier (0.87 , 0 , 0.13 , 1 ) infinite ;
207+ animation : tp-main-hint-pulse 10 s cubic-bezier (0.87 , 0 , 0.13 , 1 ) infinite ;
180208}
181209
182210.tp-main.tp-panel-dragging ,
@@ -220,8 +248,38 @@ function activateMcp() {
220248}
221249
222250@keyframes tp-main-hint-pulse {
251+ 0% ,
252+ 20% ,
253+ 40% ,
254+ 60% ,
255+ 80% ,
256+ 100% {
257+ box-shadow : var (--elevation-100 );
258+ }
259+ 10% {
260+ box-shadow :
261+ var (--elevation-100 ),
262+ 0 0 0 2px #f24e1e ;
263+ }
264+ 30% {
265+ box-shadow :
266+ var (--elevation-100 ),
267+ 0 0 0 2px #ff7262 ;
268+ }
223269 50% {
224- box-shadow : 0 0 0 2px color-mix(in srgb , var (--color-text ) 40% , var (--color-bg ) 20% );
270+ box-shadow :
271+ var (--elevation-100 ),
272+ 0 0 0 2px #a259ff ;
273+ }
274+ 70% {
275+ box-shadow :
276+ var (--elevation-100 ),
277+ 0 0 0 2px #1abcfe ;
278+ }
279+ 90% {
280+ box-shadow :
281+ var (--elevation-100 ),
282+ 0 0 0 2px #0acf83 ;
225283 }
226284}
227285
0 commit comments