@@ -76,7 +76,8 @@ const getSourceComponentProps = (
7676 const footprint = cadComponent ?. footprinter_string
7777 if ( footprint ) attrs . push ( `footprint=${ JSON . stringify ( footprint ) } ` )
7878
79- if ( pcbComponent ?. layer ) attrs . push ( `layer=${ JSON . stringify ( pcbComponent . layer ) } ` )
79+ if ( pcbComponent ?. layer )
80+ attrs . push ( `layer=${ JSON . stringify ( pcbComponent . layer ) } ` )
8081 if ( pcbComponent ?. center ?. x !== undefined )
8182 attrs . push ( `pcbX={${ pcbComponent . center . x } }` )
8283 if ( pcbComponent ?. center ?. y !== undefined )
@@ -86,15 +87,19 @@ const getSourceComponentProps = (
8687 if ( pcbComponent ?. do_not_place !== undefined )
8788 attrs . push ( `doNotPlace={${ pcbComponent . do_not_place } }` )
8889 if ( pcbComponent ?. obstructs_within_bounds !== undefined ) {
89- attrs . push ( `obstructsWithinBounds={${ pcbComponent . obstructs_within_bounds } }` )
90+ attrs . push (
91+ `obstructsWithinBounds={${ pcbComponent . obstructs_within_bounds } }` ,
92+ )
9093 }
9194
9295 const connections = ports
9396 . sort ( ( a , b ) => ( a . pin_number ?? 0 ) - ( b . pin_number ?? 0 ) )
9497 . map ( ( port ) => {
9598 const key = port . name || `pin${ port . pin_number ?? 1 } `
9699 const net = port . subcircuit_connectivity_map_key
97- ? sourceNetNameByConnectivityKey . get ( port . subcircuit_connectivity_map_key )
100+ ? sourceNetNameByConnectivityKey . get (
101+ port . subcircuit_connectivity_map_key ,
102+ )
98103 : undefined
99104 const fallbackNet =
100105 net ??
@@ -118,15 +123,18 @@ const getSourceComponentProps = (
118123 return `<resistor ${ attrs . join ( " " ) } />`
119124 case "simple_capacitor" :
120125 if ( sourceComponent . display_capacitance ) {
121- attrs . push ( `capacitance=${ JSON . stringify ( sourceComponent . display_capacitance ) } ` )
126+ attrs . push (
127+ `capacitance=${ JSON . stringify ( sourceComponent . display_capacitance ) } ` ,
128+ )
122129 } else if ( sourceComponent . capacitance !== undefined ) {
123130 attrs . push ( `capacitance={${ sourceComponent . capacitance } }` )
124131 }
125132 return `<capacitor ${ attrs . join ( " " ) } />`
126133 case "simple_diode" :
127134 return `<diode ${ attrs . join ( " " ) } />`
128135 case "simple_led" :
129- if ( sourceComponent . color ) attrs . push ( `color=${ JSON . stringify ( sourceComponent . color ) } ` )
136+ if ( sourceComponent . color )
137+ attrs . push ( `color=${ JSON . stringify ( sourceComponent . color ) } ` )
130138 return `<led ${ attrs . join ( " " ) } />`
131139 case "simple_pin_header" :
132140 if ( sourceComponent . pin_count !== undefined ) {
@@ -171,12 +179,18 @@ let sourceNetNameByConnectivityKey = new Map<string, string>()
171179export const generateSourceSubcircuitTsx = (
172180 circuitJson : AnyCircuitElement [ ] ,
173181) : string | null => {
174- const sourceComponents = su ( circuitJson ) . source_component . list ( ) as SourceComponentElement [ ]
182+ const sourceComponents = su (
183+ circuitJson ,
184+ ) . source_component . list ( ) as SourceComponentElement [ ]
175185 const sourcePorts = su ( circuitJson ) . source_port . list ( ) as SourcePortElement [ ]
176186 const sourceNets = su ( circuitJson ) . source_net . list ( ) as SourceNetElement [ ]
177- const pcbComponents = su ( circuitJson ) . pcb_component . list ( ) as PcbComponentElement [ ]
178- const cadComponents = su ( circuitJson ) . cad_component . list ( ) as CadComponentElement [ ]
179-
187+ const pcbComponents = su (
188+ circuitJson ,
189+ ) . pcb_component . list ( ) as PcbComponentElement [ ]
190+ const cadComponents = su (
191+ circuitJson ,
192+ ) . cad_component . list ( ) as CadComponentElement [ ]
193+
180194 if ( sourceComponents . length === 0 ) return null
181195 if ( sourceComponents . length === 1 && sourceNets . length === 0 ) return null
182196
@@ -209,16 +223,19 @@ export const generateSourceSubcircuitTsx = (
209223 }
210224
211225 const board = su ( circuitJson ) . pcb_board . list ( ) [ 0 ]
212- const boardWidth =
213- board ?. width !== undefined ? ` width={${ board . width } }` : ""
226+ const boardWidth = board ?. width !== undefined ? ` width={${ board . width } }` : ""
214227 const boardHeight =
215228 board ?. height !== undefined ? ` height={${ board . height } }` : ""
216229
217230 const childStrings = sourceComponents
218231 . map ( ( component ) => {
219232 const ports = portsByComponentId . get ( component . source_component_id ) ?? [ ]
220- const pcbComponent = pcbBySourceComponentId . get ( component . source_component_id )
221- const cadComponent = cadBySourceComponentId . get ( component . source_component_id )
233+ const pcbComponent = pcbBySourceComponentId . get (
234+ component . source_component_id ,
235+ )
236+ const cadComponent = cadBySourceComponentId . get (
237+ component . source_component_id ,
238+ )
222239 return getSourceComponentProps (
223240 component ,
224241 pcbComponent ,
0 commit comments