Skip to content
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
28 changes: 19 additions & 9 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.11.10"
version: "0.13.0-dev.9"
angular:
description:
path: ".."
Expand All @@ -14,18 +14,28 @@ packages:
args:
description: args
source: hosted
version: "0.9.0"
version: "0.10.0+1"
barback:
description: barback
source: hosted
version: "0.11.1"
browser:
description: browser
source: hosted
version: "0.9.1"
code_transformers:
description: code_transformers
source: hosted
version: "0.0.1-dev.3"
collection:
description: collection
source: hosted
version: "0.9.1"
di:
description: di
source: hosted
description:
path: "../../di.dart"
relative: true
source: path
version: "0.0.33"
html5lib:
description: html5lib
Expand All @@ -34,11 +44,15 @@ packages:
intl:
description: intl
source: hosted
version: "0.9.7"
version: "0.8.10+4"
logging:
description: logging
source: hosted
version: "0.9.1+1"
meta:
description: meta
source: hosted
version: "0.8.8"
path:
description: path
source: hosted
Expand Down Expand Up @@ -67,10 +81,6 @@ packages:
description: unittest
source: hosted
version: "0.10.0"
unmodifiable_collection:
description: unmodifiable_collection
source: hosted
version: "0.9.2+1"
utf:
description: utf
source: hosted
Expand Down
3 changes: 3 additions & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ dependencies:
path: ../
browser: any
unittest: any

transformers:
- angular
2 changes: 1 addition & 1 deletion example/web/animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ <h2>Stress Test</h2>
</div>
</div>
<script type="application/dart" src="animation.dart"></script>
<script src="../packages/browser/dart.js"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
79 changes: 4 additions & 75 deletions example/web/bouncing_balls.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:perf_api/perf_api.dart';
import 'package:angular/angular.dart';
import 'package:angular/angular_static.dart';
import 'package:angular/angular_dynamic.dart';
import 'package:angular/change_detection/change_detection.dart';
import 'dart:html';
import 'dart:math';
Expand Down Expand Up @@ -102,7 +102,8 @@ class BounceController {
@NgDirective(
selector: '[ball-position]',
map: const {
"ball-position": '=>position'})
"ball-position": '=>position'},
exportExpressions: const ['x', 'y'])
class BallPositionDirective {
final Element element;
final Scope scope;
Expand All @@ -125,79 +126,7 @@ class MyModule extends Module {
}

main() {
var getters = {
'x': (o) => o.x,
'y': (o) => o.y,
'bounce': (o) => o.bounce,
'fps': (o) => o.fps,
'balls': (o) => o.balls,
'length': (o) => o.length,
'digestTime': (o) => o.digestTime,
'ballClassName': (o) => o.ballClassName,
'position': (o) => o.position,
'onClick': (o) => o.onClick,
'ball': (o) => o.ball,
'color': (o) => o.color,
'changeCount': (o) => o.changeCount,
'playPause': (o) => o.playPause,
'toggleCSS': (o) => o.toggleCSS,
'timeDigest': (o) => o.timeDigest,
'expression': (o) => o.expression,
};
var setters = {
'position': (o, v) => o.position = v,
'onClick': (o, v) => o.onClick = v,
'ball': (o, v) => o.ball = v,
'x': (o, v) => o.x = v,
'y': (o, v) => o.y = v,
'balls': (o, v) => o.balls = v,
'bounce': (o, v) => o.bounce = v,
'expression': (o, v) => o.expression = v,
'fps': (o, v) => o.fps = v,
'length': (o, v) => o.length = v,
'digestTime': (o, v) => o.digestTime = v,
'ballClassName': (o, v) => o.ballClassName = v,
};
var metadata = {
BounceController: [new NgController(selector: '[bounce-controller]', publishAs: 'bounce')],
BallPositionDirective: [new NgDirective(selector: '[ball-position]', map: const { "ball-position": '=>position'})],
NgEventDirective: [new NgDirective(selector: '[ng-click]', map: const {'ng-click': '&onClick'})],
NgADirective: [new NgDirective(selector: 'a[href]')],
NgRepeatDirective: [new NgDirective(children: NgAnnotation.TRANSCLUDE_CHILDREN, selector: '[ng-repeat]', map: const {'.': '@expression'})],
NgTextMustacheDirective: [new NgDirective(selector: r':contains(/{{.*}}/)')],
NgAttrMustacheDirective: [new NgDirective(selector: r'[*=/{{.*}}/]')],
};
var types = {
Profiler: (t) => new Profiler(),
DirectiveSelectorFactory: (t) => new DirectiveSelectorFactory(),
DirectiveMap: (t) => new DirectiveMap(t(Injector), t(MetadataExtractor), t(DirectiveSelectorFactory)),
Lexer: (t) => new Lexer(),
ClosureMap: (t) => new StaticClosureMap(getters, setters), // TODO: types don't match
DynamicParserBackend: (t) => new DynamicParserBackend(t(ClosureMap)),
DynamicParser: (t) => new DynamicParser(t(Lexer), t(ParserBackend)),
Compiler: (t) => new Compiler(t(Profiler), t(Parser), t(Expando)),
WalkingCompiler: (t) => new WalkingCompiler(t(Profiler), t(Expando)),
DirectiveSelectorFactory: (t) => new DirectiveSelectorFactory(t(ElementBinderFactory)),
ElementBinderFactory: (t) => new ElementBinderFactory(t(Parser), t(Profiler), t(Expando)),
EventHandler: (t) => new EventHandler(t(Node), t(Expando), t(ExceptionHandler)),
AstParser: (t) => new AstParser(t(Parser)),
FilterMap: (t) => new FilterMap(t(Injector), t(MetadataExtractor)),
ExceptionHandler: (t) => new ExceptionHandler(),
FieldGetterFactory: (t) => new StaticFieldGetterFactory(getters),
ScopeDigestTTL: (t) => new ScopeDigestTTL(),
ScopeStats: (t) => new ScopeStats(),
RootScope: (t) => new RootScope(t(Object), t(AstParser), t(Parser), t(FieldGetterFactory), t(FilterMap), t(ExceptionHandler), t(ScopeDigestTTL), t(NgZone), t(ScopeStats)),
NgAnimate: (t) => new NgAnimate(),
Interpolate: (t) => new Interpolate(t(Parser)),

NgEventDirective: (t) => new NgEventDirective(t(Element), t(Scope)),
NgADirective: (t) => new NgADirective(t(Element)),
NgRepeatDirective: (t) => new NgRepeatDirective(t(ViewPort), t(BoundViewFactory), t(Scope), t(Parser), t(AstParser), t(FilterMap)),

BounceController: (t) => new BounceController(t(Scope)),
BallPositionDirective: (t) => new BallPositionDirective(t(Element), t(Scope)),
};
ngStaticApp(types, metadata, getters, setters)
ngDynamicApp()
.addModule(new MyModule())
.run();
}
8 changes: 0 additions & 8 deletions example/web/hello_world.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import 'package:angular/angular.dart';
import 'package:angular/angular_dynamic.dart';

// This annotation allows Dart to shake away any classes
// not used from Dart code nor listed in another @MirrorsUsed.
//
// If you create classes that are referenced from the Angular
// expressions, you must include a library target in @MirrorsUsed.
@MirrorsUsed(override: '*')
import 'dart:mirrors';

@NgController(
selector: '[hello-world-controller]',
publishAs: 'ctrl')
Expand Down
11 changes: 2 additions & 9 deletions example/web/todo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@ library todo;
import 'package:angular/angular.dart';
import 'package:angular/angular_dynamic.dart';
import 'package:angular/playback/playback_http.dart';
import 'todo.dart';

import 'dart:html';

// This annotation allows Dart to shake away any classes
// not used from Dart code nor listed in another @MirrorsUsed.
//
// If you create classes that are referenced from the Angular
// expressions, you must include a library target in @MirrorsUsed.
@MirrorsUsed(override: '*')
import 'dart:mirrors';

class Item {
String text;
bool done;
Expand All @@ -40,13 +31,15 @@ abstract class ServerController {


// An implementation of ServerController that does nothing.
@NgInjectableService()
class NoServerController implements ServerController {
init(TodoController todo) { }
}


// An implementation of ServerController that fetches items from
// the server over HTTP.
@NgInjectableService()
class HttpServerController implements ServerController {
final Http _http;
HttpServerController(this._http);
Expand Down
2 changes: 1 addition & 1 deletion example/web/todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="css/todo.css">
<title>Things To Do</title>
<script src="todo.dart" type="application/dart"></script>
<script src="../packages/browser/dart.js"></script>
<script src="packages/browser/dart.js"></script>
</head>
<body ng-app>

Expand Down
12 changes: 7 additions & 5 deletions lib/animate/animation_loop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ part of angular.animate;
* Window.animationFrame update loop that tracks and drives
* [LoopedAnimations]'s.
*/
@NgInjectableService()
class AnimationLoop {
final AnimationFrame _frames;
final Profiler _profiler;
Expand All @@ -23,7 +24,7 @@ class AnimationLoop {
* Start and play an animation through the state transitions defined in
* [Animation].
*/
void play(LoopedAnimation animation) {
void play(LoopedAnimation animation) {
_animations.add(animation);
_queueAnimationFrame();
}
Expand All @@ -42,7 +43,7 @@ class AnimationLoop {

/* On the browsers animation frame event, update each of the tracked
* animations. Group dom reads first, and and writes second.
*
*
* At any point any animation may be updated by calling interrupt and cancel
* with a reference to the [Animation] to cancel. The [AnimationRunner] will
* then forget about the [Animation] and will not call any further methods on
Expand All @@ -56,7 +57,7 @@ class AnimationLoop {
// Dom reads
_read(timeInMs);
_profiler.stopTimer("AnimationRunner.AnimationFrame.DomReads");

_profiler.startTimer("AnimationRunner.AnimationFrame.DomMutates");
// Dom mutates
_update(timeInMs);
Expand Down Expand Up @@ -86,7 +87,7 @@ class AnimationLoop {
animation.read(timeInMs);
}
}

/**
* Stop tracking and updating the [animation].
*/
Expand All @@ -100,9 +101,10 @@ class AnimationLoop {
* Wrapper around window.requestAnimationFrame so it can be intercepted and
* tested.
*/
@NgInjectableService()
class AnimationFrame {
final dom.Window _wnd;
Future<num> get animationFrame => _wnd.animationFrame;

AnimationFrame(this._wnd);
}
1 change: 1 addition & 0 deletions lib/animate/animation_optimizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ part of angular.animate;
* running animations on child elements while the dom parent is also running an
* animation.
*/
@NgInjectableService()
class AnimationOptimizer {
final Map<dom.Element, Set<Animation>> _elements = new Map<dom.Element,
Set<Animation>>();
Expand Down
2 changes: 2 additions & 0 deletions lib/animate/css_animate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ part of angular.animate;
* animation framework. This implementation uses the [AnimationLoop] class to
* queue and run CSS based transition and keyframe animations.
*/
@NgInjectableService()
class CssAnimate implements NgAnimate {
static const NG_ANIMATE = "ng-animate";
static const NG_MOVE = "ng-move";
Expand Down Expand Up @@ -130,6 +131,7 @@ class CssAnimate implements NgAnimate {
/**
* Tracked set of currently running css animations grouped by element.
*/
@NgInjectableService()
class CssAnimationMap {
final Map<dom.Element, Map<String, CssAnimation>> cssAnimations
= new Map<dom.Element, Map<String, CssAnimation>>();
Expand Down
2 changes: 2 additions & 0 deletions lib/change_detection/change_detection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ abstract class RemovedItem<V> extends CollectionChangeItem<V> {

typedef FieldGetter(object);

typedef FieldSetter(object, value);

abstract class FieldGetterFactory {
FieldGetter call(Object object, String name);
}
Expand Down
1 change: 0 additions & 1 deletion lib/core/parser/dynamic_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:angular/core/parser/eval.dart';
import 'package:angular/core/parser/utils.dart' show EvalError;
import 'package:angular/utils.dart';

@NgInjectableService()
abstract class ClosureMap {
Getter lookupGetter(String name);
Setter lookupSetter(String name);
Expand Down
2 changes: 0 additions & 2 deletions lib/core/registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ abstract class AnnotationsMap<K> {
}
}


@NgInjectableService()
abstract class MetadataExtractor {
Iterable call(Type type);
}
1 change: 0 additions & 1 deletion lib/core/registry_dynamic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ library angular.core_dynamic;
import 'dart:mirrors';
import 'package:angular/core/module.dart';

@NgInjectableService()
class DynamicMetadataExtractor implements MetadataExtractor {
final _fieldAnnotations = [
reflectType(NgAttr),
Expand Down
10 changes: 9 additions & 1 deletion lib/mock/http_backend.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
part of angular.mock;
library angular.mock.http_backend;

import 'dart:async' as dart_async;
import 'dart:convert' show JSON;
import 'dart:html';

import 'package:angular/angular.dart';
import 'package:angular/utils.dart' as utils;


class _MockXhr {
var $$method, $$url, $$async, $$reqHeaders, $$respHeaders;
Expand Down
9 changes: 3 additions & 6 deletions lib/mock/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@ library angular.mock;

import 'dart:async' as dart_async;
import 'dart:collection' show ListBase;
import 'dart:convert' show JSON;
import 'dart:html';
import 'dart:js' as js;
import 'package:angular/angular.dart';
import 'package:angular/angular_dynamic.dart';
import 'package:angular/utils.dart' as utils;
import 'package:di/di.dart';
import 'package:di/dynamic_injector.dart';
import 'package:unittest/mock.dart';

import 'http_backend.dart';

export 'http_backend.dart';
export 'zone.dart';

part 'debug.dart';
part 'exception_handler.dart';
part 'http_backend.dart';
part 'log.dart';
part 'probe.dart';
part 'test_bed.dart';
part 'mock_window.dart';
part 'test_injection.dart';

/**
* Use in addition to [AngularModule] in your tests.
Expand Down
Loading