license import { MDCFoundation } from '@material/base/foundation' ; import { SpecificEventListener } from '@material/base/types' ; import { MDCLineRippleAdapter } from './adapter' ; import { cssClasses } from './constants' ; export class MDCLineRippleFoundation extends MDCFoundation < MDCLineRippleAdapter > { static override get cssClasses ( ) { return cssClasses ; } /**
     * See  MDCLineRippleAdapter for typing information on parameters and return types.
      static override get defaultAdapter ( ) : MDCLineRippleAdapter { return { addClass : ( ) => undefined , removeClass : ( ) => undefined , hasClass : ( ) => false , setStyle : ( ) => undefined , registerEventHandler : ( ) => undefined , deregisterEventHandler : ( ) => undefined , } ; } private readonly transitionEndHandler : SpecificEventListener < 'transitionend' > ; constructor ( adapter ? ) { super ( { ... MDCLineRippleFoundation . defaultAdapter , ... adapter } ) ; this . transitionEndHandler = ( evt ) => { this . handleTransitionEnd ( evt ) ; } ; } override init ( ) { this . adapter . registerEventHandler ( 'transitionend' , this . transitionEndHandler ) ; } override destroy ( ) { this . adapter . deregisterEventHandler ( 'transitionend' , this . transitionEndHandler ) ; } activate ( ) { this . adapter . removeClass ( cssClasses . LINE_RIPPLE_DEACTIVATING ) ; this . adapter . addClass ( cssClasses . LINE_RIPPLE_ACTIVE ) ; } setRippleCenter ( xCoordinate ) { this . adapter . setStyle ( 'transform-origin' , `${ xCoordinate }px center` ) ; } deactivate ( ) { this . adapter . addClass ( cssClasses . LINE_RIPPLE_DEACTIVATING ) ; } handleTransitionEnd ( evt ) { const isDeactivating = this . adapter . hasClass ( cssClasses . LINE_RIPPLE_DEACTIVATING ) ; if ( evt . propertyName === 'opacity' ) { if ( isDeactivating ) { this . adapter . removeClass ( cssClasses . LINE_RIPPLE_ACTIVE ) ; this . adapter . removeClass ( cssClasses . LINE_RIPPLE_DEACTIVATING ) ; } } } } export default MDCLineRippleFoundation ;