From f436b6f1009b48de12f9f15984b442751247f0ac Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Wed, 28 Aug 2019 13:41:29 +0300 Subject: [PATCH 01/12] feat(android): fix tab resource icon size based on spec (#7737) --- .../bottom-navigation.android.ts | 24 +++++++------------ tns-core-modules/ui/tabs/tabs.android.ts | 24 +++++++------------ 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts b/tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts index 4da582b59..0fafaf048 100644 --- a/tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts +++ b/tns-core-modules/ui/bottom-navigation/bottom-navigation.android.ts @@ -540,23 +540,15 @@ export class BottomNavigation extends TabNavigationBase { // ICON const iconSource = tabStripItem.image && tabStripItem.image.src; if (iconSource) { - if (iconSource.indexOf(RESOURCE_PREFIX) === 0) { - tabItemSpec.iconId = ad.resources.getDrawableId(iconSource.substr(RESOURCE_PREFIX.length)); - if (tabItemSpec.iconId === 0) { - // TODO: - // traceMissingIcon(iconSource); - } - } else { - const icon = this.getIcon(tabStripItem); + const icon = this.getIcon(tabStripItem); - if (icon) { - // TODO: Make this native call that accepts string so that we don't load Bitmap in JS. - // tslint:disable-next-line:deprecation - tabItemSpec.iconDrawable = icon; - } else { - // TODO: - // traceMissingIcon(iconSource); - } + if (icon) { + // TODO: Make this native call that accepts string so that we don't load Bitmap in JS. + // tslint:disable-next-line:deprecation + tabItemSpec.iconDrawable = icon; + } else { + // TODO: + // traceMissingIcon(iconSource); } } } diff --git a/tns-core-modules/ui/tabs/tabs.android.ts b/tns-core-modules/ui/tabs/tabs.android.ts index c2334f859..d5cfbf212 100644 --- a/tns-core-modules/ui/tabs/tabs.android.ts +++ b/tns-core-modules/ui/tabs/tabs.android.ts @@ -615,23 +615,15 @@ export class Tabs extends TabsBase { // ICON const iconSource = tabStripItem.image && tabStripItem.image.src; if (iconSource) { - if (iconSource.indexOf(RESOURCE_PREFIX) === 0) { - tabItemSpec.iconId = ad.resources.getDrawableId(iconSource.substr(RESOURCE_PREFIX.length)); - if (tabItemSpec.iconId === 0) { - // TODO: - // traceMissingIcon(iconSource); - } - } else { - const icon = this.getIcon(tabStripItem); + const icon = this.getIcon(tabStripItem); - if (icon) { - // TODO: Make this native call that accepts string so that we don't load Bitmap in JS. - // tslint:disable-next-line:deprecation - tabItemSpec.iconDrawable = icon; - } else { - // TODO: - // traceMissingIcon(iconSource); - } + if (icon) { + // TODO: Make this native call that accepts string so that we don't load Bitmap in JS. + // tslint:disable-next-line:deprecation + tabItemSpec.iconDrawable = icon; + } else { + // TODO: + // traceMissingIcon(iconSource); } } } From ff6d89fc1310fc6a2a52a040e33c13f716f9588a Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Wed, 28 Aug 2019 17:10:55 +0300 Subject: [PATCH 02/12] feat(ios): add icon rendering mode for bottom navigation (#7738) --- .../app/bottom-navigation/binding-page.xml | 2 +- .../bottom-navigation-page.xml | 39 +------------------ .../bottom-navigation/fancy-fonts-page.xml | 2 +- .../bottom-navigation/icon-change-page.xml | 2 +- .../bottom-navigation.ios.ts | 18 ++++++++- tns-core-modules/ui/tabs/tabs.ios.ts | 1 + 6 files changed, 21 insertions(+), 43 deletions(-) diff --git a/e2e/ui-tests-app/app/bottom-navigation/binding-page.xml b/e2e/ui-tests-app/app/bottom-navigation/binding-page.xml index c13ec26c9..20aa4a2da 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/binding-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/binding-page.xml @@ -11,7 +11,7 @@ - + diff --git a/e2e/ui-tests-app/app/bottom-navigation/bottom-navigation-page.xml b/e2e/ui-tests-app/app/bottom-navigation/bottom-navigation-page.xml index 66266e701..00fe8dae7 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/bottom-navigation-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/bottom-navigation-page.xml @@ -3,23 +3,8 @@ - - - - - + @@ -71,26 +56,4 @@ - - - - - - - - \ No newline at end of file diff --git a/e2e/ui-tests-app/app/bottom-navigation/fancy-fonts-page.xml b/e2e/ui-tests-app/app/bottom-navigation/fancy-fonts-page.xml index 004de8346..7b1657fb9 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/fancy-fonts-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/fancy-fonts-page.xml @@ -2,7 +2,7 @@ - + diff --git a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml index 1305f2a06..23442767f 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml @@ -3,7 +3,7 @@ - + diff --git a/tns-core-modules/ui/bottom-navigation/bottom-navigation.ios.ts b/tns-core-modules/ui/bottom-navigation/bottom-navigation.ios.ts index 7ea8e43dd..2d2966105 100644 --- a/tns-core-modules/ui/bottom-navigation/bottom-navigation.ios.ts +++ b/tns-core-modules/ui/bottom-navigation/bottom-navigation.ios.ts @@ -531,7 +531,15 @@ export class BottomNavigation extends TabNavigationBase { } private getIconRenderingMode(): UIImageRenderingMode { - return UIImageRenderingMode.AlwaysOriginal; + switch (this.tabStrip && this.tabStrip.iosIconRenderingMode) { + case "alwaysOriginal": + return UIImageRenderingMode.AlwaysOriginal; + case "alwaysTemplate": + return UIImageRenderingMode.AlwaysTemplate; + case "automatic": + default: + return UIImageRenderingMode.Automatic; + } } private getIcon(tabStripItem: TabStripItem): UIImage { @@ -547,10 +555,12 @@ export class BottomNavigation extends TabNavigationBase { const color = target.style.color; const iconTag = [iconSource, font.fontStyle, font.fontWeight, font.fontSize, font.fontFamily, color].join(";"); + let isFontIcon = false; let image: UIImage = this._iconsCache[iconTag]; if (!image) { let is = new ImageSource; if (isFontIconURI(iconSource)) { + isFontIcon = true; const fontIconCode = iconSource.split("//")[1]; is = fromFontIconCode(fontIconCode, font, color); } else { @@ -564,7 +574,11 @@ export class BottomNavigation extends TabNavigationBase { image = this.getFixedSizeIcon(image); } - const originalRenderedImage = image.imageWithRenderingMode(this.getIconRenderingMode()); + let renderingMode: UIImageRenderingMode = UIImageRenderingMode.AlwaysOriginal; + if (!isFontIcon) { + renderingMode = this.getIconRenderingMode(); + } + const originalRenderedImage = image.imageWithRenderingMode(renderingMode); this._iconsCache[iconTag] = originalRenderedImage; image = originalRenderedImage; } else { diff --git a/tns-core-modules/ui/tabs/tabs.ios.ts b/tns-core-modules/ui/tabs/tabs.ios.ts index 4a664cb1a..1b6cb35b1 100644 --- a/tns-core-modules/ui/tabs/tabs.ios.ts +++ b/tns-core-modules/ui/tabs/tabs.ios.ts @@ -885,6 +885,7 @@ export class Tabs extends TabsBase { } private getIconRenderingMode(): UIImageRenderingMode { + // MDCTabBar doesn't work with rendering mode AlwaysTemplate return UIImageRenderingMode.AlwaysOriginal; } From a66f2f2f47456da99e39ae777af210fc13ea5431 Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Thu, 29 Aug 2019 09:34:57 +0300 Subject: [PATCH 03/12] fix(ios-tabs): crash when add tabstrip in loaded event (#7743) --- tns-core-modules/ui/tabs/tabs.ios.ts | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tns-core-modules/ui/tabs/tabs.ios.ts b/tns-core-modules/ui/tabs/tabs.ios.ts index 1b6cb35b1..7b56a9226 100644 --- a/tns-core-modules/ui/tabs/tabs.ios.ts +++ b/tns-core-modules/ui/tabs/tabs.ios.ts @@ -82,26 +82,24 @@ class UIPageViewControllerImpl extends UIPageViewController { public viewDidLoad(): void { const owner = this._owner.get(); - if (owner.tabStrip) { - const tabBarItems = owner.tabBarItems; - const tabBar = MDCTabBar.alloc().initWithFrame(this.view.bounds); + const tabBarItems = owner.tabBarItems; + const tabBar = MDCTabBar.alloc().initWithFrame(this.view.bounds); - if (tabBarItems && tabBarItems.length) { - tabBar.items = NSArray.arrayWithArray(tabBarItems); - } - - tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner)); - tabBar.tintColor = UIColor.blueColor; - tabBar.barTintColor = UIColor.whiteColor; - tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal); - tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Selected); - tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; - tabBar.alignment = MDCTabBarAlignment.Leading; - tabBar.sizeToFit(); - - this.tabBar = tabBar; - this.view.addSubview(tabBar); + if (tabBarItems && tabBarItems.length) { + tabBar.items = NSArray.arrayWithArray(tabBarItems); } + + tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner)); + tabBar.tintColor = UIColor.blueColor; + tabBar.barTintColor = UIColor.whiteColor; + tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal); + tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Selected); + tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; + tabBar.alignment = MDCTabBarAlignment.Leading; + tabBar.sizeToFit(); + + this.tabBar = tabBar; + this.view.addSubview(tabBar); } public viewWillAppear(animated: boolean): void { @@ -159,6 +157,8 @@ class UIPageViewControllerImpl extends UIPageViewController { } this.tabBar.frame = CGRectMake(0, tabBarTop, this.tabBar.frame.size.width, tabBarHeight); + } else { + this.tabBar.hidden = true; } const subViews: NSArray = this.view.subviews; From e3ed02858c6bfe1ccae0edb85104dce0d4b919eb Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Thu, 29 Aug 2019 16:14:29 +0300 Subject: [PATCH 04/12] fix(css): parse css selectors with escape sequences (#7689) (#7732) --- tests/app/ui/styling/style-tests.ts | 23 +++++++++++++++++++++++ tns-core-modules/css/parser.ts | 8 ++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tests/app/ui/styling/style-tests.ts b/tests/app/ui/styling/style-tests.ts index db4c180c4..d3c5cfa3d 100644 --- a/tests/app/ui/styling/style-tests.ts +++ b/tests/app/ui/styling/style-tests.ts @@ -198,6 +198,29 @@ export function test_class_selector() { TKUnit.assert(btnWithNoClass.style.color === undefined, "Color should not have a value"); } +export function test_class_selector_with_escape_characters() { + let page = helper.getClearCurrentPage(); + let btnWithClass1: buttonModule.Button; + let btnWithClass2: buttonModule.Button; + + page.css = ".test-1 { color: red; } .test-1\\/2 { color: blue }"; + + //// Will be styled + btnWithClass1 = new buttonModule.Button(); + btnWithClass1.className = "test-1"; + + btnWithClass2 = new buttonModule.Button(); + btnWithClass2.className = "test-1/2"; + + const stack = new stackModule.StackLayout(); + page.content = stack; + stack.addChild(btnWithClass1); + stack.addChild(btnWithClass2); + + helper.assertViewColor(btnWithClass1, "#FF0000"); + helper.assertViewColor(btnWithClass2, "#0000FF"); +} + export function test_multiple_class_selector() { let page = helper.getClearCurrentPage(); let btnWithClasses: buttonModule.Button; diff --git a/tns-core-modules/css/parser.ts b/tns-core-modules/css/parser.ts index 5fa7a9919..28d464209 100644 --- a/tns-core-modules/css/parser.ts +++ b/tns-core-modules/css/parser.ts @@ -546,7 +546,7 @@ function parseArgumentsList(text: string, start: number, argument: (value: st } end = arg.end; value.push(arg); - + closingBracketOrCommaRegEx.lastIndex = end; const closingBracketOrComma = closingBracketOrCommaRegEx.exec(text); if (closingBracketOrComma) { @@ -734,7 +734,7 @@ export function parseUniversalSelector(text: string, start: number = 0): Parsed< return { start, end, value: { type: "*" }}; } -const simpleIdentifierSelectorRegEx = /(#|\.|:|\b)([_-\w][_-\w\d]*)/gy; +const simpleIdentifierSelectorRegEx = /(#|\.|:|\b)([_-\w][_-\w\d\\/]*)/gy; export function parseSimpleIdentifierSelector(text: string, start: number = 0): Parsed { simpleIdentifierSelectorRegEx.lastIndex = start; const result = simpleIdentifierSelectorRegEx.exec(text); @@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start: number = 0): } const end = simpleIdentifierSelectorRegEx.lastIndex; const type = <"#" | "." | ":" | "">result[1]; - const identifier: string = result[2]; + const identifier: string = result[2].replace(/\\/g, ""); const value = { type, identifier }; return { start, end, value }; @@ -1617,4 +1617,4 @@ export class CSSNativeScript { return selectors; } -} \ No newline at end of file +} From 92c3338dd5f0238e6065f45a95e42b322a1114cc Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Thu, 29 Aug 2019 21:15:23 +0300 Subject: [PATCH 05/12] fix(ios-tabs): handle nesting proxy view container (#7755) --- tns-core-modules/ui/tabs/tabs.ios.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/ui/tabs/tabs.ios.ts b/tns-core-modules/ui/tabs/tabs.ios.ts index 7b56a9226..be26ca1b0 100644 --- a/tns-core-modules/ui/tabs/tabs.ios.ts +++ b/tns-core-modules/ui/tabs/tabs.ios.ts @@ -150,10 +150,17 @@ class UIPageViewControllerImpl extends UIPageViewController { scrollViewHeight = this.view.frame.size.height - safeAreaInsetsBottom; } - const parent = owner.parent; + let parent = owner.parent; + + // Handle Angular scenario where Tabs is in a ProxyViewContainer + // It is possible to wrap components in ProxyViewContainers indefinitely + while (parent && !parent.nativeViewProtected) { + parent = parent.parent; + } + if (parent && majorVersion > 10) { // TODO: Figure out a better way to handle ViewController nesting/Safe Area nesting - tabBarTop = Math.max(tabBarTop, owner.parent.nativeView.safeAreaInsets.top); + tabBarTop = Math.max(tabBarTop, parent.nativeView.safeAreaInsets.top); } this.tabBar.frame = CGRectMake(0, tabBarTop, this.tabBar.frame.size.width, tabBarHeight); From d23ffb8dbfb08815dde083807ba9ece5c2fbf3fb Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Fri, 30 Aug 2019 09:09:35 +0300 Subject: [PATCH 06/12] fix-next(css): className to preserve root views classes (#7725) --- .../styling/root-views-css-classes-tests.ts | 120 ++++++++++++++++-- tests/app/ui/styling/style-tests.ts | 30 ++++- .../application/application-common.ts | 19 ++- tns-core-modules/application/application.d.ts | 5 - .../application/application.ios.ts | 22 ++-- tns-core-modules/css/system-classes.d.ts | 30 +++++ tns-core-modules/css/system-classes.ts | 32 +++++ .../ui/core/view-base/view-base.ts | 33 +++-- tns-core-modules/ui/core/view/view-common.ts | 13 +- tns-core-modules/ui/frame/frame.android.ts | 20 +-- tns-core-modules/ui/utils.android.ts | 2 +- tns-core-modules/ui/utils.d.ts | 1 + tns-core-modules/ui/utils.ios.ts | 2 +- 13 files changed, 263 insertions(+), 66 deletions(-) create mode 100644 tns-core-modules/css/system-classes.d.ts create mode 100644 tns-core-modules/css/system-classes.ts diff --git a/tests/app/ui/styling/root-views-css-classes-tests.ts b/tests/app/ui/styling/root-views-css-classes-tests.ts index aa636f92b..b259f57b5 100644 --- a/tests/app/ui/styling/root-views-css-classes-tests.ts +++ b/tests/app/ui/styling/root-views-css-classes-tests.ts @@ -22,6 +22,7 @@ import { } from "tns-core-modules/ui/core/view/view-common"; import { DeviceType } from "tns-core-modules/ui/enums/enums"; +const CLASS_NAME = "class-name"; const ROOT_CSS_CLASS = "ns-root"; const MODAL_CSS_CLASS = "ns-modal"; const ANDROID_PLATFORM_CSS_CLASS = "ns-android"; @@ -32,18 +33,41 @@ const PORTRAIT_ORIENTATION_CSS_CLASS = "ns-portrait"; const LANDSCAPE_ORIENTATION_CSS_CLASS = "ns-landscape"; const UNKNOWN_ORIENTATION_CSS_CLASS = "ns-unknown"; -export function test_root_view_root_css_class() { - const rootViewCssClasses = getRootView().cssClasses; +function _test_root_view_root_css_class(shouldSetClassName: boolean) { + const rootView = getRootView(); + if (shouldSetClassName) { + rootView.className = CLASS_NAME; + } + const rootViewCssClasses = rootView.cssClasses; TKUnit.assertTrue(rootViewCssClasses.has( ROOT_CSS_CLASS), `${ROOT_CSS_CLASS} CSS class is missing` ); + + if (shouldSetClassName) { + TKUnit.assertTrue(rootViewCssClasses.has( + CLASS_NAME), + `${CLASS_NAME} CSS class is missing` + ); + } } -export function test_root_view_platform_css_class() { - const rootViewCssClasses = getRootView().cssClasses; +export function test_root_view_root_css_class() { + _test_root_view_root_css_class(false); +} +export function test_root_view_class_name_preserve_root_css_class() { + _test_root_view_root_css_class(true); +} + +function _test_root_view_platform_css_class(shouldSetClassName: boolean) { + const rootView = getRootView(); + if (shouldSetClassName) { + rootView.className = CLASS_NAME; + } + + const rootViewCssClasses = rootView.cssClasses; if (isAndroid) { TKUnit.assertTrue(rootViewCssClasses.has( ANDROID_PLATFORM_CSS_CLASS), @@ -63,10 +87,30 @@ export function test_root_view_platform_css_class() { `${ANDROID_PLATFORM_CSS_CLASS} CSS class is present` ); } + + if (shouldSetClassName) { + TKUnit.assertTrue(rootViewCssClasses.has( + CLASS_NAME), + `${CLASS_NAME} CSS class is missing` + ); + } } -export function test_root_view_device_type_css_class() { - const rootViewCssClasses = getRootView().cssClasses; +export function test_root_view_platform_css_class() { + _test_root_view_platform_css_class(false); +} + +export function test_root_view_class_name_preserve_platform_css_class() { + _test_root_view_platform_css_class(true); +} + +function _test_root_view_device_type_css_class(shouldSetClassName: boolean) { + const rootView = getRootView(); + if (shouldSetClassName) { + rootView.className = CLASS_NAME; + } + + const rootViewCssClasses = rootView.cssClasses; const deviceType = device.deviceType; if (deviceType === DeviceType.Phone) { @@ -88,10 +132,30 @@ export function test_root_view_device_type_css_class() { `${PHONE_DEVICE_TYPE_CSS_CLASS} CSS class is present` ); } + + if (shouldSetClassName) { + TKUnit.assertTrue(rootViewCssClasses.has( + CLASS_NAME), + `${CLASS_NAME} CSS class is missing` + ); + } } -export function test_root_view_orientation_css_class() { - const rootViewCssClasses = getRootView().cssClasses; +export function test_root_view_device_type_css_class() { + _test_root_view_device_type_css_class(false); +} + +export function test_root_view_class_name_preserve_device_type_css_class() { + _test_root_view_device_type_css_class(true); +} + +function _test_root_view_orientation_css_class(shouldSetClassName: boolean) { + const rootView = getRootView(); + if (shouldSetClassName) { + rootView.className = CLASS_NAME; + } + + const rootViewCssClasses = rootView.cssClasses; let appOrientation; if (isAndroid) { @@ -140,9 +204,24 @@ export function test_root_view_orientation_css_class() { `${PORTRAIT_ORIENTATION_CSS_CLASS} CSS class is present` ); } + + if (shouldSetClassName) { + TKUnit.assertTrue(rootViewCssClasses.has( + CLASS_NAME), + `${CLASS_NAME} CSS class is missing` + ); + } } -export function test_modal_root_view_modal_css_class() { +export function test_root_view_orientation_css_class() { + _test_root_view_orientation_css_class(false); +} + +export function test_root_view_class_name_preserve_orientation_css_class() { + _test_root_view_orientation_css_class(true); +} + +function _test_modal_root_view_modal_css_class(shouldSetClassName: boolean) { let modalClosed = false; const modalCloseCallback = function () { @@ -153,7 +232,20 @@ export function test_modal_root_view_modal_css_class() { const page = args.object; page.off(View.shownModallyEvent, modalPageShownModallyEventHandler); - TKUnit.assertTrue(_rootModalViews[0].cssClasses.has(MODAL_CSS_CLASS)); + const rootModalView = _rootModalViews[0]; + if (shouldSetClassName) { + rootModalView.className = CLASS_NAME; + } + + const rootModalViewCssClasses = rootModalView.cssClasses; + TKUnit.assertTrue(rootModalViewCssClasses.has(MODAL_CSS_CLASS), + `${MODAL_CSS_CLASS} CSS class is missing`); + + if (shouldSetClassName) { + TKUnit.assertTrue(rootModalViewCssClasses.has(CLASS_NAME), + `${CLASS_NAME} CSS class is missing`); + } + args.closeCallback(); }; @@ -186,3 +278,11 @@ export function test_modal_root_view_modal_css_class() { helper.navigate(hostPageFactory); TKUnit.waitUntilReady(() => modalClosed); } + +export function test_modal_root_view_modal_css_class() { + _test_modal_root_view_modal_css_class(false); +} + +export function test_modal_root_view_class_name_preserve_modal_css_class() { + _test_modal_root_view_modal_css_class(true); +} diff --git a/tests/app/ui/styling/style-tests.ts b/tests/app/ui/styling/style-tests.ts index d3c5cfa3d..004ddeacd 100644 --- a/tests/app/ui/styling/style-tests.ts +++ b/tests/app/ui/styling/style-tests.ts @@ -225,7 +225,7 @@ export function test_multiple_class_selector() { let page = helper.getClearCurrentPage(); let btnWithClasses: buttonModule.Button; - page.css = ".style1 { color: red; } .style2 { background-color: blue } "; + page.css = ".style1 { color: red; } .style2 { background-color: blue; } "; //// Will be styled btnWithClasses = new buttonModule.Button(); @@ -239,6 +239,24 @@ export function test_multiple_class_selector() { helper.assertViewBackgroundColor(btnWithClasses, "#0000FF"); } +export function test_class_selector_overwriting() { + const page = helper.getClearCurrentPage(); + page.css = ".first { color: red; } .second { background-color: blue; }"; + + const btnWithClass = new buttonModule.Button(); + const stack = new stackModule.StackLayout(); + page.content = stack; + stack.addChild(btnWithClass); + + btnWithClass.className = "first"; + helper.assertViewColor(btnWithClass, "#FF0000"); + TKUnit.assert(btnWithClass.style.backgroundColor === undefined, " Background color should not have a value"); + + btnWithClass.className = "second"; + TKUnit.assert(btnWithClass.style.color === undefined, "Color should not have a value"); + helper.assertViewBackgroundColor(btnWithClass, "#0000FF"); +} + export function test_id_selector() { let page = helper.getClearCurrentPage(); page.style.color = unsetValue; @@ -1497,7 +1515,7 @@ export function test_css_calc() { TKUnit.assertEqual(stack.width as any, 125, "Stack - width === 125"); (stack as any).style = `width: calc(100% / 2)`; - TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); + TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); // This should log an error for the invalid css-calc expression, but not cause a crash stack.className = "invalid-css-calc"; @@ -1568,7 +1586,7 @@ export function test_nested_css_calc() { (stack as any).style = `width: calc(100% * calc(1 / 2)`; - TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); + TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); } export function test_css_variables() { @@ -1678,7 +1696,7 @@ export function test_css_calc_and_variables() { // Test setting the CSS variable via the style-attribute, this should override any value set via css-class (stack as any).style = `${cssVarName}: 0.5`; - TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); + TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); } export function test_css_variable_fallback() { @@ -1819,10 +1837,10 @@ export function test_nested_css_calc_and_variables() { // Test setting the CSS variable via the style-attribute, this should override any value set via css-class stack.className = "wide"; (stack as any).style = `${cssVarName}: 0.25`; - TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); + TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%"); stack.className = "nested"; - TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 1 }, "Stack - width === 100%"); + TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 1 }, "Stack - width === 100%"); } export function test_css_variable_is_applied_to_normal_properties() { diff --git a/tns-core-modules/application/application-common.ts b/tns-core-modules/application/application-common.ts index 6c6a92de4..c59774ea2 100644 --- a/tns-core-modules/application/application-common.ts +++ b/tns-core-modules/application/application-common.ts @@ -40,6 +40,8 @@ import { LoadAppCSSEventData, UnhandledErrorEventData } from "./application"; + +import { CLASS_PREFIX, pushToRootViewCssClasses, removeFromRootViewCssClasses } from "../css/system-classes"; import { DeviceOrientation } from "../ui/enums/enums"; export { UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData }; @@ -54,11 +56,10 @@ export const uncaughtErrorEvent = "uncaughtError"; export const discardedErrorEvent = "discardedError"; export const orientationChangedEvent = "orientationChanged"; -export const CSS_CLASS_PREFIX = "ns-"; const ORIENTATION_CSS_CLASSES = [ - `${CSS_CLASS_PREFIX}${DeviceOrientation.portrait}`, - `${CSS_CLASS_PREFIX}${DeviceOrientation.landscape}`, - `${CSS_CLASS_PREFIX}${DeviceOrientation.unknown}` + `${CLASS_PREFIX}${DeviceOrientation.portrait}`, + `${CLASS_PREFIX}${DeviceOrientation.landscape}`, + `${CLASS_PREFIX}${DeviceOrientation.unknown}` ]; let cssFile: string = "./app.css"; @@ -126,9 +127,15 @@ export function loadAppCss(): void { } export function orientationChanged(rootView: View, newOrientation: "portrait" | "landscape" | "unknown"): void { - const newOrientationCssClass = `${CSS_CLASS_PREFIX}${newOrientation}`; + const newOrientationCssClass = `${CLASS_PREFIX}${newOrientation}`; if (!rootView.cssClasses.has(newOrientationCssClass)) { - ORIENTATION_CSS_CLASSES.forEach(c => rootView.cssClasses.delete(c)); + const removeCssClass = (c: string) => { + removeFromRootViewCssClasses(c); + rootView.cssClasses.delete(c); + }; + + ORIENTATION_CSS_CLASSES.forEach(c => removeCssClass(c)); + pushToRootViewCssClasses(newOrientationCssClass); rootView.cssClasses.add(newOrientationCssClass); rootView._onCssStateChange(); } diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts index 8ef338b76..672e55cc5 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -53,11 +53,6 @@ export const lowMemoryEvent: string; */ export const orientationChangedEvent: string; -/** - * String value "ns-" used for CSS class prefix. - */ -export const CSS_CLASS_PREFIX: string; - /** * Event data containing information for the application events. */ diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts index 49e9b80cb..37a834096 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -1,4 +1,3 @@ - import { ApplicationEventData, CssChangedEventData, @@ -9,9 +8,8 @@ import { } from "."; import { - CSS_CLASS_PREFIX, displayedEvent, exitEvent, getCssFileName, launchEvent, livesync, - lowMemoryEvent, notify, on, orientationChanged, orientationChangedEvent, resumeEvent, - setApplication, suspendEvent + displayedEvent, exitEvent, getCssFileName, launchEvent, livesync, lowMemoryEvent, notify, on, + orientationChanged, orientationChangedEvent, resumeEvent, setApplication, suspendEvent } from "./application-common"; // First reexport so that app module is initialized. @@ -19,18 +17,15 @@ export * from "./application-common"; // TODO: Remove this and get it from global to decouple builder for angular import { createViewFromEntry } from "../ui/builder"; +import { CLASS_PREFIX, getRootViewCssClasses, pushToRootViewCssClasses } from "../css/system-classes"; import { ios as iosView, View } from "../ui/core/view"; import { Frame, NavigationEntry } from "../ui/frame"; import { device } from "../platform/platform"; import { profile } from "../profiling"; import { ios } from "../utils/utils"; -const ROOT = "root"; const IOS_PLATFORM = "ios"; -const ROOT_VIEW_CSS_CLASSES = [ - `${CSS_CLASS_PREFIX}${ROOT}`, - `${CSS_CLASS_PREFIX}${IOS_PLATFORM}` -]; + const getVisibleViewController = ios.getVisibleViewController; // NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430 @@ -317,9 +312,12 @@ function createRootView(v?: View) { } const deviceType = device.deviceType.toLowerCase(); - ROOT_VIEW_CSS_CLASSES.push(`${CSS_CLASS_PREFIX}${deviceType}`); - ROOT_VIEW_CSS_CLASSES.push(`${CSS_CLASS_PREFIX}${iosApp.orientation}`); - ROOT_VIEW_CSS_CLASSES.forEach(c => rootView.cssClasses.add(c)); + pushToRootViewCssClasses(`${CLASS_PREFIX}${IOS_PLATFORM}`); + pushToRootViewCssClasses(`${CLASS_PREFIX}${deviceType}`); + pushToRootViewCssClasses(`${CLASS_PREFIX}${iosApp.orientation}`); + + const rootViewCssClasses = getRootViewCssClasses(); + rootViewCssClasses.forEach(c => rootView.cssClasses.add(c)); return rootView; } diff --git a/tns-core-modules/css/system-classes.d.ts b/tns-core-modules/css/system-classes.d.ts new file mode 100644 index 000000000..98f7ee59e --- /dev/null +++ b/tns-core-modules/css/system-classes.d.ts @@ -0,0 +1,30 @@ +/** + * @module "system-classes" + */ /** */ + +/** + * String value "ns-" used for CSS system class prefix. + */ +export const CLASS_PREFIX: string; + +/** + * Gets CSS system class for modal root view. + */ +export function getModalRootViewCssClass(): string; + +/** + * Gets CSS system classes for root view. + */ +export function getRootViewCssClasses(): string[]; + +/** + * * Appends new CSS class to the system classes and returns the new length of the array. + * @param value New CSS system class. + */ +export function pushToRootViewCssClasses(value: string): number; + +/** + * Removes CSS class from the system classes and returns it. + * @param value + */ +export function removeFromRootViewCssClasses(value: string): string; diff --git a/tns-core-modules/css/system-classes.ts b/tns-core-modules/css/system-classes.ts new file mode 100644 index 000000000..6e2f7e80c --- /dev/null +++ b/tns-core-modules/css/system-classes.ts @@ -0,0 +1,32 @@ +const MODAL = "modal"; +const ROOT = "root"; + +export const CLASS_PREFIX = "ns-"; + +const modalRootViewCssClass = `${CLASS_PREFIX}${MODAL}`; +const rootViewCssClasses = [`${CLASS_PREFIX}${ROOT}`]; + +export function getModalRootViewCssClass(): string { + return modalRootViewCssClass; +} + +export function getRootViewCssClasses(): string[] { + return rootViewCssClasses; +} + +export function pushToRootViewCssClasses(value: string): number { + rootViewCssClasses.push(value); + + return rootViewCssClasses.length; +} + +export function removeFromRootViewCssClasses(value: string): string { + const index = rootViewCssClasses.indexOf(value); + let removedElement; + + if (index > -1) { + removedElement = rootViewCssClasses.splice(index, 1); + } + + return removedElement; +} diff --git a/tns-core-modules/ui/core/view-base/view-base.ts b/tns-core-modules/ui/core/view-base/view-base.ts index 06ec4c996..89dc23607 100644 --- a/tns-core-modules/ui/core/view-base/view-base.ts +++ b/tns-core-modules/ui/core/view-base/view-base.ts @@ -1,10 +1,13 @@ // Definitions. import { ViewBase as ViewBaseDefinition } from "."; +import { + AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order +} from "../../layouts/flexbox-layout"; import { Page } from "../../page"; -import { Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf } from "../../layouts/flexbox-layout"; // Types. import { Property, CssProperty, CssAnimationProperty, InheritedProperty, Style, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from "../properties"; +import { getModalRootViewCssClass, getRootViewCssClasses } from "../../../css/system-classes"; import { Source } from "../../../utils/debug"; import { Binding, BindingOptions, Observable, WrappedValue, PropertyChangeData, traceEnabled, traceWrite, traceCategories } from "../bindable"; import { isIOS, isAndroid } from "../../../platform"; @@ -22,10 +25,9 @@ export { isIOS, isAndroid, layout, Color }; export * from "../bindable"; export * from "../properties"; +import * as dnm from "../../../debugger/dom-node"; import * as ssm from "../../styling/style-scope"; -// import { DOMNode } from "../../../debugger/dom-node"; -import * as dnm from "../../../debugger/dom-node"; let domNodeModule: typeof dnm; function ensuredomNodeModule(): void { @@ -1036,11 +1038,26 @@ bindingContextProperty.register(ViewBase); export const classNameProperty = new Property({ name: "className", valueChanged(view: ViewBase, oldValue: string, newValue: string) { - let classes = view.cssClasses; - classes.clear(); - if (typeof newValue === "string" && newValue !== "") { - newValue.split(" ").forEach(c => classes.add(c)); + const cssClasses = view.cssClasses; + + const modalViewCssClass = getModalRootViewCssClass(); + const rootViewCssClasses = getRootViewCssClasses(); + + const shouldAddModalRootViewCssClass = cssClasses.has(modalViewCssClass); + const shouldAddRootViewCssClasses = cssClasses.has(rootViewCssClasses[0]); + + cssClasses.clear(); + + if (shouldAddModalRootViewCssClass) { + cssClasses.add(modalViewCssClass); + } else if (shouldAddRootViewCssClasses) { + rootViewCssClasses.forEach(c => cssClasses.add(c)); } + + if (typeof newValue === "string" && newValue !== "") { + newValue.split(" ").forEach(c => cssClasses.add(c)); + } + view._onCssStateChange(); } }); @@ -1058,4 +1075,4 @@ export function booleanConverter(v: string): boolean { } throw new Error(`Invalid boolean: ${v}`); -} \ No newline at end of file +} diff --git a/tns-core-modules/ui/core/view/view-common.ts b/tns-core-modules/ui/core/view/view-common.ts index d09e09929..4e9352358 100644 --- a/tns-core-modules/ui/core/view/view-common.ts +++ b/tns-core-modules/ui/core/view/view-common.ts @@ -5,9 +5,8 @@ import { } from "."; import { - ViewBase, Property, booleanConverter, EventData, layout, - getEventOrGestureName, traceEnabled, traceWrite, traceCategories, - InheritedProperty, ShowModalOptions + booleanConverter, EventData, getEventOrGestureName, InheritedProperty, layout, + Property, ShowModalOptions, traceCategories, traceEnabled, traceWrite, ViewBase } from "../view-base"; import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLength } from "../../styling/style-properties"; @@ -20,6 +19,7 @@ import { fromString as gestureFromString } from "../../gestures"; +import { getModalRootViewCssClass } from "../../../css/system-classes"; import { createViewFromEntry } from "../../builder"; import { sanitizeModuleName } from "../../builder/module-name-sanitizer"; import { StyleScope } from "../../styling/style-scope"; @@ -31,9 +31,6 @@ export * from "../view-base"; export { LinearGradient }; import * as am from "../../animation"; -import { CSS_CLASS_PREFIX } from "../../../application"; - -const MODAL = "modal"; let animationModule: typeof am; function ensureAnimationModule() { @@ -373,7 +370,9 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { protected _showNativeModalView(parent: ViewCommon, options: ShowModalOptions) { _rootModalViews.push(this); - this.cssClasses.add(`${CSS_CLASS_PREFIX}${MODAL}`); + + const modalRootViewCssClass = getModalRootViewCssClass(); + this.cssClasses.add(modalRootViewCssClass); parent._modal = this; this._modalParent = parent; diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index f93d9a874..fc52f37b8 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -7,9 +7,10 @@ import { Page } from "../page"; // Types. import * as application from "../../application"; + import { - FrameBase, goBack, _stack, NavigationType, - Observable, View, traceCategories, traceEnabled, traceError, traceWrite + _stack, FrameBase, goBack, NavigationType, Observable, + traceCategories, traceEnabled, traceError, traceWrite, View } from "./frame-common"; import { @@ -19,6 +20,7 @@ import { // TODO: Remove this and get it from global to decouple builder for angular import { createViewFromEntry } from "../builder"; +import { CLASS_PREFIX, getRootViewCssClasses, pushToRootViewCssClasses } from "../../css/system-classes"; import { device } from "../../platform/platform"; import { profile } from "../../profiling"; @@ -32,12 +34,7 @@ interface AnimatorState { transitionName: string; } -const ROOT = "root"; const ANDROID_PLATFORM = "android"; -const ROOT_VIEW_CSS_CLASSES = [ - `${application.CSS_CLASS_PREFIX}${ROOT}`, - `${application.CSS_CLASS_PREFIX}${ANDROID_PLATFORM}` -]; const INTENT_EXTRA = "com.tns.activity"; const ROOT_VIEW_ID_EXTRA = "com.tns.activity.rootViewId"; @@ -1289,9 +1286,12 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks { activityRootViewsMap.set(rootView._domId, new WeakRef(rootView)); const deviceType = device.deviceType.toLowerCase(); - ROOT_VIEW_CSS_CLASSES.push(`${application.CSS_CLASS_PREFIX}${deviceType}`); - ROOT_VIEW_CSS_CLASSES.push(`${application.CSS_CLASS_PREFIX}${application.android.orientation}`); - ROOT_VIEW_CSS_CLASSES.forEach(c => this._rootView.cssClasses.add(c)); + pushToRootViewCssClasses(`${CLASS_PREFIX}${ANDROID_PLATFORM}`); + pushToRootViewCssClasses(`${CLASS_PREFIX}${deviceType}`); + pushToRootViewCssClasses(`${CLASS_PREFIX}${application.android.orientation}`); + + const rootViewCssClasses = getRootViewCssClasses(); + rootViewCssClasses.forEach(c => this._rootView.cssClasses.add(c)); } // Initialize native visual tree; diff --git a/tns-core-modules/ui/utils.android.ts b/tns-core-modules/ui/utils.android.ts index b253eba9e..b8e7bc80b 100644 --- a/tns-core-modules/ui/utils.android.ts +++ b/tns-core-modules/ui/utils.android.ts @@ -10,4 +10,4 @@ export function _layoutRootView(rootView: any, parentBounds: any) { throw new Error("Not implemented for Android"); } -} \ No newline at end of file +} diff --git a/tns-core-modules/ui/utils.d.ts b/tns-core-modules/ui/utils.d.ts index e54e208bd..a30b9f6f3 100644 --- a/tns-core-modules/ui/utils.d.ts +++ b/tns-core-modules/ui/utils.d.ts @@ -3,6 +3,7 @@ */ import { View } from "./core/view"; + export module ios { /** * Gets actual height of a [UIView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/) widget in device pixels. diff --git a/tns-core-modules/ui/utils.ios.ts b/tns-core-modules/ui/utils.ios.ts index 21ed98575..de61713bb 100644 --- a/tns-core-modules/ui/utils.ios.ts +++ b/tns-core-modules/ui/utils.ios.ts @@ -24,4 +24,4 @@ export module ios { return utils.layout.toDevicePixels(min); } -} \ No newline at end of file +} From c6efd0812010bcf01e19d8d6747dc89ba056a29f Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Wed, 4 Sep 2019 17:54:48 +0300 Subject: [PATCH 07/12] docs: cut the 6.1.0 release (#7773) --- CHANGELOG.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff57aa2f..1acc36b75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ + +# [6.1.0](https://github.com/NativeScript/NativeScript/compare/6.0.7...6.1.0) (2019-09-02) + + +### Bug Fixes + +* dots can now be used in module names ([#7655](https://github.com/NativeScript/NativeScript/issues/7655)) ([b6ff4d3](https://github.com/NativeScript/NativeScript/commit/b6ff4d3)) +* **css:** parse css selectors with escape sequences ([#7689](https://github.com/NativeScript/NativeScript/issues/7689)) ([#7732](https://github.com/NativeScript/NativeScript/issues/7732)) ([e3ed028](https://github.com/NativeScript/NativeScript/commit/e3ed028)) +* **ios-tabs:** handle tabs extended layout for ios 10 ([f7f0612](https://github.com/NativeScript/NativeScript/commit/f7f0612)) +* **ios-tabs:** crash when add tabstrip in loaded event ([#7743](https://github.com/NativeScript/NativeScript/issues/7743)) ([a66f2f2](https://github.com/NativeScript/NativeScript/commit/a66f2f2)) +* **ios-tabs:** handle nesting proxy view container ([#7755](https://github.com/NativeScript/NativeScript/issues/7755)) ([92c3338](https://github.com/NativeScript/NativeScript/commit/92c3338)) +* handle empty folders in non-bundle-compat ([#7649](https://github.com/NativeScript/NativeScript/issues/7649)) ([5fd7913](https://github.com/NativeScript/NativeScript/commit/5fd7913)) + + +### Features + +* implement css-variables and css-calc ([#7553](https://github.com/NativeScript/NativeScript/issues/7553)) ([673c808](https://github.com/NativeScript/NativeScript/commit/673c808)) +* add CSS classes to app/modal root views to target platform/device/orientation/type ([#7606](https://github.com/NativeScript/NativeScript/issues/7606)) ([3adba68](https://github.com/NativeScript/NativeScript/commit/3adba68)) +* **GridLayout:** Add synonym property column[Span] for col[Span] in GridLayout ([#7641](https://github.com/NativeScript/NativeScript/issues/7641)) ([d3c39c1](https://github.com/NativeScript/NativeScript/commit/d3c39c1)) +* apply styles when adding them to the application scope ([#7652](https://github.com/NativeScript/NativeScript/issues/7652)) ([1d12136](https://github.com/NativeScript/NativeScript/commit/1d12136)) +* expose application orientation ([#7602](https://github.com/NativeScript/NativeScript/issues/7602)) ([e2c3c8c](https://github.com/NativeScript/NativeScript/commit/e2c3c8c)) +* **ios-bottom-navigation:** add icon rendering mode ([#7738](https://github.com/NativeScript/NativeScript/issues/7738)) ([ff6d89f](https://github.com/NativeScript/NativeScript/commit/ff6d89f)) +* **android-tabs/bottom-navigation:** fix tab resource icon size based on specification ([#7737](https://github.com/NativeScript/NativeScript/issues/7737)) ([f436b6f](https://github.com/NativeScript/NativeScript/commit/f436b6f)) +* **tabs/bottom-navigation:** introduce TabStrip.isIconSizeFixed property ([#7691](https://github.com/NativeScript/NativeScript/issues/7691)) ([8039c2c](https://github.com/NativeScript/NativeScript/commit/8039c2c)) +* **tabs/bottom-navigation:** add support for custom tabstrip ([#7580](https://github.com/NativeScript/NativeScript/issues/7580)) ([acc3436](https://github.com/NativeScript/NativeScript/commit/acc3436)) +* **tabs/bottom-navigation:** inherit TabContentItem from ContentView ([#7629](https://github.com/NativeScript/NativeScript/issues/7629)) ([72ca461](https://github.com/NativeScript/NativeScript/commit/72ca461)) +* **tabs/bottom-navigation:** flexible font icon usage ([#7672](https://github.com/NativeScript/NativeScript/issues/7672)) ([c0b8db4](https://github.com/NativeScript/NativeScript/commit/c0b8db4)) +* **tabs:** emit tabStripItem tap event ([#7693](https://github.com/NativeScript/NativeScript/issues/7693)) ([b0d1c91](https://github.com/NativeScript/NativeScript/commit/b0d1c91)) +* **tabs/bottom-navigation:** add TabStrip.itemTap event ([#7711](https://github.com/NativeScript/NativeScript/issues/7711)) ([55c9cc9](https://github.com/NativeScript/NativeScript/commit/55c9cc9)) + + ## [6.0.7](https://github.com/NativeScript/NativeScript/compare/6.0.4...6.0.7) (2019-08-22) @@ -32,6 +63,25 @@ + +## [6.0.5](https://github.com/NativeScript/NativeScript/compare/6.0.4...6.0.5) (2019-08-02) + + +### Bug Fixes + +* **observable-array:** splice to notify correct amount of added items ([#7426](https://github.com/NativeScript/NativeScript/issues/7426)) ([5e14de6](https://github.com/NativeScript/NativeScript/commit/5e14de6)) +* added missing openFile method in ios utils ([#7431](https://github.com/NativeScript/NativeScript/issues/7431)) ([cb58cab](https://github.com/NativeScript/NativeScript/commit/cb58cab)) +* full Unicode support in xml ([#7428](https://github.com/NativeScript/NativeScript/issues/7428)) ([b8659e6](https://github.com/NativeScript/NativeScript/commit/b8659e6)) +* **timer:** setTimeout/setInterval support for boolean period ([#7569](https://github.com/NativeScript/NativeScript/issues/7569)) ([a569bb2](https://github.com/NativeScript/NativeScript/commit/a569bb2)) + + +### Features + +* **bottom-navigation-ios:** limit to 5 items ([5815246](https://github.com/NativeScript/NativeScript/commit/5815246)) +* split globals to support smaller worker chunks ([0ee0b67](https://github.com/NativeScript/NativeScript/commit/0ee0b67)) + + + ## [6.0.4](https://github.com/NativeScript/NativeScript/compare/6.0.3...6.0.4) (2019-07-30) From 997d6de2e3ffd8d0db955e52327d91ed1b158351 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 10 Sep 2019 13:38:38 +0300 Subject: [PATCH 08/12] fix(android-list-picker): NoSuchFieldException on api29 (#7790) --- .../ui/list-picker/list-picker.android.ts | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/tns-core-modules/ui/list-picker/list-picker.android.ts b/tns-core-modules/ui/list-picker/list-picker.android.ts index ccc9ea5e1..328af50fd 100644 --- a/tns-core-modules/ui/list-picker/list-picker.android.ts +++ b/tns-core-modules/ui/list-picker/list-picker.android.ts @@ -1,8 +1,12 @@ import { ListPickerBase, selectedIndexProperty, itemsProperty, colorProperty, Color } from "./list-picker-common"; import { ItemsSource } from "."; +import { device } from "../../platform"; +import lazy from "../../utils/lazy"; export * from "./list-picker-common"; +const sdkVersion = lazy(() => parseInt(device.sdkVersion)); + interface Formatter { new (owner: ListPicker): android.widget.NumberPicker.Formatter; } @@ -90,7 +94,14 @@ export class ListPicker extends ListPickerBase { super.initNativeView(); initializeNativeClasses(); const nativeView = this.nativeViewProtected; - this._selectorWheelPaint = getSelectorWheelPaint(nativeView); + + // api28 and lower uses reflection to retrieve and manipulate + // android.graphics.Paint object; this is no longer allowed on newer api levels but + // equivalent public methods are exposed on api29+ directly on the native widget + if (sdkVersion() < 29) { + this._selectorWheelPaint = getSelectorWheelPaint(nativeView); + } + const formatter = new Formatter(this); nativeView.setFormatter(formatter); (nativeView).formatter = formatter; @@ -153,28 +164,33 @@ export class ListPicker extends ListPickerBase { selectedIndexProperty.coerce(this); } - [colorProperty.getDefault](): { wheelColor: number, textColor: number } { - const editText = (this.nativeViewProtected).editText; - - return { - wheelColor: this._selectorWheelPaint.getColor(), - textColor: editText ? editText.getTextColors().getDefaultColor() : -1 - }; - } - [colorProperty.setNative](value: { wheelColor: number, textColor: number } | Color) { - let color: number; - let wheelColor: number; - if (value instanceof Color) { - color = wheelColor = value.android; - } else { - color = value.textColor; - wheelColor = value.wheelColor; + [colorProperty.getDefault](): number { + // api28 and lower uses reflection to retrieve and manipulate + // android.graphics.Paint object; this is no longer allowed on newer api levels but + // equivalent public methods are exposed on api29+ directly on the native widget + if (this._selectorWheelPaint) { + return this._selectorWheelPaint.getColor(); } - this._selectorWheelPaint.setColor(wheelColor); - const editText = (this.nativeViewProtected).editText; - if (editText) { - editText.setTextColor(color); + return this.nativeView.getTextColor(); + } + [colorProperty.setNative](value: number | Color) { + const color = value instanceof Color ? value.android : value; + + // api28 and lower uses reflection to retrieve and manipulate + // android.graphics.Paint object; this is no longer allowed on newer api levels but + // equivalent public methods are exposed on api29+ directly on the native widget + if (this._selectorWheelPaint) { + this._selectorWheelPaint.setColor(color); + + const editText = (this.nativeViewProtected).editText; + if (editText) { + editText.setTextColor(color); + } + } else { + // api29 and higher native implementation sets + // both wheel color and input text color with single call + this.nativeView.setTextColor(color); } } } From 2d0737a92d1890b53b1ea5081661297c75350458 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 10 Sep 2019 15:43:17 +0300 Subject: [PATCH 09/12] chore: hardcode tslib version to 1.10.0 (#7776) --- package.json | 2 +- tns-core-modules/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 905c56dca..3c57d4ab9 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "shelljs": "^0.7.0", "source-map-support": "^0.4.17", "time-grunt": "1.3.0", - "tslib": "^1.9.3", + "tslib": "1.10.0", "tslint": "^5.4.3", "typedoc": "^0.13.0", "typedoc-plugin-external-module-name": "git://github.com/PanayotCankov/typedoc-plugin-external-module-name.git#with-js", diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index e65bcbf73..126ceeecc 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -28,7 +28,7 @@ "dependencies": { "reduce-css-calc": "^2.1.6", "tns-core-modules-widgets": "next", - "tslib": "^1.9.3" + "tslib": "1.10.0" }, "devDependencies": { "@types/node": "~7.0.5", From 20c07731b3d87c41a50f77de0a9a5c228bffce1e Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 10 Sep 2019 18:41:13 +0300 Subject: [PATCH 10/12] fix(css-calc): reduce_css_calc_1.default is not a function (#7787) (#7801) --- tns-core-modules/ui/core/properties/properties.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tns-core-modules/ui/core/properties/properties.ts b/tns-core-modules/ui/core/properties/properties.ts index b79a611fb..527d100bc 100644 --- a/tns-core-modules/ui/core/properties/properties.ts +++ b/tns-core-modules/ui/core/properties/properties.ts @@ -1,4 +1,4 @@ -import reduceCSSCalc from "reduce-css-calc"; +import * as reduceCSSCalc from "reduce-css-calc"; // Definitions. import * as definitions from "../view-base"; From a8680f07610e3ad44ef223858a0f2fa7204cf168 Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Wed, 11 Sep 2019 15:58:59 +0300 Subject: [PATCH 11/12] release: cut the 6.1.1 release (#7808) * release: cut the 6.1.1 release --- CHANGELOG.md | 10 ++++++++++ tns-core-modules/package.json | 2 +- tns-platform-declarations/package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1acc36b75..e511bdab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [6.1.1](https://github.com/NativeScript/NativeScript/compare/6.1.0...6.1.1) (2019-09-11) + + +### Bug Fixes + +* **android-list-picker:** NoSuchFieldException on api29 ([#7790](https://github.com/NativeScript/NativeScript/issues/7790)) ([997d6de](https://github.com/NativeScript/NativeScript/commit/997d6de)) +* **css-calc:** reduce_css_calc_1.default is not a function ([#7787](https://github.com/NativeScript/NativeScript/issues/7787)) ([#7801](https://github.com/NativeScript/NativeScript/issues/7801)) ([20c0773](https://github.com/NativeScript/NativeScript/commit/20c0773)) + + + # [6.1.0](https://github.com/NativeScript/NativeScript/compare/6.0.7...6.1.0) (2019-09-02) diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 126ceeecc..9c763fb59 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -1,7 +1,7 @@ { "name": "tns-core-modules", "description": "Telerik NativeScript Core Modules", - "version": "6.1.0", + "version": "6.1.1", "homepage": "https://www.nativescript.org", "repository": { "type": "git", diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index 920aef4da..83ee96fc8 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "6.1.0", + "version": "6.1.1", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": { From 25046c7f94ec76bac8f34b040547782e6150ab8f Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Wed, 18 Sep 2019 01:05:39 +0300 Subject: [PATCH 12/12] chore: remove grunt and update build scripts (#7838) * chore: prepare and pack scripts * chore: update @types/node dep * chore: remove prepare-dist command from pack-dist --- build/clear-private-definitions.js | 51 +++ build/create-release-changelog-pr.js | 18 - build/pack-dist.sh | 19 + build/prepare-dist.sh | 69 ++++ build/run-testsapp.grunt.js | 354 ------------------ package.json | 20 +- tns-core-modules-widgets/LICENSE | 201 ---------- tns-core-modules-widgets/build.sh | 4 +- tns-core-modules/LICENSE | 201 ---------- tns-core-modules/package.json | 2 +- tns-core-modules/tsconfig.json | 33 ++ .../frame/transition-definitions.android.d.ts | 1 + tns-platform-declarations/tsconfig.json | 21 +- 13 files changed, 206 insertions(+), 788 deletions(-) create mode 100644 build/clear-private-definitions.js delete mode 100644 build/create-release-changelog-pr.js create mode 100755 build/pack-dist.sh create mode 100755 build/prepare-dist.sh delete mode 100644 build/run-testsapp.grunt.js delete mode 100755 tns-core-modules-widgets/LICENSE delete mode 100755 tns-core-modules/LICENSE create mode 100644 tns-core-modules/tsconfig.json diff --git a/build/clear-private-definitions.js b/build/clear-private-definitions.js new file mode 100644 index 000000000..a8a5cabbd --- /dev/null +++ b/build/clear-private-definitions.js @@ -0,0 +1,51 @@ +const path = require("path"); +const fs = require("fs"); +const readdirp = require("readdirp"); + +const inputFolder = path.resolve(process.argv[2]); + +console.log(`Clearing private definitions in ${inputFolder}`); + +function filterTypeScriptFiles(content) { + var leadingPrivate = /^.*@private/ig; + if (leadingPrivate.test(content)) { + return { shouldDelete: true }; + } + + let blockCommentPrivate = /\/\*\*([^](?!\*\/))*@module([^](?!\*\/))*@private[^]*?\*\//g; + if (blockCommentPrivate.test(content)) { + return { shouldDelete: true }; + } + + let newContent = content; + newContent = newContent.replace(/\/\/[\/\s]*@private[^]*?\/\/[\/\s]*?@endprivate/gm, ""); + + if (newContent !== content) { + return { shouldReplace: true, newContent: newContent }; + } + + return { shouldReplace: false, shouldDelete: false }; +}; + +readdirp(inputFolder, { + fileFilter: ["*.d.ts"], + directoryFilter: function (di) { return !di.path.includes("node_modules"); } +}).on("data", (entry) => { + const { fullPath } = entry; + const content = fs.readFileSync(fullPath, "utf8"); + const { shouldDelete, shouldReplace, newContent } = filterTypeScriptFiles(content); + + if (shouldDelete) { + console.log("[Delete]", fullPath) + fs.unlinkSync(fullPath); + } else if (shouldReplace) { + console.log("[Cleared]", fullPath) + fs.writeFileSync(fullPath, newContent, "utf8", (err) => { + console.log("ERROR writing file: " + fullPath, error); + }) + } +}) + .on("warn", error => console.error("non-fatal error", error)) + .on("error", error => console.error("fatal error", error)) + .on("end", () => console.log("done")); + diff --git a/build/create-release-changelog-pr.js b/build/create-release-changelog-pr.js deleted file mode 100644 index 409f46dda..000000000 --- a/build/create-release-changelog-pr.js +++ /dev/null @@ -1,18 +0,0 @@ -const { readFileSync } = require("fs"); -const { resolve } = require("path"); -const { createPR, argsParser, gitBranch } = require("./pr-helper"); - -const currentBranch = argsParser().currentBranch || gitBranch; -const modulesPackageVersion = argsParser().packageVersion || JSON.parse(readFileSync(resolve(process.cwd(), "tns-core-modules/package.json")).toString()).version; -const title = argsParser().title || `release: cut the ${modulesPackageVersion} release`; -const baseBranch = argsParser().base || "release"; -const body = argsParser().body || "docs: update changelog"; - -const postQuery = { - "body": body, - "head": currentBranch, - "base": baseBranch, - "title": title -} - -createPR(postQuery); \ No newline at end of file diff --git a/build/pack-dist.sh b/build/pack-dist.sh new file mode 100755 index 000000000..cc6685a86 --- /dev/null +++ b/build/pack-dist.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -x +set -e + +DIST=dist; +ROOT_DIR=$(cd `dirname $0` && pwd)/..; +cd "$ROOT_DIR" + +( + cd "$DIST/tns-platform-declarations" + TGZ="$(npm pack)" + mv "$TGZ" "../$TGZ" +) + +( + cd "$DIST/tns-core-modules" + TGZ="$(npm pack)" + mv "$TGZ" "../$TGZ" +) \ No newline at end of file diff --git a/build/prepare-dist.sh b/build/prepare-dist.sh new file mode 100755 index 000000000..7f7c08fcc --- /dev/null +++ b/build/prepare-dist.sh @@ -0,0 +1,69 @@ +#!/bin/bash +set -x +set -e + +DIST=dist; +ROOT_DIR=$(cd `dirname $0` && pwd)/..; +cd "$ROOT_DIR" + +mkdir -p "$DIST" + +## NPM INSTALL +( + echo "NPM install in root of the repo" + cd "$ROOT_DIR" + npm install +) + +## Prepare Platfrom Declarations +( + PACKAGE=tns-platform-declarations; + + echo "Clearing $DIST/$PACKAGE" + npx rimraf "$DIST/$PACKAGE" + npx rimraf "$DIST/$PACKAGE*.tgz" + + echo "Copying $PACKAGE $DIST/$PACKAGE..." + npx ncp "$PACKAGE" "$DIST/$PACKAGE" + + echo "Copying README and LICENSE to $DIST/$PACKAGE" + npx ncp LICENSE "$DIST/$PACKAGE"/LICENSE + + cd "$DIST/$PACKAGE" + + echo 'Running npm install...' + npm install + + echo 'Running npm test...' + npm test +) + +## Prepare Core Modules +( + PACKAGE=tns-core-modules; + + echo "Clearing $DIST/$PACKAGE" + npx rimraf "$DIST/$PACKAGE" + npx rimraf "$DIST/$PACKAGE*.tgz" + + echo "Copying $PACKAGE $DIST/$PACKAGE..." + npx ncp "$PACKAGE" "$DIST/$PACKAGE" + + echo "Cleaning inner readme.md-s ..." + npx rimraf "$DIST/$PACKAGE/**/README.md" + npx rimraf "$DIST/$PACKAGE/**/Readme.md" + + echo "Copying README and LICENSE to $DIST/$PACKAGE" + npx ncp LICENSE "$DIST"/"$PACKAGE"/LICENSE + npx ncp README.md "$DIST"/"$PACKAGE"/README.md + + ( + echo 'TypeScript transpile...' + cd "$DIST/$PACKAGE" + npm install + npx tsc + ) + + echo "Clearing typescript definitions from private APIs..." + node build/clear-private-definitions "$DIST/$PACKAGE" +) diff --git a/build/run-testsapp.grunt.js b/build/run-testsapp.grunt.js deleted file mode 100644 index 533a58462..000000000 --- a/build/run-testsapp.grunt.js +++ /dev/null @@ -1,354 +0,0 @@ -module.exports = { - - run: function(grunt) { - var pathModule = require("path"); - - var modulesPackageConfig = grunt.file.readJSON('package.json'); - - //Construct and validate the arguments - var args = { - platform: grunt.option("platform"), - modulesPath: grunt.option("modulesPath"), - tnsPath: grunt.option("tnsPath"), - emulatorProcessIdentifier: grunt.option("emuPId"), - emuAvdName: grunt.option("avd"), - outFile: grunt.option("logFilePath"), - runtimePath: grunt.option("runtimePath"), - runtimeVersion: grunt.option("runtimeVersion"), - showEmu: grunt.option("showEmu"), - runAppOnly: grunt.option("runAppOnly"), - pathToApp: grunt.option("pathToApp") - }; - - (function validateInput(){ - if (!(/^(Android|iOS)$/).test(args.platform)) { - throw new Error("Invalid target platform specified! Use --platform=Android|iOS"); - } - - if (args.platform === "Android") { - if (!args.emulatorProcessIdentifier) { - throw new Error("Please, specify an identifier of the emulator process so that it can be stopped (--emuPId=...). Too many emulators started might cause machine overload"); - } - if (!args.emuAvdName) { - throw new Error("Please, specify the name of the AVD to start (--avd=...)."); - } - } - - if (args.runAppOnly && !args.pathToApp) { - throw new Error("runAppOnly called, but no path to application specified. Please, add the path via the (--pathToApp=...) parameter."); - } - }()); - - var localCfg = { - tnsPath: args.tnsPath || "tns", - emulatorProcessIdentifier: args.emulatorProcessIdentifier, - modulesPath: args.modulesPath || "./bin/dist/tns-core-modules-" + modulesPackageConfig.version + ".tgz", - emuAvdName: args.emuAvdName, - outFile: args.outFile || "./TestRunResult.txt", - frameworkArgument: args.runtimePath ? " --frameworkPath=" + args.runtimePath : "", - runtimeVersionArgument: args.runtimeVersion ? "@" + args.runtimeVersion : "", - showEmu: args.showEmu || false, - runAppOnly: args.runAppOnly || false, - - workingDir:".testsapprun", - testsAppName:"TestsApp", - tnsCoreModulesSource: pathModule.resolve("./tns-core-modules"), - applicationDir: pathModule.join(".testsapprun", "TestsApp"), - appDir: pathModule.join(".testsapprun", "TestsApp", "app"), - pathToApk: "./platforms/android/build/outputs/apk/TestsApp-debug.apk", - pathToApp: "./platforms/ios/build/emulator/TestsApp.app", - deployedAppName:"org.nativescript.TestsApp", - mainActivityName:"com.tns.NativeScriptActivity", - pathToCompiledTests: "bin/dist/tests/app", - simulatorSysLog: pathModule.join(process.env.HOME, "Library/Logs/CoreSimulator", args.emuAvdName, "/system.log"), - platform: args.platform - } - - if (localCfg.runAppOnly) { - localCfg.pathToApp = localCfg.pathToApk = args.pathToApp; - localCfg.applicationDir = "./"; - } - - grunt.initConfig({ - clean: { - workingDir: { - src: localCfg.workingDir - }, - originalAppDir: { - src: [ - localCfg.appDir + "/*", - "!" + pathModule.join(localCfg.appDir, "App_Resources") + "" - ] - }, - modules: { - src: pathModule.join(localCfg.applicationDir, "node_modules", "tns-core-modules") - }, - tempExtractedModules: { - src: pathModule.join(localCfg.applicationDir, "node_modules", "package") - }, - simulatorLog: { - src: localCfg.simulatorSysLog, - options: { - force: true - } - } - }, - mkdir: { - workingDir: { - options: { - create: [localCfg.workingDir], - mode: 0700 - } - } - }, - copy: { - testsAppToRunDir: { - src: "**/*.*", - dest: localCfg.appDir, - cwd: localCfg.pathToCompiledTests, - expand: true - }, - modulesToDir: { - expand: true, - src: "**/*.*", - cwd: pathModule.join(localCfg.applicationDir, "node_modules", "package"), - dest: pathModule.join(localCfg.applicationDir, "node_modules", "tns-core-modules") - }, - addAndroidPermissions: { - src: "AndroidManifest.xml", - dest: localCfg.applicationDir + "/app/App_Resources/Android/", - cwd: localCfg.applicationDir + "/app/App_Resources/Android", - expand: true, - options: { - process: function(content, srcPath) { - var newContent = content; - - var internetPermissionFinder = /((\s*)]*android\.permission\.INTERNET[^>]*>)/; - - if (!/uses-permission[^>]*android\.permission\.ACCESS_NETWORK_STATE/.test(content)) { - newContent = newContent.replace(internetPermissionFinder, "$1$2"); - } - if (!/uses-permission[^>]*android\.permission\.ACCESS_FINE_LOCATION/.test(content)) { - newContent = newContent.replace(internetPermissionFinder, "$1$2"); - } - return newContent; - } - } - }, - addiOSPermissions: { - src: localCfg.testsAppName + "-Info.plist", - dest: pathModule.join(localCfg.applicationDir,"/platforms/ios/", localCfg.testsAppName) + "/", - cwd: pathModule.join(localCfg.applicationDir,"/platforms/ios/", localCfg.testsAppName), - expand: true, - options: { - process: function(content, srcPath) { - var newContent = content; - - var lastDictLocator = /(<\/dict>\s*<\/plist>)$/gm; - - if (!/NSAppTransportSecurity/.test(content)) { - newContent = newContent.replace(lastDictLocator, "NSAppTransportSecurity\n$1"); - } - if (!/NSAllowsArbitraryLoads/.test(content)) { - newContent = newContent.replace(lastDictLocator, "\nNSAllowsArbitraryLoads\n\n\n$1"); - } - return newContent; - } - } - }, - simulatorLog: { - src: localCfg.simulatorSysLog, - dest: localCfg.outFile - } - }, - exec: { - killAndroidEmulator: { - cmd: "pkill '" + localCfg.emulatorProcessIdentifier + "'", - exitCode: [0, 1] - }, - killiOSEmulator: { - cmd: "pkill Simulator", - exitCode: [0, 1] - }, - createApp: { - cmd: localCfg.tnsPath + " create " + localCfg.testsAppName, - cwd: localCfg.workingDir - }, - restartAdb: { - cmd: "adb kill-server && adb start-server" - }, - uninstallExistingAndroidApp: { - cmd: "adb uninstall " + localCfg.deployedAppName - }, - installNewAndroidApp: { - cmd: "adb install " + localCfg.pathToApk, - cwd: localCfg.applicationDir - }, - startAndroidEmulator: { - cmd: "emulator -avd " + localCfg.emuAvdName + " -no-audio " + (args.showEmu ? "" : "-no-window") + "&" - }, - startAndroidApp: { - cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName - }, - uninstallExistingiOSApp: { - cmd: "xcrun simctl uninstall " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName, - cwd: localCfg.applicationDir - }, - installNewiOSApp: { - cmd: "xcrun simctl install " + localCfg.emuAvdName + " " + localCfg.pathToApp, - cwd: localCfg.applicationDir - }, - startiOSApp: { - cmd: "xcrun simctl launch " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName - }, - "npm-i-modules": { - cmd: "npm i " + pathModule.relative(localCfg.applicationDir, localCfg.modulesPath), - cwd: localCfg.applicationDir - }, - "npm-i-widgets": { - cmd: "npm i tns-core-modules-widgets@next", - cwd: localCfg.applicationDir - } - }, - shell: { - collectAndroidLog: { - command: "./expect.exp " + "'adb logcat *:D' " + localCfg.outFile, - options: { - execOptions: { - maxBuffer: Infinity - } - } - }, - waitiOSLogCompletion: { - command: "./expect.exp " + "'tail -f " + localCfg.simulatorSysLog + "' " + localCfg.outFile, - options: { - execOptions: { - maxBuffer: Infinity - } - } - }, - startiOSSimulator: { - command: "xcrun instruments -w " + localCfg.emuAvdName, - options: { - failOnError: false - }, - }, - buildApp: { - command: "tns build " + localCfg.platform.toLowerCase(), - options: { - execOptions: { - maxBuffer: Infinity, - cwd: localCfg.applicationDir - } - } - }, - addPlatform: { - command: "tns platform add " + localCfg.platform.toLowerCase() + localCfg.runtimeVersionArgument + " " + localCfg.frameworkArgument, - options: { - execOptions: { - maxBuffer: Infinity, - cwd: localCfg.applicationDir - } - } - }, - } - }); - - grunt.loadNpmTasks("grunt-shell"); - grunt.loadNpmTasks("grunt-exec"); - grunt.loadNpmTasks("grunt-mkdir"); - grunt.loadNpmTasks("grunt-contrib-clean"); - grunt.loadNpmTasks("grunt-contrib-copy"); - - var getPlatformSpecificTask = function(templatedTaskName) { - return templatedTaskName.replace(/\{platform\}/, localCfg.platform); - } - - grunt.registerTask("startEmulatorAndroid", [ - getPlatformSpecificTask("exec:startAndroidEmulator"), - ]); - - grunt.registerTask("startEmulatoriOS", [ - getPlatformSpecificTask("shell:startiOSSimulator"), - ]); - - grunt.registerTask("collectLogAndroid", [ - "shell:collectAndroidLog" - ]); - - grunt.registerTask("collectLogiOS", [ - "shell:waitiOSLogCompletion", - "copy:simulatorLog" - ]); - - grunt.registerTask("doPreUninstallAppAndroid", [ - "exec:restartAdb" - ]); - - grunt.registerTask("doPreUninstallAppiOS", [ - "clean:simulatorLog" - ]); - - grunt.registerTask("cleanup", [ -// getPlatformSpecificTask("exec:kill{platform}Emulator"), - "clean:workingDir" - ]); - - grunt.registerTask("buildOnly", [ - "exec:createApp", - "clean:originalAppDir", - "copy:testsAppToRunDir", - "clean:modules", - "exec:npm-i-modules", - "exec:npm-i-widgets", - "copy:modulesToDir", - "clean:tempExtractedModules", - - "shell:addPlatform", - getPlatformSpecificTask("copy:add{platform}Permissions"), - "shell:buildApp", - ]); - - grunt.registerTask("buildTestsApp", [ - "cleanup", - "mkdir:workingDir", - "buildOnly" - - ]); - grunt.registerTask("buildOnlyTestsApp", ["buildTestsApp"]); - - grunt.registerTask("runOnly", [ -// getPlatformSpecificTask("doPreUninstallApp{platform}"), - - getPlatformSpecificTask("exec:uninstallExisting{platform}App"), - getPlatformSpecificTask("exec:installNew{platform}App"), - getPlatformSpecificTask("exec:start{platform}App"), - getPlatformSpecificTask("collectLog{platform}"), - ]); - - grunt.registerTask("runApp", [ -// "cleanup", -// getPlatformSpecificTask("startEmulator{platform}"), - "runOnly", - "cleanup" - - ]); - - grunt.registerTask("runOnlyTestsApp", ["runApp"]); - - - var tasksToExecute = ["runApp"]; - if (!localCfg.runAppOnly) { - tasksToExecute = [ - "cleanup", - "mkdir:workingDir", - getPlatformSpecificTask("startEmulator{platform}"), - "buildOnly", - "runOnly", - "cleanup" - ]; - } - - grunt.registerTask("testsapp", tasksToExecute); - } -} diff --git a/package.json b/package.json index 3c57d4ab9..fad67c4ed 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "devDependencies": { "@types/chai": "^4.0.4", "@types/mocha": "^2.2.42", - "@types/node": "^7.0.5", + "@types/node": "~10.12.18", "chai": "^4.1.2", "concurrently": "^2.1.0", "css": "^2.2.1", @@ -32,9 +32,12 @@ "mocha-typescript": "^1.1.9", "module-alias": "^2.0.1", "nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master", + "ncp": "^2.0.0", "parse-css": "git+https://github.com/tabatkins/parse-css.git", "parserlib": "^1.1.1", + "readdirp": "^3.1.2", "reduce-css-calc": "^2.1.6", + "rimraf": "^2.5.0", "shady-css-parser": "^0.1.0", "shelljs": "^0.7.0", "source-map-support": "^0.4.17", @@ -46,8 +49,7 @@ "typescript": "^3.1.6" }, "scripts": { - "setup": "", - "setup-widgets": "( cd tns-core-modules-widgets && sh build.sh ) && npm run dev-link-tns-core-modules-widgets", + "setup-widgets": "(cd tns-core-modules-widgets && sh build.sh) && npm run dev-link-tns-core-modules-widgets", "tsc": "node --max_old_space_size=4096 ./node_modules/typescript/bin/tsc", "ci": "tsc && npm run tslint && npm run ci-apps && npm run ci-e2e && npm run ci-tests", "ci-apps": "cd apps && npm i ../tns-core-modules ../tns-platform-declarations --save", @@ -56,7 +58,7 @@ "unit-test": "tsc -p tsconfig.unit-tests.json && mocha --opts unit-tests/mocha.opts", "unit-test-watch": "mocha-typescript-watch -p tsconfig.unit-tests.json --opts unit-tests/mocha.opts", "compile-all": "npm run tsc -- -p tsconfig.json --outDir bin/dist", - "compile-modules": "npm run tsc -- -p tsconfig.modules.json --outDir bin/dist", + "compile-modules": "npm run tsc -- -p tsconfig.modules.json", "compile-check-base-dts": "npm run tsc -- -p tsconfig.base-dts.json", "compile-unit-tests": "npm run tsc -- -p tsconfig.unit-tests.json --outDir bin/dist/unit-tests", "compile-check-combined-dts": "npm run tsc -- -p tsconfig.combined-dts.json", @@ -67,20 +69,16 @@ "dev-tsc-e2e": "npm run tsc -- -p e2e", "dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run tsc && npm run dev-tsc-tests && npm run dev-tsc-apps && && npm run dev-tsc-e2e", "dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd tns-core-modules && npm i ../tns-core-modules-widgets/dist/package --save)", - "dev-declarations": "npm run setup && rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests", + "dev-declarations": "rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests", "test": "npm run test-android && npm run test-ios", - "pretest": "npm run setup && npm run tsc", "test-android": "tns run android --path tests --justlaunch --no-watch", "test-ios": "tns run ios --path tests --justlaunch --no-watch", "test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run android --path tests --watch\"", "test-watch-ios": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run ios --path tests --watch\"", "typedoc": "typedoc --tsconfig tsconfig.typedoc.json --out bin/dist/apiref --includeDeclarations --name NativeScript --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module).d.ts\"", "dev-typedoc": "npm run typedoc && cd bin/dist/apiref && npx http-server", - "test-tsc-es2016": "npm run tsc -- -p tsconfig.public.es2016.json", "tslint": "tslint --project tsconfig.tslint.json --config build/tslint.json", - "madge-ios": "tsc --skipLibCheck && tns prepare ios --path tests && madge --circular tests/platforms/ios/tests/app/tns_modules/tns-core-modules", - "madge-ios-image": "tsc --skipLibCheck && tns prepare ios --path tests && madge --image graph-tests-ios.svg tests/platforms/ios/tests/app/tns_modules/tns-core-modules", - "madge-android": "tsc --skipLibCheck && tns prepare android --path tests && madge --circular tests/platforms/android/app/src/main/assets/app/tns_modules/tns-core-modules", - "madge-android-image": "tsc --skipLibCheck && tns prepare android --path tests && madge --image graph-tests-android.svg tests/platforms/android/app/src/main/assets/app/tns_modules/tns-core-modules" + "prepare-dist": "bash ./build/prepare-dist.sh", + "pack-dist": "bash ./build/pack-dist.sh" } } diff --git a/tns-core-modules-widgets/LICENSE b/tns-core-modules-widgets/LICENSE deleted file mode 100755 index 061c44028..000000000 --- a/tns-core-modules-widgets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright (c) 2015-2019 Progress Software Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/tns-core-modules-widgets/build.sh b/tns-core-modules-widgets/build.sh index d1d2ec1a7..c4ede3f23 100755 --- a/tns-core-modules-widgets/build.sh +++ b/tns-core-modules-widgets/build.sh @@ -15,7 +15,9 @@ export SKIP_PACK=true ./build.ios.sh echo "Copy NPM artefacts" -cp .npmignore LICENSE README.md package.json dist/package +cp .npmignore README.md package.json dist/package +cp ../LICENSE dist/package + if [ "$1" ] then diff --git a/tns-core-modules/LICENSE b/tns-core-modules/LICENSE deleted file mode 100755 index ef8add3b4..000000000 --- a/tns-core-modules/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright (c) 2015-2019 Progress Software Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 9c763fb59..8ee9d95f3 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -31,7 +31,7 @@ "tslib": "1.10.0" }, "devDependencies": { - "@types/node": "~7.0.5", + "@types/node": "~10.12.18", "tns-platform-declarations": "next" }, "scripts": { diff --git a/tns-core-modules/tsconfig.json b/tns-core-modules/tsconfig.json new file mode 100644 index 000000000..631dd8b0d --- /dev/null +++ b/tns-core-modules/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "noEmitOnError": false, + "noEmitHelpers": true, + "target": "es5", + "module": "commonjs", + "declaration": false, + "noImplicitAny": false, + "noImplicitUseStrict": true, + "removeComments": true, + "experimentalDecorators": true, + "diagnostics": true, + "sourceMap": true, + "lib": [ + "es6", "dom" + ], + "types": [ + "node", + "chai", + "mocha" + ], + "baseUrl": ".", + "paths": { + "tns-core-modules/*": ["*"] + } + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "tns-core-modules/node_modules/" + ] +} diff --git a/tns-core-modules/ui/frame/transition-definitions.android.d.ts b/tns-core-modules/ui/frame/transition-definitions.android.d.ts index 1a86939f2..5773d3a0a 100644 --- a/tns-core-modules/ui/frame/transition-definitions.android.d.ts +++ b/tns-core-modules/ui/frame/transition-definitions.android.d.ts @@ -1,4 +1,5 @@ /** + * @module "ui/frame/transition-definitions.android * @private */ /** */ diff --git a/tns-platform-declarations/tsconfig.json b/tns-platform-declarations/tsconfig.json index ab70b0477..ad84e06bf 100644 --- a/tns-platform-declarations/tsconfig.json +++ b/tns-platform-declarations/tsconfig.json @@ -1,5 +1,24 @@ { - "extends": "../tsconfig.shared", + "compilerOptions": { + "noEmitOnError": false, + "noEmitHelpers": true, + "target": "es5", + "module": "commonjs", + "declaration": false, + "noImplicitAny": false, + "noImplicitUseStrict": true, + "removeComments": true, + "experimentalDecorators": true, + "diagnostics": true, + "sourceMap": true, + "lib": [ + "es6", "dom" + ], + "baseUrl": ".", + "paths": { + "tns-core-modules/*": ["tns-core-modules/*"] + } + }, "exclude": [ "android-*.d.ts", "android/android-*.d.ts",