From 778ded9fcf3058272c346e953054a92e59ea73d0 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Fri, 17 Feb 2017 09:01:37 -0800 Subject: [PATCH] refactor: rename `ComponentRenderTypeV2` to `RendererTypeV2` --- modules/@angular/compiler/src/aot/compiler.ts | 5 +--- .../@angular/compiler/src/compile_metadata.ts | 25 +++++++++---------- modules/@angular/compiler/src/identifiers.ts | 8 +++--- modules/@angular/compiler/src/jit/compiler.ts | 21 ++++++++-------- .../compiler/src/metadata_resolver.ts | 11 ++++---- .../src/view_compiler/compile_view.ts | 6 ++--- .../src/view_compiler/view_builder.ts | 2 +- .../src/view_compiler/view_compiler.ts | 5 ++-- .../src/view_compiler_next/view_compiler.ts | 12 ++++----- modules/@angular/core/src/render.ts | 2 +- modules/@angular/core/src/render/api.ts | 4 +-- modules/@angular/core/src/view/index.ts | 2 +- modules/@angular/core/src/view/provider.ts | 16 ++++++------ modules/@angular/core/src/view/services.ts | 4 +-- modules/@angular/core/src/view/types.ts | 4 +-- modules/@angular/core/src/view/util.ts | 10 ++++---- modules/@angular/core/src/view/view.ts | 8 +++--- .../platform-browser/src/dom/dom_renderer.ts | 8 +++--- .../platform-server/src/server_renderer.ts | 6 ++--- tools/public_api_guard/core/index.d.ts | 22 ++++++++-------- 20 files changed, 87 insertions(+), 94 deletions(-) diff --git a/modules/@angular/compiler/src/aot/compiler.ts b/modules/@angular/compiler/src/aot/compiler.ts index 4ee54666cb..7c9bdb799e 100644 --- a/modules/@angular/compiler/src/aot/compiler.ts +++ b/modules/@angular/compiler/src/aot/compiler.ts @@ -223,10 +223,7 @@ export class AotCompiler { } compiledAnimations.forEach(entry => targetStatements.push(...entry.statements)); targetStatements.push(...viewResult.statements); - return { - viewClassVar: viewResult.viewClassVar, - compRenderTypeVar: viewResult.componentRenderTypeVar - }; + return {viewClassVar: viewResult.viewClassVar, compRenderTypeVar: viewResult.rendererTypeVar}; } private _codgenStyles( diff --git a/modules/@angular/compiler/src/compile_metadata.ts b/modules/@angular/compiler/src/compile_metadata.ts index 64fc05167d..5b74ce411d 100644 --- a/modules/@angular/compiler/src/compile_metadata.ts +++ b/modules/@angular/compiler/src/compile_metadata.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ChangeDetectionStrategy, ComponentFactory, ComponentRenderTypeV2, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core'; +import {ChangeDetectionStrategy, ComponentFactory, RendererTypeV2, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core'; import {StaticSymbol} from './aot/static_symbol'; import {ListWrapper} from './facade/collection'; @@ -117,7 +117,7 @@ export function viewClassName(compType: any, embeddedTemplateIndex: number): str return `View_${identifierName({reference: compType})}_${embeddedTemplateIndex}`; } -export function componentRenderTypeName(compType: any): string { +export function rendererTypeName(compType: any): string { return `RenderType_${identifierName({reference: compType})}`; } @@ -315,7 +315,7 @@ export interface CompileDirectiveSummary extends CompileTypeSummary { template: CompileTemplateSummary; wrapperType: StaticSymbol|ProxyClass; componentViewType: StaticSymbol|ProxyClass; - componentRenderType: StaticSymbol|ComponentRenderTypeV2; + rendererType: StaticSymbol|RendererTypeV2; componentFactory: StaticSymbol|ComponentFactory; } @@ -326,7 +326,7 @@ export class CompileDirectiveMetadata { static create( {isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, providers, viewProviders, queries, viewQueries, entryComponents, template, wrapperType, - componentViewType, componentRenderType, componentFactory}: { + componentViewType, rendererType, componentFactory}: { isHost?: boolean, type?: CompileTypeMetadata, isComponent?: boolean, @@ -344,7 +344,7 @@ export class CompileDirectiveMetadata { template?: CompileTemplateMetadata, wrapperType?: StaticSymbol|ProxyClass, componentViewType?: StaticSymbol|ProxyClass, - componentRenderType?: StaticSymbol|ComponentRenderTypeV2, + rendererType?: StaticSymbol|RendererTypeV2, componentFactory?: StaticSymbol|ComponentFactory, } = {}): CompileDirectiveMetadata { const hostListeners: {[key: string]: string} = {}; @@ -399,7 +399,7 @@ export class CompileDirectiveMetadata { template, wrapperType, componentViewType, - componentRenderType, + rendererType, componentFactory, }); } @@ -424,13 +424,13 @@ export class CompileDirectiveMetadata { wrapperType: StaticSymbol|ProxyClass; componentViewType: StaticSymbol|ProxyClass; - componentRenderType: StaticSymbol|ComponentRenderTypeV2; + rendererType: StaticSymbol|RendererTypeV2; componentFactory: StaticSymbol|ComponentFactory; constructor({isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, viewQueries, - entryComponents, template, wrapperType, componentViewType, componentRenderType, + entryComponents, template, wrapperType, componentViewType, rendererType, componentFactory}: { isHost?: boolean, type?: CompileTypeMetadata, @@ -451,7 +451,7 @@ export class CompileDirectiveMetadata { template?: CompileTemplateMetadata, wrapperType?: StaticSymbol|ProxyClass, componentViewType?: StaticSymbol|ProxyClass, - componentRenderType?: StaticSymbol|ComponentRenderTypeV2, + rendererType?: StaticSymbol|RendererTypeV2, componentFactory?: StaticSymbol|ComponentFactory, } = {}) { this.isHost = !!isHost; @@ -474,7 +474,7 @@ export class CompileDirectiveMetadata { this.wrapperType = wrapperType; this.componentViewType = componentViewType; - this.componentRenderType = componentRenderType; + this.rendererType = rendererType; this.componentFactory = componentFactory; } @@ -499,7 +499,7 @@ export class CompileDirectiveMetadata { template: this.template && this.template.toSummary(), wrapperType: this.wrapperType, componentViewType: this.componentViewType, - componentRenderType: this.componentRenderType, + rendererType: this.rendererType, componentFactory: this.componentFactory }; } @@ -535,8 +535,7 @@ export function createHostComponentMeta( queries: [], viewQueries: [], componentViewType: hostViewType, - componentRenderType: - {id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}} + rendererType: {id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}} }); } diff --git a/modules/@angular/compiler/src/identifiers.ts b/modules/@angular/compiler/src/identifiers.ts index b6987e9fc9..3398de93a2 100644 --- a/modules/@angular/compiler/src/identifiers.ts +++ b/modules/@angular/compiler/src/identifiers.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ComponentRenderTypeV2, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation, ɵAnimationGroupPlayer, ɵAnimationKeyframe, ɵAnimationSequencePlayer, ɵAnimationStyles, ɵAnimationTransition, ɵAppView, ɵChangeDetectorStatus, ɵCodegenComponentFactoryResolver, ɵComponentRef_, ɵDebugAppView, ɵDebugContext, ɵNgModuleInjector, ɵNoOpAnimationPlayer, ɵStaticNodeDebugInfo, ɵTemplateRef_, ɵValueUnwrapper, ɵViewContainer, ɵViewType, ɵbalanceAnimationKeyframes, ɵclearStyles, ɵcollectAndResolveStyles, ɵdevModeEqual, ɵprepareFinalAnimationStyles, ɵreflector, ɵregisterModuleFactory, ɵrenderStyles, ɵviewEngine, ɵview_utils} from '@angular/core'; +import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, RendererTypeV2, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation, ɵAnimationGroupPlayer, ɵAnimationKeyframe, ɵAnimationSequencePlayer, ɵAnimationStyles, ɵAnimationTransition, ɵAppView, ɵChangeDetectorStatus, ɵCodegenComponentFactoryResolver, ɵComponentRef_, ɵDebugAppView, ɵDebugContext, ɵNgModuleInjector, ɵNoOpAnimationPlayer, ɵStaticNodeDebugInfo, ɵTemplateRef_, ɵValueUnwrapper, ɵViewContainer, ɵViewType, ɵbalanceAnimationKeyframes, ɵclearStyles, ɵcollectAndResolveStyles, ɵdevModeEqual, ɵprepareFinalAnimationStyles, ɵreflector, ɵregisterModuleFactory, ɵrenderStyles, ɵviewEngine, ɵview_utils} from '@angular/core'; import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata'; @@ -380,11 +380,11 @@ export class Identifiers { member: 'unwrapValue', runtime: ɵviewEngine.unwrapValue }; - static createComponentRenderTypeV2: IdentifierSpec = { + static createRendererTypeV2: IdentifierSpec = { name: 'ɵviewEngine', moduleUrl: CORE, - member: 'createComponentRenderTypeV2', - runtime: ɵviewEngine.createComponentRenderTypeV2 + member: 'createRendererTypeV2', + runtime: ɵviewEngine.createRendererTypeV2 }; } diff --git a/modules/@angular/compiler/src/jit/compiler.ts b/modules/@angular/compiler/src/jit/compiler.ts index de4c783e6d..a90429cf64 100644 --- a/modules/@angular/compiler/src/jit/compiler.ts +++ b/modules/@angular/compiler/src/jit/compiler.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Compiler, ComponentFactory, ComponentRenderTypeV2, Inject, Injector, ModuleWithComponentFactories, NgModuleFactory, Type} from '@angular/core'; +import {Compiler, ComponentFactory, Inject, Injector, ModuleWithComponentFactories, NgModuleFactory, RendererTypeV2, Type} from '@angular/core'; import {AnimationCompiler} from '../animation/animation_compiler'; import {AnimationParser} from '../animation/animation_parser'; @@ -290,18 +290,17 @@ export class JitCompiler implements Compiler { .concat(...compiledAnimations.map(ca => ca.statements)) .concat(compileResult.statements); let viewClass: any; - let componentRenderType: any; + let rendererType: any; if (!this._compilerConfig.useJit) { - [viewClass, componentRenderType] = interpretStatements( - statements, [compileResult.viewClassVar, compileResult.componentRenderTypeVar]); + [viewClass, rendererType] = interpretStatements( + statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]); } else { const sourceUrl = `/${identifierName(template.ngModule.type)}/${identifierName(template.compType)}/${template.isHost?'host':'component'}.ngfactory.js`; - [viewClass, componentRenderType] = jitStatements( - sourceUrl, statements, - [compileResult.viewClassVar, compileResult.componentRenderTypeVar]); + [viewClass, rendererType] = jitStatements( + sourceUrl, statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]); } - template.compiled(viewClass, componentRenderType); + template.compiled(viewClass, rendererType); } private _resolveStylesCompileResult( @@ -336,11 +335,11 @@ class CompiledTemplate { public compMeta: CompileDirectiveMetadata, public ngModule: CompileNgModuleMetadata, public directives: CompileIdentifierMetadata[]) {} - compiled(viewClass: Function, componentRenderType: any) { + compiled(viewClass: Function, rendererType: any) { this._viewClass = viewClass; (this.compMeta.componentViewType).setDelegate(viewClass); - for (let prop in componentRenderType) { - (this.compMeta.componentRenderType)[prop] = componentRenderType[prop]; + for (let prop in rendererType) { + (this.compMeta.rendererType)[prop] = rendererType[prop]; } this.isCompiled = true; } diff --git a/modules/@angular/compiler/src/metadata_resolver.ts b/modules/@angular/compiler/src/metadata_resolver.ts index 340e18146b..698ff03df1 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, Attribute, ChangeDetectionStrategy, Component, ComponentFactory, ComponentRenderTypeV2, Directive, Host, Inject, Injectable, InjectionToken, ModuleWithProviders, Optional, Provider, Query, SchemaMetadata, Self, SkipSelf, Type, resolveForwardRef} from '@angular/core'; +import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, Attribute, ChangeDetectionStrategy, Component, ComponentFactory, Directive, Host, Inject, Injectable, InjectionToken, ModuleWithProviders, Optional, Provider, Query, RendererTypeV2, SchemaMetadata, Self, SkipSelf, Type, resolveForwardRef} from '@angular/core'; import {StaticSymbol, StaticSymbolCache} from './aot/static_symbol'; import {ngfactoryFilePath} from './aot/util'; @@ -131,10 +131,10 @@ export class CompileMetadataResolver { } } - private getComponentRenderType(dirType: any): StaticSymbol|ComponentRenderTypeV2 { + private getRendererType(dirType: any): StaticSymbol|RendererTypeV2 { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get( - ngfactoryFilePath(dirType.filePath), cpl.componentRenderTypeName(dirType)); + ngfactoryFilePath(dirType.filePath), cpl.rendererTypeName(dirType)); } else { // returning an object as proxy, // that we fill later during runtime compilation. @@ -246,7 +246,7 @@ export class CompileMetadataResolver { entryComponents: metadata.entryComponents, wrapperType: metadata.wrapperType, componentViewType: metadata.componentViewType, - componentRenderType: metadata.componentRenderType, + rendererType: metadata.rendererType, componentFactory: metadata.componentFactory, template: templateMetadata }); @@ -384,8 +384,7 @@ export class CompileMetadataResolver { wrapperType: this.getDirectiveWrapperClass(directiveType), componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) : undefined, - componentRenderType: - nonNormalizedTemplateMetadata ? this.getComponentRenderType(directiveType) : undefined, + rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : undefined, componentFactory: nonNormalizedTemplateMetadata ? this.getComponentFactory(selector, directiveType) : undefined diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index 95246cbb44..768151dbc5 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -7,7 +7,7 @@ */ import {AnimationEntryCompileResult} from '../animation/animation_compiler'; -import {CompileDirectiveMetadata, CompilePipeSummary, componentRenderTypeName, tokenName, viewClassName} from '../compile_metadata'; +import {CompileDirectiveMetadata, CompilePipeSummary, rendererTypeName, tokenName, viewClassName} from '../compile_metadata'; import {EventHandlerVars, LegacyNameResolver} from '../compiler_util/expression_converter'; import {CompilerConfig} from '../config'; import {isPresent} from '../facade/lang'; @@ -70,7 +70,7 @@ export class CompileView implements LegacyNameResolver { public pipes: CompilePipe[] = []; public locals = new Map(); public className: string; - public renderComponentTypeName: string; + public rendererTypeName: string; public classType: o.Type; public classExpr: o.ReadVarExpr; @@ -103,7 +103,7 @@ export class CompileView implements LegacyNameResolver { this.viewType = getViewType(component, viewIndex); this.className = viewClassName(component.type.reference, viewIndex); - this.renderComponentTypeName = componentRenderTypeName(component.type.reference); + this.rendererTypeName = rendererTypeName(component.type.reference); this.classType = o.expressionType(o.variable(this.className)); this.classExpr = o.variable(this.className); if (this.viewType === ViewType.COMPONENT || this.viewType === ViewType.HOST) { diff --git a/modules/@angular/compiler/src/view_compiler/view_builder.ts b/modules/@angular/compiler/src/view_compiler/view_builder.ts index 0a0d589002..e93f44c554 100644 --- a/modules/@angular/compiler/src/view_compiler/view_builder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_builder.ts @@ -386,7 +386,7 @@ function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statemen const renderCompTypeVar: o.ReadVarExpr = - o.variable(view.renderComponentTypeName); // fix highlighting: ` + o.variable(view.rendererTypeName); // fix highlighting: ` if (view.viewIndex === 0) { let templateUrlInfo: string; if (view.component.template.templateUrl == identifierModuleUrl(view.component.type)) { diff --git a/modules/@angular/compiler/src/view_compiler/view_compiler.ts b/modules/@angular/compiler/src/view_compiler/view_compiler.ts index f4d3a4258f..542c20bca1 100644 --- a/modules/@angular/compiler/src/view_compiler/view_compiler.ts +++ b/modules/@angular/compiler/src/view_compiler/view_compiler.ts @@ -24,8 +24,7 @@ export {ComponentFactoryDependency, ComponentViewDependency, DirectiveWrapperDep export class ViewCompileResult { constructor( - public statements: o.Statement[], public viewClassVar: string, - public componentRenderTypeVar: string, + public statements: o.Statement[], public viewClassVar: string, public rendererTypeVar: string, public dependencies: Array) {} } @@ -52,6 +51,6 @@ export class ViewCompiler { finishView(view, statements); return new ViewCompileResult( - statements, view.classExpr.name, view.renderComponentTypeName, dependencies); + statements, view.classExpr.name, view.rendererTypeName, dependencies); } } diff --git a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts index 96bbdd3901..5683ffa6dd 100644 --- a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts +++ b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts @@ -9,7 +9,7 @@ import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; import {AnimationEntryCompileResult} from '../animation/animation_compiler'; -import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeSummary, CompileProviderMetadata, CompileTokenMetadata, CompileTypeMetadata, componentRenderTypeName, identifierModuleUrl, identifierName, tokenReference, viewClassName} from '../compile_metadata'; +import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeSummary, CompileProviderMetadata, CompileTokenMetadata, CompileTypeMetadata, identifierModuleUrl, identifierName, rendererTypeName, tokenReference, viewClassName} from '../compile_metadata'; import {BuiltinConverter, BuiltinConverterFactory, EventHandlerVars, LocalResolver, convertActionBinding, convertPropertyBinding, convertPropertyBindingBuiltins} from '../compiler_util/expression_converter'; import {CompilerConfig} from '../config'; import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast'; @@ -45,10 +45,10 @@ export class ViewCompilerNext extends ViewCompiler { const statements: o.Statement[] = []; - const renderComponentVar = o.variable(componentRenderTypeName(component.type.reference)); + const renderComponentVar = o.variable(rendererTypeName(component.type.reference)); statements.push( renderComponentVar - .set(o.importExpr(createIdentifier(Identifiers.createComponentRenderTypeV2)).callFn([ + .set(o.importExpr(createIdentifier(Identifiers.createRendererTypeV2)).callFn([ new o.LiteralMapExpr([ new o.LiteralMapEntry('encapsulation', o.literal(component.template.encapsulation)), new o.LiteralMapEntry('styles', styles), @@ -481,11 +481,11 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver, BuiltinConverter } }); - let compRenderType = o.NULL_EXPR; + let rendererType = o.NULL_EXPR; let compView = o.NULL_EXPR; if (directiveAst.directive.isComponent) { compView = o.importExpr({reference: directiveAst.directive.componentViewType}); - compRenderType = o.importExpr({reference: directiveAst.directive.componentRenderType}); + rendererType = o.importExpr({reference: directiveAst.directive.rendererType}); } const inputDefs = directiveAst.inputs.map((inputAst, inputIndex) => { @@ -533,7 +533,7 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver, BuiltinConverter o.literal(flags), queryMatchExprs.length ? o.literalArr(queryMatchExprs) : o.NULL_EXPR, o.literal(childCount), providerExpr, depsExpr, inputDefs.length ? new o.LiteralMapExpr(inputDefs) : o.NULL_EXPR, - outputDefs.length ? new o.LiteralMapExpr(outputDefs) : o.NULL_EXPR, compView, compRenderType + outputDefs.length ? new o.LiteralMapExpr(outputDefs) : o.NULL_EXPR, compView, rendererType ]); this.nodeDefs[nodeIndex] = nodeDef; diff --git a/modules/@angular/core/src/render.ts b/modules/@angular/core/src/render.ts index d5dd29272f..93be675c41 100644 --- a/modules/@angular/core/src/render.ts +++ b/modules/@angular/core/src/render.ts @@ -7,4 +7,4 @@ */ // Public API for render -export {ComponentRenderTypeV2, RenderComponentType, Renderer, RendererFactoryV2, RendererV2, RootRenderer} from './render/api'; +export {RenderComponentType, Renderer, RendererFactoryV2, RendererTypeV2, RendererV2, RootRenderer} from './render/api'; diff --git a/modules/@angular/core/src/render/api.ts b/modules/@angular/core/src/render/api.ts index 0e0048d977..d477ee2eef 100644 --- a/modules/@angular/core/src/render/api.ts +++ b/modules/@angular/core/src/render/api.ts @@ -111,7 +111,7 @@ export abstract class RootRenderer { /** * @experimental */ -export interface ComponentRenderTypeV2 { +export interface RendererTypeV2 { id: string; encapsulation: ViewEncapsulation; styles: (string|any[])[]; @@ -122,7 +122,7 @@ export interface ComponentRenderTypeV2 { * @experimental */ export abstract class RendererFactoryV2 { - abstract createRenderer(hostElement: any, type: ComponentRenderTypeV2): RendererV2; + abstract createRenderer(hostElement: any, type: RendererTypeV2): RendererV2; } /** diff --git a/modules/@angular/core/src/view/index.ts b/modules/@angular/core/src/view/index.ts index 94d992ec21..f26f8a7418 100644 --- a/modules/@angular/core/src/view/index.ts +++ b/modules/@angular/core/src/view/index.ts @@ -14,7 +14,7 @@ export {queryDef} from './query'; export {ViewRef_, createComponentFactory, nodeValue} from './refs'; export {initServicesIfNeeded} from './services'; export {textDef} from './text'; -export {createComponentRenderTypeV2, elementEventFullName, rootRenderNodes, unwrapValue} from './util'; +export {createRendererTypeV2, elementEventFullName, rootRenderNodes, unwrapValue} from './util'; export {viewDef} from './view'; export {attachEmbeddedView, detachEmbeddedView, moveEmbeddedView} from './view_attach'; diff --git a/modules/@angular/core/src/view/provider.ts b/modules/@angular/core/src/view/provider.ts index 40adccc323..00416124f4 100644 --- a/modules/@angular/core/src/view/provider.ts +++ b/modules/@angular/core/src/view/provider.ts @@ -12,7 +12,7 @@ import {ElementRef} from '../linker/element_ref'; import {TemplateRef} from '../linker/template_ref'; import {ViewContainerRef} from '../linker/view_container_ref'; import {ViewEncapsulation} from '../metadata/view'; -import {ComponentRenderTypeV2, Renderer as RendererV1, RendererFactoryV2, RendererV2} from '../render/api'; +import {Renderer as RendererV1, RendererFactoryV2, RendererTypeV2, RendererV2} from '../render/api'; import {createChangeDetectorRef, createInjector, createRendererV1, createTemplateRef, createViewContainerRef} from './refs'; import {BindingDef, BindingType, DepDef, DepFlags, DirectiveOutputDef, DisposableFn, NodeData, NodeDef, NodeFlags, NodeType, ProviderData, ProviderType, QueryBindingType, QueryDef, QueryValueType, RootData, Services, ViewData, ViewDefinition, ViewFlags, ViewState, asElementData, asProviderData} from './types'; @@ -32,7 +32,7 @@ export function directiveDef( flags: NodeFlags, matchedQueries: [string | number, QueryValueType][], childCount: number, ctor: any, deps: ([DepFlags, any] | any)[], props?: {[name: string]: [number, string]}, outputs?: {[name: string]: string}, component?: () => ViewDefinition, - componentRenderType?: ComponentRenderTypeV2): NodeDef { + rendererType?: RendererTypeV2): NodeDef { const bindings: BindingDef[] = []; if (props) { for (let prop in props) { @@ -54,7 +54,7 @@ export function directiveDef( } return _def( NodeType.Directive, flags, matchedQueries, childCount, ProviderType.Class, ctor, ctor, deps, - bindings, outputDefs, component, componentRenderType); + bindings, outputDefs, component, rendererType); } export function pipeDef(flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef { @@ -71,12 +71,12 @@ export function _def( type: NodeType, flags: NodeFlags, matchedQueriesDsl: [string | number, QueryValueType][], childCount: number, providerType: ProviderType, token: any, value: any, deps: ([DepFlags, any] | any)[], bindings?: BindingDef[], outputs?: DirectiveOutputDef[], - component?: () => ViewDefinition, componentRenderType?: ComponentRenderTypeV2): NodeDef { + component?: () => ViewDefinition, rendererType?: RendererTypeV2): NodeDef { const {matchedQueries, references, matchedQueryIds} = splitMatchedQueriesDsl(matchedQueriesDsl); - // This is needed as the jit compiler always uses an empty hash as default ComponentRenderTypeV2, + // This is needed as the jit compiler always uses an empty hash as default RendererTypeV2, // which is not filled for host views. - if (componentRenderType && componentRenderType.encapsulation == null) { - componentRenderType = null; + if (rendererType && rendererType.encapsulation == null) { + rendererType = null; } if (!outputs) { outputs = []; @@ -120,7 +120,7 @@ export function _def( type: providerType, token, tokenKey: tokenKey(token), value, - deps: depDefs, outputs, component, componentRenderType + deps: depDefs, outputs, component, rendererType }, text: undefined, pureExpression: undefined, diff --git a/modules/@angular/core/src/view/services.ts b/modules/@angular/core/src/view/services.ts index f692dc1009..da838c966f 100644 --- a/modules/@angular/core/src/view/services.ts +++ b/modules/@angular/core/src/view/services.ts @@ -9,7 +9,7 @@ import {isDevMode} from '../application_ref'; import {DebugElement, DebugNode, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node'; import {Injector} from '../di'; -import {ComponentRenderTypeV2, RendererFactoryV2, RendererV2} from '../render/api'; +import {RendererFactoryV2, RendererTypeV2, RendererV2} from '../render/api'; import {Sanitizer, SecurityContext} from '../security'; import {isViewDebugError, viewDestroyedError, viewWrappedDebugError} from './errors'; @@ -399,7 +399,7 @@ export function getCurrentDebugContext(): DebugContext { class DebugRendererFactoryV2 implements RendererFactoryV2 { constructor(private delegate: RendererFactoryV2) {} - createRenderer(element: any, renderData: ComponentRenderTypeV2): RendererV2 { + createRenderer(element: any, renderData: RendererTypeV2): RendererV2 { return new DebugRendererV2(this.delegate.createRenderer(element, renderData)); } } diff --git a/modules/@angular/core/src/view/types.ts b/modules/@angular/core/src/view/types.ts index 17b82b1ce8..8a954363f5 100644 --- a/modules/@angular/core/src/view/types.ts +++ b/modules/@angular/core/src/view/types.ts @@ -14,7 +14,7 @@ import {TemplateRef} from '../linker/template_ref'; import {ViewContainerRef} from '../linker/view_container_ref'; import {ViewRef} from '../linker/view_ref'; import {ViewEncapsulation} from '../metadata/view'; -import {ComponentRenderTypeV2, RendererFactoryV2, RendererV2} from '../render/api'; +import {RendererFactoryV2, RendererTypeV2, RendererV2} from '../render/api'; import {Sanitizer, SecurityContext} from '../security'; // ------------------------------------- @@ -219,7 +219,7 @@ export interface ProviderDef { value: any; deps: DepDef[]; outputs: DirectiveOutputDef[]; - componentRenderType: ComponentRenderTypeV2; + rendererType: RendererTypeV2; // closure to allow recursive components component: ViewDefinitionFactory; } diff --git a/modules/@angular/core/src/view/util.ts b/modules/@angular/core/src/view/util.ts index 8da0452fc0..c0d8b4a6be 100644 --- a/modules/@angular/core/src/view/util.ts +++ b/modules/@angular/core/src/view/util.ts @@ -15,7 +15,7 @@ import {TemplateRef} from '../linker/template_ref'; import {ViewContainerRef} from '../linker/view_container_ref'; import {ViewRef} from '../linker/view_ref'; import {ViewEncapsulation} from '../metadata/view'; -import {ComponentRenderTypeV2, Renderer} from '../render/api'; +import {Renderer, RendererTypeV2} from '../render/api'; import {expressionChangedAfterItHasBeenCheckedError, isViewDebugError, viewDestroyedError, viewWrappedDebugError} from './errors'; import {DebugContext, ElementData, NodeData, NodeDef, NodeFlags, NodeType, QueryValueType, Services, ViewData, ViewDefinition, ViewDefinitionFactory, ViewFlags, ViewState, asElementData, asProviderData, asTextData} from './types'; @@ -43,11 +43,11 @@ export function unwrapValue(value: any): any { let _renderCompCount = 0; -export function createComponentRenderTypeV2(values: { +export function createRendererTypeV2(values: { styles: (string | any[])[], encapsulation: ViewEncapsulation, data: {[kind: string]: any[]} -}): ComponentRenderTypeV2 { +}): RendererTypeV2 { const isFilled = values && (values.encapsulation !== ViewEncapsulation.None || values.styles.length || Object.keys(values.data).length); if (isFilled) { @@ -173,8 +173,8 @@ export function getParentRenderElement(view: ViewData, renderHost: any, def: Nod if (renderParent) { const parent = def.parent; if (parent && (parent.type !== NodeType.Element || !parent.element.component || - (parent.element.component.provider.componentRenderType && - parent.element.component.provider.componentRenderType.encapsulation === + (parent.element.component.provider.rendererType && + parent.element.component.provider.rendererType.encapsulation === ViewEncapsulation.Native))) { // only children of non components, or children of components with native encapsulation should // be attached. diff --git a/modules/@angular/core/src/view/view.ts b/modules/@angular/core/src/view/view.ts index fa3a4bab8c..6650d01bbe 100644 --- a/modules/@angular/core/src/view/view.ts +++ b/modules/@angular/core/src/view/view.ts @@ -7,7 +7,7 @@ */ import {ViewEncapsulation} from '../metadata/view'; -import {ComponentRenderTypeV2, RendererV2} from '../render/api'; +import {RendererTypeV2, RendererV2} from '../render/api'; import {checkAndUpdateElementDynamic, checkAndUpdateElementInline, createElement} from './element'; import {expressionChangedAfterItHasBeenCheckedError} from './errors'; @@ -291,13 +291,13 @@ function createViewNodes(view: ViewData) { // the component view. Therefore, we create the component view first // and set the ProviderData in ViewData, and then instantiate the provider. const compViewDef = resolveViewDefinition(nodeDef.provider.component); - const compRenderType = nodeDef.provider.componentRenderType; + const rendererType = nodeDef.provider.rendererType; let compRenderer: RendererV2; - if (!compRenderType) { + if (!rendererType) { compRenderer = view.root.renderer; } else { const hostEl = asElementData(view, nodeDef.parent.index).renderElement; - compRenderer = view.root.rendererFactory.createRenderer(hostEl, compRenderType); + compRenderer = view.root.rendererFactory.createRenderer(hostEl, rendererType); } const componentView = createView(view.root, compRenderer, view, nodeDef, compViewDef); const providerData = {componentView, instance: undefined}; diff --git a/modules/@angular/platform-browser/src/dom/dom_renderer.ts b/modules/@angular/platform-browser/src/dom/dom_renderer.ts index 9cc734c7fb..950522dd50 100644 --- a/modules/@angular/platform-browser/src/dom/dom_renderer.ts +++ b/modules/@angular/platform-browser/src/dom/dom_renderer.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {APP_ID, ComponentRenderTypeV2, Inject, Injectable, RenderComponentType, Renderer, RendererFactoryV2, RendererV2, RootRenderer, ViewEncapsulation} from '@angular/core'; +import {APP_ID, Inject, Injectable, RenderComponentType, Renderer, RendererFactoryV2, RendererTypeV2, RendererV2, RootRenderer, ViewEncapsulation} from '@angular/core'; import {isPresent, stringify} from '../facade/lang'; import {AnimationKeyframe, AnimationPlayer, AnimationStyles, DirectRenderer, NoOpAnimationPlayer, RenderDebugInfo} from '../private_import_core'; @@ -369,7 +369,7 @@ export class DomRendererFactoryV2 implements RendererFactoryV2 { this.defaultRenderer = new DefaultDomRendererV2(eventManager); }; - createRenderer(element: any, type: ComponentRenderTypeV2): RendererV2 { + createRenderer(element: any, type: RendererTypeV2): RendererV2 { if (!element || !type) { return this.defaultRenderer; } @@ -505,7 +505,7 @@ class EmulatedEncapsulationDomRendererV2 extends DefaultDomRendererV2 { constructor( eventManager: EventManager, sharedStylesHost: DomSharedStylesHost, - private component: ComponentRenderTypeV2) { + private component: RendererTypeV2) { super(eventManager); const styles = flattenStyles(component.id, component.styles, []); sharedStylesHost.addStyles(styles); @@ -528,7 +528,7 @@ class ShadowDomRenderer extends DefaultDomRendererV2 { constructor( eventManager: EventManager, private sharedStylesHost: DomSharedStylesHost, - private hostEl: any, private component: ComponentRenderTypeV2) { + private hostEl: any, private component: RendererTypeV2) { super(eventManager); this.shadowRoot = (hostEl as any).createShadowRoot(); this.sharedStylesHost.addHost(this.shadowRoot); diff --git a/modules/@angular/platform-server/src/server_renderer.ts b/modules/@angular/platform-server/src/server_renderer.ts index 35b91a3dad..5364d1bfcf 100644 --- a/modules/@angular/platform-server/src/server_renderer.ts +++ b/modules/@angular/platform-server/src/server_renderer.ts @@ -7,7 +7,7 @@ */ import {DomElementSchemaRegistry} from '@angular/compiler'; -import {APP_ID, ComponentRenderTypeV2, Inject, Injectable, NgZone, RenderComponentType, Renderer, RendererFactoryV2, RendererV2, RootRenderer, ViewEncapsulation} from '@angular/core'; +import {APP_ID, Inject, Injectable, NgZone, RenderComponentType, Renderer, RendererFactoryV2, RendererTypeV2, RendererV2, RootRenderer, ViewEncapsulation} from '@angular/core'; import {AnimationDriver, DOCUMENT} from '@angular/platform-browser'; import {isBlank, isPresent, stringify} from './facade/lang'; @@ -273,7 +273,7 @@ export class ServerRendererFactoryV2 implements RendererFactoryV2 { this.defaultRenderer = new DefaultServerRendererV2(document, ngZone); }; - createRenderer(element: any, type: ComponentRenderTypeV2): RendererV2 { + createRenderer(element: any, type: RendererTypeV2): RendererV2 { if (!element || !type) { return this.defaultRenderer; } @@ -404,7 +404,7 @@ class EmulatedEncapsulationServerRendererV2 extends DefaultServerRendererV2 { constructor( document: any, ngZone: NgZone, sharedStylesHost: SharedStylesHost, - private component: ComponentRenderTypeV2) { + private component: RendererTypeV2) { super(document, ngZone); const styles = flattenStyles(component.id, component.styles, []); sharedStylesHost.addStyles(styles); diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index ec6610ea32..da45578d39 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -292,16 +292,6 @@ export declare abstract class ComponentRef { abstract onDestroy(callback: Function): void; } -/** @experimental */ -export interface ComponentRenderTypeV2 { - data: { - [kind: string]: any[]; - }; - encapsulation: ViewEncapsulation; - id: string; - styles: (string | any[])[]; -} - /** @stable */ export declare const ContentChild: ContentChildDecorator; @@ -859,7 +849,17 @@ export declare abstract class Renderer { /** @experimental */ export declare abstract class RendererFactoryV2 { - abstract createRenderer(hostElement: any, type: ComponentRenderTypeV2): RendererV2; + abstract createRenderer(hostElement: any, type: RendererTypeV2): RendererV2; +} + +/** @experimental */ +export interface RendererTypeV2 { + data: { + [kind: string]: any[]; + }; + encapsulation: ViewEncapsulation; + id: string; + styles: (string | any[])[]; } /** @experimental */