@@ -11,6 +11,7 @@ import {invalidDefinition, invalidKeyframes, invalidOffset, invalidParallelAnima
1111import { AnimationDriver } from '../render/animation_driver' ;
1212import { getOrSetDefaultValue } from '../render/shared' ;
1313import { convertToMap , copyObj , extractStyleParams , iteratorToArray , NG_ANIMATING_SELECTOR , NG_TRIGGER_SELECTOR , normalizeAnimationEntry , resolveTiming , SUBSTITUTION_EXPR_START , validateStyleParams , visitDslNode } from '../util' ;
14+ import { pushUnrecognizedPropertiesWarning } from '../warning_helpers' ;
1415
1516import { AnimateAst , AnimateChildAst , AnimateRefAst , Ast , DynamicTimingAst , GroupAst , KeyframesAst , QueryAst , ReferenceAst , SequenceAst , StaggerAst , StateAst , StyleAst , TimingAst , TransitionAst , TriggerAst } from './animation_ast' ;
1617import { AnimationDslVisitor } from './animation_dsl_visitor' ;
@@ -56,22 +57,30 @@ const SELF_TOKEN_REGEX = new RegExp(`\s*${SELF_TOKEN}\s*,?`, 'g');
5657 * Otherwise an error will be thrown.
5758 */
5859export function buildAnimationAst (
59- driver : AnimationDriver , metadata : AnimationMetadata | AnimationMetadata [ ] ,
60- errors : Error [ ] ) : Ast < AnimationMetadataType > {
61- return new AnimationAstBuilderVisitor ( driver ) . build ( metadata , errors ) ;
60+ driver : AnimationDriver , metadata : AnimationMetadata | AnimationMetadata [ ] , errors : Error [ ] ,
61+ warnings : string [ ] ) : Ast < AnimationMetadataType > {
62+ return new AnimationAstBuilderVisitor ( driver ) . build ( metadata , errors , warnings ) ;
6263}
6364
6465const ROOT_SELECTOR = '' ;
6566
6667export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
6768 constructor ( private _driver : AnimationDriver ) { }
6869
69- build ( metadata : AnimationMetadata | AnimationMetadata [ ] , errors : Error [ ] ) :
70+ build ( metadata : AnimationMetadata | AnimationMetadata [ ] , errors : Error [ ] , warnings : string [ ] ) :
7071 Ast < AnimationMetadataType > {
7172 const context = new AnimationAstBuilderContext ( errors ) ;
7273 this . _resetContextStyleTimingState ( context ) ;
73- return < Ast < AnimationMetadataType > > visitDslNode (
74- this , normalizeAnimationEntry ( metadata ) , context ) ;
74+ const ast =
75+ < Ast < AnimationMetadataType > > visitDslNode ( this , normalizeAnimationEntry ( metadata ) , context ) ;
76+
77+ if ( context . unsupportedCSSPropertiesFound . size ) {
78+ pushUnrecognizedPropertiesWarning (
79+ warnings ,
80+ [ ...context . unsupportedCSSPropertiesFound . keys ( ) ] ,
81+ ) ;
82+ }
83+ return ast ;
7584 }
7685
7786 private _resetContextStyleTimingState ( context : AnimationAstBuilderContext ) {
@@ -297,7 +306,8 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
297306
298307 tuple . forEach ( ( value , prop ) => {
299308 if ( ! this . _driver . validateStyleProperty ( prop ) ) {
300- context . errors . push ( invalidProperty ( prop ) ) ;
309+ tuple . delete ( prop ) ;
310+ context . unsupportedCSSPropertiesFound . add ( prop ) ;
301311 return ;
302312 }
303313
@@ -503,6 +513,7 @@ export class AnimationAstBuilderContext {
503513 public currentTime : number = 0 ;
504514 public collectedStyles = new Map < string , Map < string , StyleTimeTuple > > ( ) ;
505515 public options : AnimationOptions | null = null ;
516+ public unsupportedCSSPropertiesFound : Set < string > = new Set < string > ( ) ;
506517 constructor ( public errors : Error [ ] ) { }
507518}
508519
0 commit comments