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

Commit 5c4e0d8

Browse files
committed
fix: More consistent type naming
Closes #902 BREAKING CHANGE: - Concepts: - Filter -> Formatter - import: - angular/directive/ng_a.dart -> angular/directive/a_href.dart - angular/filter/currency.dart -> angular/formatter/currency.dart - angular/filter/date.dart -> angular/formatter/date.dart - angular/filter/filter.dart -> angular/formatter/filter.dart - angular/filter/json.dart -> angular/formatter/json.dart - angular/filter/limit_to.dart -> angular/formatter/limit_to.dart - angular/filter/lowercase.dart -> angular/formatter/lowercase.dart - angular/filter/module.dart -> angular/formatter/module.dart - angular/filter/number.dart -> angular/formatter/number.dart - angular/filter/order_by.dart -> angular/formatter/order_by.dart - angular/filter/stringify.dart -> angular/formatter/stringify.dart - angular/filter/uppercase.dart -> angular/formatter/uppercase.dart - Types: - NgA -> AHref - NgAttachAware -> AttachAware - NgDetachAware -> DetachAware - NgShadowRootAware -> ShadowRootAware - NgFilter -> Formatter - NgInjectableService -> Injectable - AbstractNgAnnotation -> Directive - AbstractNgFieldAnnotation -> DirectiveAnnotation - NgComponent -> Component - NgController -> Controller - NgDirective -> Decorator - NgAnimate -> Animate - NgZone -> VmTurnZone - NgAnimationModule -> AnimationModule - NgCoreModule -> CoreModule - NgCoreDomModule -> CoreDomModule - NgAnimationDirective -> NgAnimation - NgAnimationChildrenDirective -> NgAnimationChildren - FilterMap -> FormatterMap - NgAttrMustacheDirective -> AttrMustache - NgTextMustacheDirective -> TextMustache - Constants - NgDirective.LOCAL_VISIBILITY -> Directive.LOCAL_VISIBILITY - NgDirective.CHILDREN_VISIBILITY -> Directive.CHILDREN_VISIBILITY - NgDirective.DIRECT_CHILDREN_VISIBILITY -> Directive.DIRECT_CHILDREN_VISIBILITY
1 parent 365d166 commit 5c4e0d8

File tree

152 files changed

+1203
-1134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+1203
-1134
lines changed

example/web/animation.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ part 'animation/visibility_demo.dart';
99
part 'animation/stress_demo.dart';
1010
part 'animation/css_demo.dart';
1111

12-
@NgController(
12+
@Controller(
1313
selector: '[animation-demo]',
1414
publishAs: 'demo')
15-
class AnimationDemoController {
15+
class AnimationDemo {
1616
final pages = ["About", "ng-repeat", "Visibility", "Css", "Stress Test"];
1717
var currentPage = "About";
1818
}
1919

2020
class AnimationDemoModule extends Module {
2121
AnimationDemoModule() {
22-
install(new NgAnimateModule());
23-
type(RepeatDemoComponent);
24-
type(VisibilityDemoComponent);
25-
type(StressDemoComponent);
26-
type(CssDemoComponent);
27-
type(AnimationDemoController);
22+
install(new AnimationModule());
23+
type(RepeatDemo);
24+
type(VisibilityDemo);
25+
type(StressDemo);
26+
type(CssDemo);
27+
type(AnimationDemo);
2828
}
2929
}
3030
main() {

example/web/animation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h2>About</h2>
1818
<p>The NgAnimate module is a port with modifications of the original
1919
AngularJS animation module. The default implementation does nothing.
2020
It simply provides hooks into the angular subsystem. Adding
21-
<code>NgAnimateModule</code> however is a whole different story. Once
21+
<code>AnimationModule</code> however is a whole different story. Once
2222
added it allows you define and run css animations on your elements with
2323
pure CSS.</p>
2424
<p>Check out the demos above.</p>

example/web/animation/css_demo.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
part of animation;
22

3-
@NgComponent(
3+
@Component(
44
selector: 'css-demo',
55
template: '''
66
<div class="css-demo">
@@ -24,8 +24,8 @@ part of animation;
2424
''',
2525
publishAs: 'ctrl',
2626
applyAuthorStyles: true)
27-
class CssDemoComponent {
27+
class CssDemo {
2828
bool stateA = false;
2929
bool stateB = false;
3030
bool stateC = false;
31-
}
31+
}

example/web/animation/repeat_demo.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
part of animation;
22

3-
@NgComponent(
3+
@Component(
44
selector: 'repeat-demo',
55
template: '''
66
<div class="repeat-demo">
@@ -18,7 +18,7 @@ part of animation;
1818
''',
1919
publishAs: 'ctrl',
2020
applyAuthorStyles: true)
21-
class RepeatDemoComponent {
21+
class RepeatDemo {
2222
var thing = 0;
2323
final items = [];
2424

example/web/animation/stress_demo.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
part of animation;
22

3-
@NgComponent(
3+
@Component(
44
selector: 'stress-demo',
55
template: '''
66
<div class="stress-demo">
@@ -13,7 +13,7 @@ part of animation;
1313
''',
1414
publishAs: 'ctrl',
1515
applyAuthorStyles: true)
16-
class StressDemoComponent {
16+
class StressDemo {
1717
bool _visible = true;
1818
final numbers = <int>[1, 2];
1919

example/web/animation/visibility_demo.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
part of animation;
22

3-
@NgComponent(
3+
@Component(
44
selector: 'visibility-demo',
55
template: '''
66
<div class="visibility-demo">
@@ -18,6 +18,6 @@ part of animation;
1818
''',
1919
publishAs: 'ctrl',
2020
applyAuthorStyles: true)
21-
class VisibilityDemoComponent {
21+
class VisibilityDemo {
2222
bool visible = false;
23-
}
23+
}

example/web/bouncing_balls.dart

+5-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BallModel {
2626

2727
}
2828

29-
@NgController(
29+
@Controller(
3030
selector: '[bounce-controller]',
3131
publishAs: 'bounce')
3232
class BounceController {
@@ -99,15 +99,15 @@ class BounceController {
9999

100100
List<String> _CACHE = new List.generate(500, (i) => '${i}px');
101101

102-
@NgDirective(
102+
@Decorator(
103103
selector: '[ball-position]',
104104
map: const {
105105
"ball-position": '=>position'},
106106
exportExpressions: const ['x', 'y'])
107-
class BallPositionDirective {
107+
class BallPosition {
108108
final Element element;
109109
final Scope scope;
110-
BallPositionDirective(this.element, this.scope);
110+
BallPosition(this.element, this.scope);
111111

112112
px(x) => _CACHE[max(0, x.round())];
113113

@@ -125,8 +125,7 @@ class BallPositionDirective {
125125
class MyModule extends Module {
126126
MyModule() {
127127
type(BounceController);
128-
type(BallPositionDirective);
129-
factory(ScopeStatsConfig, (i) => new ScopeStatsConfig());
128+
type(BallPosition);
130129
}
131130
}
132131

example/web/hello_world.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import 'package:angular/angular.dart';
22
import 'package:angular/application_factory.dart';
33

4-
@NgController(
4+
@Controller(
55
selector: '[hello-world-controller]',
66
publishAs: 'ctrl')
7-
class HelloWorldController {
7+
class HelloWorld {
88
String name = "world";
99
}
1010

1111
main() {
1212
applicationFactory()
13-
.addModule(new Module()..type(HelloWorldController))
13+
.addModule(new Module()..type(HelloWorld))
1414
.run();
1515
}

example/web/todo.dart

+15-15
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ class Item {
2525

2626
// ServerController interface. Logic in main.dart determines which
2727
// implementation we should use.
28-
abstract class ServerController {
29-
init(TodoController todo);
28+
abstract class Server {
29+
init(Todo todo);
3030
}
3131

3232

3333
// An implementation of ServerController that does nothing.
34-
@NgInjectableService()
35-
class NoServerController implements ServerController {
36-
init(TodoController todo) { }
34+
@Injectable()
35+
class NoOpServer implements Server {
36+
init(Todo todo) { }
3737
}
3838

3939

4040
// An implementation of ServerController that fetches items from
4141
// the server over HTTP.
42-
@NgInjectableService()
43-
class HttpServerController implements ServerController {
42+
@Injectable()
43+
class HttpServer implements Server {
4444
final Http _http;
45-
HttpServerController(this._http);
45+
HttpServer(this._http);
4646

47-
init(TodoController todo) {
47+
init(Todo todo) {
4848
_http(method: 'GET', url: '/todos').then((HttpResponse data) {
4949
data.data.forEach((d) {
5050
todo.items.add(new Item(d["text"], d["done"]));
@@ -54,14 +54,14 @@ class HttpServerController implements ServerController {
5454
}
5555

5656

57-
@NgController(
57+
@Controller(
5858
selector: '[todo-controller]',
5959
publishAs: 'todo')
60-
class TodoController {
60+
class Todo {
6161
var items = <Item>[];
6262
Item newItem;
6363

64-
TodoController(ServerController serverController) {
64+
Todo(Server serverController) {
6565
newItem = new Item();
6666
items = [
6767
new Item('Write Angular in Dart', true),
@@ -95,16 +95,16 @@ class TodoController {
9595
main() {
9696
print(window.location.search);
9797
var module = new Module()
98-
..type(TodoController)
98+
..type(Todo)
9999
..type(PlaybackHttpBackendConfig);
100100

101101
// If these is a query in the URL, use the server-backed
102102
// TodoController. Otherwise, use the stored-data controller.
103103
var query = window.location.search;
104104
if (query.contains('?')) {
105-
module.type(ServerController, implementedBy: HttpServerController);
105+
module.type(Server, implementedBy: HttpServer);
106106
} else {
107-
module.type(ServerController, implementedBy: NoServerController);
107+
module.type(Server, implementedBy: NoOpServer);
108108
}
109109

110110
if (query == '?record') {

lib/angular.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export 'package:angular/core/module.dart';
66
export 'package:angular/directive/module.dart';
77
export 'package:angular/core/annotation.dart';
88
export 'package:angular/introspection.dart';
9-
export 'package:angular/filter/module.dart';
9+
export 'package:angular/formatter/module.dart';
1010
export 'package:angular/routing/module.dart';
1111
export 'package:di/di.dart';
1212
export 'package:route_hierarchical/client.dart' hide childRoute;

lib/animate/animation_loop.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ part of angular.animate;
44
* Window.animationFrame update loop that tracks and drives
55
* [LoopedAnimations]'s.
66
*/
7-
@NgInjectableService()
7+
@Injectable()
88
class AnimationLoop {
99
final AnimationFrame _frames;
1010
final Profiler _profiler;
1111
final List<LoopedAnimation> _animations = [];
12-
final NgZone _zone;
12+
final VmTurnZone _zone;
1313

1414
bool _animationFrameQueued = false;
1515

@@ -101,7 +101,7 @@ class AnimationLoop {
101101
* Wrapper around window.requestAnimationFrame so it can be intercepted and
102102
* tested.
103103
*/
104-
@NgInjectableService()
104+
@Injectable()
105105
class AnimationFrame {
106106
final dom.Window _wnd;
107107
Future<num> get animationFrame => _wnd.animationFrame;

lib/animate/animation_optimizer.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ part of angular.animate;
66
* running animations on child elements while the dom parent is also running an
77
* animation.
88
*/
9-
@NgInjectableService()
9+
@Injectable()
1010
class AnimationOptimizer {
1111
final Map<dom.Element, Set<Animation>> _elements = new Map<dom.Element,
1212
Set<Animation>>();

lib/animate/css_animate.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ part of angular.animate;
66
* animation framework. This implementation uses the [AnimationLoop] class to
77
* queue and run CSS based transition and keyframe animations.
88
*/
9-
@NgInjectableService()
10-
class CssAnimate implements NgAnimate {
9+
@Injectable()
10+
class CssAnimate implements Animate {
1111
static const NG_ANIMATE = "ng-animate";
1212
static const NG_MOVE = "ng-move";
1313
static const NG_INSERT = "ng-enter";
@@ -131,7 +131,7 @@ class CssAnimate implements NgAnimate {
131131
/**
132132
* Tracked set of currently running css animations grouped by element.
133133
*/
134-
@NgInjectableService()
134+
@Injectable()
135135
class CssAnimationMap {
136136
final Map<dom.Element, Map<String, CssAnimation>> cssAnimations
137137
= new Map<dom.Element, Map<String, CssAnimation>>();

lib/animate/module.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* elements for block level directives such as `ng-if`, `ng-repeat`,
1515
* `ng-hide`, and more.
1616
*
17-
* To use, install the NgAnimateModule into your main module:
17+
* To use, install the AnimationModule into your main module:
1818
*
1919
* var module = new Module()
20-
* ..install(new NgAnimateModule());
20+
* ..install(new AnimationModule());
2121
*
2222
* Once the module has been installed, all block level DOM manipulations will
2323
* be routed through the [CssAnimate] class instead of the
@@ -124,7 +124,7 @@ part 'ng_animate.dart';
124124
final Logger _logger = new Logger('ng.animate');
125125

126126
/**
127-
* Installing the NgAnimateModule will install a [CssAnimate] implementation of
127+
* Installing the AnimationModule will install a [CssAnimate] implementation of
128128
* the [NgAnimate] interface in your application. This will change the behavior
129129
* of view construction, and some of the native directives to allow you to add
130130
* and define css transition and keyframe animations for the styles of your
@@ -153,14 +153,14 @@ final Logger _logger = new Logger('ng.animate');
153153
* opacity: 0;
154154
* }
155155
*/
156-
class NgAnimateModule extends Module {
157-
NgAnimateModule() {
156+
class AnimationModule extends Module {
157+
AnimationModule() {
158158
type(AnimationFrame);
159159
type(AnimationLoop);
160160
type(CssAnimationMap);
161161
type(AnimationOptimizer);
162-
type(NgAnimateDirective);
163-
type(NgAnimateChildrenDirective);
162+
type(NgAnimate);
163+
type(NgAnimateChildren);
164164
type(NgAnimate, implementedBy: CssAnimate);
165165
}
166166
}

0 commit comments

Comments
 (0)