@@ -41,35 +41,36 @@ function queue_timeout(ms: number, fn: () => void) {
4141}
4242
4343class Modal {
44- #element: HTMLDivElement ;
44+ #element: HTMLElement ;
4545 #glide: Glide ;
4646 #dom: Sandbox [ "DOM" ] ;
4747
4848 constructor ( sandbox : Sandbox ) {
4949 this . #dom = sandbox . DOM ;
5050 this . #glide = sandbox . glide ;
51- this . #element = sandbox . DOM . create_element ( "div" , {
52- id : "which-key" ,
53- style : {
54- display : "none" ,
55- position : "fixed" ,
56- bottom : "2rem" ,
57- right : "2rem" ,
58- background : "var(--glide-cmdl-bg)" ,
59- fontFamily : "var(--glide-cmdl-font-family)" ,
60- fontSize : "var(--glide-cmdl-font-size)" ,
61- lineHeight : "var(--glide-cmdl-line-height)" ,
62- color : "var(--glide-cmdl-fg)" ,
63- zIndex : "2147483646" ,
64- boxShadow : "0 -8px 32px hsla(0, 0%, 0%, 0.4)" ,
65- minWidth : "300px" ,
66- maxWidth : "600px" ,
67- maxHeight : "60vh" ,
68- overflow : "hidden" ,
69- borderRadius : "4px" ,
70- border : "1px solid hsla(0, 0%, 100%, 0.1)" ,
71- } ,
72- } ) ;
51+ this . #element = ( sandbox . document . getElementById ( "which-key" ) as HTMLElement | undefined )
52+ ?? sandbox . DOM . create_element ( "div" , {
53+ id : "which-key" ,
54+ style : {
55+ display : "none" ,
56+ position : "fixed" ,
57+ bottom : "2rem" ,
58+ right : "2rem" ,
59+ background : "var(--glide-cmdl-bg)" ,
60+ fontFamily : "var(--glide-cmdl-font-family)" ,
61+ fontSize : "var(--glide-cmdl-font-size)" ,
62+ lineHeight : "var(--glide-cmdl-line-height)" ,
63+ color : "var(--glide-cmdl-fg)" ,
64+ zIndex : "2147483646" ,
65+ boxShadow : "0 -8px 32px hsla(0, 0%, 0%, 0.4)" ,
66+ minWidth : "300px" ,
67+ maxWidth : "600px" ,
68+ maxHeight : "60vh" ,
69+ overflow : "hidden" ,
70+ borderRadius : "4px" ,
71+ border : "1px solid hsla(0, 0%, 100%, 0.1)" ,
72+ } ,
73+ } ) ;
7374
7475 sandbox . glide . autocmds . create ( "WindowLoaded" , ( ) => {
7576 sandbox . document . children [ 0 ] ! . appendChild ( this . #element) ;
0 commit comments