import { isJsonExpr } from "./Expr" ; import { Style , Theme } from "./Theme" ; /**
 * The ThemeVisitor visits every style in the theme in a depth-first fashion.
 */ export class ThemeVisitor { constructor ( readonly theme ) { } param visitFunc returns visitStyles ( visitFunc ) { const visit = ( style ) : boolean => { if ( isJsonExpr ( style ) ) { return false ; } if ( visitFunc ( style ) ) { return true ; } return false ; } ; if ( this . theme . styles !== undefined ) { for ( const styleSetName in this . theme . styles ) { if ( this . theme . styles [ styleSetName ] !== undefined ) { for ( const style of this . theme . styles [ styleSetName ] ) { if ( visit ( style ) ) { return true ; } } } } } return false ; } }