From 034e84ebafefb34e7bc33703c6a73cb3ba039aa8 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Thu, 17 Oct 2019 16:18:11 +0300 Subject: [PATCH 1/9] chore: bump version to 6.3.0 (#7973) --- nativescript-core/package.json | 2 +- tns-core-modules-package/package.json | 2 +- tns-core-modules-widgets/package.json | 2 +- tns-platform-declarations/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nativescript-core/package.json b/nativescript-core/package.json index a6bc4365a..a0441e28b 100644 --- a/nativescript-core/package.json +++ b/nativescript-core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "Telerik NativeScript Core Modules", - "version": "6.2.0", + "version": "6.3.0", "homepage": "https://www.nativescript.org", "repository": { "type": "git", diff --git a/tns-core-modules-package/package.json b/tns-core-modules-package/package.json index 9d250cd7c..80898b426 100644 --- a/tns-core-modules-package/package.json +++ b/tns-core-modules-package/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "Telerik NativeScript Core Modules", - "version": "6.1.0", + "version": "6.3.0", "homepage": "https://www.nativescript.org", "repository": { "type": "git", diff --git a/tns-core-modules-widgets/package.json b/tns-core-modules-widgets/package.json index 7a5a212c4..edc6372b7 100644 --- a/tns-core-modules-widgets/package.json +++ b/tns-core-modules-widgets/package.json @@ -1,6 +1,6 @@ { "name": "tns-core-modules-widgets", - "version": "6.2.0", + "version": "6.3.0", "description": "Native widgets used in the NativeScript framework.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index 83b9b9f7e..efdf880e3 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "6.2.0", + "version": "6.3.0", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": { From 904590ee7d06fabc30df50e421109bcd248b5815 Mon Sep 17 00:00:00 2001 From: Sidhya Tikku <33092447+sidhyatikku@users.noreply.github.com> Date: Mon, 21 Oct 2019 20:33:35 +0530 Subject: [PATCH 2/9] chore: update .gitignore (#7981) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bfaaf29ce..9a3d7ca49 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ package-lock.json .DS_Store .nsbuildinfo tsdoc-metadata.json +thumbs.db # IDEs and editors /.idea From 86339250d8fc8c34531abab561e65a8775d66b34 Mon Sep 17 00:00:00 2001 From: Chaman Kumar <55803791+Chaman37606@users.noreply.github.com> Date: Mon, 28 Oct 2019 18:53:44 +0530 Subject: [PATCH 3/9] chore: update readme (#8019) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a808e93f..f73f597f7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Check out the links below to get started: ## For CTOs -Making the right technology choices is key to success. Our [CTO’s guide to NativeScript](https://www.nativescript.org/ctos-guide) helps you understand why NativeScript is the right choice for your next mobile project. +Making the right technology choices is the key to success. Our [CTO’s guide to NativeScript](https://www.nativescript.org/ctos-guide) helps you understand why NativeScript is the right choice for your next mobile project. ## Getting Started and Installation From 1c694d31653f60cff233b98973a93286137e3884 Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Tue, 29 Oct 2019 14:52:04 +0200 Subject: [PATCH 4/9] chore: add api-report check to travis (#8023) --- .travis.yml | 3 +++ CONTRIBUTING.md | 1 + package.json | 1 + 3 files changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index b9b29624e..768ac73dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ script: - npm run setup - npm run unit-test +# public API changes check +- npm run api-extractor-ci + # circular references check - cd tests && npm i - node_modules/.bin/webpack --env.android diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a278151d..4e0f2a208 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,6 +69,7 @@ git checkout -b master - Rebase your changes to the latest master: `git pull --rebase upstream master`. - Ensure all unit test are green for Android and iOS. Check [running unit tests](DevelopmentWorkflow.md#running-unit-tests). - Ensure your changes pass tslint validation. (run `npm run tslint` in the root of the repo). + - If you've made changes to a public API, make sure you update and add the `api-reports/NativeScript.api.md` file to the PR. (run `npm run api-extractor` to update the api-report and definitions). 6. Push your fork. If you have rebased you might have to use force-push your branch: ``` diff --git a/package.json b/package.json index 5c18e302d..800119891 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "unit-test-watch": "mocha-typescript-watch -p unit-tests/tsconfig.json --opts unit-tests/mocha.opts", "dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd nativescript-core && npm i ../tns-core-modules-widgets/dist/package --save)", "api-extractor": "api-extractor run --local --verbose && (cd nativescript-core && cat nativescript-core.header nativescript-core.d.ts > tmp_file && mv tmp_file nativescript-core.d.ts)", + "api-extractor-ci": "api-extractor run --verbose", "typedoc": "npm run api-extractor && typedoc --tsconfig tsconfig.typedoc.json", "typedoc-dev": "npm run typedoc && cd bin/dist/apiref && npx http-server", "build-core": "sh ./build/build-core.sh", From 9f9e8f8f1957694fb302f78ca4d7022e391dba45 Mon Sep 17 00:00:00 2001 From: Nikolay Tsonev Date: Thu, 31 Oct 2019 13:12:39 +0200 Subject: [PATCH 5/9] Fixing API REF build script - docs (#8043) --- build-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-docs.sh b/build-docs.sh index def09eb11..dcf6cd329 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -27,7 +27,7 @@ extract_snippets() { npm install markdown-snippet-injector - for SNIPPET_DIR in {tests/app,apps/app,tns-core-modules} ; do + for SNIPPET_DIR in {tests/app,apps/app,nativescript-core} ; do echo "Extracting snippets from: $SNIPPET_DIR" node "$BIN" --root="$SNIPPET_DIR" --target="$TARGET_DIR" \ --sourceext=".js|.ts|.xml|.html|.css" From eb960b71626f7066e5e3978c35956ae8552e7431 Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Thu, 7 Nov 2019 13:19:20 +0200 Subject: [PATCH 6/9] chore: add no android.R tslint rule (#8033) --- build/tslint.json | 4 ++++ package.json | 1 + 2 files changed, 5 insertions(+) diff --git a/build/tslint.json b/build/tslint.json index 4180d428a..34f6da9af 100644 --- a/build/tslint.json +++ b/build/tslint.json @@ -1,4 +1,7 @@ { + "rulesDirectory": [ + "@nativescript/tslint-rules" + ], "rules": { "arrow-return-shorthand": true, "class-name": true, @@ -9,6 +12,7 @@ "jsdoc-format": false, "max-line-length": [false, 120], "newline-before-return": true, + "no-android-resources": true, "no-arg": true, "no-bitwise": false, "no-consecutive-blank-lines": true, diff --git a/package.json b/package.json index 800119891..adf3acb47 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "license": "Apache-2.0", "devDependencies": { "@microsoft/api-extractor": "^7.5.0", + "@nativescript/tslint-rules": "0.0.5", "@types/chai": "^4.0.4", "@types/mocha": "^2.2.42", "@types/node": "~10.12.18", From 481ac7f21feead75fa7e54c2148b063d4e17d823 Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Thu, 7 Nov 2019 13:44:49 +0200 Subject: [PATCH 7/9] chore: d.ts file cleanup (#8044) --- tns-core-modules-package/tns-core-modules.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tns-core-modules-package/tns-core-modules.d.ts b/tns-core-modules-package/tns-core-modules.d.ts index cfdcf5318..f0e450342 100644 --- a/tns-core-modules-package/tns-core-modules.d.ts +++ b/tns-core-modules-package/tns-core-modules.d.ts @@ -1 +1,2 @@ -// Not needed. Only added for back-compatibility as some apps refer to this file. d \ No newline at end of file +// Not needed. Only added for back-compatibility as some apps refer to this file. + From fc2a233e9598def50969247c1516c32260b7e283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Sj=C3=B8gren?= Date: Thu, 7 Nov 2019 16:30:03 +0100 Subject: [PATCH 8/9] fix: nested css-calc and css-variables with fallback (#7987) --- .../ui/core/properties/properties.ts | 43 +++++++++---------- tests/app/ui/styling/style-tests.ts | 8 ++++ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/nativescript-core/ui/core/properties/properties.ts b/nativescript-core/ui/core/properties/properties.ts index 24cea4c99..8ecaeaab9 100644 --- a/nativescript-core/ui/core/properties/properties.ts +++ b/nativescript-core/ui/core/properties/properties.ts @@ -58,19 +58,16 @@ export function _getStyleProperties(): CssProperty[] { return getPropertiesFromMap(cssSymbolPropertyMap) as CssProperty[]; } -const cssVariableExpressionRegexp = /\bvar\(\s*(--[^,\s]+?)(?:\s*,\s*(.+))?\s*\)/; -const cssVariableAllExpressionsRegexp = /\bvar\(\s*(--[^,\s]+?)(?:\s*,\s*(.+))?\s*\)/g; - export function isCssVariable(property: string) { return /^--[^,\s]+?$/.test(property); } export function isCssCalcExpression(value: string) { - return /\bcalc\(/.test(value); + return value.includes("calc("); } export function isCssVariableExpression(value: string) { - return cssVariableExpressionRegexp.test(value); + return value.includes("var(--"); } export function _evaluateCssVariableExpression(view: ViewBase, cssName: string, value: string): string { @@ -90,26 +87,28 @@ export function _evaluateCssVariableExpression(view: ViewBase, cssName: string, while (lastValue !== output) { lastValue = output; - output = output.replace(cssVariableAllExpressionsRegexp, (matchStr, cssVariableName: string, fallbackStr: string) => { - const cssVariableValue = view.style.getCssVariable(cssVariableName); - if (cssVariableValue !== null) { - return cssVariableValue; - } + const idx = output.lastIndexOf("var("); + if (idx === -1) { + continue; + } - if (fallbackStr) { - // css-variable not found, using fallback-string. - const fallbackOutput = _evaluateCssVariableExpression(view, cssName, fallbackStr); - if (fallbackOutput) { - // If the fallback have multiple values, return the first of them. - return fallbackOutput.split(",")[0]; - } - } + const endIdx = output.indexOf(")", idx); + if (endIdx === -1) { + continue; + } - // Couldn't find a value for the css-variable or the fallback, return "unset" - traceWrite(`Failed to get value for css-variable "${cssVariableName}" used in "${cssName}"=[${value}] to ${view}`, traceCategories.Style, traceMessageType.error); + const matched = output.substring(idx + 4, endIdx).split(",").map((v) => v.trim()).filter((v) => !!v); + const cssVariableName = matched.shift(); + let cssVariableValue = view.style.getCssVariable(cssVariableName); + if (cssVariableValue === null && matched.length) { + cssVariableValue = _evaluateCssVariableExpression(view, cssName, matched.join(", ")).split(",")[0]; + } - return "unset"; - }); + if (!cssVariableValue) { + cssVariableValue = "unset"; + } + + output = `${output.substring(0, idx)}${cssVariableValue}${output.substring(endIdx + 1)}`; } return output; diff --git a/tests/app/ui/styling/style-tests.ts b/tests/app/ui/styling/style-tests.ts index 0eb398cdc..37835cbb4 100644 --- a/tests/app/ui/styling/style-tests.ts +++ b/tests/app/ui/styling/style-tests.ts @@ -1789,6 +1789,7 @@ export function test_nested_css_calc_and_variables() { const cssVarName = `--my-width-factor-base-${Date.now()}`; const cssVarName2 = `--my-width-factor-${Date.now()}`; + const undefinedCssVarName = `--my-undefined-variable-${Date.now()}`; const stack = new stackModule.StackLayout(); stack.css = ` @@ -1809,6 +1810,10 @@ export function test_nested_css_calc_and_variables() { StackLayout.nested { ${cssVarName2}: calc(var(${cssVarName}) * 2); } + + StackLayout.nested-fallback { + width: calc(calc(var(${undefinedCssVarName}, 16) / 2) * 2)); + } `; const label = new labelModule.Label(); @@ -1841,6 +1846,9 @@ export function test_nested_css_calc_and_variables() { stack.className = "nested"; TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 1 }, "Stack - width === 100%"); + + stack.className = "nested-fallback"; + TKUnit.assertDeepEqual(stack.width, 16, "Stack - width === 16"); } export function test_css_variable_is_applied_to_normal_properties() { From d0d4d811025a7e53e25dd86884c261369be92ee5 Mon Sep 17 00:00:00 2001 From: Martin Bektchiev Date: Mon, 11 Nov 2019 14:47:26 +0200 Subject: [PATCH 9/9] refactor(ios): Chrome DevTools Runtime domain (#8072) Move the logic from core modules to iOS runtime. This way watches and expressions evaluation in console will work for apps which do not use the core modules (e.g. TestRunner of iOS runtime) --- .../debugger/webinspector-network.ios.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/nativescript-core/debugger/webinspector-network.ios.ts b/nativescript-core/debugger/webinspector-network.ios.ts index 6832f6acd..ddf2c6b97 100644 --- a/nativescript-core/debugger/webinspector-network.ios.ts +++ b/nativescript-core/debugger/webinspector-network.ios.ts @@ -247,14 +247,3 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai return resourceData; } } - -@inspectorCommands.DomainDispatcher("Runtime") -export class RuntimeDomainDebugger { - constructor() { - __inspectorSendEvent(`{"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"http://main.xml","name":"","auxData":{"isDefault":true,"frameId":"${frameId}"}}}}`); - } - - compileScript(): { scriptId?: string, exceptionDetails?: Object } { - return {}; - } -}