diff --git a/modules/@angular/compiler-cli/src/codegen.ts b/modules/@angular/compiler-cli/src/codegen.ts index cef1896337..91048668a0 100644 --- a/modules/@angular/compiler-cli/src/codegen.ts +++ b/modules/@angular/compiler-cli/src/codegen.ts @@ -11,7 +11,7 @@ * Intended to be used in a build step. */ import * as compiler from '@angular/compiler'; -import {ComponentMetadata, NgModuleMetadata, ViewEncapsulation} from '@angular/core'; +import {Component, NgModule, ViewEncapsulation} from '@angular/core'; import {AngularCompilerOptions, NgcCliOptions} from '@angular/tsc-wrapped'; import * as path from 'path'; import * as ts from 'typescript'; @@ -62,9 +62,9 @@ export class CodeGenerator { const staticType = this.reflectorHost.findDeclaration(absSourcePath, symbol, absSourcePath); const annotations = this.staticReflector.annotations(staticType); annotations.forEach((annotation) => { - if (annotation instanceof NgModuleMetadata) { + if (annotation instanceof NgModule) { result.ngModules.push(staticType); - } else if (annotation instanceof ComponentMetadata) { + } else if (annotation instanceof Component) { result.components.push(staticType); } }); diff --git a/modules/@angular/compiler-cli/src/extract_i18n.ts b/modules/@angular/compiler-cli/src/extract_i18n.ts index d4c511d830..d9395444a2 100644 --- a/modules/@angular/compiler-cli/src/extract_i18n.ts +++ b/modules/@angular/compiler-cli/src/extract_i18n.ts @@ -17,7 +17,7 @@ import 'reflect-metadata'; import * as compiler from '@angular/compiler'; -import {ComponentMetadata, NgModuleMetadata, ViewEncapsulation} from '@angular/core'; +import {Component, NgModule, ViewEncapsulation} from '@angular/core'; import * as path from 'path'; import * as ts from 'typescript'; import * as tsc from '@angular/tsc-wrapped'; @@ -87,9 +87,9 @@ export class Extractor { const staticType = this.reflectorHost.findDeclaration(absSourcePath, symbol, absSourcePath); const annotations = this.staticReflector.annotations(staticType); annotations.forEach((annotation) => { - if (annotation instanceof NgModuleMetadata) { + if (annotation instanceof NgModule) { result.ngModules.push(staticType); - } else if (annotation instanceof ComponentMetadata) { + } else if (annotation instanceof Component) { result.components.push(staticType); } }); diff --git a/modules/@angular/compiler-cli/src/static_reflector.ts b/modules/@angular/compiler-cli/src/static_reflector.ts index 6db04a24a4..4bd14ddd40 100644 --- a/modules/@angular/compiler-cli/src/static_reflector.ts +++ b/modules/@angular/compiler-cli/src/static_reflector.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {AttributeMetadata, ComponentMetadata, ContentChildMetadata, ContentChildrenMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, HostMetadata, InjectMetadata, InjectableMetadata, InputMetadata, NgModuleMetadata, OptionalMetadata, OutputMetadata, PipeMetadata, QueryMetadata, SelfMetadata, SkipSelfMetadata, ViewChildMetadata, ViewChildrenMetadata, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core'; +import {Attribute, Component, ContentChild, ContentChildren, Directive, Host, HostBinding, HostListener, Inject, Injectable, Input, NgModule, Optional, Output, Pipe, Query, Self, SkipSelf, ViewChild, ViewChildren, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core'; import {ReflectorReader} from './private_import_core'; @@ -181,54 +181,47 @@ export class StaticReflector implements ReflectorReader { this.host.angularImportLocations(); this.opaqueToken = this.host.findDeclaration(diOpaqueToken, 'OpaqueToken'); + this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Host'), Host); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'Host'), HostMetadata); + this.host.findDeclaration(diDecorators, 'Injectable'), Injectable); + this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Self'), Self); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'Injectable'), InjectableMetadata); + this.host.findDeclaration(diDecorators, 'SkipSelf'), SkipSelf); + this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Inject'), Inject); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'Self'), SelfMetadata); + this.host.findDeclaration(diDecorators, 'Optional'), Optional); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'SkipSelf'), SkipSelfMetadata); + this.host.findDeclaration(coreDecorators, 'Attribute'), Attribute); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'Inject'), InjectMetadata); + this.host.findDeclaration(coreDecorators, 'ContentChild'), ContentChild); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diDecorators, 'Optional'), OptionalMetadata); + this.host.findDeclaration(coreDecorators, 'ContentChildren'), ContentChildren); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Attribute'), AttributeMetadata); + this.host.findDeclaration(coreDecorators, 'ViewChild'), ViewChild); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'ContentChild'), ContentChildMetadata); + this.host.findDeclaration(coreDecorators, 'ViewChildren'), ViewChildren); + this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Input'), Input); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'ContentChildren'), ContentChildrenMetadata); + this.host.findDeclaration(coreDecorators, 'Output'), Output); + this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Pipe'), Pipe); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'ViewChild'), ViewChildMetadata); + this.host.findDeclaration(coreDecorators, 'HostBinding'), HostBinding); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'ViewChildren'), ViewChildrenMetadata); + this.host.findDeclaration(coreDecorators, 'HostListener'), HostListener); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Input'), InputMetadata); + this.host.findDeclaration(coreDecorators, 'Directive'), Directive); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Output'), OutputMetadata); + this.host.findDeclaration(coreDecorators, 'Component'), Component); this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Pipe'), PipeMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'HostBinding'), HostBindingMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'HostListener'), HostListenerMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Directive'), DirectiveMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'Component'), ComponentMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(coreDecorators, 'NgModule'), NgModuleMetadata); + this.host.findDeclaration(coreDecorators, 'NgModule'), NgModule); // Note: Some metadata classes can be used directly with Provider.deps. + this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'Host'), Host); + this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'Self'), Self); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diMetadata, 'HostMetadata'), HostMetadata); + this.host.findDeclaration(diMetadata, 'SkipSelf'), SkipSelf); this.registerDecoratorOrConstructor( - this.host.findDeclaration(diMetadata, 'SelfMetadata'), SelfMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(diMetadata, 'SkipSelfMetadata'), SkipSelfMetadata); - this.registerDecoratorOrConstructor( - this.host.findDeclaration(diMetadata, 'OptionalMetadata'), OptionalMetadata); + this.host.findDeclaration(diMetadata, 'Optional'), Optional); this.registerFunction(this.host.findDeclaration(animationMetadata, 'trigger'), trigger); this.registerFunction(this.host.findDeclaration(animationMetadata, 'state'), state); diff --git a/modules/@angular/compiler-cli/test/static_reflector_spec.ts b/modules/@angular/compiler-cli/test/static_reflector_spec.ts index 213054fdd2..acaa683e90 100644 --- a/modules/@angular/compiler-cli/test/static_reflector_spec.ts +++ b/modules/@angular/compiler-cli/test/static_reflector_spec.ts @@ -7,7 +7,7 @@ */ import {StaticReflector, StaticReflectorHost, StaticSymbol} from '@angular/compiler-cli/src/static_reflector'; -import {HostListenerMetadata, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core'; +import {HostListener, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core'; import {ListWrapper} from '@angular/facade/src/collection'; import {isBlank} from '@angular/facade/src/lang'; import {MetadataCollector} from '@angular/tsc-wrapped'; @@ -92,7 +92,7 @@ describe('StaticReflector', () => { host.findDeclaration('src/app/hero-detail.component', 'HeroDetailComponent'); let props = reflector.propMetadata(HeroDetailComponent); expect(props['hero']).toBeTruthy(); - expect(props['onMouseOver']).toEqual([new HostListenerMetadata('mouseover', ['$event'])]); + expect(props['onMouseOver']).toEqual([new HostListener('mouseover', ['$event'])]); }); it('should get an empty object from propMetadata for an unknown class', () => { diff --git a/modules/@angular/compiler/src/compiler.ts b/modules/@angular/compiler/src/compiler.ts index 15802d0244..f23e7f20f6 100644 --- a/modules/@angular/compiler/src/compiler.ts +++ b/modules/@angular/compiler/src/compiler.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {COMPILER_OPTIONS, ClassProvider, Compiler, CompilerFactory, CompilerOptions, Component, ExistingProvider, FactoryProvider, Inject, Injectable, OptionalMetadata, PLATFORM_INITIALIZER, PlatformRef, Provider, ReflectiveInjector, TRANSLATIONS, TRANSLATIONS_FORMAT, Type, TypeProvider, ValueProvider, ViewEncapsulation, createPlatformFactory, isDevMode, platformCore} from '@angular/core'; +import {COMPILER_OPTIONS, ClassProvider, Compiler, CompilerFactory, CompilerOptions, Component, ExistingProvider, FactoryProvider, Inject, Injectable, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, ReflectiveInjector, TRANSLATIONS, TRANSLATIONS_FORMAT, Type, TypeProvider, ValueProvider, ViewEncapsulation, createPlatformFactory, isDevMode, platformCore} from '@angular/core'; export * from './template_parser/template_ast'; export {TEMPLATE_TRANSFORMS} from './template_parser/template_parser'; @@ -66,8 +66,8 @@ export const COMPILER_PROVIDERS: Array|{[k: string]: any}|any[]> = new i18n.I18NHtmlParser(parser, translations, format), deps: [ HtmlParser, - [new OptionalMetadata(), new Inject(TRANSLATIONS)], - [new OptionalMetadata(), new Inject(TRANSLATIONS_FORMAT)], + [new Optional(), new Inject(TRANSLATIONS)], + [new Optional(), new Inject(TRANSLATIONS_FORMAT)], ] }, TemplateParser, diff --git a/modules/@angular/compiler/src/directive_resolver.ts b/modules/@angular/compiler/src/directive_resolver.ts index 4f7cb5a219..f01a86f3a4 100644 --- a/modules/@angular/compiler/src/directive_resolver.ts +++ b/modules/@angular/compiler/src/directive_resolver.ts @@ -6,19 +6,19 @@ * found in the LICENSE file at https://angular.io/license */ -import {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, Type, resolveForwardRef} from '@angular/core'; +import {Component, Directive, HostBinding, HostListener, Injectable, Input, Output, Query, Type, resolveForwardRef} from '@angular/core'; import {StringMapWrapper} from './facade/collection'; import {isPresent, stringify} from './facade/lang'; import {ReflectorReader, reflector} from './private_import_core'; import {splitAtColon} from './util'; -function _isDirectiveMetadata(type: any): type is DirectiveMetadata { - return type instanceof DirectiveMetadata; +function _isDirectiveMetadata(type: any): type is Directive { + return type instanceof Directive; } /* - * Resolve a `Type` for {@link DirectiveMetadata}. + * Resolve a `Type` for {@link Directive}. * * This interface can be overridden by the application developer to create custom behavior. * @@ -29,9 +29,9 @@ export class DirectiveResolver { constructor(private _reflector: ReflectorReader = reflector) {} /** - * Return {@link DirectiveMetadata} for a given `Type`. + * Return {@link Directive} for a given `Type`. */ - resolve(type: Type, throwIfNotFound = true): DirectiveMetadata { + resolve(type: Type, throwIfNotFound = true): Directive { var typeMetadata = this._reflector.annotations(resolveForwardRef(type)); if (isPresent(typeMetadata)) { var metadata = typeMetadata.find(_isDirectiveMetadata); @@ -47,8 +47,8 @@ export class DirectiveResolver { } private _mergeWithPropertyMetadata( - dm: DirectiveMetadata, propertyMetadata: {[key: string]: any[]}, - directiveType: Type): DirectiveMetadata { + dm: Directive, propertyMetadata: {[key: string]: any[]}, + directiveType: Type): Directive { var inputs: string[] = []; var outputs: string[] = []; var host: {[key: string]: string} = {}; @@ -56,31 +56,31 @@ export class DirectiveResolver { StringMapWrapper.forEach(propertyMetadata, (metadata: any[], propName: string) => { metadata.forEach(a => { - if (a instanceof InputMetadata) { + if (a instanceof Input) { if (isPresent(a.bindingPropertyName)) { inputs.push(`${propName}: ${a.bindingPropertyName}`); } else { inputs.push(propName); } - } else if (a instanceof OutputMetadata) { - const output: OutputMetadata = a; + } else if (a instanceof Output) { + const output: Output = a; if (isPresent(output.bindingPropertyName)) { outputs.push(`${propName}: ${output.bindingPropertyName}`); } else { outputs.push(propName); } - } else if (a instanceof HostBindingMetadata) { - const hostBinding: HostBindingMetadata = a; + } else if (a instanceof HostBinding) { + const hostBinding: HostBinding = a; if (isPresent(hostBinding.hostPropertyName)) { host[`[${hostBinding.hostPropertyName}]`] = propName; } else { host[`[${propName}]`] = propName; } - } else if (a instanceof HostListenerMetadata) { - const hostListener: HostListenerMetadata = a; + } else if (a instanceof HostListener) { + const hostListener: HostListener = a; var args = isPresent(hostListener.args) ? (hostListener.args).join(', ') : ''; host[`(${hostListener.eventName})`] = `${propName}(${args})`; - } else if (a instanceof QueryMetadata) { + } else if (a instanceof Query) { queries[propName] = a; } }); @@ -91,8 +91,8 @@ export class DirectiveResolver { private _extractPublicName(def: string) { return splitAtColon(def, [null, def])[1].trim(); } private _merge( - dm: DirectiveMetadata, inputs: string[], outputs: string[], host: {[key: string]: string}, - queries: {[key: string]: any}, directiveType: Type): DirectiveMetadata { + dm: Directive, inputs: string[], outputs: string[], host: {[key: string]: string}, + queries: {[key: string]: any}, directiveType: Type): Directive { let mergedInputs: string[]; if (isPresent(dm.inputs)) { @@ -132,8 +132,8 @@ export class DirectiveResolver { var mergedQueries = isPresent(dm.queries) ? StringMapWrapper.merge(dm.queries, queries) : queries; - if (dm instanceof ComponentMetadata) { - return new ComponentMetadata({ + if (dm instanceof Component) { + return new Component({ selector: dm.selector, inputs: mergedInputs, outputs: mergedOutputs, @@ -155,7 +155,7 @@ export class DirectiveResolver { }); } else { - return new DirectiveMetadata({ + return new Directive({ selector: dm.selector, inputs: mergedInputs, outputs: mergedOutputs, diff --git a/modules/@angular/compiler/src/metadata_resolver.ts b/modules/@angular/compiler/src/metadata_resolver.ts index 04d26c7466..f128b420e0 100644 --- a/modules/@angular/compiler/src/metadata_resolver.ts +++ b/modules/@angular/compiler/src/metadata_resolver.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, InjectMetadata, Injectable, ModuleWithProviders, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, Type, resolveForwardRef} from '@angular/core'; +import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, Attribute, ChangeDetectionStrategy, Component, Host, Inject, Injectable, ModuleWithProviders, Optional, Provider, Query, SchemaMetadata, Self, SkipSelf, Type, resolveForwardRef} from '@angular/core'; import {StringMapWrapper} from '../src/facade/collection'; @@ -55,7 +55,7 @@ export class CompileMetadataResolver { this._directiveCache.delete(type); this._pipeCache.delete(type); this._ngModuleOfTypes.delete(type); - // Clear all of the NgModuleMetadata as they contain transitive information! + // Clear all of the NgModule as they contain transitive information! this._ngModuleCache.clear(); } @@ -123,8 +123,8 @@ export class CompileMetadataResolver { var moduleUrl = staticTypeModuleUrl(directiveType); var entryComponentMetadata: cpl.CompileTypeMetadata[] = []; let selector = dirMeta.selector; - if (dirMeta instanceof ComponentMetadata) { - var cmpMeta = dirMeta; + if (dirMeta instanceof Component) { + var cmpMeta = dirMeta; assertArrayOfStrings('styles', cmpMeta.styles); assertInterpolationSymbols('interpolation', cmpMeta.interpolation); var animations = isPresent(cmpMeta.animations) ? @@ -483,29 +483,29 @@ export class CompileMetadataResolver { let isSelf = false; let isSkipSelf = false; let isOptional = false; - let query: QueryMetadata = null; - let viewQuery: QueryMetadata = null; + let query: Query = null; + let viewQuery: Query = null; var token: any = null; if (isArray(param)) { (param).forEach((paramEntry) => { - if (paramEntry instanceof HostMetadata) { + if (paramEntry instanceof Host) { isHost = true; - } else if (paramEntry instanceof SelfMetadata) { + } else if (paramEntry instanceof Self) { isSelf = true; - } else if (paramEntry instanceof SkipSelfMetadata) { + } else if (paramEntry instanceof SkipSelf) { isSkipSelf = true; - } else if (paramEntry instanceof OptionalMetadata) { + } else if (paramEntry instanceof Optional) { isOptional = true; - } else if (paramEntry instanceof AttributeMetadata) { + } else if (paramEntry instanceof Attribute) { isAttribute = true; token = paramEntry.attributeName; - } else if (paramEntry instanceof QueryMetadata) { + } else if (paramEntry instanceof Query) { if (paramEntry.isViewQuery) { viewQuery = paramEntry; } else { query = paramEntry; } - } else if (paramEntry instanceof InjectMetadata) { + } else if (paramEntry instanceof Inject) { token = paramEntry.token; } else if (isValidType(paramEntry) && isBlank(token)) { token = paramEntry; @@ -653,10 +653,10 @@ export class CompileMetadataResolver { } getQueriesMetadata( - queries: {[key: string]: QueryMetadata}, isViewQuery: boolean, + queries: {[key: string]: Query}, isViewQuery: boolean, directiveType: Type): cpl.CompileQueryMetadata[] { var res: cpl.CompileQueryMetadata[] = []; - StringMapWrapper.forEach(queries, (query: QueryMetadata, propertyName: string) => { + StringMapWrapper.forEach(queries, (query: Query, propertyName: string) => { if (query.isViewQuery === isViewQuery) { res.push(this.getQueryMetadata(query, propertyName, directiveType)); } @@ -669,7 +669,7 @@ export class CompileMetadataResolver { } - getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type|Function): + getQueryMetadata(q: Query, propertyName: string, typeOrFunc: Type|Function): cpl.CompileQueryMetadata { var selectors: cpl.CompileTokenMetadata[]; if (isString(q.selector)) { @@ -733,8 +733,7 @@ function staticTypeModuleUrl(value: any): string { return cpl.isStaticSymbol(value) ? value.filePath : null; } -function componentModuleUrl( - reflector: ReflectorReader, type: any, cmpMetadata: ComponentMetadata): string { +function componentModuleUrl(reflector: ReflectorReader, type: any, cmpMetadata: Component): string { if (cpl.isStaticSymbol(type)) { return staticTypeModuleUrl(type); } diff --git a/modules/@angular/compiler/src/ng_module_resolver.ts b/modules/@angular/compiler/src/ng_module_resolver.ts index 4d4e0dc5e7..2830aca863 100644 --- a/modules/@angular/compiler/src/ng_module_resolver.ts +++ b/modules/@angular/compiler/src/ng_module_resolver.ts @@ -6,25 +6,24 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable, NgModuleMetadata, Type} from '@angular/core'; +import {Injectable, NgModule, Type} from '@angular/core'; import {isPresent, stringify} from './facade/lang'; import {ReflectorReader, reflector} from './private_import_core'; -function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata { - return obj instanceof NgModuleMetadata; +function _isNgModuleMetadata(obj: any): obj is NgModule { + return obj instanceof NgModule; } /** - * Resolves types to {@link NgModuleMetadata}. + * Resolves types to {@link NgModule}. */ @Injectable() export class NgModuleResolver { constructor(private _reflector: ReflectorReader = reflector) {} - resolve(type: Type, throwIfNotFound = true): NgModuleMetadata { - const ngModuleMeta: NgModuleMetadata = - this._reflector.annotations(type).find(_isNgModuleMetadata); + resolve(type: Type, throwIfNotFound = true): NgModule { + const ngModuleMeta: NgModule = this._reflector.annotations(type).find(_isNgModuleMetadata); if (isPresent(ngModuleMeta)) { return ngModuleMeta; diff --git a/modules/@angular/compiler/src/pipe_resolver.ts b/modules/@angular/compiler/src/pipe_resolver.ts index 17e07de446..4ca5684f9e 100644 --- a/modules/@angular/compiler/src/pipe_resolver.ts +++ b/modules/@angular/compiler/src/pipe_resolver.ts @@ -6,17 +6,17 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable, PipeMetadata, Type, resolveForwardRef} from '@angular/core'; +import {Injectable, Pipe, Type, resolveForwardRef} from '@angular/core'; import {isPresent, stringify} from './facade/lang'; import {ReflectorReader, reflector} from './private_import_core'; function _isPipeMetadata(type: any): boolean { - return type instanceof PipeMetadata; + return type instanceof Pipe; } /** - * Resolve a `Type` for {@link PipeMetadata}. + * Resolve a `Type` for {@link Pipe}. * * This interface can be overridden by the application developer to create custom behavior. * @@ -27,9 +27,9 @@ export class PipeResolver { constructor(private _reflector: ReflectorReader = reflector) {} /** - * Return {@link PipeMetadata} for a given `Type`. + * Return {@link Pipe} for a given `Type`. */ - resolve(type: Type, throwIfNotFound = true): PipeMetadata { + resolve(type: Type, throwIfNotFound = true): Pipe { var metas = this._reflector.annotations(resolveForwardRef(type)); if (isPresent(metas)) { var annotation = metas.find(_isPipeMetadata); diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index abedb6ab89..768380339e 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Compiler, ComponentFactory, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core'; +import {Compiler, ComponentFactory, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, Optional, Provider, SchemaMetadata, SkipSelf, Type} from '@angular/core'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, ProviderMeta, createHostComponentMeta} from './compile_metadata'; import {CompilerConfig} from './config'; diff --git a/modules/@angular/compiler/test/directive_lifecycle_spec.ts b/modules/@angular/compiler/test/directive_lifecycle_spec.ts index cc96e77dfe..d4b62ba40b 100644 --- a/modules/@angular/compiler/test/directive_lifecycle_spec.ts +++ b/modules/@angular/compiler/test/directive_lifecycle_spec.ts @@ -11,7 +11,7 @@ import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks'; import {beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe} from '@angular/core/testing/testing_internal'; export function main() { - describe('Create DirectiveMetadata', () => { + describe('Create Directive', () => { describe('lifecycle', () => { describe('ngOnChanges', () => { diff --git a/modules/@angular/compiler/test/directive_resolver_mock_spec.ts b/modules/@angular/compiler/test/directive_resolver_mock_spec.ts index 4b304c5e94..50f62a8412 100644 --- a/modules/@angular/compiler/test/directive_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_mock_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Component, ComponentMetadata, Directive, Injector} from '@angular/core'; +import {Component, Directive, Injector} from '@angular/core'; import {TestBed, inject} from '@angular/core/testing'; import {MockDirectiveResolver} from '../testing/index'; @@ -34,8 +34,7 @@ export function main() { }); it('should allow overriding the @Directive', () => { - dirResolver.setDirective( - SomeComponent, new ComponentMetadata({selector: 'someOtherSelector'})); + dirResolver.setDirective(SomeComponent, new Component({selector: 'someOtherSelector'})); var metadata = dirResolver.resolve(SomeComponent); expect(metadata.selector).toEqual('someOtherSelector'); }); @@ -43,20 +42,20 @@ export function main() { describe('View overriding', () => { it('should fallback to the default ViewResolver when templates are not overridden', () => { - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('template'); }); it('should allow overriding the @View', () => { dirResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'})); - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('overridden template'); }); it('should allow overriding a view after it has been resolved', () => { dirResolver.resolve(SomeComponent); dirResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'})); - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('overridden template'); }); }); @@ -64,21 +63,21 @@ export function main() { describe('inline template definition overriding', () => { it('should allow overriding the default template', () => { dirResolver.setInlineTemplate(SomeComponent, 'overridden template'); - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('overridden template'); }); it('should allow overriding an overridden @View', () => { dirResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'})); dirResolver.setInlineTemplate(SomeComponent, 'overridden template x 2'); - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('overridden template x 2'); }); it('should allow overriding a view after it has been resolved', () => { dirResolver.resolve(SomeComponent); dirResolver.setInlineTemplate(SomeComponent, 'overridden template'); - var view = dirResolver.resolve(SomeComponent); + var view = dirResolver.resolve(SomeComponent); expect(view.template).toEqual('overridden template'); }); }); diff --git a/modules/@angular/compiler/test/directive_resolver_spec.ts b/modules/@angular/compiler/test/directive_resolver_spec.ts index ab53062f00..28b4552435 100644 --- a/modules/@angular/compiler/test/directive_resolver_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_spec.ts @@ -7,7 +7,7 @@ */ import {DirectiveResolver} from '@angular/compiler/src/directive_resolver'; -import {Component, ComponentMetadata, ContentChild, ContentChildren, Directive, DirectiveMetadata, HostBinding, HostListener, Input, Output, ViewChild, ViewChildren} from '@angular/core/src/metadata'; +import {Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Input, Output, ViewChild, ViewChildren} from '@angular/core/src/metadata'; @Directive({selector: 'someDirective'}) class SomeDirective { @@ -119,7 +119,7 @@ export function main() { it('should read out the Directive metadata', () => { var directiveMetadata = resolver.resolve(SomeDirective); expect(directiveMetadata) - .toEqual(new DirectiveMetadata( + .toEqual(new Directive( {selector: 'someDirective', inputs: [], outputs: [], host: {}, queries: {}})); }); @@ -132,7 +132,7 @@ export function main() { it('should not read parent class Directive metadata', function() { var directiveMetadata = resolver.resolve(SomeChildDirective); expect(directiveMetadata) - .toEqual(new DirectiveMetadata( + .toEqual(new Directive( {selector: 'someChildDirective', inputs: [], outputs: [], host: {}, queries: {}})); }); @@ -225,7 +225,7 @@ export function main() { describe('view', () => { it('should read out the template related metadata from the Component metadata', () => { - var compMetadata = resolver.resolve(ComponentWithTemplate); + var compMetadata = resolver.resolve(ComponentWithTemplate); expect(compMetadata.template).toEqual('some template'); expect(compMetadata.styles).toEqual(['some styles']); }); diff --git a/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts b/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts index 1227d5c2b1..eb409c350a 100644 --- a/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injector, NgModule, NgModuleMetadata} from '@angular/core'; +import {Injector, NgModule} from '@angular/core'; import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal'; import {isBlank, stringify} from '../src/facade/lang'; @@ -29,7 +29,7 @@ export function main() { it('should allow overriding the @NgModule', () => { ngModuleResolver.setNgModule( - SomeNgModule, new NgModuleMetadata({declarations: [SomeOtherDirective]})); + SomeNgModule, new NgModule({declarations: [SomeOtherDirective]})); var ngModule = ngModuleResolver.resolve(SomeNgModule); expect(ngModule.declarations).toEqual([SomeOtherDirective]); }); diff --git a/modules/@angular/compiler/test/ng_module_resolver_spec.ts b/modules/@angular/compiler/test/ng_module_resolver_spec.ts index da6d230feb..88eb8b5797 100644 --- a/modules/@angular/compiler/test/ng_module_resolver_spec.ts +++ b/modules/@angular/compiler/test/ng_module_resolver_spec.ts @@ -7,7 +7,7 @@ */ import {NgModuleResolver} from '@angular/compiler/src/ng_module_resolver'; -import {NgModule, NgModuleMetadata} from '@angular/core/src/metadata'; +import {NgModule} from '@angular/core/src/metadata'; import {stringify} from '../src/facade/lang'; class SomeClass1 {} @@ -36,7 +36,7 @@ export function main() { it('should read out the metadata from the class', () => { var moduleMetadata = resolver.resolve(SomeModule); - expect(moduleMetadata).toEqual(new NgModuleMetadata({ + expect(moduleMetadata).toEqual(new NgModule({ declarations: [SomeClass1], imports: [SomeClass2], exports: [SomeClass3], diff --git a/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts b/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts index 5cba291603..272767d98c 100644 --- a/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injector, Pipe, PipeMetadata} from '@angular/core'; +import {Injector, Pipe} from '@angular/core'; import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal'; import {isBlank, stringify} from '../src/facade/lang'; @@ -26,7 +26,7 @@ export function main() { }); it('should allow overriding the @Pipe', () => { - pipeResolver.setPipe(SomePipe, new PipeMetadata({name: 'someOtherName'})); + pipeResolver.setPipe(SomePipe, new Pipe({name: 'someOtherName'})); var pipe = pipeResolver.resolve(SomePipe); expect(pipe.name).toEqual('someOtherName'); }); diff --git a/modules/@angular/compiler/testing/directive_resolver_mock.ts b/modules/@angular/compiler/testing/directive_resolver_mock.ts index 772ba84da3..c2937cef00 100644 --- a/modules/@angular/compiler/testing/directive_resolver_mock.ts +++ b/modules/@angular/compiler/testing/directive_resolver_mock.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ import {DirectiveResolver} from '@angular/compiler'; -import {AnimationEntryMetadata, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, Provider, Type, resolveForwardRef} from '@angular/core'; +import {AnimationEntryMetadata, Compiler, Component, Directive, Injectable, Injector, Provider, Type, resolveForwardRef} from '@angular/core'; import {Map} from './facade/collection'; import {isArray, isPresent} from './facade/lang'; @@ -20,7 +20,7 @@ import {ViewMetadata} from './private_import_core'; */ @Injectable() export class MockDirectiveResolver extends DirectiveResolver { - private _directives = new Map, DirectiveMetadata>(); + private _directives = new Map, Directive>(); private _providerOverrides = new Map, any[]>(); private _viewProviderOverrides = new Map, any[]>(); private _views = new Map, ViewMetadata>(); @@ -33,7 +33,7 @@ export class MockDirectiveResolver extends DirectiveResolver { private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); } - resolve(type: Type, throwIfNotFound = true): DirectiveMetadata { + resolve(type: Type, throwIfNotFound = true): Directive { let metadata = this._directives.get(type); if (!metadata) { metadata = super.resolve(type, throwIfNotFound); @@ -52,7 +52,7 @@ export class MockDirectiveResolver extends DirectiveResolver { providers = originalViewProviders.concat(providerOverrides); } - if (metadata instanceof ComponentMetadata) { + if (metadata instanceof Component) { let viewProviders = metadata.viewProviders; if (isPresent(viewProviderOverrides)) { const originalViewProviders: Provider[] = @@ -80,7 +80,7 @@ export class MockDirectiveResolver extends DirectiveResolver { inlineTemplate = view.template; } - return new ComponentMetadata({ + return new Component({ selector: metadata.selector, inputs: metadata.inputs, outputs: metadata.outputs, @@ -102,7 +102,7 @@ export class MockDirectiveResolver extends DirectiveResolver { }); } - return new DirectiveMetadata({ + return new Directive({ selector: metadata.selector, inputs: metadata.inputs, outputs: metadata.outputs, @@ -114,9 +114,9 @@ export class MockDirectiveResolver extends DirectiveResolver { } /** - * Overrides the {@link DirectiveMetadata} for a directive. + * Overrides the {@link Directive} for a directive. */ - setDirective(type: Type, metadata: DirectiveMetadata): void { + setDirective(type: Type, metadata: Directive): void { this._directives.set(type, metadata); this._clearCacheFor(type); } diff --git a/modules/@angular/compiler/testing/index.ts b/modules/@angular/compiler/testing/index.ts index aed6935c45..c6a37fd6dc 100644 --- a/modules/@angular/compiler/testing/index.ts +++ b/modules/@angular/compiler/testing/index.ts @@ -26,7 +26,7 @@ export * from './directive_resolver_mock'; export * from './ng_module_resolver_mock'; export * from './pipe_resolver_mock'; -import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, CompilerFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModule, ComponentMetadata, Component, DirectiveMetadata, Directive, Pipe, Type, PlatformRef} from '@angular/core'; +import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, CompilerFactory, NgModuleFactory, Injector, NgModule, Component, Directive, Pipe, Type, PlatformRef} from '@angular/core'; import {MetadataOverride} from '@angular/core/testing'; import {TestingCompilerFactory, TestingCompiler} from './private_import_core'; import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from '@angular/compiler'; @@ -73,17 +73,17 @@ export class TestingCompilerImpl implements TestingCompiler { overrideModule(ngModule: Type, override: MetadataOverride): void { const oldMetadata = this._moduleResolver.resolve(ngModule, false); this._moduleResolver.setNgModule( - ngModule, this._overrider.overrideMetadata(NgModuleMetadata, oldMetadata, override)); + ngModule, this._overrider.overrideMetadata(NgModule, oldMetadata, override)); } overrideDirective(directive: Type, override: MetadataOverride): void { const oldMetadata = this._directiveResolver.resolve(directive, false); this._directiveResolver.setDirective( - directive, this._overrider.overrideMetadata(DirectiveMetadata, oldMetadata, override)); + directive, this._overrider.overrideMetadata(Directive, oldMetadata, override)); } overrideComponent(component: Type, override: MetadataOverride): void { const oldMetadata = this._directiveResolver.resolve(component, false); this._directiveResolver.setDirective( - component, this._overrider.overrideMetadata(ComponentMetadata, oldMetadata, override)); + component, this._overrider.overrideMetadata(Component, oldMetadata, override)); } overridePipe(pipe: Type, override: MetadataOverride): void { const oldMetadata = this._pipeResolver.resolve(pipe, false); diff --git a/modules/@angular/compiler/testing/ng_module_resolver_mock.ts b/modules/@angular/compiler/testing/ng_module_resolver_mock.ts index 3a5f8d3a87..63cdbbb0e4 100644 --- a/modules/@angular/compiler/testing/ng_module_resolver_mock.ts +++ b/modules/@angular/compiler/testing/ng_module_resolver_mock.ts @@ -7,13 +7,13 @@ */ import {NgModuleResolver} from '@angular/compiler'; -import {Compiler, Injectable, Injector, NgModuleMetadata, Type} from '@angular/core'; +import {Compiler, Injectable, Injector, NgModule, Type} from '@angular/core'; import {Map} from './facade/collection'; @Injectable() export class MockNgModuleResolver extends NgModuleResolver { - private _ngModules = new Map, NgModuleMetadata>(); + private _ngModules = new Map, NgModule>(); constructor(private _injector: Injector) { super(); } @@ -22,20 +22,20 @@ export class MockNgModuleResolver extends NgModuleResolver { private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); } /** - * Overrides the {@link NgModuleMetadata} for a module. + * Overrides the {@link NgModule} for a module. */ - setNgModule(type: Type, metadata: NgModuleMetadata): void { + setNgModule(type: Type, metadata: NgModule): void { this._ngModules.set(type, metadata); this._clearCacheFor(type); } /** - * Returns the {@link NgModuleMetadata} for a module: - * - Set the {@link NgModuleMetadata} to the overridden view when it exists or fallback to the + * Returns the {@link NgModule} for a module: + * - Set the {@link NgModule} to the overridden view when it exists or fallback to the * default * `NgModuleResolver`, see `setNgModule`. */ - resolve(type: Type, throwIfNotFound = true): NgModuleMetadata { + resolve(type: Type, throwIfNotFound = true): NgModule { var metadata = this._ngModules.get(type); if (!metadata) { metadata = super.resolve(type, throwIfNotFound); diff --git a/modules/@angular/compiler/testing/pipe_resolver_mock.ts b/modules/@angular/compiler/testing/pipe_resolver_mock.ts index 9e44f43f21..bc103d562e 100644 --- a/modules/@angular/compiler/testing/pipe_resolver_mock.ts +++ b/modules/@angular/compiler/testing/pipe_resolver_mock.ts @@ -7,13 +7,13 @@ */ import {PipeResolver} from '@angular/compiler'; -import {Compiler, Injectable, Injector, PipeMetadata, Type} from '@angular/core'; +import {Compiler, Injectable, Injector, Pipe, Type} from '@angular/core'; import {Map} from './facade/collection'; @Injectable() export class MockPipeResolver extends PipeResolver { - private _pipes = new Map, PipeMetadata>(); + private _pipes = new Map, Pipe>(); constructor(private _injector: Injector) { super(); } @@ -22,20 +22,20 @@ export class MockPipeResolver extends PipeResolver { private _clearCacheFor(pipe: Type) { this._compiler.clearCacheFor(pipe); } /** - * Overrides the {@link PipeMetadata} for a pipe. + * Overrides the {@link Pipe} for a pipe. */ - setPipe(type: Type, metadata: PipeMetadata): void { + setPipe(type: Type, metadata: Pipe): void { this._pipes.set(type, metadata); this._clearCacheFor(type); } /** - * Returns the {@link PipeMetadata} for a pipe: - * - Set the {@link PipeMetadata} to the overridden view when it exists or fallback to the + * Returns the {@link Pipe} for a pipe: + * - Set the {@link Pipe} to the overridden view when it exists or fallback to the * default * `PipeResolver`, see `setPipe`. */ - resolve(type: Type, throwIfNotFound = true): PipeMetadata { + resolve(type: Type, throwIfNotFound = true): Pipe { var metadata = this._pipes.get(type); if (!metadata) { metadata = super.resolve(type, throwIfNotFound); diff --git a/modules/@angular/core/src/animation/metadata.ts b/modules/@angular/core/src/animation/metadata.ts index b097268131..bb75c792a3 100644 --- a/modules/@angular/core/src/animation/metadata.ts +++ b/modules/@angular/core/src/animation/metadata.ts @@ -132,7 +132,7 @@ export class AnimationGroupMetadata extends AnimationWithStepsMetadata { * `animate` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given @@ -195,7 +195,7 @@ export function animate( * `group` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations @@ -237,7 +237,7 @@ export function group(steps: AnimationMetadata[]): AnimationGroupMetadata { * `sequence` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used @@ -280,7 +280,7 @@ export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata * `style` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `style` declares a key/value object containing CSS properties/styles that can then @@ -350,7 +350,7 @@ export function style( * `state` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `state` declares an animation state within the given trigger. When a state is @@ -409,7 +409,7 @@ export function state( * `keyframes` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `keyframes` specifies a collection of {@link style style} entries each optionally characterized @@ -462,7 +462,7 @@ export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSe * `transition` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `transition` declares the {@link sequence sequence of animation steps} that will be run when the @@ -557,7 +557,7 @@ export function transition(stateChangeExpr: string, steps: AnimationMetadata | A * `trigger` is an animation-specific function that is designed to be used inside of Angular2's * animation * DSL language. If this information is new, please navigate to the - * {@link ComponentMetadata#animations-anchor component animations metadata + * {@link Component#animations-anchor component animations metadata * page} to gain a better understanding of how animations in Angular2 are used. * * `trigger` Creates an animation trigger which will a list of {@link state state} and {@link @@ -565,7 +565,7 @@ export function transition(stateChangeExpr: string, steps: AnimationMetadata | A * entries that will be evaluated when the expression bound to the trigger changes. * * Triggers are registered within the component annotation data under the - * {@link ComponentMetadata#animations-anchor animations section}. An animation trigger can + * {@link Component#animations-anchor animations section}. An animation trigger can * be placed on an element within a template by referencing the name of the * trigger followed by the expression value that the trigger is bound to * (in the form of `[@triggerName]="expression"`. diff --git a/modules/@angular/core/src/change_detection/change_detection_util.ts b/modules/@angular/core/src/change_detection/change_detection_util.ts index cd9b6c852f..6a3b4f2066 100644 --- a/modules/@angular/core/src/change_detection/change_detection_util.ts +++ b/modules/@angular/core/src/change_detection/change_detection_util.ts @@ -29,7 +29,7 @@ export function devModeEqual(a: any, b: any): boolean { } /** - * Indicates that the result of a {@link PipeMetadata} transformation has changed even though the + * Indicates that the result of a {@link Pipe} transformation has changed even though the * reference * has not changed. * diff --git a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts index adfb7d539d..e2d432ec39 100644 --- a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {OptionalMetadata, Provider, SkipSelfMetadata} from '../../di'; +import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; import {getTypeNameForDebugging, isBlank, isPresent} from '../../facade/lang'; import {ChangeDetectorRef} from '../change_detector_ref'; @@ -91,7 +91,7 @@ export class IterableDiffers { return IterableDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. - deps: [[IterableDiffers, new SkipSelfMetadata(), new OptionalMetadata()]] + deps: [[IterableDiffers, new SkipSelf(), new Optional()]] }; } diff --git a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts index 8e95821fdf..bfe7e415d2 100644 --- a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {OptionalMetadata, Provider, SkipSelfMetadata} from '../../di'; +import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; import {isBlank, isPresent} from '../../facade/lang'; import {ChangeDetectorRef} from '../change_detector_ref'; @@ -81,7 +81,7 @@ export class KeyValueDiffers { return KeyValueDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. - deps: [[KeyValueDiffers, new SkipSelfMetadata(), new OptionalMetadata()]] + deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]] }; } diff --git a/modules/@angular/core/src/di/metadata.ts b/modules/@angular/core/src/di/metadata.ts index 97074d3d83..9e05286d45 100644 --- a/modules/@angular/core/src/di/metadata.ts +++ b/modules/@angular/core/src/di/metadata.ts @@ -14,7 +14,7 @@ import {makeParamDecorator} from '../util/decorators'; * * @stable */ -export interface InjectMetadataFactory { +export interface InjectDecorator { /** * A parameter metadata that specifies a dependency. * @@ -74,7 +74,7 @@ export interface Inject { token: any; } * @stable * @Annotation */ -export const Inject: InjectMetadataFactory = makeParamDecorator([['token', undefined]]); +export const Inject: InjectDecorator = makeParamDecorator([['token', undefined]]); /** @@ -82,7 +82,7 @@ export const Inject: InjectMetadataFactory = makeParamDecorator([['token', undef * * @stable */ -export interface OptionalMetadataFactory { +export interface OptionalDecorator { /** * A parameter metadata that marks a dependency as optional. {@link Injector} provides `null` if * the dependency is not found. @@ -122,14 +122,14 @@ export interface Optional {} * @stable * @Annotation */ -export const Optional: OptionalMetadataFactory = makeParamDecorator([]); +export const Optional: OptionalDecorator = makeParamDecorator([]); /** * Type of the Injectable decorator / constructor function. * * @stable */ -export interface InjectableMetadataFactory { +export interface InjectableDecorator { /** * A marker metadata that marks a class as available to {@link Injector} for creation. * @@ -179,14 +179,14 @@ export interface Injectable {} * @stable * @Annotation */ -export const Injectable: InjectableMetadataFactory = makeParamDecorator([]); +export const Injectable: InjectableDecorator = makeParamDecorator([]); /** * Type of the Self decorator / constructor function. * * @stable */ -export interface SelfMetadataFactory { +export interface SelfDecorator { /** * Specifies that an {@link Injector} should retrieve a dependency only from itself. * @@ -232,7 +232,7 @@ export interface Self {} * @stable * @Annotation */ -export const Self: SelfMetadataFactory = makeParamDecorator([]); +export const Self: SelfDecorator = makeParamDecorator([]); /** @@ -240,7 +240,7 @@ export const Self: SelfMetadataFactory = makeParamDecorator([]); * * @stable */ -export interface SkipSelfMetadataFactory { +export interface SkipSelfDecorator { /** * Specifies that the dependency resolution should start from the parent injector. * @@ -284,14 +284,14 @@ export interface SkipSelf {} * @stable * @Annotation */ -export const SkipSelf: SkipSelfMetadataFactory = makeParamDecorator([]); +export const SkipSelf: SkipSelfDecorator = makeParamDecorator([]); /** * Type of the Host decorator / constructor function. * * @stable */ -export interface HostMetadataFactory { +export interface HostDecorator { /** * Specifies that an injector should retrieve a dependency from any injector until reaching the * closest host. @@ -362,14 +362,4 @@ export interface Host {} * @stable * @Annotation */ -export const Host: HostMetadataFactory = makeParamDecorator([]); - -// TODO(tbosch): remove this -export { - Host as HostMetadata, - Inject as InjectMetadata, - Injectable as InjectableMetadata, - Optional as OptionalMetadata, - Self as SelfMetadata, - SkipSelf as SkipSelfMetadata -}; +export const Host: HostDecorator = makeParamDecorator([]); diff --git a/modules/@angular/core/src/di/reflective_injector.ts b/modules/@angular/core/src/di/reflective_injector.ts index 588234a18f..88bdcc1343 100644 --- a/modules/@angular/core/src/di/reflective_injector.ts +++ b/modules/@angular/core/src/di/reflective_injector.ts @@ -11,7 +11,7 @@ import {unimplemented} from '../facade/errors'; import {Type} from '../type'; import {Injector, THROW_IF_NOT_FOUND} from './injector'; -import {SelfMetadata, SkipSelfMetadata} from './metadata'; +import {Self, SkipSelf} from './metadata'; import {Provider} from './provider'; import {AbstractProviderError, CyclicDependencyError, InstantiationError, NoProviderError, OutOfBoundsError} from './reflective_errors'; import {ReflectiveKey} from './reflective_key'; @@ -807,7 +807,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector { return this; } - if (upperBoundVisibility instanceof SelfMetadata) { + if (upperBoundVisibility instanceof Self) { return this._getByKeySelf(key, notFoundValue); } else { @@ -834,7 +834,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector { _getByKeyDefault(key: ReflectiveKey, notFoundValue: any, lowerBoundVisibility: Object): any { var inj: Injector; - if (lowerBoundVisibility instanceof SkipSelfMetadata) { + if (lowerBoundVisibility instanceof SkipSelf) { inj = this._parent; } else { inj = this; diff --git a/modules/@angular/core/src/di/reflective_provider.ts b/modules/@angular/core/src/di/reflective_provider.ts index f07fe36d7e..63435e0fd4 100644 --- a/modules/@angular/core/src/di/reflective_provider.ts +++ b/modules/@angular/core/src/di/reflective_provider.ts @@ -12,7 +12,7 @@ import {reflector} from '../reflection/reflection'; import {Type} from '../type'; import {resolveForwardRef} from './forward_ref'; -import {HostMetadata, InjectMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './metadata'; +import {Host, Inject, Optional, Self, SkipSelf} from './metadata'; import {ClassProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ValueProvider} from './provider'; import {InvalidProviderError, MixingMultiProvidersWithRegularProvidersError, NoAnnotationError} from './reflective_errors'; import {ReflectiveKey} from './reflective_key'; @@ -226,7 +226,7 @@ function _extractToken( var optional = false; if (!isArray(metadata)) { - if (metadata instanceof InjectMetadata) { + if (metadata instanceof Inject) { return _createDependency(metadata.token, optional, null, null, depProps); } else { return _createDependency(metadata, optional, null, null, depProps); @@ -242,19 +242,19 @@ function _extractToken( if (paramMetadata instanceof Type) { token = paramMetadata; - } else if (paramMetadata instanceof InjectMetadata) { + } else if (paramMetadata instanceof Inject) { token = paramMetadata.token; - } else if (paramMetadata instanceof OptionalMetadata) { + } else if (paramMetadata instanceof Optional) { optional = true; - } else if (paramMetadata instanceof SelfMetadata) { + } else if (paramMetadata instanceof Self) { upperBoundVisibility = paramMetadata; - } else if (paramMetadata instanceof HostMetadata) { + } else if (paramMetadata instanceof Host) { upperBoundVisibility = paramMetadata; - } else if (paramMetadata instanceof SkipSelfMetadata) { + } else if (paramMetadata instanceof SkipSelf) { lowerBoundVisibility = paramMetadata; } } diff --git a/modules/@angular/core/src/linker/query_list.ts b/modules/@angular/core/src/linker/query_list.ts index 867614beb6..8657ff9ac8 100644 --- a/modules/@angular/core/src/linker/query_list.ts +++ b/modules/@angular/core/src/linker/query_list.ts @@ -14,7 +14,7 @@ import {getSymbolIterator} from '../facade/lang'; * An unmodifiable list of items that Angular keeps up to date when the state * of the application changes. * - * The type of object that {@link QueryMetadata} and {@link ViewQueryMetadata} provide. + * The type of object that {@link Query} and {@link ViewQueryMetadata} provide. * * Implements an iterable interface, therefore it can be used in both ES6 * javascript `for (var i of items)` loops as well as in Angular templates with diff --git a/modules/@angular/core/src/metadata.ts b/modules/@angular/core/src/metadata.ts index 03ebad232f..a19bc7cebc 100644 --- a/modules/@angular/core/src/metadata.ts +++ b/modules/@angular/core/src/metadata.ts @@ -23,21 +23,3 @@ export {Component, Directive, HostBinding, HostListener, Input, Output, Pipe} fr export {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from './metadata/lifecycle_hooks'; export {CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NO_ERRORS_SCHEMA, NgModule, SchemaMetadata} from './metadata/ng_module'; export {ViewEncapsulation} from './metadata/view'; - - - -// TODO(vicb): delete ? -export {Directive as DirectiveMetadata}; -export {Component as ComponentMetadata}; -export {NgModule as NgModuleMetadata}; -export {Pipe as PipeMetadata}; -export {Output as OutputMetadata}; -export {Input as InputMetadata}; -export {HostBinding as HostBindingMetadata}; -export {HostListener as HostListenerMetadata}; -export {Attribute as AttributeMetadata}; -export {ContentChildren as ContentChildrenMetadata}; -export {ContentChild as ContentChildMetadata}; -export {ViewChildren as ViewChildrenMetadata}; -export {ViewChild as ViewChildMetadata}; -export {Query as QueryMetadata}; diff --git a/modules/@angular/core/src/metadata/di.ts b/modules/@angular/core/src/metadata/di.ts index dbd614a58a..5e726c08ac 100644 --- a/modules/@angular/core/src/metadata/di.ts +++ b/modules/@angular/core/src/metadata/di.ts @@ -54,7 +54,7 @@ export const ANALYZE_FOR_ENTRY_COMPONENTS = new OpaqueToken('AnalyzeForEntryComp * * @stable */ -export interface AttributeMetadataFactory { +export interface AttributeDecorator { /** * Specifies that a constant attribute value should be injected. * @@ -122,8 +122,7 @@ export interface Attribute { attributeName?: string; } * @stable * @Annotation */ -export const Attribute: AttributeMetadataFactory = - makeParamDecorator([['attributeName', undefined]]); +export const Attribute: AttributeDecorator = makeParamDecorator([['attributeName', undefined]]); /** * Type of the Query metadata. @@ -145,7 +144,7 @@ export abstract class Query {} * * @stable */ -export interface ContentChildrenMetadataFactory { +export interface ContentChildrenDecorator { /** * Configures a content query. * @@ -187,7 +186,7 @@ export type ContentChildren = Query; * @stable * @Annotation */ -export const ContentChildren: ContentChildrenMetadataFactory = makePropDecorator( +export const ContentChildren: ContentChildrenDecorator = makePropDecorator( [ ['selector', undefined], {first: false, isViewQuery: false, descendants: false, read: undefined} @@ -199,7 +198,7 @@ export const ContentChildren: ContentChildrenMetadataFactory = makePropDecorator * * @stable */ -export interface ContentChildMetadataFactory { +export interface ContentChildDecorator { /** * Configures a content query. * @@ -246,7 +245,7 @@ export type ContentChild = Query; * @stable * @Annotation */ -export const ContentChild: ContentChildMetadataFactory = makePropDecorator( +export const ContentChild: ContentChildDecorator = makePropDecorator( [ ['selector', undefined], { first: true, @@ -258,11 +257,11 @@ export const ContentChild: ContentChildMetadataFactory = makePropDecorator( Query); /** - * Type of the ViewChildrenMetadataFactory decorator / constructor function. + * Type of the ViewChildren decorator / constructor function. * * @stable */ -export interface ViewChildrenMetadataFactory { +export interface ViewChildrenDecorator { /** * Declares a list of child element references. * @@ -357,7 +356,7 @@ export type ViewChildren = Query; * @stable * @Annotation */ -export const ViewChildren: ViewChildrenMetadataFactory = makePropDecorator( +export const ViewChildren: ViewChildrenDecorator = makePropDecorator( [ ['selector', undefined], { first: false, @@ -370,11 +369,11 @@ export const ViewChildren: ViewChildrenMetadataFactory = makePropDecorator( /** - * Type of the ViewChildMetadataFactory decorator / constructor function. + * Type of the ViewChild decorator / constructor function. * * @stable */ -export interface ViewChildMetadataFactory { +export interface ViewChildDecorator { /** * * Declares a reference of child element. @@ -462,7 +461,7 @@ export type ViewChild = Query; * @stable * @Annotation */ -export const ViewChild: ViewChildMetadataFactory = makePropDecorator( +export const ViewChild: ViewChildDecorator = makePropDecorator( [ ['selector', undefined], { first: true, diff --git a/modules/@angular/core/src/metadata/directives.ts b/modules/@angular/core/src/metadata/directives.ts index f29458acc7..2e1eedd08e 100644 --- a/modules/@angular/core/src/metadata/directives.ts +++ b/modules/@angular/core/src/metadata/directives.ts @@ -8,7 +8,7 @@ import {AnimationEntryMetadata} from '../animation/metadata'; import {ChangeDetectionStrategy} from '../change_detection/constants'; -import {InjectableMetadata, Provider} from '../di'; +import {Injectable, Provider} from '../di'; import {isPresent} from '../facade/lang'; import {Type} from '../type'; import {TypeDecorator, makeDecorator, makePropDecorator} from '../util/decorators'; @@ -21,11 +21,11 @@ import {ViewEncapsulation} from './view'; * * @stable */ -export interface DirectiveMetadataFactory { +export interface DirectiveDecorator { /** * Directives allow you to attach behavior to elements in the DOM. * - * {@link DirectiveMetadata}s with an embedded view are called {@link ComponentMetadata}s. + * {@link Directive}s with an embedded view are called {@link Component}s. * * A directive consists of a single directive annotation and a controller class. When the * directive's `selector` matches @@ -59,7 +59,7 @@ export interface DirectiveMetadataFactory { * * Angular then resolves dependencies as follows, according to the order in which they appear in * the - * {@link ComponentMetadata}: + * {@link Component}: * * 1. Dependencies on the current element * 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM @@ -85,7 +85,7 @@ export interface DirectiveMetadataFactory { * To inject element-specific special objects, declare the constructor parameter as: * - `element: ElementRef` to obtain a reference to logical element in the view. * - `viewContainer: ViewContainerRef` to control child template instantiation, for - * {@link DirectiveMetadata} directives only + * {@link Directive} directives only * - `bindingPropagation: BindingPropagation` to control change detection in a more granular way. * * ### Example @@ -311,7 +311,7 @@ export interface DirectiveMetadataFactory { * location in the current view * where these actions are performed. * - * Views are always created as children of the current {@link ComponentMetadata}, and as siblings + * Views are always created as children of the current {@link Component}, and as siblings * of * the * `