refactor: rename `ComponentRenderTypeV2` to `RendererTypeV2`
This commit is contained in:
parent
b9f17a9cb2
commit
778ded9fcf
|
@ -223,10 +223,7 @@ export class AotCompiler {
|
||||||
}
|
}
|
||||||
compiledAnimations.forEach(entry => targetStatements.push(...entry.statements));
|
compiledAnimations.forEach(entry => targetStatements.push(...entry.statements));
|
||||||
targetStatements.push(...viewResult.statements);
|
targetStatements.push(...viewResult.statements);
|
||||||
return {
|
return {viewClassVar: viewResult.viewClassVar, compRenderTypeVar: viewResult.rendererTypeVar};
|
||||||
viewClassVar: viewResult.viewClassVar,
|
|
||||||
compRenderTypeVar: viewResult.componentRenderTypeVar
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _codgenStyles(
|
private _codgenStyles(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {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 {StaticSymbol} from './aot/static_symbol';
|
||||||
import {ListWrapper} from './facade/collection';
|
import {ListWrapper} from './facade/collection';
|
||||||
|
@ -117,7 +117,7 @@ export function viewClassName(compType: any, embeddedTemplateIndex: number): str
|
||||||
return `View_${identifierName({reference: compType})}_${embeddedTemplateIndex}`;
|
return `View_${identifierName({reference: compType})}_${embeddedTemplateIndex}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function componentRenderTypeName(compType: any): string {
|
export function rendererTypeName(compType: any): string {
|
||||||
return `RenderType_${identifierName({reference: compType})}`;
|
return `RenderType_${identifierName({reference: compType})}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ export interface CompileDirectiveSummary extends CompileTypeSummary {
|
||||||
template: CompileTemplateSummary;
|
template: CompileTemplateSummary;
|
||||||
wrapperType: StaticSymbol|ProxyClass;
|
wrapperType: StaticSymbol|ProxyClass;
|
||||||
componentViewType: StaticSymbol|ProxyClass;
|
componentViewType: StaticSymbol|ProxyClass;
|
||||||
componentRenderType: StaticSymbol|ComponentRenderTypeV2;
|
rendererType: StaticSymbol|RendererTypeV2;
|
||||||
componentFactory: StaticSymbol|ComponentFactory<any>;
|
componentFactory: StaticSymbol|ComponentFactory<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ export class CompileDirectiveMetadata {
|
||||||
static create(
|
static create(
|
||||||
{isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host,
|
{isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host,
|
||||||
providers, viewProviders, queries, viewQueries, entryComponents, template, wrapperType,
|
providers, viewProviders, queries, viewQueries, entryComponents, template, wrapperType,
|
||||||
componentViewType, componentRenderType, componentFactory}: {
|
componentViewType, rendererType, componentFactory}: {
|
||||||
isHost?: boolean,
|
isHost?: boolean,
|
||||||
type?: CompileTypeMetadata,
|
type?: CompileTypeMetadata,
|
||||||
isComponent?: boolean,
|
isComponent?: boolean,
|
||||||
|
@ -344,7 +344,7 @@ export class CompileDirectiveMetadata {
|
||||||
template?: CompileTemplateMetadata,
|
template?: CompileTemplateMetadata,
|
||||||
wrapperType?: StaticSymbol|ProxyClass,
|
wrapperType?: StaticSymbol|ProxyClass,
|
||||||
componentViewType?: StaticSymbol|ProxyClass,
|
componentViewType?: StaticSymbol|ProxyClass,
|
||||||
componentRenderType?: StaticSymbol|ComponentRenderTypeV2,
|
rendererType?: StaticSymbol|RendererTypeV2,
|
||||||
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
||||||
} = {}): CompileDirectiveMetadata {
|
} = {}): CompileDirectiveMetadata {
|
||||||
const hostListeners: {[key: string]: string} = {};
|
const hostListeners: {[key: string]: string} = {};
|
||||||
|
@ -399,7 +399,7 @@ export class CompileDirectiveMetadata {
|
||||||
template,
|
template,
|
||||||
wrapperType,
|
wrapperType,
|
||||||
componentViewType,
|
componentViewType,
|
||||||
componentRenderType,
|
rendererType,
|
||||||
componentFactory,
|
componentFactory,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -424,13 +424,13 @@ export class CompileDirectiveMetadata {
|
||||||
|
|
||||||
wrapperType: StaticSymbol|ProxyClass;
|
wrapperType: StaticSymbol|ProxyClass;
|
||||||
componentViewType: StaticSymbol|ProxyClass;
|
componentViewType: StaticSymbol|ProxyClass;
|
||||||
componentRenderType: StaticSymbol|ComponentRenderTypeV2;
|
rendererType: StaticSymbol|RendererTypeV2;
|
||||||
componentFactory: StaticSymbol|ComponentFactory<any>;
|
componentFactory: StaticSymbol|ComponentFactory<any>;
|
||||||
|
|
||||||
constructor({isHost, type, isComponent, selector, exportAs,
|
constructor({isHost, type, isComponent, selector, exportAs,
|
||||||
changeDetection, inputs, outputs, hostListeners, hostProperties,
|
changeDetection, inputs, outputs, hostListeners, hostProperties,
|
||||||
hostAttributes, providers, viewProviders, queries, viewQueries,
|
hostAttributes, providers, viewProviders, queries, viewQueries,
|
||||||
entryComponents, template, wrapperType, componentViewType, componentRenderType,
|
entryComponents, template, wrapperType, componentViewType, rendererType,
|
||||||
componentFactory}: {
|
componentFactory}: {
|
||||||
isHost?: boolean,
|
isHost?: boolean,
|
||||||
type?: CompileTypeMetadata,
|
type?: CompileTypeMetadata,
|
||||||
|
@ -451,7 +451,7 @@ export class CompileDirectiveMetadata {
|
||||||
template?: CompileTemplateMetadata,
|
template?: CompileTemplateMetadata,
|
||||||
wrapperType?: StaticSymbol|ProxyClass,
|
wrapperType?: StaticSymbol|ProxyClass,
|
||||||
componentViewType?: StaticSymbol|ProxyClass,
|
componentViewType?: StaticSymbol|ProxyClass,
|
||||||
componentRenderType?: StaticSymbol|ComponentRenderTypeV2,
|
rendererType?: StaticSymbol|RendererTypeV2,
|
||||||
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
this.isHost = !!isHost;
|
this.isHost = !!isHost;
|
||||||
|
@ -474,7 +474,7 @@ export class CompileDirectiveMetadata {
|
||||||
|
|
||||||
this.wrapperType = wrapperType;
|
this.wrapperType = wrapperType;
|
||||||
this.componentViewType = componentViewType;
|
this.componentViewType = componentViewType;
|
||||||
this.componentRenderType = componentRenderType;
|
this.rendererType = rendererType;
|
||||||
this.componentFactory = componentFactory;
|
this.componentFactory = componentFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ export class CompileDirectiveMetadata {
|
||||||
template: this.template && this.template.toSummary(),
|
template: this.template && this.template.toSummary(),
|
||||||
wrapperType: this.wrapperType,
|
wrapperType: this.wrapperType,
|
||||||
componentViewType: this.componentViewType,
|
componentViewType: this.componentViewType,
|
||||||
componentRenderType: this.componentRenderType,
|
rendererType: this.rendererType,
|
||||||
componentFactory: this.componentFactory
|
componentFactory: this.componentFactory
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -535,8 +535,7 @@ export function createHostComponentMeta(
|
||||||
queries: [],
|
queries: [],
|
||||||
viewQueries: [],
|
viewQueries: [],
|
||||||
componentViewType: hostViewType,
|
componentViewType: hostViewType,
|
||||||
componentRenderType:
|
rendererType: {id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}}
|
||||||
{id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {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';
|
import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata';
|
||||||
|
|
||||||
|
@ -380,11 +380,11 @@ export class Identifiers {
|
||||||
member: 'unwrapValue',
|
member: 'unwrapValue',
|
||||||
runtime: ɵviewEngine.unwrapValue
|
runtime: ɵviewEngine.unwrapValue
|
||||||
};
|
};
|
||||||
static createComponentRenderTypeV2: IdentifierSpec = {
|
static createRendererTypeV2: IdentifierSpec = {
|
||||||
name: 'ɵviewEngine',
|
name: 'ɵviewEngine',
|
||||||
moduleUrl: CORE,
|
moduleUrl: CORE,
|
||||||
member: 'createComponentRenderTypeV2',
|
member: 'createRendererTypeV2',
|
||||||
runtime: ɵviewEngine.createComponentRenderTypeV2
|
runtime: ɵviewEngine.createRendererTypeV2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {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 {AnimationCompiler} from '../animation/animation_compiler';
|
||||||
import {AnimationParser} from '../animation/animation_parser';
|
import {AnimationParser} from '../animation/animation_parser';
|
||||||
|
@ -290,18 +290,17 @@ export class JitCompiler implements Compiler {
|
||||||
.concat(...compiledAnimations.map(ca => ca.statements))
|
.concat(...compiledAnimations.map(ca => ca.statements))
|
||||||
.concat(compileResult.statements);
|
.concat(compileResult.statements);
|
||||||
let viewClass: any;
|
let viewClass: any;
|
||||||
let componentRenderType: any;
|
let rendererType: any;
|
||||||
if (!this._compilerConfig.useJit) {
|
if (!this._compilerConfig.useJit) {
|
||||||
[viewClass, componentRenderType] = interpretStatements(
|
[viewClass, rendererType] = interpretStatements(
|
||||||
statements, [compileResult.viewClassVar, compileResult.componentRenderTypeVar]);
|
statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]);
|
||||||
} else {
|
} else {
|
||||||
const sourceUrl =
|
const sourceUrl =
|
||||||
`/${identifierName(template.ngModule.type)}/${identifierName(template.compType)}/${template.isHost?'host':'component'}.ngfactory.js`;
|
`/${identifierName(template.ngModule.type)}/${identifierName(template.compType)}/${template.isHost?'host':'component'}.ngfactory.js`;
|
||||||
[viewClass, componentRenderType] = jitStatements(
|
[viewClass, rendererType] = jitStatements(
|
||||||
sourceUrl, statements,
|
sourceUrl, statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]);
|
||||||
[compileResult.viewClassVar, compileResult.componentRenderTypeVar]);
|
|
||||||
}
|
}
|
||||||
template.compiled(viewClass, componentRenderType);
|
template.compiled(viewClass, rendererType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _resolveStylesCompileResult(
|
private _resolveStylesCompileResult(
|
||||||
|
@ -336,11 +335,11 @@ class CompiledTemplate {
|
||||||
public compMeta: CompileDirectiveMetadata, public ngModule: CompileNgModuleMetadata,
|
public compMeta: CompileDirectiveMetadata, public ngModule: CompileNgModuleMetadata,
|
||||||
public directives: CompileIdentifierMetadata[]) {}
|
public directives: CompileIdentifierMetadata[]) {}
|
||||||
|
|
||||||
compiled(viewClass: Function, componentRenderType: any) {
|
compiled(viewClass: Function, rendererType: any) {
|
||||||
this._viewClass = viewClass;
|
this._viewClass = viewClass;
|
||||||
(<ProxyClass>this.compMeta.componentViewType).setDelegate(viewClass);
|
(<ProxyClass>this.compMeta.componentViewType).setDelegate(viewClass);
|
||||||
for (let prop in componentRenderType) {
|
for (let prop in rendererType) {
|
||||||
(<any>this.compMeta.componentRenderType)[prop] = componentRenderType[prop];
|
(<any>this.compMeta.rendererType)[prop] = rendererType[prop];
|
||||||
}
|
}
|
||||||
this.isCompiled = true;
|
this.isCompiled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {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 {StaticSymbol, StaticSymbolCache} from './aot/static_symbol';
|
||||||
import {ngfactoryFilePath} from './aot/util';
|
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) {
|
if (dirType instanceof StaticSymbol) {
|
||||||
return this._staticSymbolCache.get(
|
return this._staticSymbolCache.get(
|
||||||
ngfactoryFilePath(dirType.filePath), cpl.componentRenderTypeName(dirType));
|
ngfactoryFilePath(dirType.filePath), cpl.rendererTypeName(dirType));
|
||||||
} else {
|
} else {
|
||||||
// returning an object as proxy,
|
// returning an object as proxy,
|
||||||
// that we fill later during runtime compilation.
|
// that we fill later during runtime compilation.
|
||||||
|
@ -246,7 +246,7 @@ export class CompileMetadataResolver {
|
||||||
entryComponents: metadata.entryComponents,
|
entryComponents: metadata.entryComponents,
|
||||||
wrapperType: metadata.wrapperType,
|
wrapperType: metadata.wrapperType,
|
||||||
componentViewType: metadata.componentViewType,
|
componentViewType: metadata.componentViewType,
|
||||||
componentRenderType: metadata.componentRenderType,
|
rendererType: metadata.rendererType,
|
||||||
componentFactory: metadata.componentFactory,
|
componentFactory: metadata.componentFactory,
|
||||||
template: templateMetadata
|
template: templateMetadata
|
||||||
});
|
});
|
||||||
|
@ -384,8 +384,7 @@ export class CompileMetadataResolver {
|
||||||
wrapperType: this.getDirectiveWrapperClass(directiveType),
|
wrapperType: this.getDirectiveWrapperClass(directiveType),
|
||||||
componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
|
componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
|
||||||
undefined,
|
undefined,
|
||||||
componentRenderType:
|
rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : undefined,
|
||||||
nonNormalizedTemplateMetadata ? this.getComponentRenderType(directiveType) : undefined,
|
|
||||||
componentFactory: nonNormalizedTemplateMetadata ?
|
componentFactory: nonNormalizedTemplateMetadata ?
|
||||||
this.getComponentFactory(selector, directiveType) :
|
this.getComponentFactory(selector, directiveType) :
|
||||||
undefined
|
undefined
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryCompileResult} from '../animation/animation_compiler';
|
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 {EventHandlerVars, LegacyNameResolver} from '../compiler_util/expression_converter';
|
||||||
import {CompilerConfig} from '../config';
|
import {CompilerConfig} from '../config';
|
||||||
import {isPresent} from '../facade/lang';
|
import {isPresent} from '../facade/lang';
|
||||||
|
@ -70,7 +70,7 @@ export class CompileView implements LegacyNameResolver {
|
||||||
public pipes: CompilePipe[] = [];
|
public pipes: CompilePipe[] = [];
|
||||||
public locals = new Map<string, o.Expression>();
|
public locals = new Map<string, o.Expression>();
|
||||||
public className: string;
|
public className: string;
|
||||||
public renderComponentTypeName: string;
|
public rendererTypeName: string;
|
||||||
public classType: o.Type;
|
public classType: o.Type;
|
||||||
public classExpr: o.ReadVarExpr;
|
public classExpr: o.ReadVarExpr;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ export class CompileView implements LegacyNameResolver {
|
||||||
|
|
||||||
this.viewType = getViewType(component, viewIndex);
|
this.viewType = getViewType(component, viewIndex);
|
||||||
this.className = viewClassName(component.type.reference, 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.classType = o.expressionType(o.variable(this.className));
|
||||||
this.classExpr = o.variable(this.className);
|
this.classExpr = o.variable(this.className);
|
||||||
if (this.viewType === ViewType.COMPONENT || this.viewType === ViewType.HOST) {
|
if (this.viewType === ViewType.COMPONENT || this.viewType === ViewType.HOST) {
|
||||||
|
|
|
@ -386,7 +386,7 @@ function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statemen
|
||||||
|
|
||||||
|
|
||||||
const renderCompTypeVar: o.ReadVarExpr =
|
const renderCompTypeVar: o.ReadVarExpr =
|
||||||
o.variable(view.renderComponentTypeName); // fix highlighting: `
|
o.variable(view.rendererTypeName); // fix highlighting: `
|
||||||
if (view.viewIndex === 0) {
|
if (view.viewIndex === 0) {
|
||||||
let templateUrlInfo: string;
|
let templateUrlInfo: string;
|
||||||
if (view.component.template.templateUrl == identifierModuleUrl(view.component.type)) {
|
if (view.component.template.templateUrl == identifierModuleUrl(view.component.type)) {
|
||||||
|
|
|
@ -24,8 +24,7 @@ export {ComponentFactoryDependency, ComponentViewDependency, DirectiveWrapperDep
|
||||||
|
|
||||||
export class ViewCompileResult {
|
export class ViewCompileResult {
|
||||||
constructor(
|
constructor(
|
||||||
public statements: o.Statement[], public viewClassVar: string,
|
public statements: o.Statement[], public viewClassVar: string, public rendererTypeVar: string,
|
||||||
public componentRenderTypeVar: string,
|
|
||||||
public dependencies:
|
public dependencies:
|
||||||
Array<ComponentViewDependency|ComponentFactoryDependency|DirectiveWrapperDependency>) {}
|
Array<ComponentViewDependency|ComponentFactoryDependency|DirectiveWrapperDependency>) {}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +51,6 @@ export class ViewCompiler {
|
||||||
finishView(view, statements);
|
finishView(view, statements);
|
||||||
|
|
||||||
return new ViewCompileResult(
|
return new ViewCompileResult(
|
||||||
statements, view.classExpr.name, view.renderComponentTypeName, dependencies);
|
statements, view.classExpr.name, view.rendererTypeName, dependencies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
|
import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
|
||||||
|
|
||||||
import {AnimationEntryCompileResult} from '../animation/animation_compiler';
|
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 {BuiltinConverter, BuiltinConverterFactory, EventHandlerVars, LocalResolver, convertActionBinding, convertPropertyBinding, convertPropertyBindingBuiltins} from '../compiler_util/expression_converter';
|
||||||
import {CompilerConfig} from '../config';
|
import {CompilerConfig} from '../config';
|
||||||
import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast';
|
import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast';
|
||||||
|
@ -45,10 +45,10 @@ export class ViewCompilerNext extends ViewCompiler {
|
||||||
|
|
||||||
const statements: o.Statement[] = [];
|
const statements: o.Statement[] = [];
|
||||||
|
|
||||||
const renderComponentVar = o.variable(componentRenderTypeName(component.type.reference));
|
const renderComponentVar = o.variable(rendererTypeName(component.type.reference));
|
||||||
statements.push(
|
statements.push(
|
||||||
renderComponentVar
|
renderComponentVar
|
||||||
.set(o.importExpr(createIdentifier(Identifiers.createComponentRenderTypeV2)).callFn([
|
.set(o.importExpr(createIdentifier(Identifiers.createRendererTypeV2)).callFn([
|
||||||
new o.LiteralMapExpr([
|
new o.LiteralMapExpr([
|
||||||
new o.LiteralMapEntry('encapsulation', o.literal(component.template.encapsulation)),
|
new o.LiteralMapEntry('encapsulation', o.literal(component.template.encapsulation)),
|
||||||
new o.LiteralMapEntry('styles', styles),
|
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;
|
let compView = o.NULL_EXPR;
|
||||||
if (directiveAst.directive.isComponent) {
|
if (directiveAst.directive.isComponent) {
|
||||||
compView = o.importExpr({reference: directiveAst.directive.componentViewType});
|
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) => {
|
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(flags), queryMatchExprs.length ? o.literalArr(queryMatchExprs) : o.NULL_EXPR,
|
||||||
o.literal(childCount), providerExpr, depsExpr,
|
o.literal(childCount), providerExpr, depsExpr,
|
||||||
inputDefs.length ? new o.LiteralMapExpr(inputDefs) : o.NULL_EXPR,
|
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;
|
this.nodeDefs[nodeIndex] = nodeDef;
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Public API for render
|
// Public API for render
|
||||||
export {ComponentRenderTypeV2, RenderComponentType, Renderer, RendererFactoryV2, RendererV2, RootRenderer} from './render/api';
|
export {RenderComponentType, Renderer, RendererFactoryV2, RendererTypeV2, RendererV2, RootRenderer} from './render/api';
|
||||||
|
|
|
@ -111,7 +111,7 @@ export abstract class RootRenderer {
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export interface ComponentRenderTypeV2 {
|
export interface RendererTypeV2 {
|
||||||
id: string;
|
id: string;
|
||||||
encapsulation: ViewEncapsulation;
|
encapsulation: ViewEncapsulation;
|
||||||
styles: (string|any[])[];
|
styles: (string|any[])[];
|
||||||
|
@ -122,7 +122,7 @@ export interface ComponentRenderTypeV2 {
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export abstract class RendererFactoryV2 {
|
export abstract class RendererFactoryV2 {
|
||||||
abstract createRenderer(hostElement: any, type: ComponentRenderTypeV2): RendererV2;
|
abstract createRenderer(hostElement: any, type: RendererTypeV2): RendererV2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ export {queryDef} from './query';
|
||||||
export {ViewRef_, createComponentFactory, nodeValue} from './refs';
|
export {ViewRef_, createComponentFactory, nodeValue} from './refs';
|
||||||
export {initServicesIfNeeded} from './services';
|
export {initServicesIfNeeded} from './services';
|
||||||
export {textDef} from './text';
|
export {textDef} from './text';
|
||||||
export {createComponentRenderTypeV2, elementEventFullName, rootRenderNodes, unwrapValue} from './util';
|
export {createRendererTypeV2, elementEventFullName, rootRenderNodes, unwrapValue} from './util';
|
||||||
export {viewDef} from './view';
|
export {viewDef} from './view';
|
||||||
export {attachEmbeddedView, detachEmbeddedView, moveEmbeddedView} from './view_attach';
|
export {attachEmbeddedView, detachEmbeddedView, moveEmbeddedView} from './view_attach';
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {ElementRef} from '../linker/element_ref';
|
||||||
import {TemplateRef} from '../linker/template_ref';
|
import {TemplateRef} from '../linker/template_ref';
|
||||||
import {ViewContainerRef} from '../linker/view_container_ref';
|
import {ViewContainerRef} from '../linker/view_container_ref';
|
||||||
import {ViewEncapsulation} from '../metadata/view';
|
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 {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';
|
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,
|
flags: NodeFlags, matchedQueries: [string | number, QueryValueType][], childCount: number,
|
||||||
ctor: any, deps: ([DepFlags, any] | any)[], props?: {[name: string]: [number, string]},
|
ctor: any, deps: ([DepFlags, any] | any)[], props?: {[name: string]: [number, string]},
|
||||||
outputs?: {[name: string]: string}, component?: () => ViewDefinition,
|
outputs?: {[name: string]: string}, component?: () => ViewDefinition,
|
||||||
componentRenderType?: ComponentRenderTypeV2): NodeDef {
|
rendererType?: RendererTypeV2): NodeDef {
|
||||||
const bindings: BindingDef[] = [];
|
const bindings: BindingDef[] = [];
|
||||||
if (props) {
|
if (props) {
|
||||||
for (let prop in props) {
|
for (let prop in props) {
|
||||||
|
@ -54,7 +54,7 @@ export function directiveDef(
|
||||||
}
|
}
|
||||||
return _def(
|
return _def(
|
||||||
NodeType.Directive, flags, matchedQueries, childCount, ProviderType.Class, ctor, ctor, deps,
|
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 {
|
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][],
|
type: NodeType, flags: NodeFlags, matchedQueriesDsl: [string | number, QueryValueType][],
|
||||||
childCount: number, providerType: ProviderType, token: any, value: any,
|
childCount: number, providerType: ProviderType, token: any, value: any,
|
||||||
deps: ([DepFlags, any] | any)[], bindings?: BindingDef[], outputs?: DirectiveOutputDef[],
|
deps: ([DepFlags, any] | any)[], bindings?: BindingDef[], outputs?: DirectiveOutputDef[],
|
||||||
component?: () => ViewDefinition, componentRenderType?: ComponentRenderTypeV2): NodeDef {
|
component?: () => ViewDefinition, rendererType?: RendererTypeV2): NodeDef {
|
||||||
const {matchedQueries, references, matchedQueryIds} = splitMatchedQueriesDsl(matchedQueriesDsl);
|
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.
|
// which is not filled for host views.
|
||||||
if (componentRenderType && componentRenderType.encapsulation == null) {
|
if (rendererType && rendererType.encapsulation == null) {
|
||||||
componentRenderType = null;
|
rendererType = null;
|
||||||
}
|
}
|
||||||
if (!outputs) {
|
if (!outputs) {
|
||||||
outputs = [];
|
outputs = [];
|
||||||
|
@ -120,7 +120,7 @@ export function _def(
|
||||||
type: providerType,
|
type: providerType,
|
||||||
token,
|
token,
|
||||||
tokenKey: tokenKey(token), value,
|
tokenKey: tokenKey(token), value,
|
||||||
deps: depDefs, outputs, component, componentRenderType
|
deps: depDefs, outputs, component, rendererType
|
||||||
},
|
},
|
||||||
text: undefined,
|
text: undefined,
|
||||||
pureExpression: undefined,
|
pureExpression: undefined,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import {isDevMode} from '../application_ref';
|
import {isDevMode} from '../application_ref';
|
||||||
import {DebugElement, DebugNode, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
|
import {DebugElement, DebugNode, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
|
||||||
import {Injector} from '../di';
|
import {Injector} from '../di';
|
||||||
import {ComponentRenderTypeV2, RendererFactoryV2, RendererV2} from '../render/api';
|
import {RendererFactoryV2, RendererTypeV2, RendererV2} from '../render/api';
|
||||||
import {Sanitizer, SecurityContext} from '../security';
|
import {Sanitizer, SecurityContext} from '../security';
|
||||||
|
|
||||||
import {isViewDebugError, viewDestroyedError, viewWrappedDebugError} from './errors';
|
import {isViewDebugError, viewDestroyedError, viewWrappedDebugError} from './errors';
|
||||||
|
@ -399,7 +399,7 @@ export function getCurrentDebugContext(): DebugContext {
|
||||||
class DebugRendererFactoryV2 implements RendererFactoryV2 {
|
class DebugRendererFactoryV2 implements RendererFactoryV2 {
|
||||||
constructor(private delegate: 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));
|
return new DebugRendererV2(this.delegate.createRenderer(element, renderData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {TemplateRef} from '../linker/template_ref';
|
||||||
import {ViewContainerRef} from '../linker/view_container_ref';
|
import {ViewContainerRef} from '../linker/view_container_ref';
|
||||||
import {ViewRef} from '../linker/view_ref';
|
import {ViewRef} from '../linker/view_ref';
|
||||||
import {ViewEncapsulation} from '../metadata/view';
|
import {ViewEncapsulation} from '../metadata/view';
|
||||||
import {ComponentRenderTypeV2, RendererFactoryV2, RendererV2} from '../render/api';
|
import {RendererFactoryV2, RendererTypeV2, RendererV2} from '../render/api';
|
||||||
import {Sanitizer, SecurityContext} from '../security';
|
import {Sanitizer, SecurityContext} from '../security';
|
||||||
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
@ -219,7 +219,7 @@ export interface ProviderDef {
|
||||||
value: any;
|
value: any;
|
||||||
deps: DepDef[];
|
deps: DepDef[];
|
||||||
outputs: DirectiveOutputDef[];
|
outputs: DirectiveOutputDef[];
|
||||||
componentRenderType: ComponentRenderTypeV2;
|
rendererType: RendererTypeV2;
|
||||||
// closure to allow recursive components
|
// closure to allow recursive components
|
||||||
component: ViewDefinitionFactory;
|
component: ViewDefinitionFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {TemplateRef} from '../linker/template_ref';
|
||||||
import {ViewContainerRef} from '../linker/view_container_ref';
|
import {ViewContainerRef} from '../linker/view_container_ref';
|
||||||
import {ViewRef} from '../linker/view_ref';
|
import {ViewRef} from '../linker/view_ref';
|
||||||
import {ViewEncapsulation} from '../metadata/view';
|
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 {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';
|
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;
|
let _renderCompCount = 0;
|
||||||
|
|
||||||
export function createComponentRenderTypeV2(values: {
|
export function createRendererTypeV2(values: {
|
||||||
styles: (string | any[])[],
|
styles: (string | any[])[],
|
||||||
encapsulation: ViewEncapsulation,
|
encapsulation: ViewEncapsulation,
|
||||||
data: {[kind: string]: any[]}
|
data: {[kind: string]: any[]}
|
||||||
}): ComponentRenderTypeV2 {
|
}): RendererTypeV2 {
|
||||||
const isFilled = values && (values.encapsulation !== ViewEncapsulation.None ||
|
const isFilled = values && (values.encapsulation !== ViewEncapsulation.None ||
|
||||||
values.styles.length || Object.keys(values.data).length);
|
values.styles.length || Object.keys(values.data).length);
|
||||||
if (isFilled) {
|
if (isFilled) {
|
||||||
|
@ -173,8 +173,8 @@ export function getParentRenderElement(view: ViewData, renderHost: any, def: Nod
|
||||||
if (renderParent) {
|
if (renderParent) {
|
||||||
const parent = def.parent;
|
const parent = def.parent;
|
||||||
if (parent && (parent.type !== NodeType.Element || !parent.element.component ||
|
if (parent && (parent.type !== NodeType.Element || !parent.element.component ||
|
||||||
(parent.element.component.provider.componentRenderType &&
|
(parent.element.component.provider.rendererType &&
|
||||||
parent.element.component.provider.componentRenderType.encapsulation ===
|
parent.element.component.provider.rendererType.encapsulation ===
|
||||||
ViewEncapsulation.Native))) {
|
ViewEncapsulation.Native))) {
|
||||||
// only children of non components, or children of components with native encapsulation should
|
// only children of non components, or children of components with native encapsulation should
|
||||||
// be attached.
|
// be attached.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ViewEncapsulation} from '../metadata/view';
|
import {ViewEncapsulation} from '../metadata/view';
|
||||||
import {ComponentRenderTypeV2, RendererV2} from '../render/api';
|
import {RendererTypeV2, RendererV2} from '../render/api';
|
||||||
|
|
||||||
import {checkAndUpdateElementDynamic, checkAndUpdateElementInline, createElement} from './element';
|
import {checkAndUpdateElementDynamic, checkAndUpdateElementInline, createElement} from './element';
|
||||||
import {expressionChangedAfterItHasBeenCheckedError} from './errors';
|
import {expressionChangedAfterItHasBeenCheckedError} from './errors';
|
||||||
|
@ -291,13 +291,13 @@ function createViewNodes(view: ViewData) {
|
||||||
// the component view. Therefore, we create the component view first
|
// the component view. Therefore, we create the component view first
|
||||||
// and set the ProviderData in ViewData, and then instantiate the provider.
|
// and set the ProviderData in ViewData, and then instantiate the provider.
|
||||||
const compViewDef = resolveViewDefinition(nodeDef.provider.component);
|
const compViewDef = resolveViewDefinition(nodeDef.provider.component);
|
||||||
const compRenderType = nodeDef.provider.componentRenderType;
|
const rendererType = nodeDef.provider.rendererType;
|
||||||
let compRenderer: RendererV2;
|
let compRenderer: RendererV2;
|
||||||
if (!compRenderType) {
|
if (!rendererType) {
|
||||||
compRenderer = view.root.renderer;
|
compRenderer = view.root.renderer;
|
||||||
} else {
|
} else {
|
||||||
const hostEl = asElementData(view, nodeDef.parent.index).renderElement;
|
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 componentView = createView(view.root, compRenderer, view, nodeDef, compViewDef);
|
||||||
const providerData = <ProviderData>{componentView, instance: undefined};
|
const providerData = <ProviderData>{componentView, instance: undefined};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {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 {isPresent, stringify} from '../facade/lang';
|
||||||
import {AnimationKeyframe, AnimationPlayer, AnimationStyles, DirectRenderer, NoOpAnimationPlayer, RenderDebugInfo} from '../private_import_core';
|
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);
|
this.defaultRenderer = new DefaultDomRendererV2(eventManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
createRenderer(element: any, type: ComponentRenderTypeV2): RendererV2 {
|
createRenderer(element: any, type: RendererTypeV2): RendererV2 {
|
||||||
if (!element || !type) {
|
if (!element || !type) {
|
||||||
return this.defaultRenderer;
|
return this.defaultRenderer;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ class EmulatedEncapsulationDomRendererV2 extends DefaultDomRendererV2 {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
eventManager: EventManager, sharedStylesHost: DomSharedStylesHost,
|
eventManager: EventManager, sharedStylesHost: DomSharedStylesHost,
|
||||||
private component: ComponentRenderTypeV2) {
|
private component: RendererTypeV2) {
|
||||||
super(eventManager);
|
super(eventManager);
|
||||||
const styles = flattenStyles(component.id, component.styles, []);
|
const styles = flattenStyles(component.id, component.styles, []);
|
||||||
sharedStylesHost.addStyles(styles);
|
sharedStylesHost.addStyles(styles);
|
||||||
|
@ -528,7 +528,7 @@ class ShadowDomRenderer extends DefaultDomRendererV2 {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
eventManager: EventManager, private sharedStylesHost: DomSharedStylesHost,
|
eventManager: EventManager, private sharedStylesHost: DomSharedStylesHost,
|
||||||
private hostEl: any, private component: ComponentRenderTypeV2) {
|
private hostEl: any, private component: RendererTypeV2) {
|
||||||
super(eventManager);
|
super(eventManager);
|
||||||
this.shadowRoot = (hostEl as any).createShadowRoot();
|
this.shadowRoot = (hostEl as any).createShadowRoot();
|
||||||
this.sharedStylesHost.addHost(this.shadowRoot);
|
this.sharedStylesHost.addHost(this.shadowRoot);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DomElementSchemaRegistry} from '@angular/compiler';
|
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 {AnimationDriver, DOCUMENT} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {isBlank, isPresent, stringify} from './facade/lang';
|
import {isBlank, isPresent, stringify} from './facade/lang';
|
||||||
|
@ -273,7 +273,7 @@ export class ServerRendererFactoryV2 implements RendererFactoryV2 {
|
||||||
this.defaultRenderer = new DefaultServerRendererV2(document, ngZone);
|
this.defaultRenderer = new DefaultServerRendererV2(document, ngZone);
|
||||||
};
|
};
|
||||||
|
|
||||||
createRenderer(element: any, type: ComponentRenderTypeV2): RendererV2 {
|
createRenderer(element: any, type: RendererTypeV2): RendererV2 {
|
||||||
if (!element || !type) {
|
if (!element || !type) {
|
||||||
return this.defaultRenderer;
|
return this.defaultRenderer;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ class EmulatedEncapsulationServerRendererV2 extends DefaultServerRendererV2 {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
document: any, ngZone: NgZone, sharedStylesHost: SharedStylesHost,
|
document: any, ngZone: NgZone, sharedStylesHost: SharedStylesHost,
|
||||||
private component: ComponentRenderTypeV2) {
|
private component: RendererTypeV2) {
|
||||||
super(document, ngZone);
|
super(document, ngZone);
|
||||||
const styles = flattenStyles(component.id, component.styles, []);
|
const styles = flattenStyles(component.id, component.styles, []);
|
||||||
sharedStylesHost.addStyles(styles);
|
sharedStylesHost.addStyles(styles);
|
||||||
|
|
|
@ -292,16 +292,6 @@ export declare abstract class ComponentRef<C> {
|
||||||
abstract onDestroy(callback: Function): void;
|
abstract onDestroy(callback: Function): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
|
||||||
export interface ComponentRenderTypeV2 {
|
|
||||||
data: {
|
|
||||||
[kind: string]: any[];
|
|
||||||
};
|
|
||||||
encapsulation: ViewEncapsulation;
|
|
||||||
id: string;
|
|
||||||
styles: (string | any[])[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare const ContentChild: ContentChildDecorator;
|
export declare const ContentChild: ContentChildDecorator;
|
||||||
|
|
||||||
|
@ -859,7 +849,17 @@ export declare abstract class Renderer {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare abstract class RendererFactoryV2 {
|
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 */
|
/** @experimental */
|
||||||
|
|
Loading…
Reference in New Issue