chore(rename): rename View and Template concepts for #1244
This commit is contained in:
committed by
Jeremy Elbourn
parent
564477b8a0
commit
bf7933714a
Vendored
+21
-21
@@ -20,7 +20,7 @@ export class ElementBinder {
|
||||
parentIndex:number;
|
||||
distanceToParent:number;
|
||||
directives:List<DirectiveBinder>;
|
||||
nestedProtoView:ProtoView;
|
||||
nestedProtoView:ProtoViewDto;
|
||||
propertyBindings: Map<string, ASTWithSource>;
|
||||
variableBindings: Map<string, ASTWithSource>;
|
||||
// Note: this contains a preprocessed AST
|
||||
@@ -51,7 +51,7 @@ export class ElementBinder {
|
||||
}
|
||||
|
||||
export class DirectiveBinder {
|
||||
// Index into the array of directives in the Template instance
|
||||
// Index into the array of directives in the View instance
|
||||
directiveIndex:any;
|
||||
propertyBindings: Map<string, ASTWithSource>;
|
||||
// Note: this contains a preprocessed AST
|
||||
@@ -67,7 +67,7 @@ export class DirectiveBinder {
|
||||
}
|
||||
}
|
||||
|
||||
export class ProtoView {
|
||||
export class ProtoViewDto {
|
||||
render: ProtoViewRef;
|
||||
elementBinders:List<ElementBinder>;
|
||||
variableBindings: Map<string, string>;
|
||||
@@ -86,27 +86,27 @@ export class DirectiveMetadata {
|
||||
id:any;
|
||||
selector:string;
|
||||
compileChildren:boolean;
|
||||
events:Map<string, string>;
|
||||
bind:Map<string, string>;
|
||||
hostListeners:Map<string, string>;
|
||||
properties:Map<string, string>;
|
||||
setters:List<string>;
|
||||
readAttributes:List<string>;
|
||||
type:number;
|
||||
constructor({id, selector, compileChildren, events, bind, setters, readAttributes, type}) {
|
||||
constructor({id, selector, compileChildren, hostListeners, properties, setters, readAttributes, type}) {
|
||||
this.id = id;
|
||||
this.selector = selector;
|
||||
this.compileChildren = isPresent(compileChildren) ? compileChildren : true;
|
||||
this.events = events;
|
||||
this.bind = bind;
|
||||
this.hostListeners = hostListeners;
|
||||
this.properties = properties;
|
||||
this.setters = setters;
|
||||
this.readAttributes = readAttributes;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
// An opaque reference to a ProtoView
|
||||
// An opaque reference to a RenderProtoView
|
||||
export class ProtoViewRef {}
|
||||
|
||||
// An opaque reference to a View
|
||||
// An opaque reference to a RenderView
|
||||
export class ViewRef {}
|
||||
|
||||
export class ViewContainerRef {
|
||||
@@ -118,43 +118,43 @@ export class ViewContainerRef {
|
||||
}
|
||||
}
|
||||
|
||||
export class Template {
|
||||
export class ViewDefinition {
|
||||
componentId: string;
|
||||
absUrl: string;
|
||||
inline: string;
|
||||
template: string;
|
||||
directives: List<DirectiveMetadata>;
|
||||
|
||||
constructor({componentId, absUrl, inline, directives}) {
|
||||
constructor({componentId, absUrl, template, directives}) {
|
||||
this.componentId = componentId;
|
||||
this.absUrl = absUrl;
|
||||
this.inline = inline;
|
||||
this.template = template;
|
||||
this.directives = directives;
|
||||
}
|
||||
}
|
||||
|
||||
export class Renderer {
|
||||
/**
|
||||
* Compiles a single ProtoView. Non recursive so that
|
||||
* Compiles a single RenderProtoView. Non recursive so that
|
||||
* we don't need to serialize all possible components over the wire,
|
||||
* but only the needed ones based on previous calls.
|
||||
*/
|
||||
compile(template:Template):Promise<ProtoView> { return null; }
|
||||
compile(template:ViewDefinition):Promise<ProtoViewDto> { return null; }
|
||||
|
||||
/**
|
||||
* Sets the preset nested components,
|
||||
* which will be instantiated when this protoView is instantiated.
|
||||
* Note: We can't create new ProtoViewRefs here as we need to support cycles / recursive components.
|
||||
* @param {List<ProtoViewRef>} protoViewRefs
|
||||
* ProtoView for every element with a component in this protoView or in a view container's protoView
|
||||
* RenderProtoView for every element with a component in this protoView or in a view container's protoView
|
||||
*/
|
||||
mergeChildComponentProtoViews(protoViewRef:ProtoViewRef, componentProtoViewRefs:List<ProtoViewRef>) { return null; }
|
||||
|
||||
/**
|
||||
* Creats a ProtoView that will create a root view for the given element,
|
||||
* Creats a RenderProtoView that will create a root view for the given element,
|
||||
* i.e. it will not clone the element but only attach other proto views to it.
|
||||
* Contains a single nested component with the given componentId.
|
||||
*/
|
||||
createRootProtoView(selectorOrElement, componentId):Promise<ProtoView> { return null; }
|
||||
createRootProtoView(selectorOrElement, componentId):Promise<ProtoViewDto> { return null; }
|
||||
|
||||
/**
|
||||
* Creates a view and all of its nested child components.
|
||||
@@ -182,7 +182,7 @@ export class Renderer {
|
||||
/**
|
||||
* Sets a property on an element.
|
||||
* Note: This will fail if the property was not mentioned previously as a propertySetter
|
||||
* in the Template.
|
||||
* in the View.
|
||||
*/
|
||||
setElementProperty(view:ViewRef, elementIndex:number, propertyName:string, propertyValue:any):void {}
|
||||
|
||||
@@ -195,7 +195,7 @@ export class Renderer {
|
||||
/**
|
||||
* This will set the value for a text node.
|
||||
* Note: This needs to be separate from setElementProperty as we don't have ElementBinders
|
||||
* for text nodes in the ProtoView either.
|
||||
* for text nodes in the RenderProtoView either.
|
||||
*/
|
||||
setText(view:ViewRef, textNodeIndex:number, text:string):void {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user