11import  {  set  as  setJsonPointer  }  from  "json-pointer" ; 
2- import  React ,  { 
3-   ChangeEvent , 
4-   createContext , 
5-   createElement , 
6-   Fragment , 
7-   MutableRefObject , 
8-   useContext , 
9-   useEffect , 
10-   useRef , 
11-   useState , 
12- }  from  "preact/compat" ; 
13- import  { 
2+ import  type  {  ChangeEvent ,  MutableRefObject  }  from  "preact/compat" ; 
3+ import  {  createContext ,  createElement ,  Fragment  }  from  "preact" ; 
4+ import  {  useContext ,  useEffect ,  useRef ,  useState  }  from  "preact/hooks" ; 
5+ import  type  { 
146  ImportSourceBinding , 
157  ReactPyComponent , 
168  ReactPyVdom , 
@@ -67,7 +59,7 @@ export function Element({ model }: { model: ReactPyVdom }): JSX.Element | null {
6759} 
6860
6961function  StandardElement ( {  model } : {  model : ReactPyVdom  } )  { 
70-   const  client  =  React . useContext ( ClientContext ) ; 
62+   const  client  =  useContext ( ClientContext ) ; 
7163  // Use createElement here to avoid warning about variable numbers of children not 
7264  // having keys. Warning about this must now be the responsibility of the client 
7365  // providing the models instead of the client rendering them. 
@@ -83,10 +75,10 @@ function StandardElement({ model }: { model: ReactPyVdom }) {
8375function  UserInputElement ( {  model } : {  model : ReactPyVdom  } ) : JSX . Element  { 
8476  const  client  =  useContext ( ClientContext ) ; 
8577  const  props  =  createAttributes ( model ,  client ) ; 
86-   const  [ value ,  setValue ]  =  React . useState ( props . value ) ; 
78+   const  [ value ,  setValue ]  =  useState ( props . value ) ; 
8779
8880  // honor changes to value from the client via props 
89-   React . useEffect ( ( )  =>  setValue ( props . value ) ,  [ props . value ] ) ; 
81+   useEffect ( ( )  =>  setValue ( props . value ) ,  [ props . value ] ) ; 
9082
9183  const  givenOnChange  =  props . onChange ; 
9284  if  ( typeof  givenOnChange  ===  "function" )  { 
@@ -116,7 +108,7 @@ function UserInputElement({ model }: { model: ReactPyVdom }): JSX.Element {
116108function  ScriptElement ( {  model } : {  model : ReactPyVdom  } )  { 
117109  const  ref  =  useRef < HTMLDivElement  |  null > ( null ) ; 
118110
119-   React . useEffect ( ( )  =>  { 
111+   useEffect ( ( )  =>  { 
120112    // Don't run if the parent element is missing 
121113    if  ( ! ref . current )  { 
122114      return ; 
@@ -181,10 +173,10 @@ function useImportSource(model: ReactPyVdom): MutableRefObject<any> {
181173  const  vdomImportSource  =  model . importSource ; 
182174  const  vdomImportSourceJsonString  =  JSON . stringify ( vdomImportSource ) ; 
183175  const  mountPoint  =  useRef < HTMLElement > ( null ) ; 
184-   const  client  =  React . useContext ( ClientContext ) ; 
176+   const  client  =  useContext ( ClientContext ) ; 
185177  const  [ binding ,  setBinding ]  =  useState < ImportSourceBinding  |  null > ( null ) ; 
186178
187-   React . useEffect ( ( )  =>  { 
179+   useEffect ( ( )  =>  { 
188180    let  unmounted  =  false ; 
189181
190182    if  ( vdomImportSource )  { 
0 commit comments