@@ -25,10 +25,12 @@ export function constructCoreClass(Component: () => JSX.Element) {
2525 async mount < T extends HTMLElement > ( el : T , theme : 'light' | 'dark' ) {
2626 this . #isMounting = true
2727 const { lazy } = await import ( 'solid-js' )
28- const { render, Portal } = await import ( 'solid-js/web' )
28+ const { render } = await import ( 'solid-js/web' )
29+
2930 if ( this . #isMounted) {
3031 throw new Error ( 'Devtools is already mounted' )
3132 }
33+
3234 const mountTo = el
3335 const dispose = render ( ( ) => {
3436 this . #Component = Component
@@ -38,22 +40,21 @@ export function constructCoreClass(Component: () => JSX.Element) {
3840 default : mod . ThemeContextProvider ,
3941 } ) ) ,
4042 )
43+
4144 const Devtools = this . #Component
4245 const ThemeProvider = this . #ThemeProvider
4346
4447 return (
45- < Portal mount = { mountTo } >
46- < div style = { { height : '100%' } } >
47- < ThemeProvider theme = { theme } >
48- < Devtools />
49- </ ThemeProvider >
50- </ div >
51- </ Portal >
48+ < ThemeProvider theme = { theme } >
49+ < Devtools />
50+ </ ThemeProvider >
5251 )
5352 } , mountTo )
53+
5454 this . #isMounted = true
5555 this . #isMounting = false
5656 this . #dispose = dispose
57+
5758 if ( this . #mountCb) {
5859 this . #mountCb( )
5960 this . #mountCb = null
@@ -64,24 +65,29 @@ export function constructCoreClass(Component: () => JSX.Element) {
6465 if ( ! this . #isMounted && ! this . #isMounting) {
6566 throw new Error ( 'Devtools is not mounted' )
6667 }
68+
6769 if ( this . #isMounting) {
6870 this . #mountCb = ( ) => {
6971 this . #dispose?.( )
7072 this . #isMounted = false
7173 }
7274 return
7375 }
76+
7477 this . #dispose?.( )
7578 this . #isMounted = false
7679 }
7780 }
81+
7882 class NoOpDevtoolsCore extends DevtoolsCore {
7983 constructor ( ) {
8084 super ( )
8185 }
86+
8287 async mount < T extends HTMLElement > ( _el : T , _theme : 'light' | 'dark' ) { }
8388 unmount ( ) { }
8489 }
90+
8591 return [ DevtoolsCore , NoOpDevtoolsCore ] as const
8692}
8793
0 commit comments