@@ -22,13 +22,15 @@ export class AttrAst implements TemplateAst {
22
22
visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitAttr ( this ) ; }
23
23
}
24
24
25
- export class BoundPropertyAst implements TemplateAst {
26
- constructor ( public name : string , public value : AST , public sourceInfo : string ) { }
27
- visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitProperty ( this ) ; }
25
+ export class BoundElementPropertyAst implements TemplateAst {
26
+ constructor ( public name : string , public type : PropertyBindingType , public value : AST ,
27
+ public unit : string , public sourceInfo : string ) { }
28
+ visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitElementProperty ( this ) ; }
28
29
}
29
30
30
31
export class BoundEventAst implements TemplateAst {
31
- constructor ( public name : string , public handler : AST , public sourceInfo : string ) { }
32
+ constructor ( public name : string , public target : string , public handler : AST ,
33
+ public sourceInfo : string ) { }
32
34
visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitEvent ( this ) ; }
33
35
}
34
36
@@ -38,35 +40,57 @@ export class VariableAst implements TemplateAst {
38
40
}
39
41
40
42
export class ElementAst implements TemplateAst {
41
- constructor ( public attrs : AttrAst [ ] , public properties : BoundPropertyAst [ ] ,
43
+ constructor ( public attrs : AttrAst [ ] , public properties : BoundElementPropertyAst [ ] ,
42
44
public events : BoundEventAst [ ] , public vars : VariableAst [ ] ,
43
- public directives : DirectiveMetadata [ ] , public children : TemplateAst [ ] ,
45
+ public directives : DirectiveAst [ ] , public children : TemplateAst [ ] ,
44
46
public sourceInfo : string ) { }
45
47
visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitElement ( this ) ; }
46
48
}
47
49
48
50
export class EmbeddedTemplateAst implements TemplateAst {
49
- constructor ( public attrs : AttrAst [ ] , public properties : BoundPropertyAst [ ] ,
50
- public vars : VariableAst [ ] , public directives : DirectiveMetadata [ ] ,
51
- public children : TemplateAst [ ] , public sourceInfo : string ) { }
51
+ constructor ( public attrs : AttrAst [ ] , public vars : VariableAst [ ] ,
52
+ public directives : DirectiveAst [ ] , public children : TemplateAst [ ] ,
53
+ public sourceInfo : string ) { }
52
54
visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitEmbeddedTemplate ( this ) ; }
53
55
}
54
56
57
+ export class BoundDirectivePropertyAst implements TemplateAst {
58
+ constructor ( public directiveName : string , public templateName : string , public value : AST ,
59
+ public sourceInfo : string ) { }
60
+ visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitDirectiveProperty ( this ) ; }
61
+ }
62
+
63
+ export class DirectiveAst implements TemplateAst {
64
+ constructor ( public directive : DirectiveMetadata , public properties : BoundDirectivePropertyAst [ ] ,
65
+ public hostProperties : BoundElementPropertyAst [ ] , public hostEvents : BoundEventAst [ ] ,
66
+ public sourceInfo : string ) { }
67
+ visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitDirective ( this ) ; }
68
+ }
69
+
55
70
export class NgContentAst implements TemplateAst {
56
71
constructor ( public select : string , public sourceInfo : string ) { }
57
72
visit ( visitor : TemplateAstVisitor ) : any { return visitor . visitNgContent ( this ) ; }
58
73
}
59
74
75
+ export enum PropertyBindingType {
76
+ Property ,
77
+ Attribute ,
78
+ Class ,
79
+ Style
80
+ }
81
+
60
82
export interface TemplateAstVisitor {
61
83
visitNgContent ( ast : NgContentAst ) : any ;
62
84
visitEmbeddedTemplate ( ast : EmbeddedTemplateAst ) : any ;
63
85
visitElement ( ast : ElementAst ) : any ;
64
86
visitVariable ( ast : VariableAst ) : any ;
65
87
visitEvent ( ast : BoundEventAst ) : any ;
66
- visitProperty ( ast : BoundPropertyAst ) : any ;
88
+ visitElementProperty ( ast : BoundElementPropertyAst ) : any ;
67
89
visitAttr ( ast : AttrAst ) : any ;
68
90
visitBoundText ( ast : BoundTextAst ) : any ;
69
91
visitText ( ast : TextAst ) : any ;
92
+ visitDirective ( ast : DirectiveAst ) : any ;
93
+ visitDirectiveProperty ( ast : BoundDirectivePropertyAst ) : any ;
70
94
}
71
95
72
96
0 commit comments