From 11ea763948dc641e51a13392dd98d47d5ec18fa3 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Wed, 16 Dec 2015 23:39:34 +0200 Subject: [PATCH 1/5] Update renderer to run against beta 0. --- package.json | 6 ++-- src/nativescript-angular/application.d.ts | 2 +- src/nativescript-angular/application.ts | 39 +++++++++++++++-------- src/nativescript-angular/dom_adapter.ts | 4 +-- src/nativescript-angular/renderer.ts | 18 +++++++---- src/nativescript-angular/zone.ts | 4 +-- 6 files changed, 46 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 3290dffa0..3e31560d2 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ }, "scripts": {}, "dependencies": { - "angular2": "2.0.0-alpha.46", - "@reactivex/rxjs": "5.0.0-alpha.7", + "angular2": "2.0.0-beta.0", "parse5": "1.4.2", "punycode": "1.3.2", "querystring": "0.2.0", "url": "0.10.3", "reflect-metadata": "0.1.2", - "zone.js": "0.5.8" + "rxjs": "5.0.0-beta.0", + "zone.js": "0.5.10" }, "devDependencies": { "grunt": "0.4.5", diff --git a/src/nativescript-angular/application.d.ts b/src/nativescript-angular/application.d.ts index 1ed38a435..b82b05d8e 100644 --- a/src/nativescript-angular/application.d.ts +++ b/src/nativescript-angular/application.d.ts @@ -1,4 +1,4 @@ -import { Type, ApplicationRef, Provider } from 'angular2/angular2'; +import { Type, ApplicationRef, Provider } from 'angular2/core'; export type BindingArray = Array>; export function nativeScriptBootstrap(appComponentType: any, componentInjectableBindings?: BindingArray): Promise; diff --git a/src/nativescript-angular/application.ts b/src/nativescript-angular/application.ts index ff146c9a8..717183acd 100644 --- a/src/nativescript-angular/application.ts +++ b/src/nativescript-angular/application.ts @@ -3,36 +3,49 @@ import './polyfills/array'; import './zone'; import {isPresent, Type} from 'angular2/src/facade/lang'; import {Promise, PromiseWrapper} from 'angular2/src/facade/async'; -import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader'; +import {platform, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/core'; import {bind, provide, Provider} from 'angular2/src/core/di'; -import {DOM} from 'angular2/src/core/dom/dom_adapter'; +import {DOM} from 'angular2/src/platform/dom/dom_adapter'; import {Renderer} from 'angular2/src/core/render/api'; import {NativeScriptRenderer} from './renderer'; import {NativeScriptDomAdapter} from './dom_adapter'; import {XHR} from 'angular2/src/compiler/xhr'; import {FileSystemXHR} from './xhr'; -import {Parse5DomAdapter} from 'angular2/src/core/dom/parse5_adapter'; +import {Parse5DomAdapter} from 'angular2/src/platform/server/parse5_adapter'; +import {ExceptionHandler} from 'angular2/src/facade/exception_handler'; +import {APPLICATION_COMMON_PROVIDERS} from 'angular2/src/core/application_common_providers'; +import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler'; +import {PLATFORM_COMMON_PROVIDERS} from 'angular2/src/core/platform_common_providers'; +import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common"; -import {bootstrap as angularBootstrap} from 'angular2/src/core/application'; -import {commonBootstrap} from 'angular2/src/core/application_common'; +import {bootstrap as angularBootstrap} from 'angular2/bootstrap'; - -export type BindingArray = Array; +export type ProviderArray = Array; export function nativeScriptBootstrap(appComponentType: any, - componentInjectableBindings: BindingArray = null): Promise { + customProviders: ProviderArray = null): Promise { NativeScriptDomAdapter.makeCurrent(); - let nativeScriptBindings: BindingArray = [ + let nativeScriptProviders: ProviderArray = [ NativeScriptRenderer, provide(Renderer, {useClass: NativeScriptRenderer}), provide(XHR, {useClass: FileSystemXHR}), + provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(DOM, true), deps: []}), + + provide(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}), + provide(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}), + + APPLICATION_COMMON_PROVIDERS, + COMPILER_PROVIDERS, + PLATFORM_COMMON_PROVIDERS, + FORM_PROVIDERS, ]; - var bindings = [nativeScriptBindings]; - if (isPresent(componentInjectableBindings)) { - bindings.push(componentInjectableBindings); + + var appProviders = []; + if (isPresent(customProviders)) { + appProviders.push(customProviders); } - return angularBootstrap(appComponentType, bindings) + return platform(nativeScriptProviders).application(appProviders).bootstrap(appComponentType); } diff --git a/src/nativescript-angular/dom_adapter.ts b/src/nativescript-angular/dom_adapter.ts index d5c573676..de416d7ce 100644 --- a/src/nativescript-angular/dom_adapter.ts +++ b/src/nativescript-angular/dom_adapter.ts @@ -1,5 +1,5 @@ -import {Parse5DomAdapter} from 'angular2/src/core/dom/parse5_adapter'; -import {setRootDomAdapter} from 'angular2/src/core/dom/dom_adapter'; +import {Parse5DomAdapter} from 'angular2/src/platform/server/parse5_adapter'; +import {setRootDomAdapter} from 'angular2/src/platform/dom/dom_adapter'; import {Type} from 'angular2/src/facade/lang'; export class NativeScriptDomAdapter extends Parse5DomAdapter { diff --git a/src/nativescript-angular/renderer.ts b/src/nativescript-angular/renderer.ts index 389be15b5..27527fbe5 100644 --- a/src/nativescript-angular/renderer.ts +++ b/src/nativescript-angular/renderer.ts @@ -1,6 +1,5 @@ import {Inject, Injectable} from 'angular2/src/core/di'; import {RenderComponentTemplate} from 'angular2/src/core/render/api'; -import {DOCUMENT} from 'angular2/src/core/render/dom/dom_tokens'; import {createRenderView, NodeFactory} from 'angular2/src/core/render/view_factory'; import { Renderer, @@ -18,19 +17,16 @@ import { DefaultRenderView, DefaultRenderFragmentRef } from 'angular2/src/core/render/view'; -import {DOM} from 'angular2/src/core/dom/dom_adapter'; +import {DOM} from 'angular2/src/platform/dom/dom_adapter'; import {ViewNode, DummyViewNode} from './view_node'; //var console = {log: function(msg) {}} @Injectable() export class NativeScriptRenderer extends Renderer implements NodeFactory { - private _document; - - constructor(@Inject(DOCUMENT) document) { + constructor() { super(); console.log('NativeScriptRenderer created'); - this._document = document; } public createProtoView(componentTemplateId: string, cmds: RenderTemplateCmd[]): RenderProtoViewRef { @@ -153,6 +149,16 @@ export class NativeScriptRenderer extends Renderer implements NodeFactory placeholders. + */ + setBindingDebugInfo(location: RenderElementRef, propertyName: string, propertyValue: string): void { + let node = resolveBoundNode(location); + console.log('NativeScriptRenderer.setBindingDebugInfo: ' + node.viewName + ', ' + propertyName + ' = ' + propertyValue); + } + + getNativeElementSync(location: RenderElementRef): any { console.log("NativeScriptRenderer.getNativeElementSync"); diff --git a/src/nativescript-angular/zone.ts b/src/nativescript-angular/zone.ts index e68a600c1..ea05f8bfe 100644 --- a/src/nativescript-angular/zone.ts +++ b/src/nativescript-angular/zone.ts @@ -4,7 +4,7 @@ import NativeScriptPatch from "./zone_patch" var core = require('zone.js/lib/core.js'); -var zone = global.zone = new core.Zone() -console.log('Created zone.'); +global.Zone = core.Zone; +global.zone = new core.Zone(); NativeScriptPatch.apply(); From 7fb794deaf22df521fe2c04afe8912b35988c045 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Wed, 16 Dec 2015 23:39:40 +0200 Subject: [PATCH 2/5] Angular beta 0 --- deps/angular | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/angular b/deps/angular index 3de60a412..c97552d37 160000 --- a/deps/angular +++ b/deps/angular @@ -1 +1 @@ -Subproject commit 3de60a4120371dd232c2d9089d7363bd16c3aa51 +Subproject commit c97552d3794b6317c14e6d568bc0b7e2eae0a6d5 From cad44041d5701f7269b84344703781321b55a8ca Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Wed, 16 Dec 2015 23:39:58 +0200 Subject: [PATCH 3/5] Update ng-sample for Angular beta 0 --- ng-sample/app/benchmark.ts | 10 ++--- ng-sample/app/renderer-test.ts | 16 ++++---- ng-sample/package.json | 8 ++-- ng-sample/tsconfig.json | 74 +++++++++++++++++----------------- 4 files changed, 53 insertions(+), 55 deletions(-) diff --git a/ng-sample/app/benchmark.ts b/ng-sample/app/benchmark.ts index 9928acad3..d6703e219 100644 --- a/ng-sample/app/benchmark.ts +++ b/ng-sample/app/benchmark.ts @@ -1,20 +1,20 @@ import {StackLayout} from 'ui/layouts/stack-layout'; import {Button} from 'ui/button'; import {Label} from 'ui/label'; -import {Inject, Component, View, NgIf, NgFor} from 'angular2/angular2'; +import {Inject, Component, View} from 'angular2/core'; import {ApplicationRef} from 'angular2/src/core/application_ref'; import * as profiling from './profiling'; @Component({selector: 'tree', inputs: ['data']}) @View({ - directives: [TreeComponent, NgIf], + directives: [TreeComponent], template: ` - + - + @@ -28,7 +28,7 @@ class TreeComponent { selector: 'benchmark', }) @View({ - directives: [NgIf, NgFor, TreeComponent], + directives: [TreeComponent], template: ` diff --git a/ng-sample/app/renderer-test.ts b/ng-sample/app/renderer-test.ts index 59b72f6bd..b02729d32 100644 --- a/ng-sample/app/renderer-test.ts +++ b/ng-sample/app/renderer-test.ts @@ -1,4 +1,4 @@ -import {Inject, Component, View, NgIf, NgFor} from 'angular2/angular2'; +import {Inject, Component, View} from 'angular2/core'; @Component({ selector: 'templated-component', @@ -8,10 +8,8 @@ export class TemplatedComponent { } @Component({ - selector: 'renderer-test' -}) -@View({ - directives: [NgIf, NgFor, TemplatedComponent], + selector: 'renderer-test', + directives: [TemplatedComponent], template: ` @@ -23,10 +21,10 @@ export class TemplatedComponent { - + - - + + @@ -56,7 +54,7 @@ export class RendererTest { this.moreDetailsText = 'More details:'; this.detailLines = [ - "ng-for inside a ng-if", + "ngFor inside a ngIf", "Street address", "Country, city", ]; diff --git a/ng-sample/package.json b/ng-sample/package.json index 5c4b74eb3..a81a7bb42 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -23,13 +23,13 @@ }, "homepage": "https://github.com/NativeScript/template-hello-world", "dependencies": { - "@reactivex/rxjs": "5.0.0-alpha.7", "parse5": "1.4.2", "punycode": "1.3.2", "querystring": "0.2.0", "url": "0.10.3", "reflect-metadata": "0.1.2", - "zone.js": "0.5.8" + "rxjs": "5.0.0-beta.0", + "zone.js": "0.5.10" }, "devDependencies": { "grunt": "0.4.5", @@ -39,13 +39,13 @@ "grunt-ts": "5.0.0-beta.5", "nativescript-dev-typescript": "^0.2.2", "shelljs": "^0.5.3", - "typescript": "^1.7.3", + "typescript": "^1.7.5", "webpack": "^1.12.9" }, "nativescript": { "id": "org.nativescript.ngsample", "tns-android": { - "version": "1.5.0" + "version": "1.5.1" } } } \ No newline at end of file diff --git a/ng-sample/tsconfig.json b/ng-sample/tsconfig.json index c915c45be..f3b8d24ad 100644 --- a/ng-sample/tsconfig.json +++ b/ng-sample/tsconfig.json @@ -1,39 +1,39 @@ { - "compilerOptions": { - "outDir": "app", - "rootDir": "app", - "module": "commonjs", - "target": "es5", - "inlineSourceMap": true, - "experimentalDecorators": true, - "removeComments": false, - "emitDecoratorMetadata": true, - "noEmitOnError": true - }, - "files": [ - "app/app.ts", - "app/benchmark.ts", - "app/global.d.ts", - "app/main-page.ts", - "app/main-view-model.ts", - "app/nativescript-angular/application.d.ts", - "app/nativescript-angular/application.ts", - "app/nativescript-angular/dom_adapter.ts", - "app/nativescript-angular/element-registry.d.ts", - "app/nativescript-angular/element-registry.ts", - "app/nativescript-angular/polyfills/array.ts", - "app/nativescript-angular/renderer.ts", - "app/nativescript-angular/view_node.ts", - "app/nativescript-angular/xhr.ts", - "app/nativescript-angular/zone.ts", - "app/nativescript-angular/zone_patch.ts", - "app/profiling.ts", - "app/renderer-test.ts", - "app/starter.ts", - "node_modules/tns-core-modules/tns-core-modules.d.ts" - ], - "filesGlob": [ - "node_modules/tns-core-modules/tns-core-modules.d.ts", - "app/**/*.ts" - ] + "compilerOptions": { + "outDir": "app", + "rootDir": "app", + "module": "commonjs", + "target": "es5", + "inlineSourceMap": true, + "experimentalDecorators": true, + "removeComments": false, + "emitDecoratorMetadata": true, + "noEmitOnError": true + }, + "files": [ + "app/app.ts", + "app/benchmark.ts", + "app/global.d.ts", + "app/main-page.ts", + "app/main-view-model.ts", + "app/nativescript-angular/application.d.ts", + "app/nativescript-angular/application.ts", + "app/nativescript-angular/dom_adapter.ts", + "app/nativescript-angular/element-registry.d.ts", + "app/nativescript-angular/element-registry.ts", + "app/nativescript-angular/polyfills/array.ts", + "app/nativescript-angular/renderer.ts", + "app/nativescript-angular/view_node.ts", + "app/nativescript-angular/xhr.ts", + "app/nativescript-angular/zone.ts", + "app/nativescript-angular/zone_patch.ts", + "app/profiling.ts", + "app/renderer-test.ts", + "app/starter.ts", + "node_modules/tns-core-modules/tns-core-modules.d.ts" + ], + "filesGlob": [ + "node_modules/tns-core-modules/tns-core-modules.d.ts", + "app/**/*.ts" + ] } \ No newline at end of file From 084214e8c96936be75eeceba932a3632faa04dac Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Thu, 17 Dec 2015 09:57:33 +0200 Subject: [PATCH 4/5] ng-sample package.json reformat --- ng-sample/package.json | 100 ++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/ng-sample/package.json b/ng-sample/package.json index a81a7bb42..658ebd390 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -1,51 +1,51 @@ { - "name": "tns-template-hello-world", - "main": "app.js", - "version": "1.1.0", - "author": "Telerik ", - "description": "Nativescript hello-world project template", - "license": "BSD", - "keywords": [ - "telerik", - "mobile", - "nativescript", - "{N}", - "tns", - "appbuilder", - "template" - ], - "repository": { - "type": "git", - "url": "git://github.com/NativeScript/template-hello-world.git" - }, - "bugs": { - "url": "https://github.com/NativeScript/template-hello-world/issues" - }, - "homepage": "https://github.com/NativeScript/template-hello-world", - "dependencies": { - "parse5": "1.4.2", - "punycode": "1.3.2", - "querystring": "0.2.0", - "url": "0.10.3", - "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.0", - "zone.js": "0.5.10" - }, - "devDependencies": { - "grunt": "0.4.5", - "grunt-contrib-clean": "0.6.0", - "grunt-contrib-copy": "0.8.0", - "grunt-shell": "1.1.2", - "grunt-ts": "5.0.0-beta.5", - "nativescript-dev-typescript": "^0.2.2", - "shelljs": "^0.5.3", - "typescript": "^1.7.5", - "webpack": "^1.12.9" - }, - "nativescript": { - "id": "org.nativescript.ngsample", - "tns-android": { - "version": "1.5.1" - } - } -} \ No newline at end of file + "name": "tns-template-hello-world", + "main": "app.js", + "version": "1.1.0", + "author": "Telerik ", + "description": "Nativescript hello-world project template", + "license": "BSD", + "keywords": [ + "telerik", + "mobile", + "nativescript", + "{N}", + "tns", + "appbuilder", + "template" + ], + "repository": { + "type": "git", + "url": "git://github.com/NativeScript/template-hello-world.git" + }, + "bugs": { + "url": "https://github.com/NativeScript/template-hello-world/issues" + }, + "homepage": "https://github.com/NativeScript/template-hello-world", + "dependencies": { + "parse5": "1.4.2", + "punycode": "1.3.2", + "querystring": "0.2.0", + "url": "0.10.3", + "reflect-metadata": "0.1.2", + "rxjs": "5.0.0-beta.0", + "zone.js": "0.5.10" + }, + "devDependencies": { + "grunt": "0.4.5", + "grunt-contrib-clean": "0.6.0", + "grunt-contrib-copy": "0.8.0", + "grunt-shell": "1.1.2", + "grunt-ts": "5.0.0-beta.5", + "nativescript-dev-typescript": "^0.2.2", + "shelljs": "^0.5.3", + "typescript": "^1.7.5", + "webpack": "^1.12.9" + }, + "nativescript": { + "id": "org.nativescript.ngsample", + "tns-android": { + "version": "1.5.1" + } + } +} From 9310c0eb9907fabfb329b4aa354e4e629265e441 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Thu, 17 Dec 2015 10:34:51 +0200 Subject: [PATCH 5/5] Bump version to 0.0.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e31560d2..4b8e24a6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "0.0.17", + "version": "0.0.18", "description": "", "homepage": "http://www.telerik.com", "bugs": "http://www.telerik.com",