@@ -6,6 +6,7 @@ import {createBodyCursor} from '@solid-primitives/cursor'
66import { makeEventListener } from '@solid-primitives/event-listener'
77import * as num from '@nothing-but/utils/num'
88import { useDebugger } from '@solid-devtools/debugger/bundled'
9+ import * as debug from '@solid-devtools/debugger/types'
910import { Icon , MountIcons , createDevtools } from '@solid-devtools/frontend'
1011import { useIsMobile , useIsTouch , atom } from '@solid-devtools/shared/primitives'
1112import { msg } from '@solid-devtools/shared/utils'
@@ -14,9 +15,10 @@ import frontendStyles from '@solid-devtools/frontend/dist/styles.css'
1415import overlayStyles from './styles.css'
1516
1617export type OverlayOptions = {
17- defaultOpen ?: boolean
18- alwaysOpen ?: boolean
19- noPadding ?: boolean
18+ defaultOpen ?: boolean
19+ alwaysOpen ?: boolean
20+ noPadding ?: boolean
21+ debuggerOptions ?: debug . DebuggerOptions < any >
2022}
2123
2224export function attachDevtoolsOverlay ( props ?: OverlayOptions ) : ( ( ) => void ) {
@@ -39,19 +41,21 @@ export function attachDevtoolsOverlay(props?: OverlayOptions): (() => void) {
3941 } )
4042}
4143
42- const Overlay : s . Component < OverlayOptions > = ( { defaultOpen , alwaysOpen , noPadding } ) => {
44+ const Overlay : s . Component < OverlayOptions > = props => {
4345
44- const debug = useDebugger ( )
46+ let { alwaysOpen, debuggerOptions, defaultOpen, noPadding} = props
47+
48+ const instance = useDebugger ( debuggerOptions )
4549
4650 if ( defaultOpen || alwaysOpen ) {
47- debug . toggleEnabled ( true )
51+ instance . toggleEnabled ( true )
4852 }
4953
50- const isOpen = atom ( alwaysOpen || debug . enabled ( ) )
54+ const isOpen = atom ( alwaysOpen || instance . enabled ( ) )
5155 function toggleOpen ( enabled ?: boolean ) {
5256 if ( ! alwaysOpen ) {
5357 enabled ??= ! isOpen ( )
54- debug . toggleEnabled ( enabled )
58+ instance . toggleEnabled ( enabled )
5559 isOpen . set ( enabled )
5660 }
5761 }
@@ -106,19 +110,19 @@ const Overlay: s.Component<OverlayOptions> = ({defaultOpen, alwaysOpen, noPaddin
106110 < s . Show when = { isOpen ( ) } >
107111 { _ => {
108112
109- debug . emit ( msg ( 'ResetState' , undefined ) )
113+ instance . emit ( msg ( 'ResetState' , undefined ) )
110114
111- s . onCleanup ( ( ) => debug . emit ( msg ( 'InspectNode' , null ) ) )
115+ s . onCleanup ( ( ) => instance . emit ( msg ( 'InspectNode' , null ) ) )
112116
113117 const devtools = createDevtools ( {
114118 headerSubtitle : ( ) => 'overlay' ,
115119 } )
116120
117121 devtools . output . listen ( e => {
118- separate ( e , debug . emit )
122+ separate ( e , instance . emit )
119123 } )
120124
121- debug . listen ( e => {
125+ instance . listen ( e => {
122126 separate ( e , devtools . input . emit )
123127 } )
124128
0 commit comments