@@ -20,16 +20,14 @@ globalThis['__css-content-808794906c4839b82ed240e38daf1f1c__']=".App-module__gPM
2020 return el ;
2121 } ;
2222
23- // src/getFocusHandler.ts
24- var getFocusHandler = ( node ) => {
25- return ( selector , cursorPosition = 0 ) => {
26- const target = node . querySelector ( selector ) || node . parentElement ?. querySelector ( selector ) ;
27- if ( ! target ) return ;
28- target ?. focus ( ) ;
29- if ( cursorPosition ) {
30- target ?. setSelectionRange ( cursorPosition , cursorPosition ) ;
31- }
32- } ;
23+ // src/setFocus.ts
24+ var setFocus = ( node , selector , cursorPosition = 0 ) => {
25+ const target = node . querySelector ( selector ) || node . parentElement ?. querySelector ( selector ) ;
26+ if ( ! target ) return ;
27+ target ?. focus ( ) ;
28+ if ( cursorPosition ) {
29+ target ?. setSelectionRange ( cursorPosition , cursorPosition ) ;
30+ }
3331 } ;
3432
3533 // src/domReplacer.ts
@@ -42,11 +40,10 @@ globalThis['__css-content-808794906c4839b82ed240e38daf1f1c__']=".App-module__gPM
4240 }
4341 function render ( ) {
4442 const id = document . activeElement ?. id ;
45- const selectionStart = document . activeElement ?. selectionStart ;
43+ const selectionStart = document . activeElement ?. selectionStart || 0 ;
4644 const newDom = replaceDom ( ) ;
47- const focus = getFocusHandler ( newDom ) ;
48- if ( id && focus ) {
49- focus ( `#${ id } ` , selectionStart ) ;
45+ if ( id ) {
46+ setFocus ( newDom , `#${ id } ` , selectionStart ) ;
5047 }
5148 }
5249 return {
@@ -103,7 +100,7 @@ globalThis['__css-content-808794906c4839b82ed240e38daf1f1c__']=".App-module__gPM
103100 const inputDom = /* @__PURE__ */ h (
104101 "input" ,
105102 {
106- id : "name -input" ,
103+ id : "value -input" ,
107104 class : App_default . _Input ,
108105 value : name ,
109106 onKeyup : ( e ) => {
0 commit comments