refactor(compiler): remove stale metadata classes for animations
These are no longer needed as animations are a purely runtime concept.
This commit is contained in:
parent
c80e02b881
commit
5b5108363d
|
@ -12,71 +12,12 @@ import {LifecycleHooks} from './lifecycle_reflector';
|
|||
import {ParseTreeResult as HtmlParseTreeResult} from './ml_parser/parser';
|
||||
import {splitAtColon, stringify} from './util';
|
||||
|
||||
|
||||
|
||||
// group 0: "[prop] or (event) or @trigger"
|
||||
// group 1: "prop" from "[prop]"
|
||||
// group 2: "event" from "(event)"
|
||||
// group 3: "@trigger" from "@trigger"
|
||||
const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
|
||||
|
||||
export class CompileAnimationEntryMetadata {
|
||||
constructor(
|
||||
public name: string|null = null,
|
||||
public definitions: CompileAnimationStateMetadata[]|null = null) {}
|
||||
}
|
||||
|
||||
export abstract class CompileAnimationStateMetadata {}
|
||||
|
||||
export class CompileAnimationStateDeclarationMetadata extends CompileAnimationStateMetadata {
|
||||
constructor(public stateNameExpr: string, public styles: CompileAnimationStyleMetadata) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export class CompileAnimationStateTransitionMetadata extends CompileAnimationStateMetadata {
|
||||
constructor(
|
||||
public stateChangeExpr: string|StaticSymbol|((stateA: string, stateB: string) => boolean),
|
||||
public steps: CompileAnimationMetadata) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class CompileAnimationMetadata {}
|
||||
|
||||
export class CompileAnimationKeyframesSequenceMetadata extends CompileAnimationMetadata {
|
||||
constructor(public steps: CompileAnimationStyleMetadata[] = []) { super(); }
|
||||
}
|
||||
|
||||
export class CompileAnimationStyleMetadata extends CompileAnimationMetadata {
|
||||
constructor(
|
||||
public offset: number,
|
||||
public styles: Array<string|{[key: string]: string | number}>|null = null) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export class CompileAnimationAnimateMetadata extends CompileAnimationMetadata {
|
||||
constructor(
|
||||
public timings: string|number = 0, public styles: CompileAnimationStyleMetadata|
|
||||
CompileAnimationKeyframesSequenceMetadata|null = null) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class CompileAnimationWithStepsMetadata extends CompileAnimationMetadata {
|
||||
constructor(public steps: CompileAnimationMetadata[]|null = null) { super(); }
|
||||
}
|
||||
|
||||
export class CompileAnimationSequenceMetadata extends CompileAnimationWithStepsMetadata {
|
||||
constructor(steps: CompileAnimationMetadata[]|null = null) { super(steps); }
|
||||
}
|
||||
|
||||
export class CompileAnimationGroupMetadata extends CompileAnimationWithStepsMetadata {
|
||||
constructor(steps: CompileAnimationMetadata[]|null = null) { super(steps); }
|
||||
}
|
||||
|
||||
|
||||
function _sanitizeIdentifier(name: string): string {
|
||||
return name.replace(/\W/g, '_');
|
||||
}
|
||||
|
@ -232,7 +173,6 @@ export class CompileStylesheetMetadata {
|
|||
* Summary Metadata regarding compilation of a template.
|
||||
*/
|
||||
export interface CompileTemplateSummary {
|
||||
animations: string[]|null;
|
||||
ngContentSelectors: string[];
|
||||
encapsulation: ViewEncapsulation|null;
|
||||
}
|
||||
|
@ -288,7 +228,6 @@ export class CompileTemplateMetadata {
|
|||
|
||||
toSummary(): CompileTemplateSummary {
|
||||
return {
|
||||
animations: this.animations.map(anim => anim.name),
|
||||
ngContentSelectors: this.ngContentSelectors,
|
||||
encapsulation: this.encapsulation,
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {CompileAnimationEntryMetadata, CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, templateSourceUrl} from './compile_metadata';
|
||||
import {CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, templateSourceUrl} from './compile_metadata';
|
||||
import {CompilerConfig, preserveWhitespacesDefault} from './config';
|
||||
import {ViewEncapsulation} from './core';
|
||||
import * as html from './ml_parser/ast';
|
||||
|
@ -29,7 +29,7 @@ export interface PrenormalizedTemplateMetadata {
|
|||
styleUrls: string[];
|
||||
interpolation: [string, string]|null;
|
||||
encapsulation: ViewEncapsulation|null;
|
||||
animations: CompileAnimationEntryMetadata[];
|
||||
animations: any[];
|
||||
preserveWhitespaces: boolean|null;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 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 {CompileAnimationEntryMetadata} from '@angular/compiler';
|
||||
import {CompileStylesheetMetadata, CompileTemplateMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import {CompilerConfig, preserveWhitespacesDefault} from '@angular/compiler/src/config';
|
||||
import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer';
|
||||
|
@ -25,7 +24,7 @@ function normalizeTemplate(normalizer: DirectiveNormalizer, o: {
|
|||
styleUrls?: string[];
|
||||
interpolation?: [string, string] | null;
|
||||
encapsulation?: ViewEncapsulation | null;
|
||||
animations?: CompileAnimationEntryMetadata[];
|
||||
animations?: any[];
|
||||
preserveWhitespaces?: boolean | null;
|
||||
}) {
|
||||
return normalizer.normalizeTemplate({
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {CompileQueryMetadata, CompilerConfig, ProxyClass, StaticSymbol, preserveWhitespacesDefault} from '@angular/compiler';
|
||||
import {CompileAnimationEntryMetadata, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeMetadata, CompilePipeSummary, CompileProviderMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, tokenReference} from '@angular/compiler/src/compile_metadata';
|
||||
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeMetadata, CompilePipeSummary, CompileProviderMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, tokenReference} from '@angular/compiler/src/compile_metadata';
|
||||
import {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element_schema_registry';
|
||||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
||||
import {AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, PropertyBindingType, ProviderAstType, ReferenceAst, TemplateAst, TemplateAstVisitor, TextAst, VariableAst, templateVisitAll} from '@angular/compiler/src/template_parser/template_ast';
|
||||
|
@ -136,7 +136,7 @@ export function main() {
|
|||
|
||||
function commonBeforeEach() {
|
||||
beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
|
||||
const someAnimation = new CompileAnimationEntryMetadata('someAnimation', []);
|
||||
const someAnimation = ['someAnimation'];
|
||||
const someTemplate = compileTemplateMetadata({animations: [someAnimation]});
|
||||
const component = compileDirectiveMetadataCreate({
|
||||
isHost: false,
|
||||
|
@ -550,7 +550,7 @@ Binding to attribute 'onEvent' is disallowed for security reasons ("<my-componen
|
|||
|
||||
it('should not issue a warning when host attributes contain a valid property-bound animation trigger',
|
||||
() => {
|
||||
const animationEntries = [new CompileAnimationEntryMetadata('prop', [])];
|
||||
const animationEntries = ['prop'];
|
||||
const dirA = compileDirectiveMetadataCreate({
|
||||
selector: 'div',
|
||||
template: compileTemplateMetadata({animations: animationEntries}),
|
||||
|
|
Loading…
Reference in New Issue