@@ -12,12 +12,12 @@ enum WireDirection {
1212}
1313
1414export default function drawModule ( g : ElkModel . Graph , module : FlatModule ) {
15- const nodes : any [ ] = module . nodes . map ( ( n : Cell ) => {
15+ const nodes : onml . Element [ ] = module . nodes . map ( ( n : Cell ) => {
1616 const kchild : ElkModel . Cell = _ . find ( g . children , ( c ) => c . id === n . Key ) ;
1717 return n . render ( kchild ) ;
1818 } ) ;
1919 removeDummyEdges ( g ) ;
20- const lines : any [ ] = _ . flatMap ( g . edges , ( e : ElkModel . Edge ) => {
20+ const lines : onml . Element [ ] = _ . flatMap ( g . edges , ( e : ElkModel . Edge ) => {
2121 const netId = ElkModel . wireNameLookup [ e . id ] ;
2222 const netName = 'net_' + netId . slice ( 1 , netId . length - 1 ) ;
2323 return _ . flatMap ( e . sections , ( s : ElkModel . Section ) => {
@@ -56,15 +56,19 @@ export default function drawModule(g: ElkModel.Graph, module: FlatModule) {
5656 } ) ;
5757 } ) ;
5858 const svgAttrs : onml . Attributes = Skin . skin [ 1 ] ;
59- const svg = Skin . skin . slice ( 0 , 2 ) ;
6059 svgAttrs . width = g . width . toString ( ) ;
6160 svgAttrs . height = g . height . toString ( ) ;
6261
63- const styles : any [ ] = _ . filter ( Skin . skin , ( el ) => {
64- return el [ 0 ] === 'style' ;
62+ const styles : onml . Element = [ 'style' , { } , '' ] ;
63+ onml . t ( Skin . skin , {
64+ enter : ( node ) => {
65+ if ( node . name === 'style' ) {
66+ styles [ 2 ] += node . full [ 2 ] ;
67+ }
68+ } ,
6569 } ) ;
66- const elements = styles . concat ( nodes ) . concat ( lines ) ;
67- const ret : onml . Element = [ 'svg' , svgAttrs , elements ] ;
70+ const elements : onml . Element [ ] = [ styles , ... nodes , ... lines ] ;
71+ const ret : onml . Element = [ 'svg' , svgAttrs , ... elements ] ;
6872 return onml . s ( ret ) ;
6973}
7074
0 commit comments