import { AnimationTriggerMetadata } from '@angular/animations' ; import { AnimationDriver , ɵAnimationEngine as AnimationEngine , ɵAnimationStyleNormalizer as AnimationStyleNormalizer } from '@angular/animations/browser' ; import { AnimationEngineAdapter , ObjectStore , SerializerTypes } from '../shared' ; import { fnArg } from '../shared/api' ; export class ServerAnimationEngine extends AnimationEngine { onRemovalComplete : ( element : any , context : any ) => void ; constructor ( bodyNode , driver , normalizer , private adapter , private store ) { super ( bodyNode , driver , normalizer ) ; this . onRemovalComplete = ( element , context ) => { this . adapter . onRemovalComplete ( fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( context , SerializerTypes . STORE_OBJECT ) ) ; } ; } destroy ( namespaceId , context ) { this . adapter . destroy ( fnArg ( namespaceId ) , fnArg ( context , SerializerTypes . STORE_OBJECT ) ) ; } disableAnimations ( element , disable ) { this . adapter . disableAnimations ( fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( disable ) ) ; } flush ( microtaskId ? ) { this . adapter . flush ( fnArg ( microtaskId ) ) ; } listen ( namespaceId , element , eventName , eventPhase , callback ) { const listenId = this . allocateId ( ) ; const unlisten = element . events . listen ( eventName , callback ) ; this . adapter . listen ( fnArg ( namespaceId ) , fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( eventName ) , fnArg ( eventPhase ) , fnArg ( listenId ) ) ; return ( ) => { this . adapter . unlisten ( fnArg ( listenId ) ) ; unlisten ( ) ; } ; } onInsert ( namespaceId , element , parent , insertBefore ) { this . adapter . onInsert ( fnArg ( namespaceId ) , fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( parent , SerializerTypes . STORE_OBJECT ) , fnArg ( insertBefore ) ) ; } onRemove ( namespaceId , element , context , isHostElement ? ) { this . adapter . onRemove ( fnArg ( namespaceId ) , fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( context , SerializerTypes . STORE_OBJECT ) , fnArg ( isHostElement ) ) ; } process ( namespaceId , element , property , value ) { this . adapter . process ( fnArg ( namespaceId ) , fnArg ( element , SerializerTypes . STORE_OBJECT ) , fnArg ( property ) , fnArg ( value ) ) ; } register ( namespaceId , hostElement ) { this . adapter . register ( fnArg ( namespaceId ) , fnArg ( hostElement , SerializerTypes . STORE_OBJECT ) ) ; } registerTrigger ( componentId , namespaceId , hostElement , name , metadata ) { this . adapter . registerTrigger ( fnArg ( componentId ) , fnArg ( namespaceId ) , fnArg ( hostElement , SerializerTypes . STORE_OBJECT ) , fnArg ( name ) , fnArg ( metadata ) ) ; } whenRenderingDone ( ) { return undefined ; } private allocateId ( ) { return this . store . allocateId ( ) ; } }