2017-02-22 15:14:49 -08:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
2017-02-24 00:32:19 -08:00
|
|
|
import {AnimationPlayer, NoopAnimationPlayer} from '@angular/animations';
|
2018-02-02 09:15:08 -08:00
|
|
|
import {Injectable} from '@angular/core';
|
2017-02-22 15:14:49 -08:00
|
|
|
|
2017-08-15 16:11:11 -07:00
|
|
|
import {containsElement, invokeQuery, matchesElement, validateStyleProperty} from './shared';
|
2017-02-22 15:14:49 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @experimental
|
|
|
|
*/
|
2018-02-02 09:15:08 -08:00
|
|
|
@Injectable()
|
2017-02-24 00:32:19 -08:00
|
|
|
export class NoopAnimationDriver implements AnimationDriver {
|
2017-08-15 16:11:11 -07:00
|
|
|
validateStyleProperty(prop: string): boolean { return validateStyleProperty(prop); }
|
|
|
|
|
2017-05-02 15:45:48 -07:00
|
|
|
matchesElement(element: any, selector: string): boolean {
|
|
|
|
return matchesElement(element, selector);
|
|
|
|
}
|
|
|
|
|
|
|
|
containsElement(elm1: any, elm2: any): boolean { return containsElement(elm1, elm2); }
|
|
|
|
|
|
|
|
query(element: any, selector: string, multi: boolean): any[] {
|
|
|
|
return invokeQuery(element, selector, multi);
|
|
|
|
}
|
|
|
|
|
2017-04-26 10:44:28 -07:00
|
|
|
computeStyle(element: any, prop: string, defaultValue?: string): string {
|
|
|
|
return defaultValue || '';
|
|
|
|
}
|
|
|
|
|
2017-02-22 15:14:49 -08:00
|
|
|
animate(
|
|
|
|
element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number,
|
|
|
|
easing: string, previousPlayers: any[] = []): AnimationPlayer {
|
2017-02-24 00:32:19 -08:00
|
|
|
return new NoopAnimationPlayer();
|
2017-02-22 15:14:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @experimental
|
|
|
|
*/
|
|
|
|
export abstract class AnimationDriver {
|
2017-02-24 00:32:19 -08:00
|
|
|
static NOOP: AnimationDriver = new NoopAnimationDriver();
|
2017-04-26 10:44:28 -07:00
|
|
|
|
2017-08-15 16:11:11 -07:00
|
|
|
abstract validateStyleProperty(prop: string): boolean;
|
|
|
|
|
2017-05-02 15:45:48 -07:00
|
|
|
abstract matchesElement(element: any, selector: string): boolean;
|
|
|
|
|
|
|
|
abstract containsElement(elm1: any, elm2: any): boolean;
|
|
|
|
|
|
|
|
abstract query(element: any, selector: string, multi: boolean): any[];
|
|
|
|
|
2017-04-26 10:44:28 -07:00
|
|
|
abstract computeStyle(element: any, prop: string, defaultValue?: string): string;
|
|
|
|
|
2017-02-22 15:14:49 -08:00
|
|
|
abstract animate(
|
|
|
|
element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number,
|
2017-03-24 09:56:34 -07:00
|
|
|
easing?: string|null, previousPlayers?: any[]): any;
|
2017-02-22 15:14:49 -08:00
|
|
|
}
|