1- import { createEventBus , createGlobalEmitter , type GlobalEmitter } from '@solid-primitives/event-bus'
1+ import { createGlobalEmitter , type GlobalEmitter } from '@solid-primitives/event-bus'
22import { createStaticStore } from '@solid-primitives/static-store'
33import { defer } from '@solid-primitives/utils'
44import * as s from 'solid-js'
@@ -69,33 +69,25 @@ const [modules, toggleModules] = createStaticStore({
6969} )
7070
7171// The debugger can be enabled by devtools or by the locator
72- const debuggerEnabled = s . createMemo ( ( ) => modules . debugger || modules . locatorKeyPressSignal ( ) )
73- const dgraphEnabled = s . createMemo ( ( ) => modules . dgraph && debuggerEnabled ( ) )
72+ const debuggerEnabled = s . createMemo (
73+ ( ) => modules . debugger || modules . locatorKeyPressSignal ( )
74+ )
75+ const dgraphEnabled = s . createMemo (
76+ ( ) => modules . dgraph && debuggerEnabled ( )
77+ )
7478// locator is enabled if debugger is enabled, and user pressed the key to activate it, or the plugin activated it
7579const locatorEnabled = s . createMemo (
7680 ( ) => ( modules . locatorKeyPressSignal ( ) || modules . locator ) && debuggerEnabled ( ) ,
7781)
7882
79- s . createEffect (
80- defer ( debuggerEnabled , enabled => {
81- hub . output . emit ( 'DebuggerEnabled' , enabled )
82- } ) ,
83- )
83+ s . createEffect ( defer ( debuggerEnabled , enabled => {
84+ hub . output . emit ( 'DebuggerEnabled' , enabled )
85+ } ) )
8486
8587//
8688// Current Open VIEW (currently not used)
8789//
88- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8990let currentView : DevtoolsMainView = DEFAULT_MAIN_VIEW
90- const viewChange = createEventBus < DevtoolsMainView > ( )
91-
92- function setView ( view : DevtoolsMainView ) {
93- s . batch ( ( ) => {
94- // setStructureEnabled(view === DevtoolsMainView.Structure)
95- // setDgraphEnabled(view === DevtoolsMainView.Dgraph)
96- viewChange . emit ( ( currentView = view ) )
97- } )
98- }
9991
10092//
10193// Enabled Modules
@@ -194,7 +186,6 @@ const structure = createStructure({
194186 } ,
195187 onNodeUpdate : pushNodeUpdate ,
196188 enabled : debuggerEnabled ,
197- listenToViewChange : viewChange . listen ,
198189} )
199190
200191//
@@ -210,10 +201,9 @@ const inspector = createInspector({
210201//
211202// Dependency Graph
212203//
213- createDependencyGraph ( {
204+ const dgraph = createDependencyGraph ( {
214205 emit : hub . output . emit ,
215206 enabled : dgraphEnabled ,
216- listenToViewChange : viewChange . listen ,
217207 onNodeUpdate : pushNodeUpdate ,
218208 inspectedState,
219209} )
@@ -272,7 +262,9 @@ hub.input.listen(e => {
272262 structure . setTreeWalkerMode ( e . details )
273263 break
274264 case 'ViewChange' :
275- setView ( e . details )
265+ currentView = e . details
266+ structure . onViewChange ( currentView )
267+ dgraph . onViewChange ( currentView )
276268 break
277269 case 'ToggleModule' :
278270 toggleModule ( e . details )
0 commit comments