@@ -231,12 +231,14 @@ export class ElementAnalysis<BooleanExpression, StringExpression, TernaryExpress
231231
232232 private _sealed : boolean ;
233233
234+ private _reservedClassNames : Set < string > ;
235+
234236 /** whether all styles have been added and the styles can be analyzed now. */
235237 get sealed ( ) : boolean {
236238 return this . _sealed ;
237239 }
238240
239- constructor ( location : SourceLocation , tagName ?: string , id ?: string ) {
241+ constructor ( reservedClassNames : Set < string > , location : SourceLocation , tagName ?: string , id ?: string ) {
240242 this . id = id ;
241243 this . tagName = tagName ;
242244 this . sourceLocation = location ;
@@ -249,6 +251,7 @@ export class ElementAnalysis<BooleanExpression, StringExpression, TernaryExpress
249251 this . allAttributes = new Set ( ) ;
250252 this . addedStyles = new Array ( ) ;
251253 this . _sealed = false ;
254+ this . _reservedClassNames = reservedClassNames ;
252255 }
253256
254257 hasStyles ( ) : boolean {
@@ -818,15 +821,15 @@ export class ElementAnalysis<BooleanExpression, StringExpression, TernaryExpress
818821 let classes = new Array < AttributeValueSetItem > ( ) ;
819822 let classMap = new Map < string , Style > ( ) ;
820823 for ( let style of this . allStaticStyles ) {
821- let classNames = style . cssClassesWithAliases ( configuration ) ;
824+ let classNames = style . cssClassesWithAliases ( configuration , this . _reservedClassNames ) ;
822825 classNames . forEach ( className => {
823826 classes . push ( attrValues . constant ( className ) ) ;
824827 classMap . set ( className , style ) ;
825828 } ) ;
826829 }
827830
828- let mapper : ClassMapper = mapClasses . bind ( null , configuration , classMap ) ;
829- let choices : ChoiceMapper = mapChoiceClasses . bind ( null , configuration , classMap ) ;
831+ let mapper : ClassMapper = mapClasses . bind ( null , configuration , this . _reservedClassNames , classMap ) ;
832+ let choices : ChoiceMapper = mapChoiceClasses . bind ( null , configuration , this . _reservedClassNames , classMap ) ;
830833
831834 let depAttrsMap = new MultiMap < BlockClass , DynamicAttrs < BooleanExpression , StringExpression > > ( ) ;
832835 for ( let dynAttr of this . dynamicAttributes ) {
@@ -986,13 +989,15 @@ function addToSet(
986989type ClassMapper = ( style : Style ) => ValueConstant | AttributeValueSet ;
987990function mapClasses (
988991 configuration : ResolvedConfiguration ,
992+ reservedClassNames : Set < string > ,
989993 map : Map < string , Style > ,
990994 style : Style ,
991995) : ValueConstant | AttributeValueSet {
992996 let classes = new Array < string > ( ) ;
993997 let resolvedStyles = style . resolveStyles ( ) ;
994998 for ( let resolvedStyle of resolvedStyles ) {
995- let classNames = resolvedStyle . cssClassesWithAliases ( configuration ) ;
999+ // TODO: update with a non empty set here
1000+ let classNames = resolvedStyle . cssClassesWithAliases ( configuration , reservedClassNames ) ;
9961001 classNames . forEach ( cls => {
9971002 map . set ( cls , resolvedStyle ) ;
9981003 classes . push ( cls ) ;
@@ -1008,6 +1013,7 @@ function mapClasses(
10081013type ChoiceMapper = ( includeAbsent : boolean , ...styles : Style [ ] ) => AttributeValueChoice ;
10091014function mapChoiceClasses (
10101015 configuration : ResolvedConfiguration ,
1016+ reservedClassNames : Set < string > ,
10111017 map : Map < string , Style > ,
10121018 includeAbsent : boolean ,
10131019 /* tslint:disable-next-line */
@@ -1018,7 +1024,7 @@ function mapChoiceClasses(
10181024 choices . push ( attrValues . absent ( ) ) ;
10191025 }
10201026 for ( let style of styles ) {
1021- choices . push ( mapClasses ( configuration , map , style ) ) ;
1027+ choices . push ( mapClasses ( configuration , reservedClassNames , map , style ) ) ;
10221028 }
10231029 return attrValues . oneOf ( choices ) ;
10241030}
0 commit comments