2015-12-02 10:35:51 -08:00
|
|
|
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
2015-03-23 14:10:55 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
export class RenderComponentType {
|
|
|
|
constructor(public id: string, public encapsulation: ViewEncapsulation,
|
|
|
|
public styles: Array<string | any[]>) {}
|
|
|
|
}
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
export interface ParentRenderer { renderComponent(componentType: RenderComponentType): Renderer; }
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
export abstract class Renderer implements ParentRenderer {
|
|
|
|
abstract renderComponent(componentType: RenderComponentType): Renderer;
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract selectRootElement(selector: string): any;
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract createElement(parentElement: any, name: string): any;
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract createViewRoot(hostElement: any): any;
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract createTemplateAnchor(parentElement: any): any;
|
2015-06-24 13:46:39 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract createText(parentElement: any, value: string): any;
|
2015-09-28 19:58:38 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract projectNodes(parentElement: any, nodes: any[]);
|
2015-03-23 14:10:55 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract attachViewAfter(node: any, viewRootNodes: any[]);
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract detachView(viewRootNodes: any[]);
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract destroyView(hostElement: any, viewAllNodes: any[]);
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2016-01-25 14:47:25 -08:00
|
|
|
abstract listen(renderElement: any, name: string, callback: Function): Function;
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract listenGlobal(target: string, name: string, callback: Function): Function;
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract setElementProperty(renderElement: any, propertyName: string, propertyValue: any);
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string);
|
2015-09-11 13:37:05 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-12-02 10:35:51 -08:00
|
|
|
* Used only in debug mode to serialize property changes to comment nodes,
|
|
|
|
* such as <template> placeholders.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string);
|
2015-10-06 06:53:39 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract setElementClass(renderElement: any, className: string, isAdd: boolean);
|
2015-06-23 11:21:56 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string);
|
|
|
|
|
|
|
|
abstract invokeElementMethod(renderElement: any, methodName: string, args: any[]);
|
|
|
|
|
|
|
|
abstract setText(renderNode: any, text: string);
|
2015-11-02 08:39:14 -08:00
|
|
|
}
|
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-04-15 21:51:30 -07:00
|
|
|
|
2015-12-02 10:35:51 -08:00
|
|
|
export abstract class RootRenderer implements ParentRenderer {
|
|
|
|
abstract renderComponent(componentType: RenderComponentType): Renderer;
|
2015-03-23 14:10:55 -07:00
|
|
|
}
|