Created
February 5, 2017 23:39
-
-
Save robwormald/52871182674a553058ff088e0d6e5ba5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'tree', | |
inputs: ['data'], | |
template: ` | |
<span [style.backgroundColor]="bgColor"> {{data.value}} </span> | |
<tree *ngIf='data.left != null' [data]='data.left'></tree> | |
<tree *ngIf='data.right != null' [data]='data.right'></tree> | |
` | |
}) | |
export class TreeComponent { | |
data: TreeNode; | |
get bgColor(): string { ... } | |
} | |
interface TreeNode { | |
value: string; | |
left?: TreeNode; | |
right?: TreeNode; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class View_TreeComponent_1 extends import34.DebugAppView<any> { | |
_el_0:any; | |
compView_0:import34.AppView<import1.TreeComponent>; | |
_TreeComponent_0_3:Wrapper_TreeComponent; | |
constructor(viewUtils:import16.ViewUtils,parentView:import34.AppView<any>,parentIndex:number,parentElement:any,declaredViewContainer:import40.ViewContainer) { | |
super(View_TreeComponent_1,renderType_TreeComponent,import37.ViewType.EMBEDDED,viewUtils,parentView,parentIndex,parentElement,import38.ChangeDetectorStatus.CheckAlways,nodeDebugInfos_TreeComponent1,declaredViewContainer); | |
} | |
createInternal(rootSelector:string):import39.ComponentRef<any> { | |
this._el_0 = import16.createRenderElement(this.renderer,(null as any),'tree',import16.EMPTY_INLINE_ARRAY,this.debug(0,0,63)); | |
this.compView_0 = new View_TreeComponent_0(this.viewUtils,this,0,this._el_0); | |
this._TreeComponent_0_3 = new Wrapper_TreeComponent(); | |
this.compView_0.create(this._TreeComponent_0_3.context); | |
this.init(this._el_0,((<any>this.renderer).directRenderer? (null as any): [this._el_0]),(null as any)); | |
return (null as any); | |
} | |
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any { | |
if (((token === import1.TreeComponent) && (0 === requestNodeIndex))) { return this._TreeComponent_0_3.context; } | |
return notFoundResult; | |
} | |
detectChangesInternal():void { | |
const currVal_0_0_0:any = this.parentView.context.data.right; | |
this._TreeComponent_0_3.check_data(this,currVal_0_0_0,false); | |
this._TreeComponent_0_3.ngDoCheck(this,this._el_0); | |
this.compView_0.internalDetectChanges(this.throwOnChange); | |
} | |
destroyInternal():void { | |
this.compView_0.destroy(); | |
} | |
visitRootNodesInternal(cb:any,ctx:any):void { | |
cb(this._el_0,ctx); | |
} | |
} | |
class View_TreeComponent_2 extends import34.DebugAppView<any> { | |
_el_0:any; | |
compView_0:import34.AppView<import1.TreeComponent>; | |
_TreeComponent_0_3:Wrapper_TreeComponent; | |
constructor(viewUtils:import16.ViewUtils,parentView:import34.AppView<any>,parentIndex:number,parentElement:any,declaredViewContainer:import40.ViewContainer) { | |
super(View_TreeComponent_2,renderType_TreeComponent,import37.ViewType.EMBEDDED,viewUtils,parentView,parentIndex,parentElement,import38.ChangeDetectorStatus.CheckAlways,nodeDebugInfos_TreeComponent2,declaredViewContainer); | |
} | |
createInternal(rootSelector:string):import39.ComponentRef<any> { | |
this._el_0 = import16.createRenderElement(this.renderer,(null as any),'tree',import16.EMPTY_INLINE_ARRAY,this.debug(0,0,123)); | |
this.compView_0 = new View_TreeComponent_0(this.viewUtils,this,0,this._el_0); | |
this._TreeComponent_0_3 = new Wrapper_TreeComponent(); | |
this.compView_0.create(this._TreeComponent_0_3.context); | |
this.init(this._el_0,((<any>this.renderer).directRenderer? (null as any): [this._el_0]),(null as any)); | |
return (null as any); | |
} | |
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any { | |
if (((token === import1.TreeComponent) && (0 === requestNodeIndex))) { return this._TreeComponent_0_3.context; } | |
return notFoundResult; | |
} | |
detectChangesInternal():void { | |
const currVal_0_0_0:any = this.parentView.context.data.left; | |
this._TreeComponent_0_3.check_data(this,currVal_0_0_0,false); | |
this._TreeComponent_0_3.ngDoCheck(this,this._el_0); | |
this.compView_0.internalDetectChanges(this.throwOnChange); | |
} | |
destroyInternal():void { | |
this.compView_0.destroy(); | |
} | |
visitRootNodesInternal(cb:any,ctx:any):void { | |
cb(this._el_0,ctx); | |
} | |
} | |
var renderType_TreeComponent:import29.RenderComponentType = import16.createRenderComponentType('/private/var/folders/00/1nd18000h01000cxqpysvccm006nm5/T/e2e_test.1483634509/benchmarks/src/tree/ng2/tree.ts class TreeComponent - inline template',0,import36.ViewEncapsulation.None,styles_TreeComponent,{}); | |
export class View_TreeComponent_0 extends import34.DebugAppView<import1.TreeComponent> { | |
_el_0:any; | |
_text_1:any; | |
_anchor_2:any; | |
/*private*/ _vc_2:import40.ViewContainer; | |
_TemplateRef_2_5:any; | |
_NgIf_2_6:import43.Wrapper_NgIf; | |
_anchor_3:any; | |
/*private*/ _vc_3:import40.ViewContainer; | |
_TemplateRef_3_5:any; | |
_NgIf_3_6:import43.Wrapper_NgIf; | |
/*private*/ _expr_10:any; | |
/*private*/ _expr_11:any; | |
constructor(viewUtils:import16.ViewUtils,parentView:import34.AppView<any>,parentIndex:number,parentElement:any) { | |
super(View_TreeComponent_0,renderType_TreeComponent,import37.ViewType.COMPONENT,viewUtils,parentView,parentIndex,parentElement,import38.ChangeDetectorStatus.CheckAlways,nodeDebugInfos_TreeComponent0); | |
this._expr_10 = (undefined as any); | |
this._expr_11 = (undefined as any); | |
} | |
createInternal(rootSelector:string):import39.ComponentRef<any> { | |
const parentRenderNode:any = this.renderer.createViewRoot(this.parentElement); | |
this._el_0 = import16.createRenderElement(this.renderer,parentRenderNode,'span',import16.EMPTY_INLINE_ARRAY,this.debug(0,0,0)); | |
this._text_1 = this.renderer.createText(this._el_0,'',this.debug(1,0,40)); | |
this._anchor_2 = this.renderer.createTemplateAnchor(parentRenderNode,this.debug(2,0,63)); | |
this._vc_2 = new import40.ViewContainer(2,(null as any),this,this._anchor_2); | |
this._TemplateRef_2_5 = new import41.TemplateRef_(this,2,this._anchor_2); | |
this._NgIf_2_6 = new import43.Wrapper_NgIf(this._vc_2.vcRef,this._TemplateRef_2_5); | |
this._anchor_3 = this.renderer.createTemplateAnchor(parentRenderNode,this.debug(3,0,123)); | |
this._vc_3 = new import40.ViewContainer(3,(null as any),this,this._anchor_3); | |
this._TemplateRef_3_5 = new import41.TemplateRef_(this,3,this._anchor_3); | |
this._NgIf_3_6 = new import43.Wrapper_NgIf(this._vc_3.vcRef,this._TemplateRef_3_5); | |
this.init((null as any),((<any>this.renderer).directRenderer? (null as any): [ | |
this._el_0, | |
this._text_1, | |
this._anchor_2, | |
this._anchor_3 | |
] | |
),(null as any)); | |
return (null as any); | |
} | |
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any { | |
if (((token === import41.TemplateRef) && (2 === requestNodeIndex))) { return this._TemplateRef_2_5; } | |
if (((token === import42.NgIf) && (2 === requestNodeIndex))) { return this._NgIf_2_6.context; } | |
if (((token === import41.TemplateRef) && (3 === requestNodeIndex))) { return this._TemplateRef_3_5; } | |
if (((token === import42.NgIf) && (3 === requestNodeIndex))) { return this._NgIf_3_6.context; } | |
return notFoundResult; | |
} | |
detectChangesInternal():void { | |
const currVal_2_0_0:any = (this.context.data.right != (null as any)); | |
this._NgIf_2_6.check_ngIf(this,currVal_2_0_0,false); | |
this._NgIf_2_6.ngDoCheck(this,this._anchor_2); | |
const currVal_3_0_0:any = (this.context.data.left != (null as any)); | |
this._NgIf_3_6.check_ngIf(this,currVal_3_0_0,false); | |
this._NgIf_3_6.ngDoCheck(this,this._anchor_3); | |
this._vc_2.detectChangesInNestedViews(this.throwOnChange); | |
this._vc_3.detectChangesInNestedViews(this.throwOnChange); | |
const currVal_10:any = this.context.bgColor; | |
import16.checkRenderStyle(this,this._el_0,'backgroundColor',(null as any),this._expr_10,(this._expr_10 = currVal_10),false,import30.SecurityContext.STYLE); | |
const currVal_11:any = import16.inlineInterpolate(1,' ',this.context.data.value,' '); | |
import16.checkRenderText(this,this._text_1,this._expr_11,(this._expr_11 = currVal_11),false); | |
} | |
destroyInternal():void { | |
this._vc_2.destroyNestedViews(); | |
this._vc_3.destroyNestedViews(); | |
} | |
createEmbeddedViewInternal(nodeIndex:number):import34.AppView<any> { | |
if ((nodeIndex == 2)) { return new View_TreeComponent_1(this.viewUtils,this,2,this._anchor_2,this._vc_2); } | |
if ((nodeIndex == 3)) { return new View_TreeComponent_2(this.viewUtils,this,3,this._anchor_3,this._vc_3); } | |
return (null as any); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TreeComponent_1_ViewDef = viewDef( | |
[ | |
elementDef(null, 1, 'tree'), | |
componentDef(0, TreeComponent, [], () => View_TreeComponent_0) | |
], | |
(ve: ViewEngine, view: View, comp: TreeComponent) => { | |
ve.updateComponent(view, 1, {data: comp.data.left} | |
/* as {data: TreeComponent['data']}*/); | |
} | |
); | |
const TreeComponent_1_ViewDef = viewDef( | |
[ | |
elementDef(0, null, 1, 'tree'), | |
componentDef(0, TreeComponent, [], () => View_TreeComponent_0) | |
], | |
(ve: ViewEngine, view: View, comp: TreeComponent) => { | |
ve.updateComponent(view, 1, {data: comp.data.right} | |
/* as {data: TreeComponent['data']}*/); | |
} | |
); | |
const TreeComponent_0_ViewDef = viewDef( | |
[ | |
elementDef(null, 1, 'span'), | |
textDef(0), | |
templateDef(null, 1, View_TreeComponent_1), | |
directiveDef(2, NgIf, [ | |
depDef(ViewContainerRef, 2), | |
depDef(TemplateRef, 2) | |
]), | |
templateDef(null, 1, View_TreeComponent_2), | |
directiveDef(2, NgIf, [ | |
depDef(ViewContainerRef, 4), | |
depDef(TemplateRef, 4) | |
]), | |
], | |
(ve: ViewEngine, view: View, comp: TreeComponent) => { | |
ve.updateElement(view, 0, {'background-color': comp.bgColor}); | |
ve.updateText(view, 1, interpolate(1,' ', comp.data.value,' ')); | |
ve.updateDirective(view, 3, {ngIf: comp.data.left} | |
/* as {ngIf: NgIf['ngIf']}*/); | |
ve.updateDirective(view, 5, {ngIf: comp.data.right} | |
/* as {ngIf: NgIf['ngIf']}*/); | |
ve.updateViewContainer(view, 2); | |
ve.updateViewContainer(view, 4); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment