1+ import * as s from 'solid-js'
12import { SECOND } from '@solid-primitives/date'
23import { createEventBus } from '@solid-primitives/event-bus'
34import { debounce } from '@solid-primitives/scheduled'
45import { defer } from '@solid-primitives/utils'
5- import { type Debugger , DebuggerModule , DevtoolsMainView , type NodeID } from '@solid-devtools/debugger/types'
6+ import * as debug from '@solid-devtools/debugger/types'
67import { mutate_remove } from '@solid-devtools/shared/utils'
7- import * as s from 'solid-js'
88import { App } from './App.tsx'
99import createInspector from './inspector.tsx'
1010import { type Structure } from './structure.tsx'
1111import * as ui from './ui/index.ts'
1212
1313
1414export type InputMessage = {
15- [ K in keyof Debugger . OutputChannels ] : {
15+ [ K in keyof debug . Debugger . OutputChannels ] : {
1616 name : K ,
17- details : Debugger . OutputChannels [ K ] ,
17+ details : debug . Debugger . OutputChannels [ K ] ,
1818 }
19- } [ keyof Debugger . OutputChannels ]
19+ } [ keyof debug . Debugger . OutputChannels ]
2020export type InputListener = ( e : InputMessage ) => void
2121
2222export type InputEventBus = {
@@ -25,11 +25,11 @@ export type InputEventBus = {
2525}
2626
2727export type OutputMessage = {
28- [ K in keyof Debugger . InputChannels ] : {
28+ [ K in keyof debug . Debugger . InputChannels ] : {
2929 name : K ,
30- details : Debugger . InputChannels [ K ] ,
30+ details : debug . Debugger . InputChannels [ K ] ,
3131 }
32- } [ keyof Debugger . InputChannels ]
32+ } [ keyof debug . Debugger . InputChannels ]
3333export type OutputListener = ( e : OutputMessage ) => void
3434
3535export type OutputEventBus = {
@@ -83,7 +83,7 @@ export function createDevtools(props: DevtoolsOptions) {
8383 */
8484function createViewCache ( ) {
8585 type CacheDataMap = {
86- [ DevtoolsMainView . Structure ] : Structure . Cache
86+ [ debug . DevtoolsMainView . Structure ] : Structure . Cache
8787 }
8888 let shortCache : null | any = null
8989 let nextShortCache : typeof shortCache = null
@@ -94,15 +94,15 @@ function createViewCache() {
9494 nextShortCache = null
9595 } , 3 * SECOND )
9696
97- function setCacheGetter < T extends DevtoolsMainView > ( view : T , getter : ( ) => CacheDataMap [ T ] ) {
97+ function setCacheGetter < T extends debug . DevtoolsMainView > ( view : T , getter : ( ) => CacheDataMap [ T ] ) {
9898 s . onCleanup ( ( ) => {
9999 const data = getter ( )
100100 nextShortCache = { view : view as any , data : data . short }
101101 longCache . set ( view , data . long )
102102 clearShortCache ( )
103103 } )
104104 }
105- function getCache < T extends DevtoolsMainView > (
105+ function getCache < T extends debug . DevtoolsMainView > (
106106 view : T ,
107107 ) : { [ K in 'short' | 'long' ] : CacheDataMap [ T ] [ K ] | null } {
108108 const short = shortCache && shortCache . view === view ? shortCache . data : null
@@ -170,7 +170,7 @@ function createAppCtx(props: DevtoolsOptions) {
170170 s . createEffect ( defer ( devtoolsLocatorEnabled , enabled => {
171171 output . emit ( {
172172 name : 'ToggleModule' ,
173- details : { module : DebuggerModule . Locator , enabled}
173+ details : { module : debug . DebuggerModule . Locator , enabled}
174174 } )
175175 } ) )
176176
@@ -184,10 +184,10 @@ function createAppCtx(props: DevtoolsOptions) {
184184 //
185185 // HOVERED NODE
186186 //
187- const [ clientHoveredNode , setClientHoveredNode ] = s . createSignal < NodeID | null > ( null )
187+ const [ clientHoveredNode , setClientHoveredNode ] = s . createSignal < debug . NodeID | null > ( null )
188188 const [ extHoveredNode , setExtHoveredNode ] = s . createSignal < {
189189 type : 'element' | 'node'
190- id : NodeID
190+ id : debug . NodeID
191191 } | null > ( null , { equals : ( a , b ) => a ?. id === b ?. id } )
192192
193193 // highlight hovered element
@@ -202,14 +202,14 @@ function createAppCtx(props: DevtoolsOptions) {
202202 const extNode = extHoveredNode ( )
203203 return extNode ? extNode . id : clientHoveredNode ( )
204204 } )
205- const isNodeHovered = s . createSelector < NodeID | null , NodeID > ( hoveredId )
205+ const isNodeHovered = s . createSelector < debug . NodeID | null , debug . NodeID > ( hoveredId )
206206
207- function toggleHoveredNode ( id : NodeID , type : 'element' | 'node' = 'node' , isHovered ?: boolean ) {
207+ function toggleHoveredNode ( id : debug . NodeID , type : 'element' | 'node' = 'node' , isHovered ?: boolean ) {
208208 return setExtHoveredNode ( p =>
209209 p && p . id === id ? ( isHovered ? p : null ) : isHovered ? { id, type} : p ,
210210 )
211211 }
212- function toggleHoveredElement ( id : NodeID , isHovered ?: boolean ) {
212+ function toggleHoveredElement ( id : debug . NodeID , isHovered ?: boolean ) {
213213 return toggleHoveredNode ( id , 'element' , isHovered )
214214 }
215215
@@ -218,10 +218,10 @@ function createAppCtx(props: DevtoolsOptions) {
218218 //
219219 // * there is no need for different views now
220220
221- const [ openedView , setOpenedView ] = s . createSignal < DevtoolsMainView > ( DevtoolsMainView . Structure )
221+ const [ openedView , setOpenedView ] = s . createSignal < debug . DevtoolsMainView > ( debug . DevtoolsMainView . Structure )
222222 const viewCache = createViewCache ( )
223223
224- function openView ( view : DevtoolsMainView ) {
224+ function openView ( view : debug . DevtoolsMainView ) {
225225 setOpenedView ( view )
226226 }
227227
@@ -232,7 +232,7 @@ function createAppCtx(props: DevtoolsOptions) {
232232 //
233233 // Node updates - signals and computations updating
234234 //
235- const nodeUpdates = createEventBus < NodeID > ( )
235+ const nodeUpdates = createEventBus < debug . NodeID > ( )
236236
237237 //
238238 // INSPECTOR
@@ -299,7 +299,7 @@ function createAppCtx(props: DevtoolsOptions) {
299299 output,
300300 input,
301301 viewCache,
302- listenToNodeUpdate ( id : NodeID , fn : VoidFunction ) {
302+ listenToNodeUpdate ( id : debug . NodeID , fn : VoidFunction ) {
303303 return nodeUpdates . listen ( updatedId => updatedId === id && fn ( ) )
304304 } ,
305305 }
0 commit comments