@@ -11,6 +11,7 @@ import {invalidDefinition, invalidKeyframes, invalidOffset, invalidParallelAnima
1111import { AnimationDriver } from '../render/animation_driver' ;
1212import { getOrSetAsInMap } from '../render/shared' ;
1313import { 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 ) {
@@ -303,7 +312,8 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
303312
304313 Object . keys ( tuple ) . forEach ( prop => {
305314 if ( ! this . _driver . validateStyleProperty ( prop ) ) {
306- context . errors . push ( invalidProperty ( prop ) ) ;
315+ delete tuple [ prop ] ;
316+ context . unsupportedCSSPropertiesFound . add ( prop ) ;
307317 return ;
308318 }
309319
@@ -507,6 +517,7 @@ export class AnimationAstBuilderContext {
507517 public currentTime : number = 0 ;
508518 public collectedStyles : { [ selectorName : string ] : { [ propName : string ] : StyleTimeTuple } } = { } ;
509519 public options : AnimationOptions | null = null ;
520+ public unsupportedCSSPropertiesFound : Set < string > = new Set < string > ( ) ;
510521 constructor ( public errors : Error [ ] ) { }
511522}
512523
0 commit comments