diff --git a/apps/cuteness.io/details-page.ts b/apps/cuteness.io/details-page.ts index 6955f1394..6f395cc00 100644 --- a/apps/cuteness.io/details-page.ts +++ b/apps/cuteness.io/details-page.ts @@ -1,4 +1,4 @@ -import {Page} from "ui"; +import {Page} from "ui/page"; import {EventData as ObservableEventData} from "data/observable"; // Event handler for Page "navigatedTo" event attached in details-page.xml diff --git a/apps/cuteness.io/main-page.ts b/apps/cuteness.io/main-page.ts index c2690badf..69ef8d9e3 100644 --- a/apps/cuteness.io/main-page.ts +++ b/apps/cuteness.io/main-page.ts @@ -1,5 +1,7 @@ import {EventData as ObservableEventData} from "data/observable"; -import {Page, ItemEventData, topmost as topmostFrame, ItemEventData as ListViewItemEventData} from "ui"; +import {Page} from "ui/page"; +import {ItemEventData as ListViewItemEventData} from "ui/list-view"; +import {topmost as topmostFrame} from "ui/frame"; import {AppViewModel} from "./reddit-app-view-model"; var appViewModel = new AppViewModel(); diff --git a/apps/perf-tests/NavigationTest/app.ts b/apps/perf-tests/NavigationTest/app.ts index 00c39550d..6112c7d4b 100644 --- a/apps/perf-tests/NavigationTest/app.ts +++ b/apps/perf-tests/NavigationTest/app.ts @@ -1,7 +1,8 @@ -import application = require("application"); -import navPageModule = require("../nav-page"); +import * as application from "application"; +import {NavPage} from "../nav-page"; +import {Page} from "ui/page"; +import * as trace from "trace"; -import trace = require("trace"); trace.enable(); trace.setCategories(trace.categories.concat( trace.categories.NativeLifecycle, @@ -11,18 +12,14 @@ trace.setCategories(trace.categories.concat( )); application.mainEntry = { - create: function () { - return new navPageModule.NavPage({ - index: 0, - backStackVisible: true, - clearHistory: false, - animated: true, - transition: 0, - curve: 0, - duration: 0, - }); - } - //backstackVisible: false, - //clearHistory: true + create: () => new NavPage({ + index: 0, + backStackVisible: true, + clearHistory: false, + animated: true, + transition: 0, + curve: 0, + duration: 0, + }) }; application.start(); diff --git a/apps/perf-tests/NavigationTest/list-picker-page.ts b/apps/perf-tests/NavigationTest/list-picker-page.ts index b30ebd183..6763f91b6 100644 --- a/apps/perf-tests/NavigationTest/list-picker-page.ts +++ b/apps/perf-tests/NavigationTest/list-picker-page.ts @@ -1,4 +1,5 @@ -import {Page, ListPicker} from "ui"; +import {Page} from "ui/page"; +import {ListPicker} from "ui/list-picker"; var closeCallback: Function; var page: Page; diff --git a/apps/perf-tests/nav-page.ts b/apps/perf-tests/nav-page.ts index 6d9e8d1a8..abb950de7 100644 --- a/apps/perf-tests/nav-page.ts +++ b/apps/perf-tests/nav-page.ts @@ -1,7 +1,17 @@ import definition = require("controls-page"); -import {View, Page, topmost as topmostFrame, NavigationTransition, Orientation, AnimationCurve, StackLayout, Button, Label, TextField, Switch, ListPicker, Slider} from "ui"; +import {View} from "ui/core/view"; +import {Page} from "ui/page"; +import {topmost as topmostFrame, NavigationTransition} from "ui/frame"; +import {Orientation, AnimationCurve} from "ui/enums"; +import {StackLayout} from "ui/layouts/stack-layout"; +import {Button} from "ui/button"; +import {Label} from "ui/label"; +import {TextField} from "ui/text-field"; +import {Switch} from "ui/switch"; +import {ListPicker} from "ui/list-picker"; +import {Slider} from "ui/slider"; import {Color} from "color"; -import platform = require("platform"); +import * as platform from "platform"; var availableTransitions = ["default", "custom", "flip", "flipRight", "flipLeft", "slide", "slideLeft", "slideRight", "slideTop", "slideBottom", "fade"]; if (platform.device.os === platform.platformNames.ios) { diff --git a/apps/tests/navigation/navigation-tests.ts b/apps/tests/navigation/navigation-tests.ts index a53c285b6..6ad351ac2 100644 --- a/apps/tests/navigation/navigation-tests.ts +++ b/apps/tests/navigation/navigation-tests.ts @@ -1,15 +1,12 @@ -import TKUnit = require("../TKUnit"); -import platform = require("platform"); -import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui"; -import color = require("color"); -import helper = require("../ui/helper"); -import utils = require("utils/utils"); -import trace = require("trace"); +import * as TKUnit from "../TKUnit"; +import {Page} from "ui/page"; +import {topmost as topmostFrame} from "ui/frame"; +import {Color} from "color"; // Creates a random colorful page full of meaningless stuff. var pageFactory = function(): Page { var page = new Page(); - page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); + page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); return page; }; @@ -112,4 +109,4 @@ export var test_ClearHistory = function () { topmostFrame().navigate({ create: mainPageFactory }); TKUnit.waitUntilReady(() => { return topmostFrame().currentPage === mainTestPage; }); -} \ No newline at end of file +} diff --git a/apps/tests/navigation/transition-tests.ts b/apps/tests/navigation/transition-tests.ts index f7e249465..229821bbd 100644 --- a/apps/tests/navigation/transition-tests.ts +++ b/apps/tests/navigation/transition-tests.ts @@ -1,11 +1,12 @@ -import TKUnit = require("../TKUnit"); -import platform = require("platform"); -import transitionModule = require("ui/transition"); -import color = require("color"); -import helper = require("../ui/helper"); -import utils = require("utils/utils"); -import trace = require("trace"); -import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui"; +import * as TKUnit from "../TKUnit"; +import * as helper from "../ui/helper"; +import * as platform from "platform"; +import * as trace from "trace"; +import {Color} from "color"; +import {GC} from "utils/utils"; +import {NavigationEntry, NavigationTransition} from "ui/frame"; +import {Page} from "ui/page"; +import {AnimationCurve} from "ui/enums" function _testTransition(navigationTransition: NavigationTransition) { var testId = `Transition[${JSON.stringify(navigationTransition)}]`; @@ -14,7 +15,7 @@ function _testTransition(navigationTransition: NavigationTransition) { create: function (): Page { var page = new Page(); page.id = testId; - page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); + page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); return page; }, animated: true, @@ -25,7 +26,7 @@ function _testTransition(navigationTransition: NavigationTransition) { TKUnit.wait(0.100); helper.goBack(); TKUnit.wait(0.100); - utils.GC(); + GC(); } // Extremely slow. Run only if needed. @@ -33,7 +34,7 @@ export var test_Transitions = function () { helper.navigate(() => { var page = new Page(); page.id = "TransitionsTestPage_MAIN" - page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); + page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); return page; }); diff --git a/apps/tests/ui/button/button-tests-native.ios.ts b/apps/tests/ui/button/button-tests-native.ios.ts index ed1e8dc45..b5b7223a8 100644 --- a/apps/tests/ui/button/button-tests-native.ios.ts +++ b/apps/tests/ui/button/button-tests-native.ios.ts @@ -27,19 +27,15 @@ export function getNativeTextAlignment(button: buttonModule.Button): string { switch (button.ios.titleLabel.textAlignment) { case NSTextAlignment.NSTextAlignmentLeft: return enums.TextAlignment.left; - break; case NSTextAlignment.NSTextAlignmentCenter: return enums.TextAlignment.center; - break; case NSTextAlignment.NSTextAlignmentRight: return enums.TextAlignment.right; - break; default: return "unexpected value"; - break; } } export function performNativeClick(button: buttonModule.Button): void { button.ios.sendActionsForControlEvents(UIControlEvents.UIControlEventTouchUpInside); -} \ No newline at end of file +} diff --git a/apps/tests/ui/label/label-tests-native.ios.ts b/apps/tests/ui/label/label-tests-native.ios.ts index c8aa0608a..1df70b684 100644 --- a/apps/tests/ui/label/label-tests-native.ios.ts +++ b/apps/tests/ui/label/label-tests-native.ios.ts @@ -7,16 +7,12 @@ export function getNativeTextAlignment(label: labelModule.Label): string { switch (label.ios.textAlignment) { case NSTextAlignment.NSTextAlignmentLeft: return enums.TextAlignment.left; - break; case NSTextAlignment.NSTextAlignmentCenter: return enums.TextAlignment.center; - break; case NSTextAlignment.NSTextAlignmentRight: return enums.TextAlignment.right; - break; default: return "unexpected value"; - break; } } diff --git a/apps/tests/ui/proxy-view-container/proxy-view-container-tests.ts b/apps/tests/ui/proxy-view-container/proxy-view-container-tests.ts index 2d7f361e4..f14f4d5b2 100644 --- a/apps/tests/ui/proxy-view-container/proxy-view-container-tests.ts +++ b/apps/tests/ui/proxy-view-container/proxy-view-container-tests.ts @@ -1,18 +1,20 @@ -import TKUnit = require("../../TKUnit"); -import helper = require("../helper"); -import viewModule = require("ui/core/view"); -import observable = require("data/observable"); -import color = require("color"); -import platform = require("platform"); - +import * as TKUnit from "../../TKUnit"; +import * as helper from "../helper"; +import {View} from "ui/core/view"; +import {Button} from "ui/button"; +import {Page} from "ui/page"; +import {ScrollView} from "ui/scroll-view"; +import {TabView, TabViewItem} from "ui/tab-view"; +import {LayoutBase} from "ui/layouts/layout-base" +import {StackLayout} from "ui/layouts/stack-layout" +import {GridLayout} from "ui/layouts/grid-layout" import {ProxyViewContainer} from "ui/proxy-view-container"; -import {View, Button, LayoutBase, StackLayout, GridLayout, Page, ScrollView, TabView, TabViewItem} from "ui"; export function test_add_children_to_attached_proxy() { var outer = new StackLayout(); var proxy = new ProxyViewContainer(); - function testAction(views: Array) { + function testAction(views: Array) { outer.addChild(createBtn("1")); outer.addChild(proxy); proxy.addChild(createBtn("2")); @@ -31,7 +33,7 @@ export function test_children_immediately_registered_in_parent_grid_layout() { var outer = new GridLayout(); var proxy = new ProxyViewContainer(); - function testAction(views: Array) { + function testAction(views: Array) { outer.addChild(proxy); proxy.addChild(createBtn("1")); @@ -45,7 +47,7 @@ export function test_children_registered_in_parent_grid_layout_on_attach() { var outer = new GridLayout(); var proxy = new ProxyViewContainer(); - function testAction(views: Array) { + function testAction(views: Array) { proxy.addChild(createBtn("1")); outer.addChild(proxy); @@ -59,7 +61,7 @@ export function test_add_children_to_detached_proxy() { var outer = new StackLayout(); var proxy = new ProxyViewContainer(); - function testAction(views: Array) { + function testAction(views: Array) { outer.addChild(createBtn("1")); proxy.addChild(createBtn("2")); @@ -88,7 +90,7 @@ export function test_remove_proxy() { outer.addChild(createBtn("5")); - function testAction(views: Array) { + function testAction(views: Array) { assertNativeChildren(outer, ["1", "2", "3", "4", "5"]); outer.removeChild(proxy); assertNativeChildren(outer, ["1", "5"]); @@ -111,7 +113,7 @@ export function test_remove_child_of_attached_proxy() { outer.addChild(createBtn("5")); - function testAction(views: Array) { + function testAction(views: Array) { assertNativeChildren(outer, ["1", "2", "3", "4", "5"]); proxy.removeChild(testBtn); assertNativeChildren(outer, ["1", "2", "4", "5"]); @@ -132,7 +134,7 @@ export function test_insert_inside_porxy() { outer.addChild(createBtn("5")); - function testAction(views: Array) { + function testAction(views: Array) { assertNativeChildren(outer, ["1", "2", "4", "5"]); proxy.insertChild(createBtn("3"), 1); assertNativeChildren(outer, ["1", "2", "3", "4", "5"]); @@ -152,7 +154,7 @@ export function test_insert_after_porxy() { proxy.addChild(createBtn("3")); proxy.addChild(createBtn("4")); - function testAction(views: Array) { + function testAction(views: Array) { assertNativeChildren(outer, ["1", "2", "3", "4"]); outer.insertChild(createBtn("5"), 2); assertNativeChildren(outer, ["1", "2", "3", "4", "5"]); @@ -170,7 +172,7 @@ export function test_proxy_does_not_stop_request_layout_bubble() { var btn = createBtn("2"); proxy.addChild(btn); - function testAction(views: Array) { + function testAction(views: Array) { assertNativeChildren(outer, ["1", "2"]); waitUntilElementLayoutIsValid(outer); TKUnit.assert(outer.isLayoutValid, "outer container isLayoutValid should be true"); @@ -185,7 +187,7 @@ export function test_proxy_iniside_page() { var proxy = new ProxyViewContainer(); proxy.addChild(createBtn("1")); - function testAction(views: Array) { + function testAction(views: Array) { var page = views[1]; waitUntilElementLayoutIsValid(page); }; @@ -200,7 +202,7 @@ export function test_proxy_iniside_scroll_view() { var proxy = new ProxyViewContainer(); proxy.addChild(createBtn("1")); - function testAction(views: Array) { + function testAction(views: Array) { var page = views[1]; waitUntilElementLayoutIsValid(page); }; @@ -215,7 +217,7 @@ export function test_proxy_iniside_border() { var proxy = new ProxyViewContainer(); proxy.addChild(createBtn("1")); - function testAction(views: Array) { + function testAction(views: Array) { var page = views[1]; waitUntilElementLayoutIsValid(page); }; @@ -233,7 +235,7 @@ export function test_proxy_iniside_border() { // items.push(new TabViewItem({ title: "tab with proxy", view: proxy })); // tab.items = items; -// function testAction(views: Array) { +// function testAction(views: Array) { // var page = views[1]; // waitUntilElementLayoutIsValid(page); // }; @@ -243,7 +245,7 @@ export function test_proxy_iniside_border() { // TODO: Proxy as a direct child to of ActionBar is not supported. Not sure if we want to support it. //export function test_proxy_iniside_actionBar() { -// function testAction(views: Array) { +// function testAction(views: Array) { // var page = views[1]; // var proxy = new ProxyViewContainer(); // proxy.addChild(createBtn("1")); diff --git a/apps/tests/ui/tab-view/tab-view-navigation-tests.ts b/apps/tests/ui/tab-view/tab-view-navigation-tests.ts index af83319f8..47ccdeb28 100644 --- a/apps/tests/ui/tab-view/tab-view-navigation-tests.ts +++ b/apps/tests/ui/tab-view/tab-view-navigation-tests.ts @@ -67,8 +67,7 @@ var _clickHandlerFactory = function (index: number) { } export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithAListViewTheListViewIsThere() { - return; - + /* var topFrame = frameModule.topmost(); var oldChache; @@ -126,6 +125,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis var listView = mainPage.getViewById("ListView"); TKUnit.assert(listView !== undefined, "ListView should be created when navigating back to the main page."); + */ } /* export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack_NoPageCaching() { @@ -224,4 +224,4 @@ function _clickTheFirstButtonInTheListViewNatively(tabView: TabView) { else { ((tabView.ios.viewControllers[0].view.subviews[0]).cellForRowAtIndexPath(NSIndexPath.indexPathForItemInSection(0, 0)).contentView.subviews[0]).sendActionsForControlEvents(UIControlEvents.UIControlEventTouchUpInside); } -} \ No newline at end of file +} diff --git a/apps/tests/ui/text-field/text-field-tests-native.ios.ts b/apps/tests/ui/text-field/text-field-tests-native.ios.ts index 8a7a765ee..e62fdceb1 100644 --- a/apps/tests/ui/text-field/text-field-tests-native.ios.ts +++ b/apps/tests/ui/text-field/text-field-tests-native.ios.ts @@ -31,16 +31,12 @@ export function getNativeTextAlignment(textField: textFieldModule.TextField): st switch (textField.ios.textAlignment) { case NSTextAlignment.NSTextAlignmentLeft: return enums.TextAlignment.left; - break; case NSTextAlignment.NSTextAlignmentCenter: return enums.TextAlignment.center; - break; case NSTextAlignment.NSTextAlignmentRight: return enums.TextAlignment.right; - break; default: return "unexpected value"; - break; } } @@ -49,4 +45,4 @@ export function typeTextNatively(textField: textFieldModule.TextField, text: str // Setting the text will not trigger the delegate method, so we have to do it by hand. textField.ios.delegate.textFieldDidEndEditing(textField.ios); -} \ No newline at end of file +} diff --git a/apps/tests/ui/text-view/text-view-tests-native.ios.ts b/apps/tests/ui/text-view/text-view-tests-native.ios.ts index 8393ddf81..2ab42130f 100644 --- a/apps/tests/ui/text-view/text-view-tests-native.ios.ts +++ b/apps/tests/ui/text-view/text-view-tests-native.ios.ts @@ -36,16 +36,12 @@ export function getNativeTextAlignment(textView: textViewModule.TextView): strin switch (textView.ios.textAlignment) { case NSTextAlignment.NSTextAlignmentLeft: return enums.TextAlignment.left; - break; case NSTextAlignment.NSTextAlignmentCenter: return enums.TextAlignment.center; - break; case NSTextAlignment.NSTextAlignmentRight: return enums.TextAlignment.right; - break; default: return "unexpected value"; - break; } } @@ -54,4 +50,4 @@ export function typeTextNatively(textView: textViewModule.TextView, text: string // Setting the text will not trigger the delegate method, so we have to do it by hand. textView.ios.delegate.textViewDidEndEditing(textView.ios); -} \ No newline at end of file +} diff --git a/apps/ui-tests-app/pages/touch-event.ts b/apps/ui-tests-app/pages/touch-event.ts index 9105b0a2b..8cd791e77 100644 --- a/apps/ui-tests-app/pages/touch-event.ts +++ b/apps/ui-tests-app/pages/touch-event.ts @@ -1,4 +1,6 @@ -import { Page, View, TextView } from "ui"; +import {View} from "ui/core/view"; +import {Page} from "ui/page"; +import {TextView} from "ui/text-view"; import gestures = require("ui/gestures"); export function onTouch(args: gestures.TouchGestureEventData) { diff --git a/ui/animation/animation.android.ts b/ui/animation/animation.android.ts index b669327d3..278faf29f 100644 --- a/ui/animation/animation.android.ts +++ b/ui/animation/animation.android.ts @@ -264,7 +264,6 @@ export class Animation extends common.Animation implements definition.Animation default: throw new Error("Cannot animate " + propertyAnimation.property); - break; } var i = 0; diff --git a/ui/editable-text-base/editable-text-base.android.ts b/ui/editable-text-base/editable-text-base.android.ts index 5a10f41c6..eca950091 100644 --- a/ui/editable-text-base/editable-text-base.android.ts +++ b/ui/editable-text-base/editable-text-base.android.ts @@ -57,7 +57,6 @@ export class EditableTextBase extends common.EditableTextBase { break; default: throw new Error("Invalid updateTextTrigger: " + owner.updateTextTrigger); - break; } } }); diff --git a/ui/styling/css-selector.ts b/ui/styling/css-selector.ts index be109e776..c5f0ea0e5 100644 --- a/ui/styling/css-selector.ts +++ b/ui/styling/css-selector.ts @@ -228,7 +228,6 @@ class CssCompositeSelector extends CssSelector { } if (!result) { break; - return result; } } return result; @@ -282,11 +281,9 @@ function matchesAttr(attrExpression: string, view: view.View): boolean { break; } return !types.isNullOrUndefined(view[attrName]) && attrCheckRegex.test(view[attrName]+""); - } - else { + } else { return !types.isNullOrUndefined(view[attrExpression]); } - return false; } export class CssVisualStateSelector extends CssSelector {