@@ -14,9 +14,13 @@ class TemplateElementBinder extends ElementBinder {
14
14
return _directiveCache = [template];
15
15
}
16
16
17
- TemplateElementBinder (_perf, _expando, _parser, _componentFactory, this .template, this .templateBinder,
17
+ TemplateElementBinder (perf, expando, parser, componentFactory,
18
+ transcludingComponentFactory, shadowDomComponentFactory,
19
+ this .template, this .templateBinder,
18
20
onEvents, bindAttrs, childMode)
19
- : super (_perf, _expando, _parser, _componentFactory, null , null , onEvents, bindAttrs, childMode);
21
+ : super (perf, expando, parser, componentFactory,
22
+ transcludingComponentFactory, shadowDomComponentFactory,
23
+ null , null , onEvents, bindAttrs, childMode);
20
24
21
25
String toString () => "[TemplateElementBinder template:$template ]" ;
22
26
@@ -41,7 +45,11 @@ class ElementBinder {
41
45
final Profiler _perf;
42
46
final Expando _expando;
43
47
final Parser _parser;
48
+
49
+ // The default component factory
44
50
final ComponentFactory _componentFactory;
51
+ final TranscludingComponentFactory _transcludingComponentFactory;
52
+ final ShadowDomComponentFactory _shadowDomComponentFactory;
45
53
final Map onEvents;
46
54
final Map bindAttrs;
47
55
@@ -53,7 +61,11 @@ class ElementBinder {
53
61
// Can be either COMPILE_CHILDREN or IGNORE_CHILDREN
54
62
final String childMode;
55
63
56
- ElementBinder (this ._perf, this ._expando, this ._parser, this ._componentFactory, this .component, this .decorators,
64
+ ElementBinder (this ._perf, this ._expando, this ._parser,
65
+ this ._componentFactory,
66
+ this ._transcludingComponentFactory,
67
+ this ._shadowDomComponentFactory,
68
+ this .component, this .decorators,
57
69
this .onEvents, this .bindAttrs, this .childMode);
58
70
59
71
final bool hasTemplate = false ;
@@ -215,7 +227,16 @@ class ElementBinder {
215
227
}
216
228
nodesAttrsDirectives.add (ref);
217
229
} else if (ref.annotation is Component ) {
218
- nodeModule.factory (ref.type, _componentFactory.call (node, ref), visibility: visibility);
230
+ var factory ;
231
+ var annotation = ref.annotation as Component ;
232
+ if (annotation.useShadowDom == true ) {
233
+ factory = _shadowDomComponentFactory;
234
+ } else if (annotation.useShadowDom == false ) {
235
+ factory = _transcludingComponentFactory;
236
+ } else {
237
+ factory = _componentFactory;
238
+ }
239
+ nodeModule.factory (ref.type, factory .call (node, ref), visibility: visibility);
219
240
} else {
220
241
nodeModule.type (ref.type, visibility: visibility);
221
242
}
0 commit comments