Files
angular__angular/packages/animations/browser/src/render/animation_driver.ts
T
Alan Agius 6c84c5f513 fix(animations): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces.

See the below TypeScript playgrounds

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA
```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = new NullInjector();
console.log(Injector.NULL);

```

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA

```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = ( /* @__PURE__ */new NullInjector());
console.log(Injector.NULL);
```

PR Close #43344
2021-09-09 09:21:24 -07:00

66 lines
2.0 KiB
TypeScript

/**
* @license
* Copyright Google LLC 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
*/
import {AnimationPlayer, NoopAnimationPlayer} from '@angular/animations';
import {Injectable} from '@angular/core';
import {containsElement, invokeQuery, matchesElement, validateStyleProperty} from './shared';
/**
* @publicApi
*/
@Injectable()
export class NoopAnimationDriver implements AnimationDriver {
validateStyleProperty(prop: string): boolean {
return validateStyleProperty(prop);
}
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);
}
computeStyle(element: any, prop: string, defaultValue?: string): string {
return defaultValue || '';
}
animate(
element: any, keyframes: {[key: string]: string|number}[], duration: number, delay: number,
easing: string, previousPlayers: any[] = [],
scrubberAccessRequested?: boolean): AnimationPlayer {
return new NoopAnimationPlayer(duration, delay);
}
}
/**
* @publicApi
*/
export abstract class AnimationDriver {
static NOOP: AnimationDriver = (/* @__PURE__ */ new NoopAnimationDriver());
abstract validateStyleProperty(prop: string): boolean;
abstract matchesElement(element: any, selector: string): boolean;
abstract containsElement(elm1: any, elm2: any): boolean;
abstract query(element: any, selector: string, multi: boolean): any[];
abstract computeStyle(element: any, prop: string, defaultValue?: string): string;
abstract animate(
element: any, keyframes: {[key: string]: string|number}[], duration: number, delay: number,
easing?: string|null, previousPlayers?: any[], scrubberAccessRequested?: boolean): any;
}