@@ -239,6 +239,58 @@ (Bool :$debug)
239
239
$ viz . to-file(" html/images/type-graph-{ $ type } .svg" , format => ' svg' );
240
240
$ viz . to-file(" html/images/type-graph-{ $ type } .png" , format => ' png' );
241
241
}
242
+
243
+ say " Writing specialized visualizations to html/images/" ;
244
+ my % by-group = $ tg . sorted. classify (& viz-group );
245
+ % by-group <Exception >. push : $ tg . types< Exception Any Mu >;
246
+ % by-group <Metamodel >. push : $ tg . types< Any Mu >;
247
+
248
+ for % by-group . kv -> $ group , @ types {
249
+ my $ viz = Perl6::TypeGraph::Viz. new (: types(@ types ),
250
+ : dot-hints(viz-hints($ group )),
251
+ : rank-dir(' LR' ));
252
+ $ viz . to-file(" html/images/type-graph-{ $ group } .svg" , format => ' svg' );
253
+ $ viz . to-file(" html/images/type-graph-{ $ group } .png" , format => ' png' );
254
+ }
255
+ }
256
+
257
+ sub viz-group ($ type ) {
258
+ return ' Metamodel' if $ type . name ~~ /^ 'Perl6::Metamodel' /;
259
+ return ' Exception' if $ type . name ~~ /^ 'X::' /;
260
+ return ' Any' ;
261
+ }
262
+
263
+ sub viz-hints ($ group ) {
264
+ return ' ' unless $ group eq ' Any' ;
265
+
266
+ return '
267
+ subgraph "cluster: Mu children" {
268
+ rank=same;
269
+ style=invis;
270
+ "Any";
271
+ "Junction";
272
+ }
273
+ subgraph "cluster: Pod:: top level" {
274
+ rank=same;
275
+ style=invis;
276
+ "Pod::Config";
277
+ "Pod::Block";
278
+ }
279
+ subgraph "cluster: Date/time handling" {
280
+ rank=same;
281
+ style=invis;
282
+ "Date";
283
+ "DateTime";
284
+ "DateTime-local-timezone";
285
+ }
286
+ subgraph "cluster: Collection roles" {
287
+ rank=same;
288
+ style=invis;
289
+ "Positional";
290
+ "Associative";
291
+ "Baggy";
292
+ }
293
+ ' ;
242
294
}
243
295
244
296
sub write-search-file () {
0 commit comments