Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Unified Diff: third_party/pkg/angular/lib/core_dom/element_binder_builder.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/core_dom/element_binder_builder.dart
diff --git a/third_party/pkg/angular/lib/core_dom/element_binder_builder.dart b/third_party/pkg/angular/lib/core_dom/element_binder_builder.dart
new file mode 100644
index 0000000000000000000000000000000000000000..050c53c180dbb92ada0fb9202e93794824aa7600
--- /dev/null
+++ b/third_party/pkg/angular/lib/core_dom/element_binder_builder.dart
@@ -0,0 +1,91 @@
+part of angular.core.dom_internal;
+
+@Injectable()
+class ElementBinderFactory {
+ final Parser _parser;
+ final Profiler _perf;
+ final Expando _expando;
+ final ComponentFactory _componentFactory;
+ final TranscludingComponentFactory _transcludingComponentFactory;
+ final ShadowDomComponentFactory _shadowDomComponentFactory;
+
+ ElementBinderFactory(this._parser, this._perf, this._expando, this._componentFactory,
+ this._transcludingComponentFactory, this._shadowDomComponentFactory);
+
+ // TODO: Optimize this to re-use a builder.
+ ElementBinderBuilder builder() => new ElementBinderBuilder(this);
+
+ ElementBinder binder(ElementBinderBuilder b) =>
+ new ElementBinder(_perf, _expando, _parser, _componentFactory,
+ _transcludingComponentFactory, _shadowDomComponentFactory,
+ b.component, b.decorators, b.onEvents, b.bindAttrs, b.childMode);
+ TemplateElementBinder templateBinder(ElementBinderBuilder b, ElementBinder transclude) =>
+ new TemplateElementBinder(_perf, _expando, _parser, _componentFactory,
+ _transcludingComponentFactory, _shadowDomComponentFactory,
+ b.template, transclude, b.onEvents, b.bindAttrs, b.childMode);
+}
+
+/**
+ * ElementBinderBuilder is an internal class for the Selector which is responsible for
+ * building ElementBinders.
+ */
+class ElementBinderBuilder {
+ static RegExp _MAPPING = new RegExp(r'^(\@|=\>\!|\=\>|\<\=\>|\&)\s*(.*)$');
+
+ ElementBinderFactory _factory;
+
+ final onEvents = <String, String>{};
+ final bindAttrs = <String, String>{};
+
+ var decorators = <DirectiveRef>[];
+ DirectiveRef template;
+ ViewFactory templateViewFactory;
+
+ DirectiveRef component;
+
+ // Can be either COMPILE_CHILDREN or IGNORE_CHILDREN
+ String childMode = Directive.COMPILE_CHILDREN;
+
+ ElementBinderBuilder(this._factory);
+
+ addDirective(DirectiveRef ref) {
+ var annotation = ref.annotation;
+ var children = annotation.children;
+
+ if (annotation.children == Directive.TRANSCLUDE_CHILDREN) {
+ template = ref;
+ } else if (annotation is Component) {
+ component = ref;
+ } else {
+ decorators.add(ref);
+ }
+
+ if (annotation.children == Directive.IGNORE_CHILDREN) {
+ childMode = annotation.children;
+ }
+
+ if (annotation.map != null) annotation.map.forEach((attrName, mapping) {
+ Match match = _MAPPING.firstMatch(mapping);
+ if (match == null) {
+ throw "Unknown mapping '$mapping' for attribute '$attrName'.";
+ }
+ var mode = match[1];
+ var dstPath = match[2];
+
+ String dstExpression = dstPath.isEmpty ? attrName : dstPath;
+
+ ref.mappings.add(new MappingParts(attrName, mode, dstExpression, mapping));
+ });
+ }
+
+ ElementBinder get binder {
+ if (template != null) {
+ var transclude = _factory.binder(this);
+ return _factory.templateBinder(this, transclude);
+
+ } else {
+ return _factory.binder(this);
+ }
+
+ }
+}
« no previous file with comments | « third_party/pkg/angular/lib/core_dom/element_binder.dart ('k') | third_party/pkg/angular/lib/core_dom/event_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698