@@ -8,31 +8,32 @@ It also starts listening to Solid DEV events and stores them to be sent to the d
88
99import * as s from 'solid-js'
1010import * as store from 'solid-js/store'
11- import { error } from '@solid-devtools/shared/utils'
12- import type { LocatorOptions } from './locator/locator.ts'
13- import type { Solid } from './main/types.ts'
11+ import * as debug from '@solid-devtools/debugger/types'
12+ import { assert , error } from '@solid-devtools/shared/utils'
1413
15-
16- let PassedLocatorOptions : LocatorOptions | null = null
1714/** @deprecated use `setLocatorOptions` */
18- export function useLocator ( options : LocatorOptions ) {
19- PassedLocatorOptions = options
15+ export function useLocator ( options : debug . LocatorOptions ) {
16+ setLocatorOptions ( options )
2017}
21- export function setLocatorOptions ( options : LocatorOptions ) {
22- PassedLocatorOptions = options
18+ export function setLocatorOptions ( options : debug . LocatorOptions ) {
19+ assert ( globalThis . SolidDevtools$$ , 'solid-devtools is not setup' )
20+ globalThis . SolidDevtools$$ . locator_options = options
2321}
2422
25- let ClientVersion : string | null = null
26- let SolidVersion : string | null = null
27- let ExpectedSolidVersion : string | null = null
23+ export function setDebuggerOptions ( options : debug . DebuggerOptions < any > ) {
24+ assert ( globalThis . SolidDevtools$$ , 'solid-devtools is not setup' )
25+ globalThis . SolidDevtools$$ . debugger_options = options
26+ }
2827
2928export function setClientVersion ( version : string ) {
30- ClientVersion = version
29+ assert ( globalThis . SolidDevtools$$ , 'solid-devtools is not setup' )
30+ globalThis . SolidDevtools$$ . versions . client = version
3131}
3232
3333export function setSolidVersion ( version : string , expected : string ) {
34- SolidVersion = version
35- ExpectedSolidVersion = expected
34+ assert ( globalThis . SolidDevtools$$ , 'solid-devtools is not setup' )
35+ globalThis . SolidDevtools$$ . versions . solid = version
36+ globalThis . SolidDevtools$$ . versions . expected_solid = expected
3637}
3738
3839export type SetupApi = {
@@ -50,17 +51,22 @@ export type SetupApi = {
5051 $RAW : typeof store . $RAW
5152 }
5253 // custom
53- get_created_owners ( ) : Solid . Owner [ ]
54- get_locator_options ( ) : LocatorOptions | null
54+ debugger_options : debug . DebuggerOptions < any >
55+ locator_options : debug . LocatorOptions | null
56+ get_created_owners : ( ) => debug . Solid . Owner [ ]
57+ get_locator_options : ( ) => debug . LocatorOptions | null
5558 versions : {
56- get_client ( ) : string | null
57- get_solid ( ) : string | null
58- get_expected_solid ( ) : string | null
59+ client : string | null
60+ solid : string | null
61+ expected_solid : string | null
62+ get_client : ( ) => string | null
63+ get_solid : ( ) => string | null
64+ get_expected_solid : ( ) => string | null
5965 }
6066 unowned : {
61- signals : WeakRef < Solid . Signal > [ ]
62- onSignalAdded : ( ( ref : WeakRef < Solid . Signal > , idx : number ) => void ) | null
63- onSignalRemoved : ( ( ref : WeakRef < Solid . Signal > , idx : number ) => void ) | null
67+ signals : WeakRef < debug . Solid . Signal > [ ]
68+ onSignalAdded : ( ( ref : WeakRef < debug . Solid . Signal > , idx : number ) => void ) | null
69+ onSignalRemoved : ( ( ref : WeakRef < debug . Solid . Signal > , idx : number ) => void ) | null
6470 }
6571}
6672
@@ -77,7 +83,7 @@ if (!s.DEV || !store.DEV) {
7783 error ( 'SolidJS in not in development mode!' )
7884} else {
7985
80- let created_owners : Solid . Owner [ ] | null = [ ]
86+ let created_owners : debug . Solid . Owner [ ] | null = [ ]
8187
8288 let setup : SetupApi = {
8389 solid : {
@@ -100,13 +106,20 @@ if (!s.DEV || !store.DEV) {
100106 created_owners = null
101107 return events
102108 } ,
109+ debugger_options : {
110+ eli : debug . dom_element_interface ,
111+ } ,
112+ locator_options : null ,
103113 get_locator_options ( ) {
104- return PassedLocatorOptions
114+ return this . locator_options
105115 } ,
106116 versions : {
107- get_client ( ) { return ClientVersion } ,
108- get_solid ( ) { return SolidVersion } ,
109- get_expected_solid ( ) { return ExpectedSolidVersion } ,
117+ client : null ,
118+ solid : null ,
119+ expected_solid : null ,
120+ get_client ( ) { return this . client } ,
121+ get_solid ( ) { return this . solid } ,
122+ get_expected_solid ( ) { return this . expected_solid } ,
110123 } ,
111124 unowned : {
112125 signals : [ ] ,
@@ -120,7 +133,7 @@ if (!s.DEV || !store.DEV) {
120133 created_owners ?. push ( owner )
121134 }
122135
123- let signals_registry = new FinalizationRegistry < WeakRef < Solid . Signal > > ( ref => {
136+ let signals_registry = new FinalizationRegistry < WeakRef < debug . Solid . Signal > > ( ref => {
124137 let idx = setup . unowned . signals . indexOf ( ref )
125138 setup . unowned . signals . splice ( idx , 1 )
126139 setup . unowned . onSignalRemoved ?.( ref , idx )
0 commit comments