@@ -18,6 +18,7 @@ import type { DuoyunOptionsElement, Option } from 'duoyun-ui/elements/options';
1818import { createPath } from 'duoyun-ui/elements/route' ;
1919import { getDisplayKey , hotkeys , isMac } from 'duoyun-ui/lib/hotkeys' ;
2020import { locale } from 'duoyun-ui/lib/locale' ;
21+ import { debounce } from 'duoyun-ui/lib/timer' ;
2122import { isNotNullish } from 'duoyun-ui/lib/types' ;
2223import { isIncludesString } from 'duoyun-ui/lib/utils' ;
2324import { configure , getShortcut , SearchCommand , setSearchCommand , toggleSearchState } from 'src/configure' ;
@@ -36,8 +37,7 @@ import 'duoyun-ui/elements/list';
3637import 'duoyun-ui/elements/options' ;
3738import 'duoyun-ui/elements/paragraph' ;
3839import 'duoyun-ui/elements/space' ;
39-
40- import { debounce } from 'duoyun-ui/lib/timer' ;
40+ import 'src/modules/sse' ;
4141
4242const style = css `
4343 :scope {
@@ -224,7 +224,7 @@ export class MSearchElement extends GemElement {
224224 } ;
225225
226226 #genHelpOptions = ( ) : Option [ ] => {
227- return this . #helpMessages
227+ const result = this . #helpMessages
228228 . map ( ( value ) => {
229229 if ( ! this . #matchSearch( value ) ) return ;
230230 const [ title , desc ] = value . split ( '\n' ) ;
@@ -244,6 +244,13 @@ export class MSearchElement extends GemElement {
244244 } ;
245245 } )
246246 . filter ( isNotNullish ) ;
247+ return result . length
248+ ? result
249+ : [
250+ {
251+ label : html `< m-sse prompt =${ this . #state. search } > </ m-sse > ` ,
252+ } ,
253+ ] ;
247254 } ;
248255
249256 #genFriendOptions = ( ) : Option [ ] => {
@@ -395,6 +402,25 @@ export class MSearchElement extends GemElement {
395402 } ) ;
396403 }
397404
405+ const placeholder = getTempText (
406+ i18n . get (
407+ configure . searchCommand === SearchCommand . HELP
408+ ? 'tooltip.docs.help'
409+ : configure . searchCommand === SearchCommand . SELECT_GAME
410+ ? 'tooltip.game.change'
411+ : this . #isRooms
412+ ? 'placeholder.roomSearch'
413+ : configure . user ?. playing
414+ ? 'placeholder.searchPlaying'
415+ : 'placeholder.search' ,
416+ configure . searchCommand === SearchCommand . HELP
417+ ? getShortcut ( 'OPEN_SEARCH' , true )
418+ : configure . searchCommand === SearchCommand . SELECT_GAME
419+ ? ''
420+ : getShortcut ( 'OPEN_SEARCH' , true ) ,
421+ ) ,
422+ ) ;
423+
398424 return html `
399425 < div class ="input-wrap ">
400426 < dy-input
@@ -405,24 +431,7 @@ export class MSearchElement extends GemElement {
405431 .icon =${ this . #getSearchCommandIcon( configure . searchCommand ) }
406432 @change=${ this . #onChange}
407433 @keydown=${ this . #onKeydownInput}
408- placeholder=${ getTempText (
409- i18n . get (
410- configure . searchCommand === SearchCommand . HELP
411- ? 'tooltip.docs.help'
412- : configure . searchCommand === SearchCommand . SELECT_GAME
413- ? 'tooltip.game.change'
414- : this . #isRooms
415- ? 'placeholder.roomSearch'
416- : configure . user ?. playing
417- ? 'placeholder.searchPlaying'
418- : 'placeholder.search' ,
419- configure . searchCommand === SearchCommand . HELP
420- ? getShortcut ( 'OPEN_SEARCH' , true )
421- : configure . searchCommand === SearchCommand . SELECT_GAME
422- ? ''
423- : getShortcut ( 'OPEN_SEARCH' , true ) ,
424- ) ,
425- ) }
434+ placeholder=${ placeholder }
426435 > </ dy-input >
427436 </ div >
428437 < div class ="result ">
0 commit comments