diff --git a/.gitignore b/.gitignore index 9b379bf23..bb8bf9beb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,16 @@ tags /hooks -nativescript-angular/**/*.d.ts -!nativescript-angular/global.d.ts -nativescript-angular/**/*.js -!nativescript-angular/postinstall.js -!nativescript-angular/hooks/**/*.js -!nativescript-angular/gulpfile.js +/nativescript-angular/**/*.d.ts +/nativescript-angular/**/*.js + +!/nativescript-angular/global.d.ts +!/nativescript-angular/postinstall.js +!/nativescript-angular/hooks/**/*.js +!/nativescript-angular/gulpfile.js +!/nativescript-angular/rollup.config.js +!/nativescript-angular/rollup-entry.js +!/nativescript-angular/zone-js/**/*.js .tscache .nvm diff --git a/nativescript-angular/animation-player.ts b/nativescript-angular/animation-player.ts index 5fec24bb0..a11b06d1d 100644 --- a/nativescript-angular/animation-player.ts +++ b/nativescript-angular/animation-player.ts @@ -10,7 +10,7 @@ import { View } from "ui/core/view"; import { AnimationCurve } from "ui/enums"; import { ValueSource } from "ui/core/dependency-observable"; import { isString } from "utils/types"; -import * as styleProperty from "ui/styling/style-property"; +import { getPropertyByCssName, KeyValuePair, Property } from "ui/styling/style-property"; export class NativeScriptAnimationPlayer implements AnimationPlayer { @@ -60,7 +60,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer { for (let style of keyframe.styles.styles) { for (let substyle in style) { let value = style[substyle]; - let property = styleProperty.getPropertyByCssName(substyle); + let property = getPropertyByCssName(substyle); if (property) { if (typeof value === "string" && property.valueConverter) { value = property.valueConverter(value); @@ -218,7 +218,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer { static parseTransform(value: string, animationInfo: KeyframeInfo) { let newTransform = NativeScriptAnimationPlayer.transformConverter(value); - let array = new Array>(); + let array = new Array>(); let values = undefined; for (let transform in newTransform) { switch (transform) { diff --git a/nativescript-angular/common/detached-loader.ts b/nativescript-angular/common/detached-loader.ts index 960a6001f..43a01afc1 100644 --- a/nativescript-angular/common/detached-loader.ts +++ b/nativescript-angular/common/detached-loader.ts @@ -2,11 +2,11 @@ import { ComponentRef, ComponentFactory, ViewContainerRef, Component, Type, ComponentFactoryResolver, ChangeDetectorRef } from "@angular/core"; -import * as trace from "trace"; +import { write } from "trace"; export const CATEGORY = "detached-loader"; function log(message: string) { - trace.write(message, CATEGORY); + write(message, CATEGORY); } diff --git a/nativescript-angular/directives/tab-view.ts b/nativescript-angular/directives/tab-view.ts index 13b7fcdc6..2905bd62b 100644 --- a/nativescript-angular/directives/tab-view.ts +++ b/nativescript-angular/directives/tab-view.ts @@ -1,6 +1,6 @@ import { ElementRef, Directive, Input, TemplateRef, ViewContainerRef, OnInit, AfterViewInit } from "@angular/core"; import { TabView, TabViewItem } from "ui/tab-view"; -import * as utils from "../common/utils"; +import { convertToInt } from "../common/utils"; import { rendererLog } from "../trace"; import { isBlank } from "../lang-facade"; @@ -18,7 +18,7 @@ export class TabViewDirective implements AfterViewInit { } set selectedIndex(value) { - this._selectedIndex = utils.convertToInt(value); + this._selectedIndex = convertToInt(value); if (this.viewInitialized) { this.tabView.selectedIndex = this._selectedIndex; } diff --git a/nativescript-angular/global.d.ts b/nativescript-angular/global.d.ts index 6954b2e13..272a94033 100644 --- a/nativescript-angular/global.d.ts +++ b/nativescript-angular/global.d.ts @@ -1 +1 @@ -/// +/// diff --git a/nativescript-angular/http.ts b/nativescript-angular/http.ts index ac5d8631a..2780a6fb3 100644 --- a/nativescript-angular/http.ts +++ b/nativescript-angular/http.ts @@ -7,6 +7,8 @@ import { NSFileSystem } from "./file-system/ns-file-system"; import { NgModule } from "@angular/core"; import { HttpModule, XSRFStrategy } from "@angular/http"; +export { NSHttp } from "./http/ns-http"; + export function nsHttpFactory(backend, options, nsFileSystem) { return new NSHttp(backend, options, nsFileSystem); }; diff --git a/nativescript-angular/index.ts b/nativescript-angular/index.ts index e146bd674..36809fd2e 100644 --- a/nativescript-angular/index.ts +++ b/nativescript-angular/index.ts @@ -1,3 +1,6 @@ +import "application"; + +export * from "./platform-common"; export * from "./platform"; export * from "./platform-static"; export * from "./router"; @@ -5,3 +8,12 @@ export * from "./forms"; export * from "./http"; export * from "./directives"; export * from "./common/detached-loader"; +export * from "./trace"; +export * from "./platform-providers"; +export * from "./file-system/ns-file-system"; +export * from "./modal-dialog"; +export * from "./renderer"; +export * from "./view-util"; +export * from "./animation-driver"; +export * from "./resource-loader"; +export * from "./element-registry"; diff --git a/nativescript-angular/initial-imports.js b/nativescript-angular/initial-imports.js new file mode 100644 index 000000000..86fe0ea08 --- /dev/null +++ b/nativescript-angular/initial-imports.js @@ -0,0 +1,2 @@ +// always import application at first place in order to fix some cycle dependency hell in ios. +import "application"; diff --git a/nativescript-angular/nativescript.module.ts b/nativescript-angular/nativescript.module.ts index 4ce3523e2..6c84cafaa 100644 --- a/nativescript-angular/nativescript.module.ts +++ b/nativescript-angular/nativescript.module.ts @@ -1,5 +1,5 @@ import "globals"; -import "./zone.js/dist/zone-nativescript"; +import "./zone-js/dist/zone-nativescript"; import "reflect-metadata"; import "./polyfills/array"; diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 31cdcb8ef..ba7466b1c 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -2,6 +2,9 @@ "private": true, "name": "nativescript-angular", "version": "1.3.0", + "main": "bundle.all.js", + "module": "index.js", + "typings": "index.d.ts", "description": "An Angular 2 renderer that lets you build mobile apps with NativeScript.", "homepage": "http://www.telerik.com", "bugs": "http://www.telerik.com", @@ -18,10 +21,10 @@ "postinstall": "node postinstall.js", "ngc": "ngc -p tsconfig.json", "tsc": "tsc -p tsconfig.json", - "prepublish": "npm run tsc && npm run ngc" + "prepublish": "npm run tsc && rollup -c && npm run ngc" }, "dependencies": { - "nativescript-intl": "~0.0.4", + "nativescript-intl": "~0.0.5", "@angular/core": "~2.2.1", "@angular/common": "~2.2.1", "@angular/compiler": "~2.2.1", @@ -35,15 +38,18 @@ "parse5": "1.3.2", "punycode": "1.3.2", "querystring": "0.2.0", + "rxjs": "5.0.0-beta.12", "url": "0.10.3" }, "devDependencies": { - "@angular/compiler-cli": "~2.2.1", - "codelyzer": "^2.0.0-beta.1", - "tns-core-modules": ">=2.4.0 || >=2.4.0-2016", - "tslint": "~4.0.1", + "tns-core-modules": ">=2.5.0 || >=2.5.0-2016", + "zone.js": "^0.6.21", "typescript": "^2.0.2", - "zone.js": "^0.6.21" + "tslint": "~4.0.1", + "codelyzer": "^2.0.0-beta.1", + "@angular/compiler-cli": "~2.2.1", + "rollup": "^0.36.3", + "rollup-plugin-multi-entry": "^2.0.1" }, "nativescript": {} } diff --git a/nativescript-angular/platform-common.ts b/nativescript-angular/platform-common.ts index a1ebaaa48..9837d25b6 100644 --- a/nativescript-angular/platform-common.ts +++ b/nativescript-angular/platform-common.ts @@ -1,6 +1,6 @@ // Initial imports and polyfills import "globals"; -import "./zone.js/dist/zone-nativescript"; +import "./zone-js/dist/zone-nativescript"; import "reflect-metadata"; import "./polyfills/array"; import "./polyfills/console"; @@ -28,7 +28,7 @@ if (global.___TS_UNUSED) { import { rendererLog, rendererError } from "./trace"; import { PAGE_FACTORY, PageFactory, defaultPageFactoryProvider } from "./platform-providers"; -import * as application from "application"; +import { start, setCssFileName } from "application"; import { topmost, NavigationEntry } from "ui/frame"; import { Page } from "ui/page"; import { TextView } from "ui/text-view"; @@ -91,12 +91,11 @@ export class NativeScriptPlatformRef extends PlatformRef { const mainPageEntry = this.createNavigationEntry(this._bootstrapper); if (this.appOptions && typeof this.appOptions.cssFile === "string") { - // TODO: All exported filed in ES6 modules should be read-only + // TODO: All exported fields in ES6 modules should be read-only // Change the case when tns-core-modules become ES6 compatible and there is a legal way to set cssFile - (application).cssFile = this.appOptions.cssFile; + setCssFileName(this.appOptions.cssFile); } - - application.start(mainPageEntry); + start(mainPageEntry); } livesyncModule(): void { diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index 9ea14b074..cffe83904 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -1,28 +1,21 @@ import { Inject, Injectable, Optional, NgZone, - Renderer, RootRenderer, RenderComponentType, + Renderer, RootRenderer, RenderComponentType, AnimationPlayer } from "@angular/core"; -import { AnimationPlayer } from "@angular/core"; import { AnimationStyles, AnimationKeyframe } from "./private_import_core"; import { APP_ROOT_VIEW, DEVICE } from "./platform-providers"; import { isBlank } from "./lang-facade"; import { View } from "ui/core/view"; -import * as application from "application"; +import { addCss } from "application"; import { topmost } from "ui/frame"; import { Page } from "ui/page"; -import { ViewUtil, NgView } from "./view-util"; +import { ViewUtil } from "./view-util"; +import { NgView } from "./element-registry"; import { rendererLog as traceLog } from "./trace"; import { escapeRegexSymbols } from "utils/utils"; import { Device } from "platform"; -import * as nsAnimationDriver from "./animation-driver"; -let nsAnimationDriverModule: typeof nsAnimationDriver; - -function ensureAnimationDriverModule() { - if (!nsAnimationDriverModule) { - nsAnimationDriverModule = require("./animation-driver"); - } -} +import { NativeScriptAnimationDriver } from "./animation-driver"; // CONTENT_ATTR not exported from dom_renderer - we need it for styles application. export const COMPONENT_VARIABLE = "%COMP%"; @@ -32,12 +25,11 @@ export const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; @Injectable() export class NativeScriptRootRenderer implements RootRenderer { private _viewUtil: ViewUtil; - private _animationDriver: nsAnimationDriver.NativeScriptAnimationDriver; + private _animationDriver: NativeScriptAnimationDriver; - protected get animationDriver(): nsAnimationDriver.NativeScriptAnimationDriver { + protected get animationDriver(): NativeScriptAnimationDriver { if (!this._animationDriver) { - ensureAnimationDriverModule(); - this._animationDriver = new nsAnimationDriverModule.NativeScriptAnimationDriver(); + this._animationDriver = new NativeScriptAnimationDriver(); } return this._animationDriver; } @@ -89,18 +81,18 @@ export class NativeScriptRenderer extends Renderer { constructor( private rootRenderer: NativeScriptRootRenderer, - componentProto: RenderComponentType, - private animationDriver: nsAnimationDriver.NativeScriptAnimationDriver, + private componentProto: RenderComponentType, + private animationDriver: NativeScriptAnimationDriver, private zone: NgZone) { super(); - let stylesLength = componentProto.styles.length; - this.componentProtoId = componentProto.id; + let stylesLength = this.componentProto.styles.length; + this.componentProtoId = this.componentProto.id; for (let i = 0; i < stylesLength; i++) { this.hasComponentStyles = true; - let cssString = componentProto.styles[i] + ""; + let cssString = this.componentProto.styles[i] + ""; const realCSS = this.replaceNgAttribute(cssString, this.componentProtoId); - application.addCss(realCSS); + addCss(realCSS); } traceLog("NativeScriptRenderer created"); } diff --git a/nativescript-angular/rollup-entry.js b/nativescript-angular/rollup-entry.js new file mode 100644 index 000000000..41c3effec --- /dev/null +++ b/nativescript-angular/rollup-entry.js @@ -0,0 +1,12 @@ +export * from "./index"; +export * from "./lang-facade"; +export * from "./collection-facade"; +export * from "./router-url-tree"; +export * from "./router/ns-platform-location"; +export * from "./router/ns-router-link-active"; +export * from "./router/ns-router-link"; +export * from "./router/page-router-outlet"; +export * from "./router/router-extensions"; +export * from "./parse5_adapter"; +export * from "./private_import_core"; +export * from "./private_import_platform-browser"; diff --git a/nativescript-angular/rollup.config.js b/nativescript-angular/rollup.config.js new file mode 100644 index 000000000..4173c1348 --- /dev/null +++ b/nativescript-angular/rollup.config.js @@ -0,0 +1,22 @@ +class DebugInfoRoll { + constructor(options){ + this.options = options; + } + resolveId(id, from){ + console.log(id, from); + } +} + +const debugInfoRoll = (config) => new DebugInfoRoll(config); + +export default { + entry: "rollup-entry.js", + dest: "bundle.all.js", + format: "cjs", + sourceMap: "inline", + external: ["@angular"], + treeshake: false, + plugins: [ + //debugInfoRoll(), + ] +} diff --git a/nativescript-angular/router.ts b/nativescript-angular/router.ts index 8be260fb1..93363fb45 100644 --- a/nativescript-angular/router.ts +++ b/nativescript-angular/router.ts @@ -4,15 +4,17 @@ import { LocationStrategy, PlatformLocation } from "@angular/common"; import { NSRouterLink } from "./router/ns-router-link"; import { NSRouterLinkActive } from "./router/ns-router-link-active"; import { PageRouterOutlet } from "./router/page-router-outlet"; -import { NSLocationStrategy } from "./router/ns-location-strategy"; +import { NSLocationStrategy, LocationState } from "./router/ns-location-strategy"; import { NativescriptPlatformLocation } from "./router/ns-platform-location"; import { RouterExtensions } from "./router/router-extensions"; -export { routerTraceCategory } from "./trace"; -export { PageRoute } from "./router/page-router-outlet"; -export { RouterExtensions } from "./router/router-extensions"; import { NativeScriptModule } from "./nativescript.module"; import { NsModuleFactoryLoader } from "./router/ns-module-factory-loader"; +export { PageRoute } from "./router/page-router-outlet"; +export { RouterExtensions } from "./router/router-extensions"; +export { NSLocationStrategy } from "./router/ns-location-strategy"; +export type LocationState = LocationState; + @NgModule({ declarations: [ NSRouterLink, diff --git a/nativescript-angular/tsconfig.json b/nativescript-angular/tsconfig.json index 0515ad379..255cb974d 100644 --- a/nativescript-angular/tsconfig.json +++ b/nativescript-angular/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { - "target": "es5", - "module": "commonjs", + "target": "es6", + "module": "es6", + "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, diff --git a/nativescript-angular/value-accessors/selectedIndex-value-accessor.ts b/nativescript-angular/value-accessors/selectedIndex-value-accessor.ts index 0987af402..f8da13979 100644 --- a/nativescript-angular/value-accessors/selectedIndex-value-accessor.ts +++ b/nativescript-angular/value-accessors/selectedIndex-value-accessor.ts @@ -2,7 +2,7 @@ import { Directive, ElementRef, forwardRef, AfterViewInit, HostListener } from " import { NG_VALUE_ACCESSOR } from "@angular/forms"; import { BaseValueAccessor } from "./base-value-accessor"; import { View } from "ui/core/view"; -import * as utils from "../common/utils"; +import { convertToInt } from "../common/utils"; const SELECTED_INDEX_VALUE_ACCESSOR = {provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SelectedIndexValueAccessor), multi: true}; @@ -38,7 +38,7 @@ export class SelectedIndexValueAccessor extends BaseValueAccessor void; diff --git a/nativescript-angular/zone.js/dist/zone-nativescript.js b/nativescript-angular/zone-js/dist/zone-nativescript.js similarity index 100% rename from nativescript-angular/zone.js/dist/zone-nativescript.js rename to nativescript-angular/zone-js/dist/zone-nativescript.js diff --git a/ng-sample/app/app.ts b/ng-sample/app/app.ts index 85017eb3f..9ebba8f55 100644 --- a/ng-sample/app/app.ts +++ b/ng-sample/app/app.ts @@ -3,32 +3,39 @@ //global.registerModule("./main-page", function () { return require("./main-page"); }); //import * as profiling from "./profiling"; -//profiling.start('application-start'); +//profiling.start("application-start"); // "nativescript-angular/application" import should be first in order to load some required settings (like globals and reflect-metadata) -import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform"; -import { onAfterLivesync, onBeforeLivesync } from "nativescript-angular/platform-common"; +import { + NativeScriptModule, + platformNativeScriptDynamic, + NativeScriptRouterModule, + NativeScriptFormsModule, + NativeScriptHttpModule, + routerTraceCategory, + rendererTraceCategory, + listViewTraceCategory, + PAGE_FACTORY, + PageFactory, + PageFactoryOptions, + onAfterLivesync, + onBeforeLivesync +} from "nativescript-angular"; import { NgModule } from "@angular/core"; import { Router } from "@angular/router"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; -import { NativeScriptFormsModule } from "nativescript-angular/forms"; -import { NativeScriptHttpModule } from "nativescript-angular/http"; -import { rendererTraceCategory, routerTraceCategory, listViewTraceCategory } from "nativescript-angular/trace"; -import { PAGE_FACTORY, PageFactory, PageFactoryOptions } from "nativescript-angular/platform-providers"; import { Page } from "ui/page"; import { Color } from "color"; - -import trace = require("trace"); -trace.setCategories(rendererTraceCategory); -// trace.setCategories(routerTraceCategory); -// trace.setCategories(listViewTraceCategory); -trace.enable(); - -import { RendererTest } from './examples/renderer-test'; -import { TabViewTest } from './examples/tab-view/tab-view-test'; -import { Benchmark } from './performance/benchmark'; -import { ListTest } from './examples/list/list-test'; -import { ListTemplateSelectorTest } from './examples/list/template-selector'; +import { setCategories, enable } from "trace"; +// setCategories(rendererTraceCategory); +// setCategories(routerTraceCategory); +// setCategories(listViewTraceCategory); +enable(); + +import { RendererTest } from "./examples/renderer-test"; +import { TabViewTest } from "./examples/tab-view/tab-view-test"; +import { Benchmark } from "./performance/benchmark"; +import { ListTest } from "./examples/list/list-test"; +import { ListTemplateSelectorTest } from "./examples/list/template-selector"; import { ListTestAsync, ListTestFilterAsync } from "./examples/list/list-test-async"; import { ImageTest } from "./examples/image/image-test"; import { HttpTest } from "./examples/http/http-test"; @@ -139,24 +146,24 @@ platformNativeScriptDynamic().bootstrapModule(makeExampleModule(RendererTest)); // platformNativeScriptDynamic().bootstrapModule(makeExampleModule(AnimationEnterLeaveTest)); //Livesync test -var cachedUrl: string; -onBeforeLivesync.subscribe((moduleRef) => { - console.log("------- onBeforeLivesync"); - if (moduleRef) { - const router = moduleRef.injector.get(Router); - cachedUrl = router.url; - console.log("------- Caching URL: " + cachedUrl); - } -}); - -onAfterLivesync.subscribe((moduleRef) => { - console.log("------- onAfterLivesync cachedUrl:"); - const router = moduleRef.injector.get(Router); - router.events.subscribe(e => console.log(e.toString())); - if (router && cachedUrl) { - setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0); - } -}); +//var cachedUrl: string; +//onBeforeLivesync.subscribe((moduleRef) => { +// console.log("------- onBeforeLivesync"); +// if (moduleRef) { +// const router = moduleRef.injector.get(Router); +// cachedUrl = router.url; +// console.log("------- Caching URL: " + cachedUrl); +// } +//}); +// +//onAfterLivesync.subscribe((moduleRef) => { +// console.log("------- onAfterLivesync cachedUrl:"); +// const router = moduleRef.injector.get(Router); +// router.events.subscribe(e => console.log(e.toString())); +// if (router && cachedUrl) { +// setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0); +// } +//}); //platformNativeScriptDynamic().bootstrapModule(makeExampleModule(LivesyncApp)); console.log("APP RESTART"); diff --git a/ng-sample/app/examples/renderer-test.ts b/ng-sample/app/examples/renderer-test.ts index 47426a7d1..640f48107 100644 --- a/ng-sample/app/examples/renderer-test.ts +++ b/ng-sample/app/examples/renderer-test.ts @@ -1,11 +1,11 @@ -import {Component, Directive, Host, ElementRef, Input} from '@angular/core'; -import {Observable} from 'data/observable'; -import {TextValueAccessor} from 'nativescript-angular/value-accessors/text-value-accessor'; -import {CheckedValueAccessor} from 'nativescript-angular/value-accessors/checked-value-accessor'; +import {Component, Directive, Host, ElementRef, Input} from "@angular/core"; +import {Observable} from "data/observable"; +import { TextValueAccessor, CheckedValueAccessor } from "nativescript-angular"; @Component({ - selector: 'templated-component', - templateUrl: 'title.html' + moduleId: module.id, + selector: "templated-component", + templateUrl: "../title.html" }) export class TemplatedComponent { @Input() public renderChild: boolean = false; @@ -13,7 +13,7 @@ export class TemplatedComponent { } @Directive({ - selector: 'Progress', + selector: "Progress", }) export class ProgressDirective { constructor(private element: ElementRef) { @@ -25,8 +25,9 @@ export class ProgressDirective { } @Component({ - selector: 'renderer-test', - templateUrl: './examples/renderer-test.html' + moduleId: module.id, + selector: "renderer-test", + templateUrl: "./renderer-test.html" }) export class RendererTest { public buttonText: string = ""; @@ -48,27 +49,27 @@ export class RendererTest { ]; constructor() { - this.buttonText = 'Save...' + this.buttonText = "Save..." this.showDetails = true; - this.detailsText = 'plain ng-if directive \ndetail 1-2-3...'; - this.moreDetailsText = 'More details:'; + this.detailsText = "plain ng-if directive \ndetail 1-2-3..."; + this.moreDetailsText = "More details:"; this.model = { - 'test': 'Jack', - 'testBoolean': false, - 'deliveryDate': new Date(), - 'deliveryTime': new Date(), - 'mydate': new Date(), - 'sliderTest': 0, - 'search': null, - 'selectedIndex': 0, - 'listPickerItems': [ + "test": "Jack", + "testBoolean": false, + "deliveryDate": new Date(), + "deliveryTime": new Date(), + "mydate": new Date(), + "sliderTest": 0, + "search": null, + "selectedIndex": 0, + "listPickerItems": [ 1,2,3,4 ], - 'segmentedBarItems': [ - {'title': 'first'}, - {'title': 'second'}, - {'title': 'third'}, - {'title': 'fourth'} + "segmentedBarItems": [ + {"title": "first"}, + {"title": "second"}, + {"title": "third"}, + {"title": "fourth"} ] }; @@ -79,7 +80,7 @@ export class RendererTest { } onSave($event, name, $el) { - console.log('onSave event ' + $event + ' name ' + name); + console.log("onSave event " + $event + " name " + name); alert(name); } @@ -88,7 +89,7 @@ export class RendererTest { } onToggleDetails() { - console.log('onToggleDetails current: ' + this.showDetails); + console.log("onToggleDetails current: " + this.showDetails); this.showDetails = !this.showDetails; } diff --git a/ng-sample/package.json b/ng-sample/package.json index 992d999b1..798e6e816 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -25,7 +25,6 @@ "dependencies": { "tns-core-modules": "2.4.0", "nativescript-angular": "file:../nativescript-angular", - "nativescript-intl": "^0.0.4", "@angular/core": "~2.2.1", "@angular/common": "~2.2.1", "@angular/compiler": "~2.2.1", @@ -51,7 +50,7 @@ "nativescript": { "id": "org.nativescript.ngsample", "tns-android": { - "version": "2.4.0" + "version": "2.4.1" }, "tns-ios": { "version": "2.4.0" diff --git a/ng-sample/tsconfig.json b/ng-sample/tsconfig.json index b9c49d59e..c4b1b54df 100644 --- a/ng-sample/tsconfig.json +++ b/ng-sample/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "module": "commonjs", + "moduleResolution": "node", "target": "es5", - "inlineSourceMap": true, "experimentalDecorators": true, "removeComments": false, "emitDecoratorMetadata": true, diff --git a/tests/app/lazy-loaded.module.ts b/tests/app/lazy-loaded.module.ts index 85caabed9..c4db97aa6 100644 --- a/tests/app/lazy-loaded.module.ts +++ b/tests/app/lazy-loaded.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; -import { NativeScriptModule } from "nativescript-angular"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { NativeScriptModule, NativeScriptRouterModule } from "nativescript-angular"; import { SecondComponent } from './second.component'; diff --git a/tests/app/main.ts b/tests/app/main.ts index c5c5535f5..06cba2489 100644 --- a/tests/app/main.ts +++ b/tests/app/main.ts @@ -1,12 +1,16 @@ -// "nativescript-angular/platform" import should be first in order to load some required settings (like globals and reflect-metadata) -import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; -import { NativeScriptFormsModule } from "nativescript-angular/forms"; +import { + NativeScriptModule, + platformNativeScriptDynamic, + rendererTraceCategory, + routerTraceCategory, + NativeScriptRouterModule, + NativeScriptFormsModule, + APP_ROOT_VIEW +} from "nativescript-angular"; import { AppComponent } from "./app.component"; import { GestureComponent } from "./snippets/gestures.component"; import { LayoutsComponent } from "./snippets/layouts.component"; import { IconFontComponent } from "./snippets/icon-font.component"; -import { APP_ROOT_VIEW } from "nativescript-angular/platform-providers"; import { Page } from "ui/page"; import { StackLayout } from "ui/layouts/stack-layout"; @@ -24,8 +28,6 @@ import { OpaqueToken, NgModule } from "@angular/core"; import { PageNavigationApp } from "./snippets/navigation/page-outlet"; import { NavigationApp } from "./snippets/navigation/router-outlet"; -import { rendererTraceCategory, routerTraceCategory } from "nativescript-angular/trace"; - import { BehaviorSubject } from "rxjs"; import trace = require("trace"); diff --git a/tests/app/snippets/navigation/config-snippets.ts b/tests/app/snippets/navigation/config-snippets.ts index 93e261ff5..63ac00939 100644 --- a/tests/app/snippets/navigation/config-snippets.ts +++ b/tests/app/snippets/navigation/config-snippets.ts @@ -13,8 +13,8 @@ export const routes = [ ]; // << router-config -// >> router-provider -import { NativeScriptRouterModule } from "nativescript-angular/router"; +// >> router-provider and bootstrap +import { NativeScriptRouterModule, platformNativeScriptDynamic } from "nativescript-angular"; @NgModule({ bootstrap: [GroceriesApp], @@ -26,8 +26,6 @@ import { NativeScriptRouterModule } from "nativescript-angular/router"; export class GroceriesAppModule {} // << router-provider -// >> router-bootstrap -import { platformNativeScriptDynamic } from "nativescript-angular/platform"; // >> (hide) function start_snippet() { // << (hide) diff --git a/tests/app/snippets/navigation/page-outlet.ts b/tests/app/snippets/navigation/page-outlet.ts index 2d9d8140d..263ac927c 100644 --- a/tests/app/snippets/navigation/page-outlet.ts +++ b/tests/app/snippets/navigation/page-outlet.ts @@ -2,9 +2,8 @@ import { TestApp, registerTestApp } from "../../tests/test-app"; import { ApplicationRef } from '@angular/core'; import { Router, NavigationStart, NavigationEnd } from "@angular/router"; // >> page-outlet-example -import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform"; +import { platformNativeScriptDynamic, NativeScriptModule, NativeScriptRouterModule } from "nativescript-angular"; import { Component, NgModule } from '@angular/core'; -import { NativeScriptRouterModule } from "nativescript-angular/router"; import { routes } from "./app.routes"; import { FirstComponent, SecondComponent } from "./navigation-common"; diff --git a/tests/app/snippets/navigation/route-params.ts b/tests/app/snippets/navigation/route-params.ts index 9a04e56a7..27fd2213e 100644 --- a/tests/app/snippets/navigation/route-params.ts +++ b/tests/app/snippets/navigation/route-params.ts @@ -11,7 +11,7 @@ class MyComponent { // >> router-params-page-route -import { PageRoute } from "nativescript-angular/router"; +import { PageRoute } from "nativescript-angular"; class MyPageComponent { id: number; constructor(private pageRoute: PageRoute) { diff --git a/tests/app/snippets/navigation/router-extensions.ts b/tests/app/snippets/navigation/router-extensions.ts index a7bfb35cd..b05db438f 100644 --- a/tests/app/snippets/navigation/router-extensions.ts +++ b/tests/app/snippets/navigation/router-extensions.ts @@ -1,5 +1,5 @@ import { Component } from "@angular/core"; -import { RouterExtensions } from 'nativescript-angular/router'; +import { RouterExtensions } from 'nativescript-angular'; @Component({ // ... diff --git a/tests/app/snippets/navigation/router-outlet.ts b/tests/app/snippets/navigation/router-outlet.ts index f1f228b10..84e3947d9 100644 --- a/tests/app/snippets/navigation/router-outlet.ts +++ b/tests/app/snippets/navigation/router-outlet.ts @@ -2,8 +2,7 @@ import {TestApp, registerTestApp} from "../../tests/test-app"; import { ApplicationRef } from '@angular/core'; // >> router-outlet-example import { Component, NgModule } from '@angular/core'; -import { platformNativeScriptDynamic } from "nativescript-angular/platform"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { platformNativeScriptDynamic, NativeScriptRouterModule } from "nativescript-angular"; import { Router, NavigationStart, NavigationEnd } from '@angular/router'; import { routes } from "./app.routes"; import {FirstComponent, SecondComponent} from "./navigation-common"; diff --git a/tests/app/tests/detached-loader-tests.ts b/tests/app/tests/detached-loader-tests.ts index a93b02449..b47da3081 100644 --- a/tests/app/tests/detached-loader-tests.ts +++ b/tests/app/tests/detached-loader-tests.ts @@ -7,7 +7,7 @@ import {Red} from "color/known-colors"; import {dumpView} from "./test-utils"; import {LayoutBase} from "ui/layouts/layout-base"; import {StackLayout} from "ui/layouts/stack-layout"; -import {DetachedLoader} from "nativescript-angular/common/detached-loader"; +import {DetachedLoader} from "nativescript-angular"; @Component({ template: `` diff --git a/tests/app/tests/http.ts b/tests/app/tests/http.ts index 0adfd9b88..30d599958 100644 --- a/tests/app/tests/http.ts +++ b/tests/app/tests/http.ts @@ -8,8 +8,7 @@ import {ReflectiveInjector} from '@angular/core'; import {BaseRequestOptions, ConnectionBackend, Http, Response, ResponseOptions} from '@angular/http'; import 'rxjs/add/operator/map'; import {MockBackend} from '@angular/http/testing'; -import {NSHttp} from "nativescript-angular/http/ns-http"; -import {NSFileSystem} from "nativescript-angular/file-system/ns-file-system"; +import { NSHttp, NSFileSystem } from "nativescript-angular"; import {NSFileSystemMock, FileResponses} from './mocks/ns-file-system.mock'; describe("Http", () => { diff --git a/tests/app/tests/modal-dialog.ts b/tests/app/tests/modal-dialog.ts index 93a35ee3e..d4049a5e0 100644 --- a/tests/app/tests/modal-dialog.ts +++ b/tests/app/tests/modal-dialog.ts @@ -4,7 +4,7 @@ import { TestApp } from "./test-app"; import { Component, ViewContainerRef } from "@angular/core"; import { Page } from "ui/page"; import { topmost } from "ui/frame"; -import { ModalDialogParams, ModalDialogService } from "nativescript-angular/directives/dialogs"; +import { ModalDialogParams, ModalDialogService } from "nativescript-angular"; import { device, platformNames } from "platform"; const CLOSE_WAIT = (device.os === platformNames.ios) ? 1000 : 0; diff --git a/tests/app/tests/ns-location-strategy.ts b/tests/app/tests/ns-location-strategy.ts index 430933106..aa5b4d6c3 100644 --- a/tests/app/tests/ns-location-strategy.ts +++ b/tests/app/tests/ns-location-strategy.ts @@ -1,6 +1,6 @@ //make sure you import mocha-config before @angular/core import {assert} from "./test-config"; -import {NSLocationStrategy, LocationState} from "nativescript-angular/router/ns-location-strategy"; +import {NSLocationStrategy, LocationState} from "nativescript-angular"; import {Frame, BackstackEntry, NavigationEntry} from "ui/frame"; import {Page} from "ui/page"; import {View} from "ui/core/view"; diff --git a/tests/app/tests/platform-filter-components.ts b/tests/app/tests/platform-filter-components.ts index ebf0d1be5..ff23f6cd8 100644 --- a/tests/app/tests/platform-filter-components.ts +++ b/tests/app/tests/platform-filter-components.ts @@ -3,7 +3,7 @@ import { assert } from "./test-config"; import { Component, ElementRef } from "@angular/core"; import { dumpView, createDevice } from "./test-utils"; import { TestApp } from "./test-app"; -import { DEVICE } from "nativescript-angular/platform-providers"; +import { DEVICE } from "nativescript-angular"; import { platformNames } from "platform"; @Component({ diff --git a/tests/app/tests/property-sets.ts b/tests/app/tests/property-sets.ts index de3364fc6..08fbda097 100644 --- a/tests/app/tests/property-sets.ts +++ b/tests/app/tests/property-sets.ts @@ -1,8 +1,7 @@ //make sure you import mocha-config before @angular/core import {assert} from "./test-config"; import {View} from "ui/core/view"; -import {ViewUtil} from "nativescript-angular/view-util"; -import {NgView, ViewExtensions, ViewClassMeta} from "nativescript-angular/element-registry"; +import {ViewUtil, NgView, ViewExtensions, ViewClassMeta} from "nativescript-angular"; import {Red} from "color/known-colors"; import {device, platformNames} from "platform"; import {createDevice} from "./test-utils"; diff --git a/tests/app/tests/renderer-tests.ts b/tests/app/tests/renderer-tests.ts index fb60eaac6..2f05ee904 100644 --- a/tests/app/tests/renderer-tests.ts +++ b/tests/app/tests/renderer-tests.ts @@ -9,7 +9,7 @@ import { LayoutBase } from "ui/layouts/layout-base"; import { StackLayout } from "ui/layouts/stack-layout"; import { ContentView } from "ui/content-view"; import { Button } from "ui/button"; -import { NgView } from "nativescript-angular/element-registry"; +import { NgView } from "nativescript-angular"; @Component({ template: `` diff --git a/tests/app/tests/style-properties.ts b/tests/app/tests/style-properties.ts index d2a526ef3..2fa731664 100644 --- a/tests/app/tests/style-properties.ts +++ b/tests/app/tests/style-properties.ts @@ -2,11 +2,9 @@ import {assert} from "./test-config"; import {TextField} from "ui/text-field"; import {Red, Lime} from "color/known-colors"; -import {NativeScriptRenderer, NativeScriptRootRenderer} from "nativescript-angular/renderer"; -import {NativeScriptAnimationDriver} from "nativescript-angular/animation-driver"; +import {NativeScriptRenderer, NativeScriptRootRenderer, NativeScriptAnimationDriver, NgView} from "nativescript-angular"; import {device} from "platform"; import { ViewEncapsulation, RenderComponentType } from "@angular/core"; -import {NgView} from "nativescript-angular/view-util"; describe("Setting style properties", () => { let renderer: NativeScriptRenderer = null; diff --git a/tests/app/tests/test-app.ts b/tests/app/tests/test-app.ts index dce7fc3b3..24671ed21 100644 --- a/tests/app/tests/test-app.ts +++ b/tests/app/tests/test-app.ts @@ -1,5 +1,4 @@ -import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; +import { NativeScriptModule, platformNativeScriptDynamic, NativeScriptRouterModule, APP_ROOT_VIEW } from "nativescript-angular"; import { Type, Component, ComponentRef, ComponentFactoryResolver, ApplicationRef, Renderer, @@ -9,7 +8,6 @@ import { import {GridLayout} from "ui/layouts/grid-layout"; import {LayoutBase} from "ui/layouts/layout-base"; import {topmost} from 'ui/frame'; -import {APP_ROOT_VIEW} from "nativescript-angular/platform-providers"; @Component({ selector: 'my-app', diff --git a/tests/app/tests/third-party.ts b/tests/app/tests/third-party.ts index f9e9aa528..8e062d795 100644 --- a/tests/app/tests/third-party.ts +++ b/tests/app/tests/third-party.ts @@ -6,7 +6,7 @@ import {View} from "ui/core/view"; import {Label} from "ui/label"; // >> third-party-simple-view-registration -import {registerElement} from "nativescript-angular/element-registry"; +import {registerElement} from "nativescript-angular"; registerElement("third-party-view", () => require("./third-party-view").SimpleTag); // << third-party-simple-view-registration diff --git a/tests/app/tests/value-accessor-tests.ts b/tests/app/tests/value-accessor-tests.ts index 6b82229eb..f737e78c7 100644 --- a/tests/app/tests/value-accessor-tests.ts +++ b/tests/app/tests/value-accessor-tests.ts @@ -7,13 +7,15 @@ import {DatePicker} from "ui/date-picker"; import {TimePicker} from "ui/time-picker"; import {ListPicker} from "ui/list-picker"; import {TextField} from "ui/text-field"; -import {NumberValueAccessor} from "nativescript-angular/value-accessors/number-value-accessor"; -import {CheckedValueAccessor} from "nativescript-angular/value-accessors/checked-value-accessor"; -import {DateValueAccessor} from "nativescript-angular/value-accessors/date-value-accessor"; -import {TimeValueAccessor} from "nativescript-angular/value-accessors/time-value-accessor"; -import {SelectedIndexValueAccessor} from "nativescript-angular/value-accessors/selectedIndex-value-accessor"; -import {TextValueAccessor} from "nativescript-angular/value-accessors/text-value-accessor"; -import {ElementRef} from '@angular/core'; +import { + NumberValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + SelectedIndexValueAccessor, + TextValueAccessor +} from "nativescript-angular"; +import { ElementRef } from '@angular/core'; class TestElementRef implements ElementRef { constructor(public nativeElement: View) {}; diff --git a/tests/app/tests/xhr-paths.ts b/tests/app/tests/xhr-paths.ts index d618c9b99..4eb0a4f81 100644 --- a/tests/app/tests/xhr-paths.ts +++ b/tests/app/tests/xhr-paths.ts @@ -1,6 +1,6 @@ //make sure you import mocha-config before @angular/core import {assert} from "./test-config"; -import {FileSystemResourceLoader} from "nativescript-angular/resource-loader"; +import {FileSystemResourceLoader} from "nativescript-angular"; describe("XHR name resolution", () => { it("resolves relative paths from app root", () => {