@@ -140,9 +140,9 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
140140 if ( supportsPressRipple ) {
141141 const { ROOT , UNBOUNDED } = MDCRippleFoundation . cssClasses ;
142142 requestAnimationFrame ( ( ) => {
143- this . adapter_ . addClass ( ROOT ) ;
144- if ( this . adapter_ . isUnbounded ( ) ) {
145- this . adapter_ . addClass ( UNBOUNDED ) ;
143+ this . adapter . addClass ( ROOT ) ;
144+ if ( this . adapter . isUnbounded ( ) ) {
145+ this . adapter . addClass ( UNBOUNDED ) ;
146146 // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
147147 this . layoutInternal_ ( ) ;
148148 }
@@ -155,19 +155,20 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
155155 if ( this . activationTimer_ ) {
156156 clearTimeout ( this . activationTimer_ ) ;
157157 this . activationTimer_ = 0 ;
158- this . adapter_ . removeClass ( MDCRippleFoundation . cssClasses . FG_ACTIVATION ) ;
158+ this . adapter . removeClass ( MDCRippleFoundation . cssClasses . FG_ACTIVATION ) ;
159159 }
160160
161161 if ( this . fgDeactivationRemovalTimer_ ) {
162162 clearTimeout ( this . fgDeactivationRemovalTimer_ ) ;
163163 this . fgDeactivationRemovalTimer_ = 0 ;
164- this . adapter_ . removeClass ( MDCRippleFoundation . cssClasses . FG_DEACTIVATION ) ;
164+ this . adapter . removeClass (
165+ MDCRippleFoundation . cssClasses . FG_DEACTIVATION ) ;
165166 }
166167
167168 const { ROOT , UNBOUNDED } = MDCRippleFoundation . cssClasses ;
168169 requestAnimationFrame ( ( ) => {
169- this . adapter_ . removeClass ( ROOT ) ;
170- this . adapter_ . removeClass ( UNBOUNDED ) ;
170+ this . adapter . removeClass ( ROOT ) ;
171+ this . adapter . removeClass ( UNBOUNDED ) ;
171172 this . removeCssVars_ ( ) ;
172173 } ) ;
173174 }
@@ -200,20 +201,21 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
200201 setUnbounded ( unbounded : boolean ) : void {
201202 const { UNBOUNDED } = MDCRippleFoundation . cssClasses ;
202203 if ( unbounded ) {
203- this . adapter_ . addClass ( UNBOUNDED ) ;
204+ this . adapter . addClass ( UNBOUNDED ) ;
204205 } else {
205- this . adapter_ . removeClass ( UNBOUNDED ) ;
206+ this . adapter . removeClass ( UNBOUNDED ) ;
206207 }
207208 }
208209
209210 handleFocus ( ) : void {
210- requestAnimationFrame ( ( ) =>
211- this . adapter_ . addClass ( MDCRippleFoundation . cssClasses . BG_FOCUSED ) ) ;
211+ requestAnimationFrame (
212+ ( ) => this . adapter . addClass ( MDCRippleFoundation . cssClasses . BG_FOCUSED ) ) ;
212213 }
213214
214215 handleBlur ( ) : void {
215- requestAnimationFrame ( ( ) =>
216- this . adapter_ . removeClass ( MDCRippleFoundation . cssClasses . BG_FOCUSED ) ) ;
216+ requestAnimationFrame (
217+ ( ) => this . adapter . removeClass (
218+ MDCRippleFoundation . cssClasses . BG_FOCUSED ) ) ;
217219 }
218220
219221 /**
@@ -223,7 +225,7 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
223225 * and then initialized at mount time on the client.
224226 */
225227 private supportsPressRipple_ ( ) : boolean {
226- return this . adapter_ . browserSupportsCssVars ( ) ;
228+ return this . adapter . browserSupportsCssVars ( ) ;
227229 }
228230
229231 private defaultActivationState_ ( ) : ActivationStateType {
@@ -243,43 +245,45 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
243245 private registerRootHandlers_ ( supportsPressRipple : boolean ) {
244246 if ( supportsPressRipple ) {
245247 ACTIVATION_EVENT_TYPES . forEach ( ( evtType ) => {
246- this . adapter_ . registerInteractionHandler ( evtType , this . activateHandler_ ) ;
248+ this . adapter . registerInteractionHandler ( evtType , this . activateHandler_ ) ;
247249 } ) ;
248- if ( this . adapter_ . isUnbounded ( ) ) {
249- this . adapter_ . registerResizeHandler ( this . resizeHandler_ ) ;
250+ if ( this . adapter . isUnbounded ( ) ) {
251+ this . adapter . registerResizeHandler ( this . resizeHandler_ ) ;
250252 }
251253 }
252254
253- this . adapter_ . registerInteractionHandler ( 'focus' , this . focusHandler_ ) ;
254- this . adapter_ . registerInteractionHandler ( 'blur' , this . blurHandler_ ) ;
255+ this . adapter . registerInteractionHandler ( 'focus' , this . focusHandler_ ) ;
256+ this . adapter . registerInteractionHandler ( 'blur' , this . blurHandler_ ) ;
255257 }
256258
257259 private registerDeactivationHandlers_ ( evt : Event ) {
258260 if ( evt . type === 'keydown' ) {
259- this . adapter_ . registerInteractionHandler ( 'keyup' , this . deactivateHandler_ ) ;
261+ this . adapter . registerInteractionHandler ( 'keyup' , this . deactivateHandler_ ) ;
260262 } else {
261263 POINTER_DEACTIVATION_EVENT_TYPES . forEach ( ( evtType ) => {
262- this . adapter_ . registerDocumentInteractionHandler ( evtType , this . deactivateHandler_ ) ;
264+ this . adapter . registerDocumentInteractionHandler (
265+ evtType , this . deactivateHandler_ ) ;
263266 } ) ;
264267 }
265268 }
266269
267270 private deregisterRootHandlers_ ( ) {
268271 ACTIVATION_EVENT_TYPES . forEach ( ( evtType ) => {
269- this . adapter_ . deregisterInteractionHandler ( evtType , this . activateHandler_ ) ;
272+ this . adapter . deregisterInteractionHandler ( evtType , this . activateHandler_ ) ;
270273 } ) ;
271- this . adapter_ . deregisterInteractionHandler ( 'focus' , this . focusHandler_ ) ;
272- this . adapter_ . deregisterInteractionHandler ( 'blur' , this . blurHandler_ ) ;
274+ this . adapter . deregisterInteractionHandler ( 'focus' , this . focusHandler_ ) ;
275+ this . adapter . deregisterInteractionHandler ( 'blur' , this . blurHandler_ ) ;
273276
274- if ( this . adapter_ . isUnbounded ( ) ) {
275- this . adapter_ . deregisterResizeHandler ( this . resizeHandler_ ) ;
277+ if ( this . adapter . isUnbounded ( ) ) {
278+ this . adapter . deregisterResizeHandler ( this . resizeHandler_ ) ;
276279 }
277280 }
278281
279282 private deregisterDeactivationHandlers_ ( ) {
280- this . adapter_ . deregisterInteractionHandler ( 'keyup' , this . deactivateHandler_ ) ;
283+ this . adapter . deregisterInteractionHandler ( 'keyup' , this . deactivateHandler_ ) ;
281284 POINTER_DEACTIVATION_EVENT_TYPES . forEach ( ( evtType ) => {
282- this . adapter_ . deregisterDocumentInteractionHandler ( evtType , this . deactivateHandler_ ) ;
285+ this . adapter . deregisterDocumentInteractionHandler (
286+ evtType , this . deactivateHandler_ ) ;
283287 } ) ;
284288 }
285289
@@ -288,13 +292,13 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
288292 const keys = Object . keys ( rippleStrings ) as Array < keyof typeof rippleStrings > ;
289293 keys . forEach ( ( key ) => {
290294 if ( key . indexOf ( 'VAR_' ) === 0 ) {
291- this . adapter_ . updateCssVariable ( rippleStrings [ key ] , null ) ;
295+ this . adapter . updateCssVariable ( rippleStrings [ key ] , null ) ;
292296 }
293297 } ) ;
294298 }
295299
296300 private activate_ ( evt ?: Event ) {
297- if ( this . adapter_ . isSurfaceDisabled ( ) ) {
301+ if ( this . adapter . isSurfaceDisabled ( ) ) {
298302 return ;
299303 }
300304
@@ -317,8 +321,10 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
317321 evt . type === 'mousedown' || evt . type === 'touchstart' || evt . type === 'pointerdown'
318322 ) ;
319323
320- const hasActivatedChild = evt !== undefined && activatedTargets . length > 0 && activatedTargets . some (
321- ( target ) => this . adapter_ . containsEventTarget ( target ) ) ;
324+ const hasActivatedChild = evt !== undefined &&
325+ activatedTargets . length > 0 &&
326+ activatedTargets . some (
327+ ( target ) => this . adapter . containsEventTarget ( target ) ) ;
322328 if ( hasActivatedChild ) {
323329 // Immediately reset activation state, while preserving logic that prevents touch follow-on events
324330 this . resetActivationState_ ( ) ;
@@ -362,7 +368,9 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
362368 }
363369
364370 private checkElementMadeActive_ ( evt ?: Event ) {
365- return ( evt !== undefined && evt . type === 'keydown' ) ? this . adapter_ . isSurfaceActive ( ) : true ;
371+ return ( evt !== undefined && evt . type === 'keydown' ) ?
372+ this . adapter . isSurfaceActive ( ) :
373+ true ;
366374 }
367375
368376 private animateActivation_ ( ) {
@@ -375,23 +383,23 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
375383 let translateStart = '' ;
376384 let translateEnd = '' ;
377385
378- if ( ! this . adapter_ . isUnbounded ( ) ) {
386+ if ( ! this . adapter . isUnbounded ( ) ) {
379387 const { startPoint, endPoint} = this . getFgTranslationCoordinates_ ( ) ;
380388 translateStart = `${ startPoint . x } px, ${ startPoint . y } px` ;
381389 translateEnd = `${ endPoint . x } px, ${ endPoint . y } px` ;
382390 }
383391
384- this . adapter_ . updateCssVariable ( VAR_FG_TRANSLATE_START , translateStart ) ;
385- this . adapter_ . updateCssVariable ( VAR_FG_TRANSLATE_END , translateEnd ) ;
392+ this . adapter . updateCssVariable ( VAR_FG_TRANSLATE_START , translateStart ) ;
393+ this . adapter . updateCssVariable ( VAR_FG_TRANSLATE_END , translateEnd ) ;
386394 // Cancel any ongoing activation/deactivation animations
387395 clearTimeout ( this . activationTimer_ ) ;
388396 clearTimeout ( this . fgDeactivationRemovalTimer_ ) ;
389397 this . rmBoundedActivationClasses_ ( ) ;
390- this . adapter_ . removeClass ( FG_DEACTIVATION ) ;
398+ this . adapter . removeClass ( FG_DEACTIVATION ) ;
391399
392400 // Force layout in order to re-trigger the animation.
393- this . adapter_ . computeBoundingRect ( ) ;
394- this . adapter_ . addClass ( FG_ACTIVATION ) ;
401+ this . adapter . computeBoundingRect ( ) ;
402+ this . adapter . addClass ( FG_ACTIVATION ) ;
395403 this . activationTimer_ = setTimeout ( ( ) => this . activationTimerCallback_ ( ) , DEACTIVATION_TIMEOUT_MS ) ;
396404 }
397405
@@ -402,8 +410,8 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
402410 if ( wasActivatedByPointer ) {
403411 startPoint = getNormalizedEventCoords (
404412 activationEvent ,
405- this . adapter_ . getWindowPageOffset ( ) ,
406- this . adapter_ . computeBoundingRect ( ) ,
413+ this . adapter . getWindowPageOffset ( ) ,
414+ this . adapter . computeBoundingRect ( ) ,
407415 ) ;
408416 } else {
409417 startPoint = {
@@ -434,18 +442,18 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
434442
435443 if ( activationHasEnded && this . activationAnimationHasEnded_ ) {
436444 this . rmBoundedActivationClasses_ ( ) ;
437- this . adapter_ . addClass ( FG_DEACTIVATION ) ;
445+ this . adapter . addClass ( FG_DEACTIVATION ) ;
438446 this . fgDeactivationRemovalTimer_ = setTimeout ( ( ) => {
439- this . adapter_ . removeClass ( FG_DEACTIVATION ) ;
447+ this . adapter . removeClass ( FG_DEACTIVATION ) ;
440448 } , numbers . FG_DEACTIVATION_MS ) ;
441449 }
442450 }
443451
444452 private rmBoundedActivationClasses_ ( ) {
445453 const { FG_ACTIVATION } = MDCRippleFoundation . cssClasses ;
446- this . adapter_ . removeClass ( FG_ACTIVATION ) ;
454+ this . adapter . removeClass ( FG_ACTIVATION ) ;
447455 this . activationAnimationHasEnded_ = false ;
448- this . adapter_ . computeBoundingRect ( ) ;
456+ this . adapter . computeBoundingRect ( ) ;
449457 }
450458
451459 private resetActivationState_ ( ) {
@@ -485,7 +493,7 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
485493 }
486494
487495 private layoutInternal_ ( ) {
488- this . frame_ = this . adapter_ . computeBoundingRect ( ) ;
496+ this . frame_ = this . adapter . computeBoundingRect ( ) ;
489497 const maxDim = Math . max ( this . frame_ . height , this . frame_ . width ) ;
490498
491499 // Surface diameter is treated differently for unbounded vs. bounded ripples.
@@ -499,12 +507,12 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
499507 return hypotenuse + MDCRippleFoundation . numbers . PADDING ;
500508 } ;
501509
502- this . maxRadius_ = this . adapter_ . isUnbounded ( ) ? maxDim : getBoundedRadius ( ) ;
510+ this . maxRadius_ = this . adapter . isUnbounded ( ) ? maxDim : getBoundedRadius ( ) ;
503511
504512 // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
505513 const initialSize = Math . floor ( maxDim * MDCRippleFoundation . numbers . INITIAL_ORIGIN_SCALE ) ;
506514 // Unbounded ripple size should always be even number to equally center align.
507- if ( this . adapter_ . isUnbounded ( ) && initialSize % 2 !== 0 ) {
515+ if ( this . adapter . isUnbounded ( ) && initialSize % 2 !== 0 ) {
508516 this . initialSize_ = initialSize - 1 ;
509517 } else {
510518 this . initialSize_ = initialSize ;
@@ -519,17 +527,18 @@ export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
519527 VAR_FG_SIZE , VAR_LEFT , VAR_TOP , VAR_FG_SCALE ,
520528 } = MDCRippleFoundation . strings ;
521529
522- this . adapter_ . updateCssVariable ( VAR_FG_SIZE , `${ this . initialSize_ } px` ) ;
523- this . adapter_ . updateCssVariable ( VAR_FG_SCALE , this . fgScale_ ) ;
530+ this . adapter . updateCssVariable ( VAR_FG_SIZE , `${ this . initialSize_ } px` ) ;
531+ this . adapter . updateCssVariable ( VAR_FG_SCALE , this . fgScale_ ) ;
524532
525- if ( this . adapter_ . isUnbounded ( ) ) {
533+ if ( this . adapter . isUnbounded ( ) ) {
526534 this . unboundedCoords_ = {
527535 left : Math . round ( ( this . frame_ . width / 2 ) - ( this . initialSize_ / 2 ) ) ,
528536 top : Math . round ( ( this . frame_ . height / 2 ) - ( this . initialSize_ / 2 ) ) ,
529537 } ;
530538
531- this . adapter_ . updateCssVariable ( VAR_LEFT , `${ this . unboundedCoords_ . left } px` ) ;
532- this . adapter_ . updateCssVariable ( VAR_TOP , `${ this . unboundedCoords_ . top } px` ) ;
539+ this . adapter . updateCssVariable (
540+ VAR_LEFT , `${ this . unboundedCoords_ . left } px` ) ;
541+ this . adapter . updateCssVariable ( VAR_TOP , `${ this . unboundedCoords_ . top } px` ) ;
533542 }
534543 }
535544}
0 commit comments