refactor(platform-browser): extract animations providers into separate file
This is needed so that we can use them in a local modification in G3. Attention: This change will conflict with a local mod in G3.
This commit is contained in:
parent
932a02f1c5
commit
8824e39325
|
@ -11,7 +11,6 @@
|
|||
* @description
|
||||
* Entry point for all animation APIs of the animation browser package.
|
||||
*/
|
||||
export {BrowserAnimationsModule} from './browser_animations_module';
|
||||
export {NoopAnimationsModule} from './noop_animations_module';
|
||||
export {BrowserAnimationsModule, NoopAnimationsModule} from './module';
|
||||
export {AnimationDriver} from './render/animation_driver';
|
||||
export * from './private_export';
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* @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 {NgModule} from '@angular/core';
|
||||
import {BrowserModule, ɵDomRendererFactoryV2} from '@angular/platform-browser';
|
||||
|
||||
import {BROWSER_ANIMATIONS_PROVIDERS, BROWSER_NOOP_ANIMATIONS_PROVIDERS} from './providers';
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
@NgModule({
|
||||
imports: [BrowserModule],
|
||||
providers: BROWSER_ANIMATIONS_PROVIDERS,
|
||||
})
|
||||
export class BrowserAnimationsModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
@NgModule({
|
||||
imports: [BrowserModule],
|
||||
providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,
|
||||
})
|
||||
export class NoopAnimationsModule {
|
||||
}
|
|
@ -1,34 +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 {NgModule, NgZone, RendererFactoryV2} from '@angular/core';
|
||||
import {BrowserModule, ɵDomRendererFactoryV2} from '@angular/platform-browser';
|
||||
|
||||
import {AnimationEngine} from './animation_engine';
|
||||
import {AnimationRendererFactory} from './render/animation_renderer';
|
||||
import {NoopAnimationEngine} from './render/noop_animation_engine';
|
||||
|
||||
export function instantiateRendererFactory(
|
||||
renderer: ɵDomRendererFactoryV2, engine: AnimationEngine, zone: NgZone) {
|
||||
return new AnimationRendererFactory(renderer, engine, zone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
@NgModule({
|
||||
imports: [BrowserModule],
|
||||
providers: [
|
||||
{provide: AnimationEngine, useClass: NoopAnimationEngine}, {
|
||||
provide: RendererFactoryV2,
|
||||
useFactory: instantiateRendererFactory,
|
||||
deps: [ɵDomRendererFactoryV2, AnimationEngine, NgZone]
|
||||
}
|
||||
]
|
||||
})
|
||||
export class NoopAnimationsModule {
|
||||
}
|
|
@ -5,8 +5,9 @@
|
|||
* 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 {Injectable, NgModule, NgZone, RendererFactoryV2} from '@angular/core';
|
||||
import {BrowserModule, ɵDomRendererFactoryV2} from '@angular/platform-browser';
|
||||
|
||||
import {Injectable, NgZone, Provider, RendererFactoryV2} from '@angular/core';
|
||||
import {ɵDomRendererFactoryV2} from '@angular/platform-browser';
|
||||
|
||||
import {AnimationEngine} from './animation_engine';
|
||||
import {AnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer';
|
||||
|
@ -14,6 +15,7 @@ import {WebAnimationsStyleNormalizer} from './dsl/style_normalization/web_animat
|
|||
import {AnimationDriver, NoopAnimationDriver} from './render/animation_driver';
|
||||
import {AnimationRendererFactory} from './render/animation_renderer';
|
||||
import {DomAnimationEngine} from './render/dom_animation_engine';
|
||||
import {NoopAnimationEngine} from './render/noop_animation_engine';
|
||||
import {WebAnimationsDriver, supportsWebAnimations} from './render/web_animations/web_animations_driver';
|
||||
|
||||
@Injectable()
|
||||
|
@ -40,11 +42,10 @@ export function instantiateRendererFactory(
|
|||
}
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
* Separate providers from the actual module so that we can do a local modification in Google3 to
|
||||
* include them in the BrowserModule.
|
||||
*/
|
||||
@NgModule({
|
||||
imports: [BrowserModule],
|
||||
providers: [
|
||||
export const BROWSER_ANIMATIONS_PROVIDERS: Provider[] = [
|
||||
{provide: AnimationDriver, useFactory: instantiateSupportedAnimationDriver},
|
||||
{provide: AnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer},
|
||||
{provide: AnimationEngine, useClass: InjectableAnimationEngine}, {
|
||||
|
@ -52,7 +53,16 @@ export function instantiateRendererFactory(
|
|||
useFactory: instantiateRendererFactory,
|
||||
deps: [ɵDomRendererFactoryV2, AnimationEngine, NgZone]
|
||||
}
|
||||
]
|
||||
})
|
||||
export class BrowserAnimationsModule {
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Separate providers from the actual module so that we can do a local modification in Google3 to
|
||||
* include them in the BrowserTestingModule.
|
||||
*/
|
||||
export const BROWSER_NOOP_ANIMATIONS_PROVIDERS: Provider[] = [
|
||||
{provide: AnimationEngine, useClass: NoopAnimationEngine}, {
|
||||
provide: RendererFactoryV2,
|
||||
useFactory: instantiateRendererFactory,
|
||||
deps: [ɵDomRendererFactoryV2, AnimationEngine, NgZone]
|
||||
}
|
||||
];
|
|
@ -10,7 +10,7 @@ import {USE_VIEW_ENGINE} from '@angular/compiler/src/config';
|
|||
import {Component} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {ɵAnimationEngine} from '@angular/platform-browser/animations';
|
||||
import {NoopAnimationsModule} from '../src/noop_animations_module';
|
||||
import {NoopAnimationsModule} from '../src/module';
|
||||
import {NoopAnimationEngine} from '../src/render/noop_animation_engine';
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {AnimationPlayer, Component, Injectable, RendererFactoryV2, RendererTypeV
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserAnimationsModule, ɵAnimationEngine, ɵAnimationRendererFactory} from '@angular/platform-browser/animations';
|
||||
|
||||
import {InjectableAnimationEngine} from '../../animations/src/browser_animations_module';
|
||||
import {InjectableAnimationEngine} from '../../animations/src/providers';
|
||||
import {el} from '../../testing/browser_util';
|
||||
|
||||
export function main() {
|
||||
|
|
Loading…
Reference in New Issue