@@ -8,19 +8,21 @@ import { DebuggingCache } from 'src/client/reactive/active-expression-rewriting/
88export default class AexprGraph extends Morph {
99 async initialize ( ) {
1010 this . windowTitle = "Active Expression Graph" ;
11+ this . setWindowSize ( 1200 , 800 ) ;
1112 let width = window . innerWidth ;
1213 let height = window . innerHeight ;
13- this . graphViz = await ( < d3-graphviz style = "background:gray; width:100%; height: 100% " > </ d3-graphviz > )
14+ this . graphViz = await ( < d3-graphviz style = "background:gray" > </ d3-graphviz > )
1415 this . graph . append ( this . graphViz ) ;
1516 await this . graphViz . setDotData ( this . graphData ( ) ) ;
1617 const containerElement = this . graphViz . shadowRoot . querySelector ( "#container" ) ;
17- containerElement . setAttribute ( "display" , "flex" ) ;
18+ /*containerElement.setAttribute("display", "flex");
19+ containerElement.children[0].setAttribute("display", "flex");
1820 setTimeout(() => {
1921 debugger;
2022 const svgElement = this.graphViz.shadowRoot.querySelector("svg");
2123 svgElement.setAttribute("height", "100%");
2224 svgElement.setAttribute("width", "100%");
23- } , 100 ) ;
25+ }, 10000);*/
2426 }
2527
2628 graphData ( ) {
@@ -30,25 +32,32 @@ export default class AexprGraph extends Morph {
3032
3133 const aes = AExprRegistry . allAsArray ( ) ;
3234
35+ const allDeps = new Map ( ) ;
36+
3337 let aeCount = 0 ;
3438 let depCount = 0 ;
3539 let hookCount = 0 ;
3640 for ( const ae of aes ) {
37- debugger ;
3841 const aeData = this . extractData ( ae ) ;
3942 nodes . push ( `AE${ aeCount } [shape="record" label="{${ aeData . join ( "|" ) } }"]` ) ;
4043 for ( const dep of ae . dependencies ( ) . all ( ) ) {
41- nodes . push ( `DEP${ depCount } [shape="record" label="{${ this . escapeTextForDOTRecordLabel ( dep . getName ( ) ) } |${ dep . type ( ) } }"]` ) ;
42- edges . push ( `AE${ aeCount } -> DEP${ depCount } ` ) ;
43- for ( const hook of dep . getHooks ( ) ) {
44- nodes . push ( `HOOK${ hookCount } [shape="record" label="{${ this . escapeTextForDOTRecordLabel ( hook . informationString ( ) ) } }"]` ) ;
45- edges . push ( `DEP${ depCount } -> HOOK${ hookCount } ` ) ;
46- hookCount ++ ;
44+ if ( ! allDeps . has ( dep ) ) {
45+ allDeps . set ( dep , depCount ) ;
46+ nodes . push ( `DEP${ depCount } [shape="record" label="{${ this . escapeTextForDOTRecordLabel ( dep . getName ( ) ) } |${ dep . type ( ) } }"]` ) ;
47+ depCount ++ ;
4748 }
48- depCount ++ ;
49+
50+ edges . push ( `AE${ aeCount } -> DEP${ allDeps . get ( dep ) } ` ) ;
4951 }
5052 aeCount ++ ;
5153 }
54+ for ( const dep of allDeps . keys ( ) ) {
55+ for ( const hook of dep . getHooks ( ) ) {
56+ nodes . push ( `HOOK${ hookCount } [shape="record" label="{${ this . escapeTextForDOTRecordLabel ( hook . informationString ( ) ) } }"]` ) ;
57+ edges . push ( `DEP${ allDeps . get ( dep ) } -> HOOK${ hookCount } ` ) ;
58+ hookCount ++ ;
59+ }
60+ }
5261
5362 return `digraph {
5463 graph [ splines="true" overlap="false" ];
0 commit comments