| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | import {unimplemented} from 'angular2/src/facade/exceptions'; | 
					
						
							| 
									
										
										
										
											2015-11-06 17:34:07 -08:00
										 |  |  | import {Map} from 'angular2/src/facade/collection'; | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | import {ViewEncapsulation} from 'angular2/src/core/metadata'; | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Represents an Angular ProtoView in the Rendering Context. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * When you implement a custom {@link Renderer}, `RenderProtoViewRef` specifies what Render View | 
					
						
							|  |  |  |  * your renderer should create. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * `RenderProtoViewRef` is a counterpart to {@link ProtoViewRef} available in the Application | 
					
						
							|  |  |  |  * Context. But unlike `ProtoViewRef`, `RenderProtoViewRef` contains all static nested Proto Views | 
					
						
							|  |  |  |  * that are recursively merged into a single Render Proto View. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * <!-- TODO: this is created by Renderer#createProtoView in the new compiler --> | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-10-08 09:57:10 -07:00
										 |  |  | export class RenderProtoViewRef {} | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Represents a list of sibling Nodes that can be moved by the {@link Renderer} independently of | 
					
						
							|  |  |  |  * other Render Fragments. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  |  * Any {@link RenderViewRef} has one Render Fragment. | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  |  * Additionally any View with an Embedded View that contains a {@link NgContentAst View Projection} | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  * results in additional Render Fragment. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |   <div>foo</div> | 
					
						
							|  |  |  |   {{bar}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <div>foo</div> -> view 1 / fragment 1 | 
					
						
							|  |  |  |   <ul> | 
					
						
							| 
									
										
										
										
											2015-11-23 16:02:19 -08:00
										 |  |  |     <template ngFor> | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |       <li>{{fg}}</li> -> view 2 / fragment 1 | 
					
						
							|  |  |  |     </template> | 
					
						
							|  |  |  |   </ul> | 
					
						
							|  |  |  |   {{bar}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <div>foo</div> -> view 1 / fragment 1 | 
					
						
							|  |  |  |   <ul> | 
					
						
							| 
									
										
										
										
											2015-11-23 16:02:19 -08:00
										 |  |  |     <template ngIf> | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |       <li><ng-content></></li> -> view 1 / fragment 2 | 
					
						
							|  |  |  |     </template> | 
					
						
							| 
									
										
										
										
											2015-11-23 16:02:19 -08:00
										 |  |  |     <template ngFor> | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |       <li><ng-content></></li> -> | 
					
						
							|  |  |  |       <li></li>                -> view 1 / fragment 2 + view 2 / fragment 1..n-1 | 
					
						
							|  |  |  |     </template> | 
					
						
							|  |  |  |   </ul> | 
					
						
							|  |  |  |   {{bar}} | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | // TODO(i): refactor into an interface
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:46:39 -07:00
										 |  |  | export class RenderFragmentRef {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Represents an Angular View in the Rendering Context. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * `RenderViewRef` specifies to the {@link Renderer} what View to update or destroy. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unlike a {@link ViewRef} available in the Application Context, Render View contains all the | 
					
						
							|  |  |  |  * static Component Views that have been recursively merged into a single Render View. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Each `RenderViewRef` contains one or more {@link RenderFragmentRef Render Fragments}, these | 
					
						
							|  |  |  |  * Fragments are created, hydrated, dehydrated and destroyed as a single unit together with the | 
					
						
							|  |  |  |  * View. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | // TODO(i): refactor into an interface
 | 
					
						
							| 
									
										
										
										
											2015-05-18 11:57:20 -07:00
										 |  |  | export class RenderViewRef {} | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Abstract base class for commands to the Angular renderer, using the visitor pattern. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderTemplateCmd { | 
					
						
							|  |  |  |   abstract visit(visitor: RenderCommandVisitor, context: any): any; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to begin rendering. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderBeginCmd extends RenderTemplateCmd { | 
					
						
							|  |  |  |   get ngContentIndex(): number { return unimplemented(); }; | 
					
						
							|  |  |  |   get isBound(): boolean { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to render text. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderTextCmd extends RenderBeginCmd { | 
					
						
							|  |  |  |   get value(): string { return unimplemented(); }; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to render projected content. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderNgContentCmd extends RenderTemplateCmd { | 
					
						
							| 
									
										
										
										
											2015-10-07 17:15:12 -07:00
										 |  |  |   // The index of this NgContent element
 | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  |   get index(): number { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-10-07 17:15:12 -07:00
										 |  |  |   // The index of the NgContent element into which this
 | 
					
						
							|  |  |  |   // NgContent element should be projected (if any)
 | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  |   get ngContentIndex(): number { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-10-07 17:15:12 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to begin rendering an element. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderBeginElementCmd extends RenderBeginCmd { | 
					
						
							|  |  |  |   get name(): string { return unimplemented(); }; | 
					
						
							|  |  |  |   get attrNameAndValues(): string[] { return unimplemented(); }; | 
					
						
							|  |  |  |   get eventTargetAndNames(): string[] { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to begin rendering a component. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderBeginComponentCmd extends RenderBeginElementCmd { | 
					
						
							|  |  |  |   get templateId(): string { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Command to render a component's template. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export abstract class RenderEmbeddedTemplateCmd extends RenderBeginElementCmd { | 
					
						
							|  |  |  |   get isMerged(): boolean { return unimplemented(); }; | 
					
						
							|  |  |  |   get children(): RenderTemplateCmd[] { return unimplemented(); }; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Visitor for a {@link RenderTemplateCmd}. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | export interface RenderCommandVisitor { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   visitText(cmd: RenderTextCmd, context: any): any; | 
					
						
							|  |  |  |   visitNgContent(cmd: RenderNgContentCmd, context: any): any; | 
					
						
							|  |  |  |   visitBeginElement(cmd: RenderBeginElementCmd, context: any): any; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  |   visitEndElement(context: any): any; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   visitBeginComponent(cmd: RenderBeginComponentCmd, context: any): any; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  |   visitEndComponent(context: any): any; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   visitEmbeddedTemplate(cmd: RenderEmbeddedTemplateCmd, context: any): any; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Container class produced by a {@link Renderer} when creating a Render View. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * An instance of `RenderViewWithFragments` contains a {@link RenderViewRef} and an array of | 
					
						
							|  |  |  |  * {@link RenderFragmentRef}s belonging to this Render View. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | // TODO(i): refactor this by RenderViewWithFragments and adding fragments directly to RenderViewRef
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:46:39 -07:00
										 |  |  | export class RenderViewWithFragments { | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       /** | 
					
						
							|  |  |  |        * Reference to the {@link RenderViewRef}. | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       public viewRef: RenderViewRef, | 
					
						
							|  |  |  |       /** | 
					
						
							|  |  |  |        * Array of {@link RenderFragmentRef}s ordered in the depth-first order. | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       public fragmentRefs: RenderFragmentRef[]) {} | 
					
						
							| 
									
										
										
										
											2015-05-06 10:17:38 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  * Represents an Element that is part of a {@link RenderViewRef Render View}. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * `RenderElementRef` is a counterpart to {@link ElementRef} available in the Application Context. | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  * When using `Renderer` from the Application Context, `ElementRef` can be used instead of | 
					
						
							|  |  |  |  * `RenderElementRef`. | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-06-23 11:21:56 -07:00
										 |  |  | export interface RenderElementRef { | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Reference to the Render View that contains this Element. | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-06-23 11:21:56 -07:00
										 |  |  |   renderView: RenderViewRef; | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-10-06 19:39:44 -07:00
										 |  |  |    * @internal | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Index of the Element (in the depth-first order) inside the Render View. | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * This index is used internally by Angular to locate elements. | 
					
						
							| 
									
										
										
										
											2015-07-07 08:15:58 +02:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-01 20:47:49 -07:00
										 |  |  |   boundElementIndex: number; | 
					
						
							| 
									
										
										
										
											2015-06-23 11:21:56 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Template for rendering a component, including commands and styles. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  | export class RenderComponentTemplate { | 
					
						
							|  |  |  |   constructor(public id: string, public shortId: string, public encapsulation: ViewEncapsulation, | 
					
						
							|  |  |  |               public commands: RenderTemplateCmd[], public styles: string[]) {} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Injectable service that provides a low-level interface for modifying the UI. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use this service to bypass Angular's templating and make custom UI changes that can't be | 
					
						
							|  |  |  |  * expressed declaratively. For example if you need to set a property or an attribute whose name is | 
					
						
							|  |  |  |  * not statically known, use {@link #setElementProperty} or {@link #setElementAttribute} | 
					
						
							|  |  |  |  * respectively. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * If you are implementing a custom renderer, you must implement this interface. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  |  * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`. | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  | export abstract class Renderer { | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Registers a component template represented as arrays of {@link RenderTemplateCmd}s and styles | 
					
						
							|  |  |  |    * with the Renderer. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Once a template is registered it can be referenced via {@link RenderBeginComponentCmd} when | 
					
						
							|  |  |  |    * {@link #createProtoView creating Render ProtoView}. | 
					
						
							| 
									
										
										
										
											2015-10-01 10:07:49 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  |   abstract registerComponentTemplate(template: RenderComponentTemplate); | 
					
						
							| 
									
										
										
										
											2015-10-01 10:07:49 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Creates a {@link RenderProtoViewRef} from an array of {@link RenderTemplateCmd}`s.
 | 
					
						
							| 
									
										
										
										
											2015-10-01 10:07:49 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-11-02 08:39:14 -08:00
										 |  |  |   abstract createProtoView(componentTemplateId: string, | 
					
						
							|  |  |  |                            cmds: RenderTemplateCmd[]): RenderProtoViewRef; | 
					
						
							| 
									
										
										
										
											2015-10-01 10:07:49 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Creates a Root Host View based on the provided `hostProtoViewRef`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `fragmentCount` is the number of nested {@link RenderFragmentRef}s in this View. This parameter | 
					
						
							|  |  |  |    * is non-optional so that the renderer can create a result synchronously even when application | 
					
						
							|  |  |  |    * runs in a different context (e.g. in a Web Worker). | 
					
						
							| 
									
										
										
										
											2015-06-24 13:46:39 -07:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * `hostElementSelector` is a (CSS) selector for querying the main document to find the Host | 
					
						
							|  |  |  |    * Element. The newly created Root Host View should be attached to this element. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Returns an instance of {@link RenderViewWithFragments}, representing the Render View. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, | 
					
						
							|  |  |  |                               hostElementSelector: string): RenderViewWithFragments; | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Creates a Render View based on the provided `protoViewRef`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `fragmentCount` is the number of nested {@link RenderFragmentRef}s in this View. This parameter | 
					
						
							|  |  |  |    * is non-optional so that the renderer can create a result synchronously even when application | 
					
						
							|  |  |  |    * runs in a different context (e.g. in a Web Worker). | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Returns an instance of {@link RenderViewWithFragments}, representing the Render View. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-28 08:59:19 +01:00
										 |  |  |   abstract createView(protoViewRef: RenderProtoViewRef, | 
					
						
							|  |  |  |                       fragmentCount: number): RenderViewWithFragments; | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Destroys a Render View specified via `viewRef`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * This operation should be performed only on a View that has already been dehydrated and | 
					
						
							|  |  |  |    * all of its Render Fragments have been detached. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Destroying a View indicates to the Renderer that this View is not going to be referenced in any | 
					
						
							|  |  |  |    * future operations. If the Renderer created any renderer-specific objects for this View, these | 
					
						
							|  |  |  |    * objects should now be destroyed to prevent memory leaks. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract destroyView(viewRef: RenderViewRef); | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Attaches the Nodes of a Render Fragment after the last Node of `previousFragmentRef`. | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, | 
					
						
							|  |  |  |                                        fragmentRef: RenderFragmentRef); | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Attaches the Nodes of the Render Fragment after an Element. | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef); | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Detaches the Nodes of a Render Fragment from their parent. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * This operations should be called only on a View that has been already | 
					
						
							|  |  |  |    * {@link #dehydrateView dehydrated}. | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract detachFragment(fragmentRef: RenderFragmentRef); | 
					
						
							| 
									
										
										
										
											2015-04-15 21:51:30 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Notifies a custom Renderer to initialize a Render View. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * This method is called by Angular after a Render View has been created, or when a previously | 
					
						
							|  |  |  |    * dehydrated Render View is about to be reused. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract hydrateView(viewRef: RenderViewRef); | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Notifies a custom Renderer that a Render View is no longer active. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * This method is called by Angular before a Render View will be destroyed, or when a hydrated | 
					
						
							|  |  |  |    * Render View is about to be put into a pool for future reuse. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract dehydrateView(viewRef: RenderViewRef); | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 14:26:02 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Returns the underlying native element at the specified `location`, or `null` if direct access | 
					
						
							|  |  |  |    * to native elements is not supported (e.g. when the application runs in a web worker). | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * <div class="callout is-critical"> | 
					
						
							|  |  |  |    *   <header>Use with caution</header> | 
					
						
							|  |  |  |    *   <p> | 
					
						
							|  |  |  |    *    Use this api as the last resort when direct access to DOM is needed. Use templating and | 
					
						
							|  |  |  |    *    data-binding, or other {@link Renderer} methods instead. | 
					
						
							|  |  |  |    *   </p> | 
					
						
							|  |  |  |    *   <p> | 
					
						
							|  |  |  |    *    Relying on direct DOM access creates tight coupling between your application and rendering | 
					
						
							|  |  |  |    *    layers which will make it impossible to separate the two and deploy your application into a | 
					
						
							|  |  |  |    *    web worker. | 
					
						
							|  |  |  |    *   </p> | 
					
						
							|  |  |  |    * </div> | 
					
						
							| 
									
										
										
										
											2015-06-23 14:26:02 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract getNativeElementSync(location: RenderElementRef): any; | 
					
						
							| 
									
										
										
										
											2015-06-23 14:26:02 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets a property on the Element specified via `location`. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any); | 
					
						
							| 
									
										
										
										
											2015-05-06 10:49:42 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 12:31:16 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets an attribute on the Element specified via `location`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * If `attributeValue` is `null`, the attribute is removed. | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setElementAttribute(location: RenderElementRef, attributeName: string, | 
					
						
							|  |  |  |                                attributeValue: string); | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-19 11:14:44 -08:00
										 |  |  |   abstract setBindingDebugInfo(location: RenderElementRef, propertyName: string, | 
					
						
							|  |  |  |                                propertyValue: string); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets a (CSS) class on the Element specified via `location`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `isAdd` specifies if the class should be added or removed. | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setElementClass(location: RenderElementRef, className: string, isAdd: boolean); | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets a (CSS) inline style on the Element specified via `location`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * If `styleValue` is `null`, the style is removed. | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setElementStyle(location: RenderElementRef, styleName: string, styleValue: string); | 
					
						
							| 
									
										
										
										
											2015-06-18 15:44:44 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Calls a method on the Element specified via `location`. | 
					
						
							| 
									
										
										
										
											2015-05-11 12:31:16 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]); | 
					
						
							| 
									
										
										
										
											2015-05-11 12:31:16 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets the value of an interpolated TextNode at the specified index to the `text` value. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `textNodeIndex` is the depth-first index of the Node among interpolated Nodes in the Render | 
					
						
							|  |  |  |    * View. | 
					
						
							| 
									
										
										
										
											2015-05-06 10:49:42 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setText(viewRef: RenderViewRef, textNodeIndex: number, text: string); | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Sets a dispatcher to relay all events triggered in the given Render View. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Each Render View can have only one Event Dispatcher, if this method is called multiple times, | 
					
						
							|  |  |  |    * the last provided dispatcher will be used. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  |   abstract setEventDispatcher(viewRef: RenderViewRef, dispatcher: RenderEventDispatcher); | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |  * A dispatcher that relays all events that occur in a Render View. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use {@link Renderer#setEventDispatcher} to register a dispatcher for a particular Render View. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-06-24 13:46:39 -07:00
										 |  |  | export interface RenderEventDispatcher { | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-28 19:58:38 -07:00
										 |  |  |    * Called when Event called `eventName` was triggered on an Element with an Event Binding for this | 
					
						
							|  |  |  |    * Event. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `elementIndex` specifies the depth-first index of the Element in the Render View. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * `locals` is a map for local variable to value mapping that should be used when evaluating the | 
					
						
							|  |  |  |    * Event Binding expression. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Returns `false` if `preventDefault` should be called to stop the default behavior of the Event | 
					
						
							|  |  |  |    * in the Rendering Context. | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-08-26 13:25:00 -07:00
										 |  |  |   dispatchRenderEvent(elementIndex: number, eventName: string, locals: Map<string, any>): boolean; | 
					
						
							| 
									
										
										
										
											2015-03-23 14:10:55 -07:00
										 |  |  | } |