2014-11-21 21:19:23 -08:00
|
|
|
import {ABSTRACT, CONST, normalizeBlank} from 'facade/lang';
|
|
|
|
import {List} from 'facade/collection';
|
|
|
|
import {TemplateConfig} from './template_config';
|
2014-12-23 10:45:20 -08:00
|
|
|
import {ShadowDomStrategy} from '../compiler/shadow_dom';
|
2014-11-21 21:19:23 -08:00
|
|
|
|
|
|
|
|
|
|
|
@ABSTRACT()
|
|
|
|
export class Directive {
|
|
|
|
selector:any; //string;
|
|
|
|
bind:any;
|
|
|
|
lightDomServices:any; //List;
|
|
|
|
implementsTypes:any; //List;
|
|
|
|
@CONST()
|
|
|
|
constructor({
|
|
|
|
selector,
|
|
|
|
bind,
|
|
|
|
lightDomServices,
|
|
|
|
implementsTypes
|
|
|
|
}:{
|
|
|
|
selector:string,
|
|
|
|
bind:any,
|
|
|
|
lightDomServices:List,
|
|
|
|
implementsTypes:List
|
|
|
|
}={})
|
|
|
|
{
|
|
|
|
this.selector = selector;
|
|
|
|
this.lightDomServices = lightDomServices;
|
|
|
|
this.implementsTypes = implementsTypes;
|
|
|
|
this.bind = bind;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Component extends Directive {
|
|
|
|
//TODO: vsavkin: uncomment it once the issue with defining fields in a sublass works
|
|
|
|
template:any; //TemplateConfig;
|
|
|
|
lightDomServices:any; //List;
|
|
|
|
shadowDomServices:any; //List;
|
|
|
|
componentServices:any; //List;
|
2014-12-23 10:45:20 -08:00
|
|
|
shadowDom:any; //ShadowDomStrategy;
|
2014-11-21 21:19:23 -08:00
|
|
|
|
|
|
|
@CONST()
|
|
|
|
constructor({
|
|
|
|
selector,
|
|
|
|
bind,
|
|
|
|
template,
|
|
|
|
lightDomServices,
|
|
|
|
shadowDomServices,
|
|
|
|
componentServices,
|
2014-12-23 10:45:20 -08:00
|
|
|
implementsTypes,
|
|
|
|
shadowDom
|
2014-11-21 21:19:23 -08:00
|
|
|
}:{
|
|
|
|
selector:String,
|
|
|
|
bind:Object,
|
|
|
|
template:TemplateConfig,
|
|
|
|
lightDomServices:List,
|
|
|
|
shadowDomServices:List,
|
|
|
|
componentServices:List,
|
2014-12-23 10:45:20 -08:00
|
|
|
implementsTypes:List,
|
|
|
|
shadowDom:ShadowDomStrategy
|
2014-11-21 21:19:23 -08:00
|
|
|
}={})
|
|
|
|
{
|
|
|
|
super({
|
|
|
|
selector: selector,
|
|
|
|
bind: bind,
|
|
|
|
lightDomServices: lightDomServices,
|
|
|
|
implementsTypes: implementsTypes});
|
|
|
|
|
|
|
|
this.template = template;
|
|
|
|
this.lightDomServices = lightDomServices;
|
|
|
|
this.shadowDomServices = shadowDomServices;
|
|
|
|
this.componentServices = componentServices;
|
2014-12-23 10:45:20 -08:00
|
|
|
this.shadowDom = shadowDom;
|
2014-11-21 21:19:23 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Decorator extends Directive {
|
2015-01-07 17:32:46 +01:00
|
|
|
compileChildren: boolean;
|
2014-11-21 21:19:23 -08:00
|
|
|
@CONST()
|
|
|
|
constructor({
|
|
|
|
selector,
|
|
|
|
bind,
|
|
|
|
lightDomServices,
|
|
|
|
implementsTypes
|
|
|
|
}:{
|
|
|
|
selector:string,
|
|
|
|
bind:any,
|
|
|
|
lightDomServices:List,
|
|
|
|
implementsTypes:List
|
|
|
|
}={})
|
|
|
|
{
|
|
|
|
super({
|
|
|
|
selector: selector,
|
|
|
|
bind: bind,
|
|
|
|
lightDomServices: lightDomServices,
|
|
|
|
implementsTypes: implementsTypes
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Template extends Directive {
|
|
|
|
@CONST()
|
|
|
|
constructor({
|
|
|
|
selector,
|
|
|
|
bind,
|
|
|
|
lightDomServices,
|
|
|
|
implementsTypes
|
|
|
|
}:{
|
|
|
|
selector:string,
|
|
|
|
bind:any,
|
|
|
|
lightDomServices:List,
|
|
|
|
implementsTypes:List
|
|
|
|
}={})
|
|
|
|
{
|
|
|
|
super({
|
|
|
|
selector: selector,
|
|
|
|
bind: bind,
|
|
|
|
lightDomServices: lightDomServices,
|
|
|
|
implementsTypes: implementsTypes
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|