Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Removal of @Controller #1269

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions benchmark/watch_group_perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ var _dynamicFieldGetterFactory = new DynamicFieldGetterFactory();
main() {
_fieldRead();
_fieldReadGetter();
_mapRead();
_methodInvoke0();
_methodInvoke1();
_function2();
Expand Down Expand Up @@ -107,39 +106,6 @@ _fieldReadGetter() {
time('fieldReadGetter', () => watchGrp.detectChanges());
}

_mapRead() {
var map = {
'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4,
'f': 0, 'g': 1, 'h': 2, 'i': 3, 'j': 4,
'k': 0, 'l': 1, 'm': 2, 'n': 3, 'o': 4,
'p': 0, 'q': 1, 'r': 2, 's': 3, 't': 4};
var watchGrp = new RootWatchGroup(_dynamicFieldGetterFactory,
new DirtyCheckingChangeDetector(_dynamicFieldGetterFactory), map)
..watch(_parse('a'), _reactionFn)
..watch(_parse('b'), _reactionFn)
..watch(_parse('c'), _reactionFn)
..watch(_parse('d'), _reactionFn)
..watch(_parse('e'), _reactionFn)
..watch(_parse('f'), _reactionFn)
..watch(_parse('g'), _reactionFn)
..watch(_parse('h'), _reactionFn)
..watch(_parse('i'), _reactionFn)
..watch(_parse('j'), _reactionFn)
..watch(_parse('k'), _reactionFn)
..watch(_parse('l'), _reactionFn)
..watch(_parse('m'), _reactionFn)
..watch(_parse('n'), _reactionFn)
..watch(_parse('o'), _reactionFn)
..watch(_parse('p'), _reactionFn)
..watch(_parse('q'), _reactionFn)
..watch(_parse('r'), _reactionFn)
..watch(_parse('s'), _reactionFn)
..watch(_parse('t'), _reactionFn);

print('Watch: ${watchGrp.fieldCost}; eval: ${watchGrp.evalCost}');
time('mapRead', () => watchGrp.detectChanges());
}

_methodInvoke0() {
var context = new _Obj();
context.a = new _Obj();
Expand Down
17 changes: 7 additions & 10 deletions benchmark/web/tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,22 @@ import 'package:angular/application_factory.dart';
import 'package:angular/change_detection/ast_parser.dart';

import 'dart:html';
import 'dart:math';
import 'dart:js' as js;

@Component(
selector: 'tree',
template: '<span> {{ctrl.data.value}}'
'<span ng-if="ctrl.data.right != null"><tree data=ctrl.data.right></span>'
'<span ng-if="ctrl.data.left != null"><tree data=ctrl.data.left></span>'
'</span>',
publishAs: 'ctrl')
'<span ng-if="data.right != null"><tree data=data.right></span>'
'<span ng-if="data.left != null"><tree data=data.left></span>'
'</span>')
class TreeComponent {
@NgOneWay('data')
var data;
}

@Component(
selector: 'tree-url',
templateUrl: 'tree-tmpl.html',
publishAs: 'ctrl')
templateUrl: 'tree-tmpl.html')
class TreeUrlComponent {
@NgOneWay('data')
var data;
Expand Down Expand Up @@ -189,19 +186,19 @@ class FreeTreeClass {
s.text = " $v";
}
});

scope.watchAST(treeRightNotNullAST, (v, _) {
if (v != true) return;
s.append(new SpanElement()
..append(new FreeTreeClass(scope, treeRightAST).element()));
});

scope.watchAST(treeLeftNotNullAST, (v, _) {
if (v != true) return;
s.append(new SpanElement()
..append(new FreeTreeClass(scope, treeLeftAST).element()));
});

return elt;
}
}
Expand Down
24 changes: 24 additions & 0 deletions example/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "paper-example",
"version": "0.0.1",
"homepage": "https://github.com/angular/angular.dart",
"authors": [
"James deBoer <james@huronbox.com>"
],
"description": "Paper with AngularDart",
"main": "web/index.html",
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.4",
"paper-elements": "Polymer/paper-elements#~0.3.4",
"core-elements": "Polymer/core-elements#~0.3.4"
}
}
40 changes: 22 additions & 18 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,61 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.13.6"
version: "0.18.0"
angular:
description:
path: ".."
relative: true
source: path
version: "0.11.0"
version: "0.12.0"
args:
description: args
source: hosted
version: "0.10.0+2"
barback:
description: barback
source: hosted
version: "0.13.0"
version: "0.14.1+3"
browser:
description: browser
source: hosted
version: "0.10.0+2"
code_transformers:
description: code_transformers
source: hosted
version: "0.1.3"
version: "0.1.6"
collection:
description: collection
source: hosted
version: "0.9.2"
version: "0.9.4"
di:
description: di
source: hosted
version: "1.1.0"
version: "2.0.1"
html5lib:
description: html5lib
source: hosted
version: "0.10.0"
intl:
description: intl
source: hosted
version: "0.9.9"
version: "0.8.10+4"
logging:
description: logging
source: hosted
version: "0.9.1+1"
version: "0.9.2"
matcher:
description: matcher
source: hosted
version: "0.10.0"
mock:
description: mock
version: "0.11.0"
meta:
description: meta
source: hosted
version: "0.10.0+1"
version: "0.8.8"
path:
description: path
source: hosted
version: "1.2.1"
version: "1.2.2"
perf_api:
description: perf_api
source: hosted
Expand All @@ -70,20 +70,24 @@ packages:
source_maps:
description: source_maps
source: hosted
version: "0.9.0"
version: "0.9.3"
stack_trace:
description: stack_trace
source: hosted
version: "0.9.3+1"
version: "1.0.2"
typed_mock:
description: typed_mock
source: hosted
version: "0.0.4"
unittest:
description: unittest
source: hosted
version: "0.10.1+2"
version: "0.11.0+3"
utf:
description: utf
source: hosted
version: "0.9.0"
version: "0.9.0+1"
web_components:
description: web_components
source: hosted
version: "0.3.3"
version: "0.3.5+1"
6 changes: 2 additions & 4 deletions example/web/animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ part 'animation/visibility_demo.dart';
part 'animation/stress_demo.dart';
part 'animation/css_demo.dart';

@Controller(
selector: '[animation-demo]',
publishAs: 'demo')
@Injectable()
class AnimationDemo {
final pages = ["About", "ng-repeat", "Visibility", "Css", "Stress Test"];
var currentPage = "About";
Expand All @@ -24,11 +22,11 @@ class AnimationDemoModule extends Module {
bind(VisibilityDemo);
bind(StressDemo);
bind(CssDemo);
bind(AnimationDemo);
}
}
main() {
applicationFactory()
.addModule(new AnimationDemoModule())
.rootContextType(AnimationDemo)
.run();
}
10 changes: 6 additions & 4 deletions example/web/animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
</head>
<body class="ng-cloak" ng-app animation-demo>
<nav>
<button ng-repeat="page in demo.pages"
ng-click="demo.currentPage = page"
ng-class="{'current': demo.currentPage == page}">
<button ng-repeat="page in pages"
ng-click="currentPage = page"
ng-class="{'current': currentPage == page}">
{{page}}
</button>
</nav>
<div class="content" ng-switch="demo.currentPage">
<div class="content" ng-switch="currentPage">
<div class="demo" ng-switch-default>

<h2>About</h2>
<p>The NgAnimate module is a port with modifications of the original
AngularJS animation module. The default implementation does nothing.
Expand All @@ -22,6 +23,7 @@ <h2>About</h2>
added it allows you define and run css animations on your elements with
pure CSS.</p>
<p>Check out the demos above.</p>

</div>
<div class="demo" ng-switch-when="ng-repeat">
<h2>ng-repeat Demo</h2>
Expand Down
19 changes: 9 additions & 10 deletions example/web/animation/css_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ part of animation;
selector: 'css-demo',
template: '''
<div class="css-demo">
<button ng-click="ctrl.stateA = !ctrl.stateA"
ng-class="{'active': ctrl.stateA}">
<button ng-click="stateA = !stateA"
ng-class="{'active': stateA}">
Toggle A</button>
<button ng-click="ctrl.stateB = !ctrl.stateB"
ng-class="{'active': ctrl.stateB}">
<button ng-click="stateB = !stateB"
ng-class="{'active': stateB}">
Toggle B</button>
<button ng-click="ctrl.stateC = !ctrl.stateC"
ng-class="{'active': ctrl.stateC}">
<button ng-click="stateC = !stateC"
ng-class="{'active': stateC}">
Toggle C</button>
<div class="box-container">
<div class="css-box" ng-class="{
'a': ctrl.stateA,
'b': ctrl.stateB,
'c': ctrl.stateC}">BOX</div>
'a': stateA,
'b': stateB,
'c': stateC}">BOX</div>
</div>
</div>
</div>
''',
publishAs: 'ctrl',
applyAuthorStyles: true)
class CssDemo {
bool stateA = false;
Expand Down
10 changes: 4 additions & 6 deletions example/web/animation/repeat_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ part of animation;
useShadowDom: false,
template: '''
<div class="repeat-demo">
<button ng-click="ctrl.addItem()">Add Thing</button>
<button ng-click="ctrl.removeItem()">Remove Thing
</button>
<button ng-click="addItem()">Add Thing</button>
<button ng-click="removeItem()">Remove Thing</button>
<ul>
<li ng-repeat="outer in ctrl.items">
<li ng-repeat="outer in items">
<ul>
<li ng-repeat="inner in ctrl.items">{{inner}}</li>
<li ng-repeat="inner in items">{{inner}}</li>
</ul>
</li>
</ul>
</div>
''',
publishAs: 'ctrl',
applyAuthorStyles: true)
class RepeatDemo {
var thing = 0;
Expand Down
5 changes: 2 additions & 3 deletions example/web/animation/stress_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ part of animation;
selector: 'stress-demo',
template: '''
<div class="stress-demo">
<button ng-click="ctrl.visible = !ctrl.visible">
<button ng-click="visible = !visible">
Toggle Visibility</button>
<div>
<div class="stress-box" ng-repeat="number in ctrl.numbers"></div>
<div class="stress-box" ng-repeat="number in numbers"></div>
</div>
</div>
''',
publishAs: 'ctrl',
applyAuthorStyles: true)
class StressDemo {
bool _visible = true;
Expand Down
7 changes: 3 additions & 4 deletions example/web/animation/visibility_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ part of animation;
selector: 'visibility-demo',
template: '''
<div class="visibility-demo">
<button ng-click="ctrl.visible = !ctrl.visible">Toggle Visibility</button>
<div class="visible-if" ng-if="ctrl.visible">
<button ng-click="visible = !visible">Toggle Visibility</button>
<div class="visible-if" ng-if="visible">
<p>Hello World. ng-if will create and destroy
dom elements each time you toggle me.</p>
</div>
<div class="visible-hide" ng-hide="ctrl.visible">
<div class="visible-hide" ng-hide="visible">
<p>Hello World. ng-hide will add and remove
the .ng-hide class from me to show and
hide this view of text.</p>
</div>
</div>
''',
publishAs: 'ctrl',
useShadowDom: false)
class VisibilityDemo {
bool visible = false;
Expand Down
Loading