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
e107322f5c
commit
3052063c05
@ -13,71 +13,12 @@ import {LifecycleHooks} from './lifecycle_reflector';
|
|||||||
import {CssSelector} from './selector';
|
import {CssSelector} from './selector';
|
||||||
import {splitAtColon} from './util';
|
import {splitAtColon} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// group 0: "[prop] or (event) or @trigger"
|
// group 0: "[prop] or (event) or @trigger"
|
||||||
// group 1: "prop" from "[prop]"
|
// group 1: "prop" from "[prop]"
|
||||||
// group 2: "event" from "(event)"
|
// group 2: "event" from "(event)"
|
||||||
// group 3: "@trigger" from "@trigger"
|
// group 3: "@trigger" from "@trigger"
|
||||||
const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
|
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 {
|
function _sanitizeIdentifier(name: string): string {
|
||||||
return name.replace(/\W/g, '_');
|
return name.replace(/\W/g, '_');
|
||||||
}
|
}
|
||||||
@ -233,7 +174,6 @@ export class CompileStylesheetMetadata {
|
|||||||
* Summary Metadata regarding compilation of a template.
|
* Summary Metadata regarding compilation of a template.
|
||||||
*/
|
*/
|
||||||
export interface CompileTemplateSummary {
|
export interface CompileTemplateSummary {
|
||||||
animations: string[]|null;
|
|
||||||
ngContentSelectors: string[];
|
ngContentSelectors: string[];
|
||||||
encapsulation: ViewEncapsulation|null;
|
encapsulation: ViewEncapsulation|null;
|
||||||
}
|
}
|
||||||
@ -285,7 +225,6 @@ export class CompileTemplateMetadata {
|
|||||||
|
|
||||||
toSummary(): CompileTemplateSummary {
|
toSummary(): CompileTemplateSummary {
|
||||||
return {
|
return {
|
||||||
animations: this.animations.map(anim => anim.name),
|
|
||||||
ngContentSelectors: this.ngContentSelectors,
|
ngContentSelectors: this.ngContentSelectors,
|
||||||
encapsulation: this.encapsulation,
|
encapsulation: this.encapsulation,
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import {ViewEncapsulation, ɵstringify as stringify} from '@angular/core';
|
import {ViewEncapsulation, ɵstringify as stringify} from '@angular/core';
|
||||||
|
|
||||||
import {CompileAnimationEntryMetadata, CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, templateSourceUrl} from './compile_metadata';
|
import {CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, templateSourceUrl} from './compile_metadata';
|
||||||
import {CompilerConfig, preserveWhitespacesDefault} from './config';
|
import {CompilerConfig, preserveWhitespacesDefault} from './config';
|
||||||
import {CompilerInjectable} from './injectable';
|
import {CompilerInjectable} from './injectable';
|
||||||
import * as html from './ml_parser/ast';
|
import * as html from './ml_parser/ast';
|
||||||
@ -30,7 +30,7 @@ export interface PrenormalizedTemplateMetadata {
|
|||||||
styleUrls: string[];
|
styleUrls: string[];
|
||||||
interpolation: [string, string]|null;
|
interpolation: [string, string]|null;
|
||||||
encapsulation: ViewEncapsulation|null;
|
encapsulation: ViewEncapsulation|null;
|
||||||
animations: CompileAnimationEntryMetadata[];
|
animations: any[];
|
||||||
preserveWhitespaces: boolean|null;
|
preserveWhitespaces: boolean|null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
* 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 {CompileAnimationEntryMetadata} from '@angular/compiler';
|
|
||||||
import {CompileStylesheetMetadata, CompileTemplateMetadata} from '@angular/compiler/src/compile_metadata';
|
import {CompileStylesheetMetadata, CompileTemplateMetadata} from '@angular/compiler/src/compile_metadata';
|
||||||
import {CompilerConfig, preserveWhitespacesDefault} from '@angular/compiler/src/config';
|
import {CompilerConfig, preserveWhitespacesDefault} from '@angular/compiler/src/config';
|
||||||
import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer';
|
import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer';
|
||||||
@ -30,7 +29,7 @@ function normalizeTemplate(normalizer: DirectiveNormalizer, o: {
|
|||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
interpolation?: [string, string] | null;
|
interpolation?: [string, string] | null;
|
||||||
encapsulation?: ViewEncapsulation | null;
|
encapsulation?: ViewEncapsulation | null;
|
||||||
animations?: CompileAnimationEntryMetadata[];
|
animations?: any[];
|
||||||
preserveWhitespaces?: boolean | null;
|
preserveWhitespaces?: boolean | null;
|
||||||
}) {
|
}) {
|
||||||
return normalizer.normalizeTemplate({
|
return normalizer.normalizeTemplate({
|
||||||
@ -55,7 +54,7 @@ function normalizeTemplateOnly(normalizer: DirectiveNormalizer, o: {
|
|||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
interpolation?: [string, string] | null;
|
interpolation?: [string, string] | null;
|
||||||
encapsulation?: ViewEncapsulation | null;
|
encapsulation?: ViewEncapsulation | null;
|
||||||
animations?: CompileAnimationEntryMetadata[];
|
animations?: any[];
|
||||||
preserveWhitespaces?: boolean | null;
|
preserveWhitespaces?: boolean | null;
|
||||||
}) {
|
}) {
|
||||||
return normalizer.normalizeTemplateOnly({
|
return normalizer.normalizeTemplateOnly({
|
||||||
@ -111,7 +110,7 @@ function normalizeLoadedTemplate(
|
|||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
interpolation?: [string, string] | null;
|
interpolation?: [string, string] | null;
|
||||||
encapsulation?: ViewEncapsulation | null;
|
encapsulation?: ViewEncapsulation | null;
|
||||||
animations?: CompileAnimationEntryMetadata[];
|
animations?: any[];
|
||||||
preserveWhitespaces?: boolean;
|
preserveWhitespaces?: boolean;
|
||||||
},
|
},
|
||||||
template: string, templateAbsUrl: string) {
|
template: string, templateAbsUrl: string) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
import {CompileQueryMetadata, CompilerConfig, JitReflector, ProxyClass, StaticSymbol, preserveWhitespacesDefault} from '@angular/compiler';
|
import {CompileQueryMetadata, CompilerConfig, JitReflector, 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 {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element_schema_registry';
|
||||||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/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';
|
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';
|
||||||
@ -132,7 +132,7 @@ export function main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
|
beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
|
||||||
const someAnimation = new CompileAnimationEntryMetadata('someAnimation', []);
|
const someAnimation = ['someAnimation'];
|
||||||
const someTemplate = compileTemplateMetadata({animations: [someAnimation]});
|
const someTemplate = compileTemplateMetadata({animations: [someAnimation]});
|
||||||
const component = compileDirectiveMetadataCreate({
|
const component = compileDirectiveMetadataCreate({
|
||||||
isHost: false,
|
isHost: false,
|
||||||
@ -575,7 +575,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',
|
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({
|
const dirA = compileDirectiveMetadataCreate({
|
||||||
selector: 'div',
|
selector: 'div',
|
||||||
template: compileTemplateMetadata({animations: animationEntries}),
|
template: compileTemplateMetadata({animations: animationEntries}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user