1- import { BoxRenderable , TextareaRenderable , MouseEvent , PasteEvent , decodePasteBytes } from "@opentui/core"
2- import { createEffect , createMemo , onMount , createSignal , onCleanup , on , Show , Switch , Match } from "solid-js"
1+ import { BoxRenderable , RGBA , TextareaRenderable , MouseEvent , PasteEvent , decodePasteBytes } from "@opentui/core"
2+ import {
3+ createEffect ,
4+ createMemo ,
5+ onMount ,
6+ createSignal ,
7+ onCleanup ,
8+ on ,
9+ Show ,
10+ Switch ,
11+ Match ,
12+ } from "solid-js"
313import "opentui-spinner/solid"
414import path from "path"
515import { fileURLToPath } from "url"
@@ -35,6 +45,7 @@ import { DialogProvider as DialogProviderConnect } from "../dialog-provider"
3545import { DialogAlert } from "../../ui/dialog-alert"
3646import { useToast } from "../../ui/toast"
3747import { useKV } from "../../context/kv"
48+ import { createFadeIn } from "../../util/signal"
3849import { useTextareaKeybindings } from "../textarea-keybindings"
3950import { DialogSkill } from "../dialog-skill"
4051import { useArgs } from "@tui/context/args"
@@ -75,6 +86,10 @@ function randomIndex(count: number) {
7586 return Math . floor ( Math . random ( ) * count )
7687}
7788
89+ function fadeColor ( color : RGBA , alpha : number ) {
90+ return RGBA . fromValues ( color . r , color . g , color . b , color . a * alpha )
91+ }
92+
7893let stashed : { prompt : PromptInfo ; cursor : number } | undefined
7994
8095export function Prompt ( props : PromptProps ) {
@@ -97,6 +112,7 @@ export function Prompt(props: PromptProps) {
97112 const renderer = useRenderer ( )
98113 const { theme, syntax } = useTheme ( )
99114 const kv = useKV ( )
115+ const animationsEnabled = createMemo ( ( ) => kv . get ( "animations_enabled" , true ) )
100116 const list = createMemo ( ( ) => props . placeholders ?. normal ?? [ ] )
101117 const shell = createMemo ( ( ) => props . placeholders ?. shell ?? [ ] )
102118 const [ auto , setAuto ] = createSignal < AutocompleteRef > ( )
@@ -858,6 +874,13 @@ export function Prompt(props: PromptProps) {
858874 return ! ! current
859875 } )
860876
877+ const agentMetaAlpha = createFadeIn ( ( ) => ! ! local . agent . current ( ) , animationsEnabled )
878+ const modelMetaAlpha = createFadeIn ( ( ) => ! ! local . agent . current ( ) && store . mode === "normal" , animationsEnabled )
879+ const variantMetaAlpha = createFadeIn (
880+ ( ) => ! ! local . agent . current ( ) && store . mode === "normal" && showVariant ( ) ,
881+ animationsEnabled ,
882+ )
883+
861884 const placeholderText = createMemo ( ( ) => {
862885 if ( props . showPlaceholder === false ) return undefined
863886 if ( store . mode === "shell" ) {
@@ -1133,17 +1156,24 @@ export function Prompt(props: PromptProps) {
11331156 < Show when = { local . agent . current ( ) } fallback = { < box height = { 1 } /> } >
11341157 { ( agent ) => (
11351158 < >
1136- < text fg = { highlight ( ) } > { store . mode === "shell" ? "Shell" : Locale . titlecase ( agent ( ) . name ) } </ text >
1159+ < text fg = { fadeColor ( highlight ( ) , agentMetaAlpha ( ) ) } >
1160+ { store . mode === "shell" ? "Shell" : Locale . titlecase ( agent ( ) . name ) } { " " }
1161+ </ text >
11371162 < Show when = { store . mode === "normal" } >
11381163 < box flexDirection = "row" gap = { 1 } >
1139- < text flexShrink = { 0 } fg = { keybind . leader ? theme . textMuted : theme . text } >
1164+ < text
1165+ flexShrink = { 0 }
1166+ fg = { fadeColor ( keybind . leader ? theme . textMuted : theme . text , modelMetaAlpha ( ) ) }
1167+ >
11401168 { local . model . parsed ( ) . model }
11411169 </ text >
1142- < text fg = { theme . textMuted } > { currentProviderLabel ( ) } </ text >
1170+ < text fg = { fadeColor ( theme . textMuted , modelMetaAlpha ( ) ) } > { currentProviderLabel ( ) } </ text >
11431171 < Show when = { showVariant ( ) } >
1144- < text fg = { theme . textMuted } > ·</ text >
1172+ < text fg = { fadeColor ( theme . textMuted , variantMetaAlpha ( ) ) } > ·</ text >
11451173 < text >
1146- < span style = { { fg : theme . warning , bold : true } } > { local . model . variant . current ( ) } </ span >
1174+ < span style = { { fg : fadeColor ( theme . warning , variantMetaAlpha ( ) ) , bold : true } } >
1175+ { local . model . variant . current ( ) }
1176+ </ span >
11471177 </ text >
11481178 </ Show >
11491179 </ box >
0 commit comments