diff --git a/.eslintrc.json b/.eslintrc.json index 6921290df..3cbbb9c6d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,57 +1,13 @@ { - "root": true, - "ignorePatterns": ["**/*"], - "plugins": ["@nrwl/nx"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "extends": ["plugin:prettier/recommended"], - "parserOptions": { - "project": ["packages/core/tsconfig.json", "packages/webpack/tsconfig.json"] - }, - "plugins": ["prettier"], - "rules": { - "prettier/prettier": "warn", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/triple-slash-reference": "off", - "no-prototype-builtins": "off", - "no-inner-declarations": "off", - "no-constant-condition": "off", - "no-useless-escape": "off", - "@nrwl/nx/enforce-module-boundaries": [ - "error", - { - "enforceBuildableLibDependency": true, - "allow": [], - "depConstraints": [ - { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] - } - ] - } - ] - } - }, - { - "files": ["*.ts", "*.tsx"], - "extends": ["plugin:@nrwl/nx/typescript"], - "parserOptions": { - "project": "./tsconfig.*?.json" - }, - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "extends": ["plugin:@nrwl/nx/javascript"], - "rules": {} - } - ] + "parser": "@typescript-eslint/parser", + "parserOptions": { + "sourceType": "module", + "ecmaVersion": 2015 + }, + "plugins": ["@nativescript"], + "rules": { + "@nativescript/no-nativescript-angular-imports": "warn", + "@nativescript/no-tns-core-modules-imports": "warn", + "@nativescript/no-duplicate-ns-imports": "warn" + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index aef8770c0..481c3314f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,79 @@ +## [8.0.1](https://github.com/NativeScript/NativeScript/compare/8.0.0-core...8.0.1) (2021-04-07) + + +### Bug Fixes + +* **android:** accessibility crash on View not extending android.view.View ([#9303](https://github.com/NativeScript/NativeScript/issues/9303)) ([fde666d](https://github.com/NativeScript/NativeScript/commit/fde666de28ae58cd00cae6ce37705427b579a58f)) +* **android:** crash on slide transition ([#9289](https://github.com/NativeScript/NativeScript/issues/9289)) ([e73cebf](https://github.com/NativeScript/NativeScript/commit/e73cebf7650474cb71de4a17576860a3499f9c05)) +* **core:** Enums deprecation adjustment ([#9306](https://github.com/NativeScript/NativeScript/issues/9306)) ([f42acd8](https://github.com/NativeScript/NativeScript/commit/f42acd817f5353f86ba353ff483ff8d0e7bf7a61)) + + + +# [8.0.0](https://github.com/NativeScript/NativeScript/compare/7.3.0-core...8.0.0) (2021-04-06) + + +### Bug Fixes + +* **color:** support web standard #rrggbbaa format ([aaeab99](https://github.com/NativeScript/NativeScript/commit/aaeab990c8f73d206bf19e1c918ec45e30d9e3a5)), closes [#ff00ff00](https://github.com/NativeScript/NativeScript/issues/ff00ff00) [#ff00ff00](https://github.com/NativeScript/NativeScript/issues/ff00ff00) [#00ff00](https://github.com/NativeScript/NativeScript/issues/00ff00) [#00ff00](https://github.com/NativeScript/NativeScript/issues/00ff00) +* **core:** stack layout padding ([#9183](https://github.com/NativeScript/NativeScript/issues/9183)) ([a12c188](https://github.com/NativeScript/NativeScript/commit/a12c188d0fa752f35be3daeafd14099e8589d815)), closes [#8810](https://github.com/NativeScript/NativeScript/issues/8810) +* **core:** trace instead of throw ([cc592b6](https://github.com/NativeScript/NativeScript/commit/cc592b63fddda324755f8abc0e0c4029a7dbeb22)) +* **layouts:** rootlayout not closing when no shadecover transition specified ([#9278](https://github.com/NativeScript/NativeScript/issues/9278)) ([3c569ef](https://github.com/NativeScript/NativeScript/commit/3c569effedbc593e845c42bd396ff68a0d72171d)) +* move BottomNavigation and Tabs to [@nativescript-community](https://github.com/nativescript-community) ([e62acba](https://github.com/NativeScript/NativeScript/commit/e62acba79243a91da6a0e915b47751daac3c985e)) +* safeguards against invalid values ([f5db584](https://github.com/NativeScript/NativeScript/commit/f5db58414a7d5ab7052c5fbd94a602fd870826b4)) +* **core:** type collisions with namespace ([#8809](https://github.com/NativeScript/NativeScript/issues/8809)) ([7330509](https://github.com/NativeScript/NativeScript/commit/733050995c5b28692e11c3bc122430c8634e29d4)) +* **ios:** gesture touch event coordinates improvements ([#8998](https://github.com/NativeScript/NativeScript/issues/8998)) ([d46f956](https://github.com/NativeScript/NativeScript/commit/d46f9562b4cb5a6f31c0afd4b63ff640583193c3)) + + +### Features + +* **observable-array:** findIndex now supported ([770030e](https://github.com/NativeScript/NativeScript/commit/770030e7f61cd5006c67994051d4bfad5ce6c502)) +* **view:** "hidden" property binding is now supported ([f00144e](https://github.com/NativeScript/NativeScript/commit/f00144e872c908f98949e0173db778ccec8fdcf0)) +* implement BoxShadowDrawable ([9a7d3ec](https://github.com/NativeScript/NativeScript/commit/9a7d3ecb34887fffa572ce105ebc23bf21ba11ec)) +* implement spreadRadius ([fca3466](https://github.com/NativeScript/NativeScript/commit/fca3466408f282d2763d4501b8489ece54d29905)) +* improved css-shadow parser ([d2f50e5](https://github.com/NativeScript/NativeScript/commit/d2f50e50bba6e3b11fee14fa2f64034f02f8672f)) +* **core:** box shadow demo ([#9182](https://github.com/NativeScript/NativeScript/issues/9182)) ([3bd2d96](https://github.com/NativeScript/NativeScript/commit/3bd2d96f296b57a1b7bedc48530e55c15f963ac2)) +* **core:** box-shadow support ([#9161](https://github.com/NativeScript/NativeScript/issues/9161)) ([67e2fe4](https://github.com/NativeScript/NativeScript/commit/67e2fe42b7dc8fcc907c40d8c27a08e1e6d3e683)) +* **core:** convenient color utilities ([#9066](https://github.com/NativeScript/NativeScript/issues/9066)) ([304633d](https://github.com/NativeScript/NativeScript/commit/304633d6b26e8181bdd052300e40f138c09ebddc)) +* **core:** first class a11y support ([#8909](https://github.com/NativeScript/NativeScript/issues/8909)) ([d5a8a25](https://github.com/NativeScript/NativeScript/commit/d5a8a25aba1ee38b62c7cf424047a5c65e3bd9e1)) +* **core:** reusable views ([#9163](https://github.com/NativeScript/NativeScript/issues/9163)) ([6cc130f](https://github.com/NativeScript/NativeScript/commit/6cc130fa6f9a716789e00e64f92a5b09dba7f358)) +* **core:** RootLayout with api to fluidly handle dynamic layers ([#8980](https://github.com/NativeScript/NativeScript/issues/8980)) ([a90609a](https://github.com/NativeScript/NativeScript/commit/a90609a670ebbdfda7f31bea0e42e7de93875e69)) +* **core:** text-shadow support ([#8991](https://github.com/NativeScript/NativeScript/issues/8991)) ([a6b1bde](https://github.com/NativeScript/NativeScript/commit/a6b1bde655aff61ac1afa682672026817971c2a5)) + +### BREAKING CHANGES + +* **core:** `BottomNavigation` and `Tabs` moved to `@nativescript-community` + +If using `BottomNavigation`, just install `@nativescript-community/ui-material-bottom-navigation` and update your imports to use it. + +If using `Tabs`, just install `@nativescript-community/ui-material-tabs` and update your imports to use it. + +* **core:** support web standard #rrggbbaa format + +BEFORE: + +``` +// #aarrggbb + +const color = new Color('#ff00ff00'); + +Label { + background-color: #ff00ff00; +} +``` + +AFTER: + +``` +// #rrggbbaa + +const color = new Color('#00ff00ff'); + +Label { + background-color: #00ff00ff; +} +``` + + # [7.3.0](https://github.com/NativeScript/NativeScript/compare/7.2.2-core...7.3.0) (2021-02-27) diff --git a/README.md b/README.md index 422774c96..3effe82f8 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,9 @@ [NativeScript](http://www.nativescript.org) empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile development and can be utilized in a number of diverse use cases. -## Getting Started and Installation +## Setup and Installation -Our Getting Started Guides are hands-on tutorials that walk you through developing with NativeScript: - -* [Get started with JavaScript](http://docs.nativescript.org/tutorial/chapter-0) -* [Get started with TypeScript and Angular](http://docs.nativescript.org/angular/tutorial/ng-chapter-0) +* [Environment Setup](https://docs.nativescript.org/environment-setup.html) ## Contribute @@ -29,7 +26,7 @@ $ npm run setup $ npm start ``` -We love you and PR's 🤗 Please follow our [contributing guide](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md) and see [our code of governance](https://nativescript.org/governance/) to become as involved as you want to be. +We love you and PR's 🤗 Please follow our [contributing guide](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md) and see [our code of governance](https://github.com/NativeScript/management/blob/master/nativescript-governance.md) to become as involved as you want to be. ## @nativescript/* @@ -49,15 +46,11 @@ We love you and PR's 🤗 Please follow our [contributing guide](https://github. ## Quick Links - [NativeScript home page](https://nativescript.org) -- [Install NativeScript demo mobile app](https://www.nativescript.org/nativescript-example-application) - [NativeScript playground](https://play.nativescript.org) - [NativeScript and Angular](https://play.nativescript.org/?template=play-ng&tutorial=getting-started-ng) - [NativeScript on Twitter](http://twitter.com/NativeScript) -- [NativeScript community Slack channel](https://www.nativescript.org/slack-invitation-form) - [NativeScript on Stack Overflow](http://stackoverflow.com/questions/tagged/nativescript) - [NativeScript documentation](https://docs.nativescript.org/) -- [NativeScript marketplace](https://market.nativescript.org/) -- [NativeScript roadmap](https://www.nativescript.org/roadmap) ## Other framework source repositories @@ -72,12 +65,10 @@ Outside of the source centralized in this repo, the NativeScript framework consi - **[CLI](//github.com/NativeScript/nativescript-cli)** - [![npm](https://img.shields.io/npm/dm/nativescript.svg)](https://www.npmjs.com/package/nativescript) - This repo contains the NativeScript command-line interface, which lets you create, build, and run apps using the NativeScript framework. The CLI is written in TypeScript. -- **[Docs](//github.com/NativeScript/docs)** +- **[Docs](//github.com/NativeScript/docs-new)** - [![Docs](https://img.shields.io/badge/Docs-NativeScript-brightgreen)](https://docs.nativescript.org/) - This repo contains the NativeScript framework documentation, which is available at . The docs are written in Markdown. -In addition to the code that makes up the NativeScript framework itself, we also provide a number of [open-source sample apps](https://www.nativescript.org/app-samples-with-code) from which you can take reference while building your NativeScript application. - ## License [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/NativeScript/NativeScript/blob/master/LICENSE) diff --git a/apps/automated/.npmrc b/apps/automated/.npmrc new file mode 100644 index 000000000..521a9f7c0 --- /dev/null +++ b/apps/automated/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true diff --git a/apps/automated/src/color/color-tests.ts b/apps/automated/src/color/color-tests.ts index 6f55c871e..5e8c455df 100644 --- a/apps/automated/src/color/color-tests.ts +++ b/apps/automated/src/color/color-tests.ts @@ -39,7 +39,7 @@ export var test_Argb_Color = function () { TKUnit.assertEqual(color.r, 255, 'Color.r not properly parsed'); TKUnit.assertEqual(color.g, 100, 'Color.g not properly parsed'); TKUnit.assertEqual(color.b, 100, 'Color.b not properly parsed'); - TKUnit.assertEqual(color.hex, '#64FF6464', 'Color.hex not properly parsed'); + TKUnit.assertEqual(color.hex, '#FF646464', 'Color.hex not properly parsed'); TKUnit.assertEqual(color.argb, 0x64ff6464, 'Color.argb not properly parsed'); }; @@ -86,6 +86,6 @@ export var test_rgba_Color_CSS = function () { TKUnit.assertEqual(color.r, 255, 'Color.r not properly parsed'); TKUnit.assertEqual(color.g, 100, 'Color.g not properly parsed'); TKUnit.assertEqual(color.b, 100, 'Color.b not properly parsed'); - TKUnit.assertEqual(color.hex, '#80FF6464', 'Color.hex not properly parsed'); + TKUnit.assertEqual(color.hex, '#FF646480', 'Color.hex not properly parsed'); TKUnit.assertEqual(color.argb, 0x80ff6464, 'Color.argb not properly parsed'); }; diff --git a/apps/automated/src/data/observable-tests.ts b/apps/automated/src/data/observable-tests.ts index 50fd2be07..5bfa1cefb 100644 --- a/apps/automated/src/data/observable-tests.ts +++ b/apps/automated/src/data/observable-tests.ts @@ -1,10 +1,9 @@ // >> observable-require -import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from '@nativescript/core'; +import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive, ObservableArray } from '@nativescript/core'; // << observable-require import * as TKUnit from '../tk-unit'; import * as types from '@nativescript/core/utils/types'; -import { ObservableArray } from '@nativescript/core'; var TESTED_NAME = 'tested'; class TestObservable extends Observable { diff --git a/apps/automated/src/name-resolvers-tests/qualifier-matcher-tests.ts b/apps/automated/src/name-resolvers-tests/qualifier-matcher-tests.ts index 979f2e897..f68e15914 100644 --- a/apps/automated/src/name-resolvers-tests/qualifier-matcher-tests.ts +++ b/apps/automated/src/name-resolvers-tests/qualifier-matcher-tests.ts @@ -1,39 +1,39 @@ import * as TKUnit from '../tk-unit'; -import * as enums from '@nativescript/core/ui/enums'; +import { CoreTypes } from '@nativescript/core'; import { findMatch, PlatformContext } from '@nativescript/core/module-name-resolver/qualifier-matcher'; export const androidPhonePortraitContext: PlatformContext = { width: 360, height: 640, - deviceType: enums.DeviceType.Phone, + deviceType: CoreTypes.DeviceType.Phone, os: 'android', }; export const androidPhoneLandscapeContext: PlatformContext = { width: 640, height: 360, - deviceType: enums.DeviceType.Phone, + deviceType: CoreTypes.DeviceType.Phone, os: 'android', }; export const androidTabletPortraitContext: PlatformContext = { width: 600, height: 960, - deviceType: enums.DeviceType.Tablet, + deviceType: CoreTypes.DeviceType.Tablet, os: 'android', }; export const iPhonePortraitContext: PlatformContext = { width: 320, height: 480, - deviceType: enums.DeviceType.Phone, + deviceType: CoreTypes.DeviceType.Phone, os: 'ios', }; export const iPhoneLandscapeContext: PlatformContext = { width: 480, height: 320, - deviceType: enums.DeviceType.Phone, + deviceType: CoreTypes.DeviceType.Phone, os: 'ios', }; diff --git a/apps/automated/src/navigation/navigation-tests.ts b/apps/automated/src/navigation/navigation-tests.ts index b80ef3141..62d943b54 100644 --- a/apps/automated/src/navigation/navigation-tests.ts +++ b/apps/automated/src/navigation/navigation-tests.ts @@ -1,8 +1,5 @@ import * as TKUnit from '../tk-unit'; -import { EventData, Page, NavigatedData } from '@nativescript/core'; -import { Frame, NavigationTransition } from '@nativescript/core/ui/frame'; -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import { Color } from '@nativescript/core/color'; +import { EventData, Page, NavigatedData, Frame, NavigationTransition, StackLayout, Color } from '@nativescript/core'; import * as helper from '../ui-helper'; import * as frame from '@nativescript/core/ui/frame'; // Creates a random colorful page full of meaningless stuff. diff --git a/apps/automated/src/navigation/transition-tests.ts b/apps/automated/src/navigation/transition-tests.ts index 4ace09557..abb722d38 100644 --- a/apps/automated/src/navigation/transition-tests.ts +++ b/apps/automated/src/navigation/transition-tests.ts @@ -1,10 +1,9 @@ import * as helper from '../ui-helper'; import * as platform from '@nativescript/core/platform'; -import { Trace } from '@nativescript/core'; +import { Trace, CoreTypes } from '@nativescript/core'; import { Color } from '@nativescript/core/color'; import { NavigationEntry, NavigationTransition } from '@nativescript/core/ui/frame'; import { Page } from '@nativescript/core/ui/page'; -import { AnimationCurve } from '@nativescript/core/ui/enums'; import { CustomTransition } from './custom-transition'; function _testTransition(navigationTransition: NavigationTransition) { @@ -51,7 +50,7 @@ export function test_Transitions() { // Built-in transitions transitions.forEach((name) => { - _testTransition({ name, duration: 20, curve: AnimationCurve.easeIn }); + _testTransition({ name, duration: 20, curve: CoreTypes.AnimationCurve.easeIn }); }); // helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: false }); diff --git a/apps/automated/src/pages/page7.ts b/apps/automated/src/pages/page7.ts index 858a63c8b..93d464ec1 100644 --- a/apps/automated/src/pages/page7.ts +++ b/apps/automated/src/pages/page7.ts @@ -1,6 +1,6 @@ import * as pages from '@nativescript/core/ui/page'; import * as buttons from '@nativescript/core/ui/button'; -import { VerticalAlignment } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; export function createPage() { var page = new pages.Page(); @@ -10,7 +10,7 @@ export function createPage() { btn.height = 60; btn.text = 'test'; - var vAligns: VerticalAlignment[] = ['stretch', 'top', 'middle', 'bottom']; + var vAligns: CoreTypes.VerticalAlignmentType[] = ['stretch', 'top', 'middle', 'bottom']; //var hAligns = ["stretch", "left", "center", "right"]; var count = 0; btn.on(buttons.tapEvent, function () { diff --git a/apps/automated/src/test-runner.ts b/apps/automated/src/test-runner.ts index 5191ee291..62ba954d6 100644 --- a/apps/automated/src/test-runner.ts +++ b/apps/automated/src/test-runner.ts @@ -187,15 +187,6 @@ allTests['BUTTON'] = buttonTests; import * as labelTests from './ui/label/label-tests'; allTests['LABEL'] = labelTests; -import * as bottomNavigationTests from './ui/bottom-navigation/bottom-navigation-tests'; -allTests['BOTTOM-NAVIGATION'] = bottomNavigationTests; - -import * as bottomNavigationTestsNew from './ui/bottom-navigation/bottom-navigation-tests-new'; -allTests['BOTTOM-NAVIGATION-NEW'] = bottomNavigationTestsNew; - -import * as bottomNavigationNavigationTests from './ui/bottom-navigation/bottom-navigation-navigation-tests'; -isIOS && (allTests['BOTTOM-NAVIGATION-NAVIGATION'] = bottomNavigationNavigationTests); - import * as tabViewTests from './ui/tab-view/tab-view-tests'; allTests['TAB-VIEW'] = tabViewTests; @@ -283,13 +274,6 @@ allTests['LIVESYNC'] = livesyncTests; import * as tabViewRootTests from './ui/tab-view/tab-view-root-tests'; allTests['TAB-VIEW-ROOT'] = tabViewRootTests; -import * as bottomNavigationRootTests from './ui/bottom-navigation/bottom-navigation-root-tests'; -allTests['BOTTOM-NAVIGATION-ROOT'] = bottomNavigationRootTests; - -// Reset root view didn't work with android tabs -import * as tabsRootTests from './ui/tabs/tabs-root-tests'; -isIOS && (allTests['TABS-ROOT'] = tabsRootTests); - import * as resetRootViewTests from './ui/root-view/reset-root-view-tests'; allTests['RESET-ROOT-VIEW'] = resetRootViewTests; diff --git a/apps/automated/src/ui/action-bar/action-bar-tests.android.ts b/apps/automated/src/ui/action-bar/action-bar-tests.android.ts index edc069f97..efed8663f 100644 --- a/apps/automated/src/ui/action-bar/action-bar-tests.android.ts +++ b/apps/automated/src/ui/action-bar/action-bar-tests.android.ts @@ -1,7 +1,7 @@ import * as TKUnit from '../../tk-unit'; import { createPageAndNavigate } from './action-bar-tests-common'; import { ActionItem } from '@nativescript/core/ui/action-bar'; -import { Visibility } from '@nativescript/core/ui/enums'; +import { CoreTypes } from '@nativescript/core'; import { Button } from '@nativescript/core/ui/button'; export * from './action-bar-tests-common'; @@ -15,7 +15,7 @@ export function test_actionItem_visibility() { const menu = toolbar.getMenu(); TKUnit.assertTrue(menu.hasVisibleItems(), 'Visibility does not work'); - actionItem.visibility = Visibility.collapse; + actionItem.visibility = CoreTypes.Visibility.collapse; TKUnit.assertFalse(menu.hasVisibleItems(), 'Visibility does not work'); } @@ -28,7 +28,7 @@ export function test_navigationButton_visibility() { const toolbar = page.actionBar.nativeViewProtected; TKUnit.assertNotNull(toolbar.getNavigationIcon(), 'Visibility does not work'); - actionItem.visibility = Visibility.collapse; + actionItem.visibility = CoreTypes.Visibility.collapse; TKUnit.assertNull(toolbar.getNavigationIcon(), 'Visibility does not work'); } diff --git a/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts b/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts index ac2b7bd0f..0dca1d7ce 100644 --- a/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts +++ b/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts @@ -5,7 +5,7 @@ import * as LabelModule from '@nativescript/core/ui/label'; import * as helper from '../../ui-helper'; import * as view from '@nativescript/core/ui/core/view'; import * as actionBar from '@nativescript/core/ui/action-bar'; -import { Visibility } from '@nativescript/core/ui/enums'; +import { CoreTypes } from '@nativescript/core'; export * from './action-bar-tests-common'; @@ -95,7 +95,7 @@ export function test_actionItem_visibility() { var leftBarButtonItemsCount = navigationItem.leftBarButtonItems ? navigationItem.leftBarButtonItems.count : 0; TKUnit.assertEqual(leftBarButtonItemsCount, 1, 'Visibility does not work'); - actionItem.visibility = Visibility.collapse; + actionItem.visibility = CoreTypes.Visibility.collapse; TKUnit.waitUntilReady(() => { leftBarButtonItemsCount = navigationItem.leftBarButtonItems ? navigationItem.leftBarButtonItems.count : 0; @@ -118,7 +118,7 @@ export function test_navigationButton_visibility() { var navigationItem: UINavigationItem = viewController.navigationItem; TKUnit.assertFalse(navigationItem.hidesBackButton, 'Visibility does not work'); - actionItem.visibility = Visibility.collapse; + actionItem.visibility = CoreTypes.Visibility.collapse; TKUnit.waitUntilReady(() => { return navigationItem.hidesBackButton; diff --git a/apps/automated/src/ui/animation/animation-tests.ts b/apps/automated/src/ui/animation/animation-tests.ts index e9d6d9479..20d4b907b 100644 --- a/apps/automated/src/ui/animation/animation-tests.ts +++ b/apps/automated/src/ui/animation/animation-tests.ts @@ -4,12 +4,11 @@ import * as viewModule from '@nativescript/core/ui/core/view'; import { Label } from '@nativescript/core/ui/label'; import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; import * as colorModule from '@nativescript/core/color'; -import * as enums from '@nativescript/core/ui/enums'; +import { CoreTypes, PercentLength } from '@nativescript/core'; import { AnimationPromise } from '@nativescript/core/ui/animation'; // >> animation-require import * as animation from '@nativescript/core/ui/animation'; -import { PercentLength } from '@nativescript/core/ui/styling/style-properties'; // << animation-require function prepareTest(parentHeight?: number, parentWidth?: number): Label { @@ -46,7 +45,7 @@ export function test_AnimatingProperties(done) { duration: 5, delay: 10, iterations: 3, - curve: enums.AnimationCurve.easeIn, + curve: CoreTypes.AnimationCurve.easeIn, }) .then(() => { //console.log("Animation finished."); @@ -418,7 +417,7 @@ export function test_AnimateRotate(done) { }); } -function animateExtentAndAssertExpected(along: 'height' | 'width', value: PercentLength, pixelExpected: PercentLength): Promise { +function animateExtentAndAssertExpected(along: 'height' | 'width', value: CoreTypes.PercentLengthType, pixelExpected: CoreTypes.PercentLengthType): Promise { function pretty(val) { return JSON.stringify(val, null, 2); } @@ -478,7 +477,7 @@ export function test_AnimateExtent_Should_AcceptStringPixelValues(done) { const expected = { unit: 'px', value: pair[1], - } as PercentLength; + } as CoreTypes.PercentLengthType; promise = promise.then(() => { return animateExtentAndAssertExpected('height', input, expected); }); diff --git a/apps/automated/src/ui/animation/css-animation-tests.ts b/apps/automated/src/ui/animation/css-animation-tests.ts index cf4ffa851..d9d17d637 100644 --- a/apps/automated/src/ui/animation/css-animation-tests.ts +++ b/apps/automated/src/ui/animation/css-animation-tests.ts @@ -1,7 +1,7 @@ import * as TKUnit from '../../tk-unit'; import * as styleScope from '@nativescript/core/ui/styling/style-scope'; import * as keyframeAnimation from '@nativescript/core/ui/animation/keyframe-animation'; -import * as enums from '@nativescript/core/ui/enums'; +import { CoreTypes } from '@nativescript/core'; import * as helper from '../../ui-helper'; import * as stackModule from '@nativescript/core/ui/layouts/stack-layout'; import * as labelModule from '@nativescript/core/ui/label'; @@ -37,7 +37,7 @@ export function test_ReadAnimationProperties() { let animation = createAnimationFromCSS(css, 'test'); TKUnit.assertEqual(animation.name, 'first'); TKUnit.assertEqual(animation.duration, 4000); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.easeIn); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeIn); TKUnit.assertEqual(animation.delay, 1500); TKUnit.assertEqual(animation.iterations, 10); TKUnit.assertTrue(animation.isForwards); @@ -48,22 +48,22 @@ export function test_ReadTheAnimationProperty() { let animation = createAnimationFromCSS('.test { animation: second 0.2s ease-out 1 2 }', 'test'); TKUnit.assertEqual(animation.name, 'second'); TKUnit.assertEqual(animation.duration, 200); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.easeOut); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeOut); TKUnit.assertEqual(animation.delay, 1000); TKUnit.assertEqual(animation.iterations, 2); } export function test_ReadAnimationCurve() { let animation = createAnimationFromCSS('.test { animation-timing-function: ease-in; }', 'test'); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.easeIn); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeIn); animation = createAnimationFromCSS('.test { animation-timing-function: ease-out; }', 'test'); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.easeOut); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeOut); animation = createAnimationFromCSS('.test { animation-timing-function: linear; }', 'test'); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.linear); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.linear); animation = createAnimationFromCSS('.test { animation-timing-function: ease-in-out; }', 'test'); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.easeInOut); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeInOut); animation = createAnimationFromCSS('.test { animation-timing-function: spring; }', 'test'); - TKUnit.assertEqual(animation.curve, enums.AnimationCurve.spring); + TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.spring); animation = createAnimationFromCSS('.test { animation-timing-function: cubic-bezier(0.1, 1.0, 0.5, 0.5); }', 'test'); let curve = animation.curve; TKUnit.assert(curve.x1 === 0.1 && curve.y1 === 1.0 && curve.x2 === 0.5 && curve.y2 === 0.5); @@ -389,8 +389,8 @@ export function test_ReadTwoAnimations() { scope.ensureSelectors(); let selector = findSelectorInScope(scope, 'test'); TKUnit.assertEqual(scope.getAnimations(selector.ruleset).length, 2); - TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[0].curve, enums.AnimationCurve.easeOut); - TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[1].curve, enums.AnimationCurve.easeIn); + TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[0].curve, CoreTypes.AnimationCurve.easeOut); + TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[1].curve, CoreTypes.AnimationCurve.easeIn); TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[1].name, 'two'); TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[1].duration, 2000); } @@ -401,12 +401,12 @@ export function test_AnimationCurveInKeyframes() { scope.ensureSelectors(); let selector = findSelectorInScope(scope, 'test'); let animation = scope.getAnimations(selector.ruleset)[0]; - TKUnit.assertEqual(animation.keyframes[0].curve, enums.AnimationCurve.linear); + TKUnit.assertEqual(animation.keyframes[0].curve, CoreTypes.AnimationCurve.linear); TKUnit.assertEqual(animation.keyframes[1].curve, undefined); TKUnit.assertEqual(animation.keyframes[1].curve, undefined); let realAnimation = keyframeAnimation.KeyframeAnimation.keyframeAnimationFromInfo(animation); - TKUnit.assertEqual(realAnimation.animations[1].curve, enums.AnimationCurve.linear); - TKUnit.assertEqual(realAnimation.animations[2].curve, enums.AnimationCurve.easeIn); + TKUnit.assertEqual(realAnimation.animations[1].curve, CoreTypes.AnimationCurve.linear); + TKUnit.assertEqual(realAnimation.animations[2].curve, CoreTypes.AnimationCurve.easeIn); } function getTransformsValues(declarations) { diff --git a/apps/automated/src/ui/bottom-navigation/bottom-navigation-navigation-tests.ts b/apps/automated/src/ui/bottom-navigation/bottom-navigation-navigation-tests.ts deleted file mode 100644 index 3350bb038..000000000 --- a/apps/automated/src/ui/bottom-navigation/bottom-navigation-navigation-tests.ts +++ /dev/null @@ -1,284 +0,0 @@ -import * as TKUnit from '../../tk-unit'; -import * as helper from '../../ui-helper'; -import { Label } from '@nativescript/core/ui/label'; -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import { Frame } from '@nativescript/core/ui/frame'; -import { Page } from '@nativescript/core/ui/page'; -import { ListView, ItemEventData } from '@nativescript/core/ui/list-view'; -import { BottomNavigation, TabContentItem, TabStrip, TabStripItem } from '@nativescript/core'; -import { Button , tapEvent} from '@nativescript/core/ui/button'; - -var ASYNC = 2; - -function _createBottomNavigation(): BottomNavigation { - var tabView = new BottomNavigation(); - tabView.id = 'BottomNavigation'; - - return tabView; -} - -function _createContentItems(count: number): Array { - const items = new Array(); - for (let i = 0; i < count; i++) { - const label = new Label(); - label.text = 'Tab ' + i; - const tabEntry = new TabContentItem(); - tabEntry.content = label; - items.push(tabEntry); - } - - return items; -} - -function _createTabStrip(count: number): TabStrip { - const items = new Array(); - for (let i = 0; i < count; i++) { - let tabStripEntry = new TabStripItem(); - tabStripEntry.title = 'Tab ' + i; - items.push(tabStripEntry); - } - - const tabStrip = new TabStrip(); - tabStrip.items = items; - - return tabStrip; -} - -function _createListView(): ListView { - var listView = new ListView(); - listView.id = 'ListView'; - var items = Array.apply(null, Array(10)).map(function (_, i) { - return i; - }); - - listView.on(ListView.itemLoadingEvent, function (args: ItemEventData) { - var button = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/toolbox/src/pages/css-playground.ts b/apps/toolbox/src/pages/css-playground.ts new file mode 100644 index 000000000..c2d99fdf4 --- /dev/null +++ b/apps/toolbox/src/pages/css-playground.ts @@ -0,0 +1,43 @@ +import { Observable, EventData, Page, Label } from '@nativescript/core'; +import { addTaggedAdditionalCSS, removeTaggedAdditionalCSS } from '@nativescript/core/ui/styling/style-scope'; + +let page: Page; +let playLabel: Label; +let CSSTag = 'css-playground'; + +export function navigatingTo(args: EventData) { + page = args.object; + page.bindingContext = new CssPlaygroundModel(); + playLabel = page.getViewById('play'); +} + +export class CssPlaygroundModel extends Observable { + currentCSS = [ + `width: 200;`, + `font-size: 20;`, + `background: #65adf1;`, + `color: white;`, + `box-shadow: 5 5;`, + // `text-shadow: 2 2 red;`, + `padding: 16;`, + ].join('\n'); + + onTextChange(args) { + this.currentCSS = args.value; + } + + resetCSS() { + console.log('reset css...'); + removeTaggedAdditionalCSS(CSSTag); + + playLabel._onCssStateChange(); + playLabel.requestLayout(); + } + + applyCSS(args) { + this.resetCSS(); + addTaggedAdditionalCSS(`#play { ${this.currentCSS}`, CSSTag); + playLabel._onCssStateChange(); + playLabel.requestLayout(); + } +} diff --git a/apps/toolbox/src/pages/css-playground.xml b/apps/toolbox/src/pages/css-playground.xml new file mode 100644 index 000000000..cdc4aa6df --- /dev/null +++ b/apps/toolbox/src/pages/css-playground.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + +