@@ -11,6 +11,7 @@ export type PropDataType =
1111 | "function"
1212 | "bigint"
1313 | "vnode"
14+ | "signal"
1415 | "blob"
1516 | "symbol"
1617 | "html" ;
@@ -33,6 +34,7 @@ export function parseProps(
3334 depth = 0 ,
3435 name = path ,
3536 out = new Map < string , PropData > ( ) ,
37+ forceReadonly = false ,
3638) : Map < string , PropData > {
3739 if ( depth >= limit ) {
3840 out . set ( path , {
@@ -63,7 +65,7 @@ export function parseProps(
6365 data . forEach ( ( item , i ) => {
6466 const childPath = `${ path } .${ i } ` ;
6567 children . push ( childPath ) ;
66- parseProps ( item , childPath , limit , depth + 1 , "" + i , out ) ;
68+ parseProps ( item , childPath , limit , depth + 1 , "" + i , out , forceReadonly ) ;
6769 } ) ;
6870 } else if ( typeof data === "object" ) {
6971 if ( data === null ) {
@@ -134,7 +136,15 @@ export function parseProps(
134136 ( data . entries as any [ ] ) . forEach ( ( item , i ) => {
135137 const childPath = `${ path } .${ i } ` ;
136138 children . push ( childPath ) ;
137- parseProps ( item , childPath , limit , depth + 1 , "" + i , out ) ;
139+ parseProps (
140+ item ,
141+ childPath ,
142+ limit ,
143+ depth + 1 ,
144+ "" + i ,
145+ out ,
146+ forceReadonly ,
147+ ) ;
138148 } ) ;
139149 out . set ( path , node ) ;
140150 } else if (
@@ -158,7 +168,15 @@ export function parseProps(
158168 ( data . entries as any [ ] ) . forEach ( ( item , i ) => {
159169 const childPath = `${ path } .${ i } ` ;
160170 children . push ( childPath ) ;
161- parseProps ( item , childPath , limit , depth + 1 , "" + i , out ) ;
171+ parseProps (
172+ item ,
173+ childPath ,
174+ limit ,
175+ depth + 1 ,
176+ "" + i ,
177+ out ,
178+ forceReadonly ,
179+ ) ;
162180 } ) ;
163181 out . set ( path , node ) ;
164182 } else if (
@@ -209,6 +227,36 @@ export function parseProps(
209227 children : [ ] ,
210228 meta : null ,
211229 } ) ;
230+ } else if (
231+ // Same for Signals
232+ maybeCollection &&
233+ typeof data . name === "string" &&
234+ data . type === "signal"
235+ ) {
236+ const children : string [ ] = [ ] ;
237+ const isEditable = data . name === "Signal" ;
238+ const node : PropData = {
239+ depth,
240+ name,
241+ id : path ,
242+ type : "signal" ,
243+ editable : isEditable ,
244+ value : data ,
245+ children,
246+ meta : null ,
247+ } ;
248+ const childPath = `${ path } .value` ;
249+ children . push ( childPath ) ;
250+ out . set ( path , node ) ;
251+ parseProps (
252+ data . value ,
253+ childPath ,
254+ limit ,
255+ depth + 1 ,
256+ "value" ,
257+ out ,
258+ ! isEditable ,
259+ ) ;
212260 } else {
213261 const node : PropData = {
214262 depth,
@@ -225,7 +273,15 @@ export function parseProps(
225273 Object . keys ( data ) . forEach ( key => {
226274 const nextPath = `${ path } .${ key } ` ;
227275 node . children . push ( nextPath ) ;
228- parseProps ( data [ key ] , nextPath , limit , depth + 1 , key , out ) ;
276+ parseProps (
277+ data [ key ] ,
278+ nextPath ,
279+ limit ,
280+ depth + 1 ,
281+ key ,
282+ out ,
283+ forceReadonly ,
284+ ) ;
229285 } ) ;
230286
231287 out . set ( path , node ) ;
@@ -238,7 +294,8 @@ export function parseProps(
238294 name,
239295 id : path ,
240296 type : type as any ,
241- editable : type !== "undefined" && data !== "[[Circular]]" ,
297+ editable :
298+ type !== "undefined" && data !== "[[Circular]]" && ! forceReadonly ,
242299 value : data ,
243300 children : [ ] ,
244301 meta : null ,
0 commit comments