@@ -11,8 +11,6 @@ import { StyleResolver } from "./StyleResolver";
1111
1212const data : AggregateRewriteData = _data ;
1313
14- let DEBUGGING = false ;
15-
1614type DebugExpression = string | Array < DebugExpression > ;
1715
1816enum Operator {
@@ -29,13 +27,14 @@ interface StyleIdToOptimizationsMap {
2927export default class CSSBlocksService extends Service {
3028 possibleOptimizations ! : StyleIdToOptimizationsMap ;
3129 styleNames : { [ name : string ] : string } ;
30+ static enableDebugMode : Boolean = false ;
3231 constructor ( ) {
3332 super ( ...arguments ) ;
3433 this . possibleOptimizations = getOptimizationInverseMap ( data . optimizations ) ;
3534 this . styleNames = getStyleNames ( ) ;
3635 }
3736 classNamesFor ( argv : Array < string | number | boolean | null > ) : string {
38- if ( DEBUGGING ) {
37+ if ( CSSBlocksService . enableDebugMode ) {
3938 console . log ( argv ) ;
4039 }
4140 let styleEvaluator = new StyleEvaluator ( data , argv ) ;
@@ -47,7 +46,7 @@ export default class CSSBlocksService extends Service {
4746 resolver . addStyle ( style ) ;
4847 }
4948
50- if ( DEBUGGING ) {
49+ if ( CSSBlocksService . enableDebugMode ) {
5150 this . debugStyles ( "all possible implied styles" , resolver . currentStyles ( ) ) ;
5251 }
5352
@@ -68,7 +67,7 @@ export default class CSSBlocksService extends Service {
6867 classNames . push ( data . outputClassnames [ idx ] ) ;
6968 }
7069 let result = classNames . join ( " " ) ;
71- if ( DEBUGGING ) {
70+ if ( CSSBlocksService . enableDebugMode ) {
7271 console . log ( classNames ) ;
7372 }
7473 return result ;
@@ -93,7 +92,7 @@ export default class CSSBlocksService extends Service {
9392 * Reverse maps style ids to their style names for debugging.
9493 */
9594 debugStyles ( msg : string , stylesApplied : Set < number > ) : void {
96- if ( ! DEBUGGING ) return ;
95+ if ( ! CSSBlocksService . enableDebugMode ) return ;
9796 let appliedStyleNames = new Array < string > ( ) ;
9897 for ( let s of stylesApplied ) {
9998 appliedStyleNames . push ( this . styleNames [ s ] ) ;
0 commit comments