From 1ef034359ff9074a1ab83eff179f4a6e4b2d8d02 Mon Sep 17 00:00:00 2001 From: mgechev Date: Thu, 25 Jun 2015 16:02:58 +0300 Subject: [PATCH 0001/1480] Update angular to alpha28 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59d7592d4..dca04bc94 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "typescript": "~1.5.0-beta" }, "dependencies": { - "angular2": "2.0.0-alpha.27", + "angular2": "2.0.0-alpha.28", "es6-module-loader": "^0.15.0", "systemjs": "^0.16.0", "zone.js": "^0.4.1", From ceb71ae5ce35d0b09de1a06f3feee8a2e73287be Mon Sep 17 00:00:00 2001 From: Robert Penner Date: Thu, 25 Jun 2015 23:34:38 +0545 Subject: [PATCH 0002/1480] Simplify About component code --- app/components/about/about.html | 2 +- app/components/about/about.ts | 7 +------ app/services/NameList.ts | 8 +++----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/components/about/about.html b/app/components/about/about.html index 54dcfbfdc..d43860e5e 100644 --- a/app/components/about/about.html +++ b/app/components/about/about.html @@ -10,5 +10,5 @@

diff --git a/app/components/about/about.ts b/app/components/about/about.ts index b580feb93..253678c90 100644 --- a/app/components/about/about.ts +++ b/app/components/about/about.ts @@ -11,12 +11,7 @@ import {NamesList} from '../../services/NameList'; directives: [NgFor] }) export class About { - names: Array; - list: NamesList; - - constructor(list: NamesList) { - this.list = list; - this.names = list.get(); + constructor(public list: NamesList) { } addName(newname) { this.list.add(newname.value); diff --git a/app/services/NameList.ts b/app/services/NameList.ts index 9ebb50750..01a985ed6 100644 --- a/app/services/NameList.ts +++ b/app/services/NameList.ts @@ -1,12 +1,10 @@ export class NamesList { - names: Array; - constructor() { - this.names = ['Dijkstra', 'Knuth', 'Turing', 'Hopper']; - } + names = ['Dijkstra', 'Knuth', 'Turing', 'Hopper']; + get() { return this.names; } - add(value) { + add(value: string) { this.names.push(value); } } From 590bc3c76600b08b816775141107f43523e2dd9d Mon Sep 17 00:00:00 2001 From: mgechev Date: Fri, 26 Jun 2015 18:07:56 +0300 Subject: [PATCH 0003/1480] Update part2 --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fd9258115..97c8c20c1 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,9 @@ Add reference to the installed library in `PATH.src.lib`. # Contributors -[mgechev](https://github.com/mgechev) |[ludohenin](https://github.com/ludohenin) |[jgolla](https://github.com/jgolla) | -:---: |:---: |:---: | -[mgechev](https://github.com/mgechev) |[ludohenin](https://github.com/ludohenin) |[jgolla](https://github.com/jgolla) | - +[mgechev](https://github.com/mgechev) |[ludohenin](https://github.com/ludohenin) |[robertpenner](https://github.com/robertpenner) |[jgolla](https://github.com/jgolla) | +:---: |:---: |:---: |:---: | +[mgechev](https://github.com/mgechev) |[ludohenin](https://github.com/ludohenin) |[robertpenner](https://github.com/robertpenner) |[jgolla](https://github.com/jgolla) | # Change Log You can follow the [Angular 2 change log here](https://github.com/angular/angular/blob/master/CHANGELOG.md). From 60d891fe5128afc23a5f97c1c2647c4432c0904d Mon Sep 17 00:00:00 2001 From: ludohenin Date: Sat, 27 Jun 2015 14:59:59 +0200 Subject: [PATCH 0004/1480] Fix #24 --- README.md | 5 +++++ app/index.html | 3 ++- app/init.ts | 3 ++- gulpfile.js | 18 +++++++++++++----- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 97c8c20c1..49e9c3cda 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,11 @@ gulp serve.prod └── tsd.json ``` +# Configuration + +Configure your app base if you serve the app from another directory than root in `gulpfile.js`. +Defaults to `var APP_BASE = '/'` + # Now to extend? If you want to use your custom libraries: diff --git a/app/index.html b/app/index.html index 597316ea3..fd6844751 100644 --- a/app/index.html +++ b/app/index.html @@ -3,6 +3,7 @@ + My Angular 2 App @@ -16,7 +17,7 @@ - + \ No newline at end of file diff --git a/app/init.ts b/app/init.ts index 4967f1deb..531d362b9 100644 --- a/app/init.ts +++ b/app/init.ts @@ -1,8 +1,9 @@ /// System.config({ + baseURL: '<%= APP_BASE %>', paths: {'*': '*.js?v=<%= VERSION %>'} }); -System.import('./app') +System.import('app') .catch(e => console.error(e, 'Report this error at https://github.com/mgechev/angular2-seed/issues')); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 1bc00e198..4f74aa121 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,6 +29,7 @@ var openResource = require('open'); // -------------- // Configuration. +var APP_BASE = '/'; var PATH = { dest: { @@ -141,7 +142,7 @@ gulp.task('build.js.dev', function () { return result.js .pipe(sourcemaps.write()) - .pipe(template({ VERSION: getVersion() })) + .pipe(template(templateLocals())) .pipe(gulp.dest(PATH.dest.dev.all)); }); @@ -154,7 +155,7 @@ gulp.task('build.index.dev', function() { var target = gulp.src(injectableDevAssetsRef(), { read: false }); return gulp.src('./app/index.html') .pipe(inject(target, { transform: transformPath('dev') })) - .pipe(template({ VERSION: getVersion() })) + .pipe(template(templateLocals())) .pipe(gulp.dest(PATH.dest.dev.all)); }); @@ -211,7 +212,7 @@ gulp.task('build.init.prod', function() { return result.js .pipe(uglify()) - .pipe(template({ VERSION: getVersion() })) + .pipe(template(templateLocals())) .pipe(sourcemaps.write()) .pipe(gulp.dest(PATH.dest.prod.all)); }); @@ -234,7 +235,7 @@ gulp.task('build.index.prod', function() { join(PATH.dest.prod.all, '**/*.css')], { read: false }); return gulp.src('./app/index.html') .pipe(inject(target, { transform: transformPath('prod') })) - .pipe(template({ VERSION: getVersion() })) + .pipe(template(templateLocals())) .pipe(gulp.dest(PATH.dest.prod.all)); }); @@ -303,7 +304,7 @@ gulp.task('serve.prod', ['build.prod'], function () { function transformPath(env) { var v = '?v=' + getVersion(); return function (filepath) { - arguments[0] = filepath.replace('/' + PATH.dest[env].all, '.') + v; + arguments[0] = filepath.replace('/' + PATH.dest[env].all, '') + v; return inject.transform.apply(inject.transform, arguments); }; } @@ -322,6 +323,13 @@ function getVersion(){ return pkg.version; } +function templateLocals() { + return { + VERSION: getVersion(), + APP_BASE: APP_BASE + }; +} + function registerBumpTasks() { semverReleases.forEach(function (release) { var semverTaskName = 'semver.' + release; From 583d0143841d4c2b71aa6b026d2709e055fc86c5 Mon Sep 17 00:00:00 2001 From: ludohenin Date: Mon, 29 Jun 2015 20:34:49 +0200 Subject: [PATCH 0005/1480] Fix #26 --- app/app.ts | 4 +++- app/components/about/about.ts | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/app.ts b/app/app.ts index 29311f57f..18aa6e0a9 100644 --- a/app/app.ts +++ b/app/app.ts @@ -4,9 +4,11 @@ import {RouteConfig, RouterOutlet, RouterLink, routerInjectables} from 'angular2 import {Home} from './components/home/home'; import {About} from './components/about/about'; +import {NamesList} from './services/NameList'; @Component({ - selector: 'app' + selector: 'app', + appInjector: [NamesList] }) @RouteConfig([ { path: '/', component: Home, as: 'home' }, diff --git a/app/components/about/about.ts b/app/components/about/about.ts index 253678c90..f927535db 100644 --- a/app/components/about/about.ts +++ b/app/components/about/about.ts @@ -3,8 +3,7 @@ import {Component, View, NgFor} from 'angular2/angular2'; import {NamesList} from '../../services/NameList'; @Component({ - selector: 'component-2', - appInjector: [NamesList] + selector: 'component-2' }) @View({ templateUrl: './components/about/about.html?v=<%= VERSION %>', From c5bce4a9afdd51b35cc0fe80982687c9313d1f1e Mon Sep 17 00:00:00 2001 From: Daniel Stockhammer Date: Mon, 29 Jun 2015 21:15:18 +0100 Subject: [PATCH 0006/1480] Update Angular typings to v2.0.0-alpha28 --- typings/angular2/angular2.d.ts | 7308 +++++++++++++++++++------------- 1 file changed, 4422 insertions(+), 2886 deletions(-) diff --git a/typings/angular2/angular2.d.ts b/typings/angular2/angular2.d.ts index a4af96202..7454046e8 100644 --- a/typings/angular2/angular2.d.ts +++ b/typings/angular2/angular2.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular v2.0.0-alpha.26 +// Type definitions for Angular v2.0.0-alpha.28 // Project: http://angular.io/ // Definitions by: angular team // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -17,7 +17,7 @@ interface List extends Array {} interface Map {} -interface StringMap {} +interface StringMap extends Map {} interface Type {} declare module "angular2/angular2" { @@ -26,667 +26,2750 @@ declare module "angular2/angular2" { // See https://github.com/Microsoft/TypeScript/issues/1168 class BaseException /* extends Error */ { - message: any; - stack: any; + message: string; + stack: string; toString(): string; } } declare module "angular2/angular2" { - class AbstractChangeDetector extends ChangeDetector { - addChild(cd: ChangeDetector): any; - addShadowDomChild(cd: ChangeDetector): any; - callOnAllChangesDone(): any; - checkNoChanges(): any; - detectChanges(): any; - detectChangesInRecords(throwOnChange: boolean): any; - lightDomChildren: List; - markAsCheckOnce(): any; - markPathToRootAsCheckOnce(): any; - mode: string; - parent: ChangeDetector; - ref: ChangeDetectorRef; - remove(): any; - removeChild(cd: ChangeDetector): any; - removeShadowDomChild(cd: ChangeDetector): any; - shadowDomChildren: List; - } - class ProtoRecord { + mode: RecordType; + name: string; + funcOrValue: any; args: List; - bindingRecord: BindingRecord; + fixedArgs: List; contextIndex: number; directiveIndex: DirectiveIndex; + selfIndex: number; + bindingRecord: BindingRecord; expressionAsString: string; - fixedArgs: List; - funcOrValue: any; - isLifeCycleRecord(): boolean; - isPipeRecord(): boolean; - isPureFunction(): boolean; lastInBinding: boolean; lastInDirective: boolean; - mode: number; - name: string; - selfIndex: number; - } - - class LifecycleEvent { - name: string; - } - - interface FormDirective { - addControl(dir: ControlDirective): void; - addControlGroup(dir: ControlGroupDirective): void; - getControl(dir: ControlDirective): Control; - removeControl(dir: ControlDirective): void; - removeControlGroup(dir: ControlGroupDirective): void; - updateModel(dir: ControlDirective, value: any): void; + isPureFunction(): boolean; + isPipeRecord(): boolean; + isLifeCycleRecord(): boolean; } - - /** - * A directive that contains a group of [ControlDirective]. - * - * @exportedAs angular2/forms - */ - class ControlContainerDirective { - formDirective: FormDirective; - name: string; - path: List; + enum RecordType { + SELF, + CONST, + PRIMITIVE_OP, + PROPERTY, + LOCAL, + INVOKE_METHOD, + INVOKE_CLOSURE, + KEYED_ACCESS, + PIPE, + INTERPOLATE, + SAFE_PROPERTY, + SAFE_INVOKE_METHOD, + DIRECTIVE_LIFECYCLE } - + /** - * A marker annotation that marks a class as available to `Injector` for creation. Used by tooling - * for generating constructor stubs. - * + * `DependencyAnnotation` is used by the framework to extend DI. + * + * Only annotations implementing `DependencyAnnotation` are added to the list of dependency + * properties. + * + * For example: + * * ``` - * class NeedsService { - * constructor(svc:UsefulService) {} + * class Parent extends DependencyAnnotation {} + * class NotDependencyProperty {} + * + * class AComponent { + * constructor(@Parent @NotDependencyProperty aService:AService) {} * } - * - * @Injectable - * class UsefulService {} * ``` + * + * will create the following dependency: + * + * ``` + * new Dependency(Key.get(AService), [new Parent()]) + * ``` + * + * The framework can use `new Parent()` to handle the `aService` dependency + * in a specific way. + * * @exportedAs angular2/di_annotations */ - class Injectable { - } - - - /** - * Injectable Objects that contains a live list of child directives in the light Dom of a directive. - * The directives are kept in depth-first pre-order traversal of the DOM. - * - * In the future this class will implement an Observable interface. - * For now it uses a plain list of observable callbacks. - * - * @exportedAs angular2/view - */ - class BaseQueryList { - add(obj: any): any; - fireCallbacks(): any; - onChange(callback: any): any; - removeCallback(callback: any): any; - reset(newList: any): any; - } - - class AppProtoView { - bindElement(parent: ElementBinder, distanceToParent: int, protoElementInjector: ProtoElementInjector, componentDirective?: DirectiveBinding): ElementBinder; - - /** - * Adds an event binding for the last created ElementBinder via bindElement. - * - * If the directive index is a positive integer, the event is evaluated in the context of - * the given directive. - * - * If the directive index is -1, the event is evaluated in the context of the enclosing view. - * - * @param {string} eventName - * @param {AST} expression - * @param {int} directiveIndex The directive index in the binder or -1 when the event is not bound - * to a directive - */ - bindEvent(eventBindings: List, boundElementIndex: number, directiveIndex?: int): void; - elementBinders: List; - protoChangeDetector: ProtoChangeDetector; - protoLocals: Map; - render: RenderProtoViewRef; - variableBindings: Map; - } - - - /** - * Const of making objects: http://jsperf.com/instantiate-size-of-object - */ - class AppView implements ChangeDispatcher, EventDispatcher { - callAction(elementIndex: number, actionExpression: string, action: Object): any; - changeDetector: ChangeDetector; - componentChildViews: List; - - /** - * The context against which data-binding expressions in this view are evaluated against. - * This is always a component instance. - */ - context: any; - dispatchEvent(elementIndex: number, eventName: string, locals: Map): boolean; - elementInjectors: List; - freeHostViews: List; - getDetectorFor(directive: DirectiveIndex): any; - getDirectiveFor(directive: DirectiveIndex): any; - hydrated(): boolean; - init(changeDetector: ChangeDetector, elementInjectors: List, rootElementInjectors: List, preBuiltObjects: List, componentChildViews: List): any; - - /** - * Variables, local to this view, that can be used in binding expressions (in addition to the - * context). This is used for thing like `