fix(core): remove core animation import symbols (#22692)

This patch removes the deprecated support for animation
symbol imports from @angular/core.

BREAKING CHANGE: it is no longer possible to import
animation-related functions from @angular/core. All
animation symbols must now be imported from @angular/animations.

PR Close #22692
This commit is contained in:
Matias Niemelä 2018-03-09 15:54:59 -08:00 committed by Kara Erickson
parent c09bd67aee
commit f5a98f41fe
9 changed files with 9 additions and 296 deletions

View File

@ -1,8 +1,8 @@
// #docregion // #docregion
import { animate, AnimationEntryMetadata, state, style, transition, trigger } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations';
// Component transition animations // Component transition animations
export const slideInDownAnimation: AnimationEntryMetadata = export const slideInDownAnimation =
trigger('routeAnimation', [ trigger('routeAnimation', [
state('*', state('*',
style({ style({

View File

@ -6,7 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {Component, animate, keyframes, state, style, transition, trigger} from '@angular/core'; import {animate, keyframes, state, style, transition, trigger} from '@angular/animations';
import {Component} from '@angular/core';
@Component({ @Component({
host: { host: {

View File

@ -6,12 +6,12 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {AnimateApp} from './app/animate-app'; import {AnimateApp} from './app/animate-app';
@NgModule({declarations: [AnimateApp], bootstrap: [AnimateApp], imports: [BrowserModule]}) @NgModule({declarations: [AnimateApp], bootstrap: [AnimateApp], imports: [BrowserAnimationsModule]})
class ExampleModule { class ExampleModule {
} }

View File

@ -6,7 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {Component, animate, state, style, transition, trigger} from '@angular/core'; import {animate, state, style, transition, trigger} from '@angular/animations';
import {Component} from '@angular/core';
@Component({ @Component({
selector: 'animation-app', selector: 'animation-app',

View File

@ -5,8 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be * 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 * found in the LICENSE file at https://angular.io/license
*/ */
import {AUTO_STYLE, AnimationMetadata, AnimationMetadataType, animate, animation, group, keyframes, query, sequence, state, style, transition, trigger, useAnimation, ɵStyleData} from '@angular/animations'; import {AUTO_STYLE, AnimationMetadata, AnimationMetadataType, AnimationOptions, animate, animation, group, keyframes, query, sequence, state, style, transition, trigger, useAnimation, ɵStyleData} from '@angular/animations';
import {AnimationOptions} from '@angular/core/src/animation/dsl';
import {Animation} from '../../src/dsl/animation'; import {Animation} from '../../src/dsl/animation';
import {buildAnimationAst} from '../../src/dsl/animation_ast_builder'; import {buildAnimationAst} from '../../src/dsl/animation_ast_builder';

View File

@ -1,150 +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 {AnimateTimings, AnimationMetadataType, animate as _animate, group as _group, keyframes as _keyframes, sequence as _sequence, state as _state, style as _style, transition as _transition, trigger as _trigger} from './dsl';
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export const AUTO_STYLE = '*';
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationMetadata { type: AnimationMetadataType; }
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationTriggerMetadata {
name: string;
definitions: AnimationMetadata[];
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationStateMetadata extends AnimationMetadata {
name: string;
styles: AnimationStyleMetadata;
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationTransitionMetadata extends AnimationMetadata {
expr: string|
((fromState: string, toState: string, element: any, params: {[key: string]: any}) => boolean);
animation: AnimationMetadata|AnimationMetadata[];
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
steps: AnimationStyleMetadata[];
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationStyleMetadata extends AnimationMetadata {
styles: '*'|{[key: string]: string | number}|Array<{[key: string]: string | number}|'*'>;
offset: number|null;
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationAnimateMetadata extends AnimationMetadata {
timings: string|number|AnimateTimings;
styles: AnimationStyleMetadata|AnimationKeyframesSequenceMetadata|null;
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationSequenceMetadata extends AnimationMetadata { steps: AnimationMetadata[]; }
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export interface AnimationGroupMetadata extends AnimationMetadata { steps: AnimationMetadata[]; }
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata {
return _trigger(name, definitions);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function animate(
timings: string | number, styles?: AnimationStyleMetadata |
AnimationKeyframesSequenceMetadata): AnimationAnimateMetadata {
return _animate(timings, styles);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
return _group(steps);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata {
return _sequence(steps);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function style(
tokens: {[key: string]: string | number} |
Array<{[key: string]: string | number}>): AnimationStyleMetadata {
return _style(tokens);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function state(name: string, styles: AnimationStyleMetadata): AnimationStateMetadata {
return _state(name, styles);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata {
return _keyframes(steps);
}
/**
* @deprecated This symbol has moved. Please Import from @angular/animations instead!
*/
export function transition(stateChangeExpr: string, steps: AnimationMetadata | AnimationMetadata[]):
AnimationTransitionMetadata {
return _transition(stateChangeExpr, steps);
}
/**
* @deprecated This has been renamed to `AnimationEvent`. Please import it from @angular/animations.
*/
export interface AnimationTransitionEvent {
fromState: string;
toState: string;
totalTime: number;
phaseName: string;
element: any;
triggerName: string;
}

View File

@ -1 +0,0 @@
../../../animations/src/animation_metadata.ts

View File

@ -35,28 +35,3 @@ export * from './core_private_export';
export * from './core_render3_private_export'; export * from './core_render3_private_export';
export {Sanitizer, SecurityContext} from './sanitization/security'; export {Sanitizer, SecurityContext} from './sanitization/security';
export * from './codegen_private_exports'; export * from './codegen_private_exports';
export * from './animation/animation_metadata_wrapped';
import {AnimationTriggerMetadata} from './animation/animation_metadata_wrapped';
// For backwards compatibility.
/**
* @deprecated from v4
*/
export type AnimationEntryMetadata = any;
/**
* @deprecated from v4
*/
export type AnimationStateTransitionMetadata = any;
/**
* @deprecated from v4
*/
export type AnimationPlayer = any;
/**
* @deprecated from v4
*/
export type AnimationStyles = any;
/**
* @deprecated from v4
*/
export type AnimationKeyframe = any;

View File

@ -21,90 +21,6 @@ export interface AfterViewInit {
/** @experimental */ /** @experimental */
export declare const ANALYZE_FOR_ENTRY_COMPONENTS: InjectionToken<any>; export declare const ANALYZE_FOR_ENTRY_COMPONENTS: InjectionToken<any>;
/** @deprecated */
export declare function animate(timings: string | number, styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata): AnimationAnimateMetadata;
/** @deprecated */
export interface AnimationAnimateMetadata extends AnimationMetadata {
styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null;
timings: string | number | AnimateTimings;
}
/** @deprecated */
export declare type AnimationEntryMetadata = any;
/** @deprecated */
export interface AnimationGroupMetadata extends AnimationMetadata {
steps: AnimationMetadata[];
}
/** @deprecated */
export declare type AnimationKeyframe = any;
/** @deprecated */
export interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
steps: AnimationStyleMetadata[];
}
/** @deprecated */
export interface AnimationMetadata {
type: AnimationMetadataType;
}
/** @deprecated */
export declare type AnimationPlayer = any;
/** @deprecated */
export interface AnimationSequenceMetadata extends AnimationMetadata {
steps: AnimationMetadata[];
}
/** @deprecated */
export interface AnimationStateMetadata extends AnimationMetadata {
name: string;
styles: AnimationStyleMetadata;
}
/** @deprecated */
export declare type AnimationStateTransitionMetadata = any;
/** @deprecated */
export interface AnimationStyleMetadata extends AnimationMetadata {
offset: number | null;
styles: '*' | {
[key: string]: string | number;
} | Array<{
[key: string]: string | number;
} | '*'>;
}
/** @deprecated */
export declare type AnimationStyles = any;
/** @deprecated */
export interface AnimationTransitionEvent {
element: any;
fromState: string;
phaseName: string;
toState: string;
totalTime: number;
triggerName: string;
}
/** @deprecated */
export interface AnimationTransitionMetadata extends AnimationMetadata {
animation: AnimationMetadata | AnimationMetadata[];
expr: string | ((fromState: string, toState: string, element: any, params: {
[key: string]: any;
}) => boolean);
}
/** @deprecated */
export interface AnimationTriggerMetadata {
definitions: AnimationMetadata[];
name: string;
}
/** @experimental */ /** @experimental */
export declare const APP_BOOTSTRAP_LISTENER: InjectionToken<((compRef: ComponentRef<any>) => void)[]>; export declare const APP_BOOTSTRAP_LISTENER: InjectionToken<((compRef: ComponentRef<any>) => void)[]>;
@ -147,9 +63,6 @@ export declare function assertPlatform(requiredToken: any): PlatformRef;
/** @stable */ /** @stable */
export declare const Attribute: AttributeDecorator; export declare const Attribute: AttributeDecorator;
/** @deprecated */
export declare const AUTO_STYLE = "*";
/** @stable */ /** @stable */
export declare enum ChangeDetectionStrategy { export declare enum ChangeDetectionStrategy {
OnPush = 0, OnPush = 0,
@ -431,9 +344,6 @@ export interface GetTestability {
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean): Testability | null; findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean): Testability | null;
} }
/** @deprecated */
export declare function group(steps: AnimationMetadata[]): AnimationGroupMetadata;
/** @stable */ /** @stable */
export declare const Host: HostDecorator; export declare const Host: HostDecorator;
@ -562,9 +472,6 @@ export declare class IterableDiffers {
static extend(factories: IterableDifferFactory[]): StaticProvider; static extend(factories: IterableDifferFactory[]): StaticProvider;
} }
/** @deprecated */
export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;
/** @stable */ /** @stable */
export interface KeyValueChangeRecord<K, V> { export interface KeyValueChangeRecord<K, V> {
readonly currentValue: V | null; readonly currentValue: V | null;
@ -935,9 +842,6 @@ export interface SelfDecorator {
new (): Self; new (): Self;
} }
/** @deprecated */
export declare function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata;
/** @experimental */ /** @experimental */
export declare function setTestabilityGetter(getter: GetTestability): void; export declare function setTestabilityGetter(getter: GetTestability): void;
@ -964,19 +868,9 @@ export interface SkipSelfDecorator {
new (): SkipSelf; new (): SkipSelf;
} }
/** @deprecated */
export declare function state(name: string, styles: AnimationStyleMetadata): AnimationStateMetadata;
/** @stable */ /** @stable */
export declare type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider | ConstructorProvider | FactoryProvider | any[]; export declare type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider | ConstructorProvider | FactoryProvider | any[];
/** @deprecated */
export declare function style(tokens: {
[key: string]: string | number;
} | Array<{
[key: string]: string | number;
}>): AnimationStyleMetadata;
/** @experimental */ /** @experimental */
export declare class SystemJsNgModuleLoader implements NgModuleFactoryLoader { export declare class SystemJsNgModuleLoader implements NgModuleFactoryLoader {
constructor(_compiler: Compiler, config?: SystemJsNgModuleLoaderConfig); constructor(_compiler: Compiler, config?: SystemJsNgModuleLoaderConfig);
@ -1023,18 +917,12 @@ export interface TrackByFunction<T> {
(index: number, item: T): any; (index: number, item: T): any;
} }
/** @deprecated */
export declare function transition(stateChangeExpr: string, steps: AnimationMetadata | AnimationMetadata[]): AnimationTransitionMetadata;
/** @experimental */ /** @experimental */
export declare const TRANSLATIONS: InjectionToken<string>; export declare const TRANSLATIONS: InjectionToken<string>;
/** @experimental */ /** @experimental */
export declare const TRANSLATIONS_FORMAT: InjectionToken<string>; export declare const TRANSLATIONS_FORMAT: InjectionToken<string>;
/** @deprecated */
export declare function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata;
/** @stable */ /** @stable */
export declare const Type: FunctionConstructor; export declare const Type: FunctionConstructor;