Revert "refactor(platform-browser): move platform-browser/animations to animations/browser (#15043)"
This reverts commit 195b863ea4
.
This commit is contained in:
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of the platform-browser/animations/testing package.
|
||||
*/
|
||||
|
||||
export * from './src/testing';
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"typings": "../../typings/animations/testing.d.ts",
|
||||
"main": "../../bundles/platform-browser-animations-testing.umd.js",
|
||||
"module": "../../@angular/platform-browser/animations/testing.es5.js",
|
||||
"es2015": "../../@angular/platform-browser/animations/testing.js"
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
export default {
|
||||
entry:
|
||||
'../../../../dist/packages-dist/platform-browser/@angular/platform-browser/animations/testing.es5.js',
|
||||
dest:
|
||||
'../../../../dist/packages-dist/platform-browser/bundles/platform-browser-animations-testing.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.platformBrowser.testing',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/platform-browser': 'ng.platformBrowser'
|
||||
}
|
||||
};
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
import {AUTO_STYLE, AnimationPlayer, NoopAnimationPlayer, ɵStyleData} from '@angular/animations';
|
||||
|
||||
import {AnimationDriver} from '../src/render/animation_driver';
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
export class MockAnimationDriver implements AnimationDriver {
|
||||
static log: AnimationPlayer[] = [];
|
||||
|
||||
animate(
|
||||
element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number,
|
||||
easing: string, previousPlayers: any[] = []): MockAnimationPlayer {
|
||||
const player =
|
||||
new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
|
||||
MockAnimationDriver.log.push(<AnimationPlayer>player);
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
export class MockAnimationPlayer extends NoopAnimationPlayer {
|
||||
private __finished = false;
|
||||
public previousStyles: {[key: string]: string | number} = {};
|
||||
|
||||
constructor(
|
||||
public element: any, public keyframes: {[key: string]: string | number}[],
|
||||
public duration: number, public delay: number, public easing: string,
|
||||
public previousPlayers: any[]) {
|
||||
super();
|
||||
previousPlayers.forEach(player => {
|
||||
if (player instanceof MockAnimationPlayer) {
|
||||
const styles = player._captureStyles();
|
||||
Object.keys(styles).forEach(prop => { this.previousStyles[prop] = styles[prop]; });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
finish(): void {
|
||||
super.finish();
|
||||
this.__finished = true;
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
super.destroy();
|
||||
this.__finished = true;
|
||||
}
|
||||
|
||||
private _captureStyles(): {[styleName: string]: string | number} {
|
||||
const captures: ɵStyleData = {};
|
||||
|
||||
Object.keys(this.previousStyles).forEach(prop => {
|
||||
captures[prop] = this.previousStyles[prop];
|
||||
});
|
||||
|
||||
if (this.hasStarted()) {
|
||||
// when assembling the captured styles, it's important that
|
||||
// we build the keyframe styles in the following order:
|
||||
// {other styles within keyframes, ... previousStyles }
|
||||
this.keyframes.forEach(kf => {
|
||||
Object.keys(kf).forEach(prop => {
|
||||
if (prop != 'offset') {
|
||||
captures[prop] = this.__finished ? kf[prop] : AUTO_STYLE;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return captures;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
export {MockAnimationDriver, MockAnimationPlayer} from './mock_animation_driver';
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig-build",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../dist/packages-dist/animations",
|
||||
"paths": {
|
||||
"@angular/animations": ["../../../dist/packages-dist/animations"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"browser/testing/index.ts",
|
||||
"../../../node_modules/@types/hammerjs/index.d.ts",
|
||||
"../../../node_modules/@types/jasmine/index.d.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"strictMetadataEmit": true
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user