Merge branch 'master' of github.com:NativeScript/NativeScript

This commit is contained in:
Martin Guillon
2021-10-13 13:45:21 +02:00
16 changed files with 90 additions and 40 deletions

View File

@ -1,3 +1,23 @@
## [8.1.4](https://github.com/NativeScript/NativeScript/compare/8.1.3-core...8.1.4) (2021-10-09)
### Bug Fixes
* **android:** StringIndexOutOfBoundsException with invalid drawables ([#9563](https://github.com/NativeScript/NativeScript/issues/9563)) ([8e76bbe](https://github.com/NativeScript/NativeScript/commit/8e76bbe2515c5c743d3db30a940ccb8040314bea))
* background parsing color [#9559](https://github.com/NativeScript/NativeScript/issues/9559) ([#9560](https://github.com/NativeScript/NativeScript/issues/9560)) ([3e21748](https://github.com/NativeScript/NativeScript/commit/3e21748af4dcf76fec3822b4d5e9c844794eda1d))
* **ios:** ActionBar flat property using new appearance api for iOS 15 ([#9558](https://github.com/NativeScript/NativeScript/issues/9558)) ([183b4d4](https://github.com/NativeScript/NativeScript/commit/183b4d4b10a4ec7f9527e5373c8ce723c3db0c3e))
* **ios:** TextView respect editable binding ([#9589](https://github.com/NativeScript/NativeScript/issues/9589)) ([2b2ce37](https://github.com/NativeScript/NativeScript/commit/2b2ce377e6d7bd33de3fd8df9482772a650b75b5))
* **ios:** replace autofill string in textfield ([#9555](https://github.com/NativeScript/NativeScript/issues/9555)) ([889f6d7](https://github.com/NativeScript/NativeScript/commit/889f6d73cf8bdc080c54387708562d00c2684e9b))
* **style:** CSS variables should be case-sensitive. ([#9603](https://github.com/NativeScript/NativeScript/issues/9603)) ([02aa0f6](https://github.com/NativeScript/NativeScript/commit/02aa0f652a5637b089a8894f6635462073715205))
### Features
* **android** openFile dialog title ([#9600](https://github.com/NativeScript/NativeScript/issues/9600)) ([77d2533](https://github.com/NativeScript/NativeScript/commit/77d253379802487007c138ca025ac21f9bece002))
* **text:** add css text-align justify ([#9573](https://github.com/NativeScript/NativeScript/issues/9573)) ([1de5295](https://github.com/NativeScript/NativeScript/commit/1de5295ad980b394460de7d9d4b884e5a3b5a679))
## [8.1.3](https://github.com/NativeScript/NativeScript/compare/8.1.2-core...8.1.3) (2021-09-18) ## [8.1.3](https://github.com/NativeScript/NativeScript/compare/8.1.2-core...8.1.3) (2021-09-18)

View File

@ -14,10 +14,10 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core" "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
}, },
"devDependencies": { "devDependencies": {
"@nativescript/android": "7.0.1", "@nativescript/android": "8.1.1",
"@nativescript/ios": "7.2.0", "@nativescript/ios": "8.1.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.1.4" "typescript": "4.3.5"
}, },
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3", "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
"readme": "NativeScript Application" "readme": "NativeScript Application"

View File

@ -11,9 +11,9 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core" "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
}, },
"devDependencies": { "devDependencies": {
"@nativescript/android": "7.0.1", "@nativescript/android": "8.1.1",
"@nativescript/ios": "7.2.0", "@nativescript/ios": "8.1.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.1.4" "typescript": "4.3.5"
} }
} }

View File

@ -11,10 +11,10 @@
"@nativescript/core": "file:../../packages/core" "@nativescript/core": "file:../../packages/core"
}, },
"devDependencies": { "devDependencies": {
"@nativescript/android": "7.0.1", "@nativescript/android": "8.1.1",
"@nativescript/ios": "7.2.0", "@nativescript/ios": "8.1.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.1.4" "typescript": "4.3.5"
}, },
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4", "gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
"readme": "NativeScript Application", "readme": "NativeScript Application",

View File

@ -1,6 +1,6 @@
{ {
"name": "nativescript", "name": "nativescript",
"version": "8.1.3", "version": "8.1.4",
"license": "MIT", "license": "MIT",
"config": { "config": {
"npm_alias": "npm" "npm_alias": "npm"
@ -82,7 +82,7 @@
"mocha": "^8.0.1", "mocha": "^8.0.1",
"mocha-typescript": "^1.1.17", "mocha-typescript": "^1.1.17",
"module-alias": "^2.2.2", "module-alias": "^2.2.2",
"nativescript": "~8.1.2", "nativescript": "~8.1.3",
"nativescript-typedoc-theme": "1.1.0", "nativescript-typedoc-theme": "1.1.0",
"parse-css": "git+https://github.com/tabatkins/parse-css.git", "parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1", "parserlib": "^1.1.1",

View File

@ -1,7 +1,7 @@
**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, **Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,
standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
parser written in ECMAScript (also popularly known as parser written in ECMAScript (also popularly known as
[JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript)). [JavaScript](http://en.wikipedia.org/wiki/JavaScript).
Esprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat), Esprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat),
with the help of [many contributors](https://github.com/ariya/esprima/contributors). with the help of [many contributors](https://github.com/ariya/esprima/contributors).
@ -9,7 +9,7 @@ with the help of [many contributors](https://github.com/ariya/esprima/contributo
- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) - Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
- Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla - Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla
[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API) [Parser AST](https://web.archive.org/web/20201119095346/https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API)
- Optional tracking of syntax node location (index-based and line-column) - Optional tracking of syntax node location (index-based and line-column)
- Heavily tested (> 700 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html)) - Heavily tested (> 700 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html))
- [Partial support](http://esprima.org/doc/es6.html) for ECMAScript 6 - [Partial support](http://esprima.org/doc/es6.html) for ECMAScript 6
@ -19,6 +19,6 @@ language tools, from [code instrumentation](http://esprima.org/demo/functiontrac
to [editor autocompletion](http://esprima.org/demo/autocomplete.html). to [editor autocompletion](http://esprima.org/demo/autocomplete.html).
Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as
[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima). [Rhino](https://github.com/mozilla/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima).
For more information, check the web site [esprima.org](http://esprima.org). For more information, check the web site [esprima.org](http://esprima.org).

View File

@ -3,7 +3,7 @@
"main": "index", "main": "index",
"types": "index.d.ts", "types": "index.d.ts",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.", "description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"version": "8.1.3", "version": "8.1.4",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -359,7 +359,7 @@ export class ActionBar extends ActionBarBase {
if (color) { if (color) {
const titleTextColor = NSDictionary.dictionaryWithObjectForKey(color.ios, NSForegroundColorAttributeName); const titleTextColor = NSDictionary.dictionaryWithObjectForKey(color.ios, NSForegroundColorAttributeName);
if (majorVersion >= 15) { if (majorVersion >= 15) {
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new(); const appearance = this._getAppearance(navBar);
appearance.titleTextAttributes = titleTextColor; appearance.titleTextAttributes = titleTextColor;
} }
navBar.titleTextAttributes = titleTextColor; navBar.titleTextAttributes = titleTextColor;
@ -379,12 +379,10 @@ export class ActionBar extends ActionBarBase {
const color_ = color instanceof Color ? color.ios : color; const color_ = color instanceof Color ? color.ios : color;
if (majorVersion >= 15) { if (majorVersion >= 15) {
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new(); const appearance = this._getAppearance(navBar);
// appearance.configureWithOpaqueBackground(); // appearance.configureWithOpaqueBackground();
appearance.backgroundColor = color_; appearance.backgroundColor = color_;
navBar.standardAppearance = appearance; this._updateAppearance(navBar, appearance);
navBar.compactAppearance = appearance;
navBar.scrollEdgeAppearance = appearance;
} else { } else {
// legacy styling // legacy styling
navBar.barTintColor = color_; navBar.barTintColor = color_;
@ -406,31 +404,23 @@ export class ActionBar extends ActionBarBase {
} }
private updateFlatness(navBar: UINavigationBar) { private updateFlatness(navBar: UINavigationBar) {
if (this.flat) { if (this.flat) {
if (majorVersion >= 15) { if (majorVersion >= 15) {
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new(); const appearance = this._getAppearance(navBar);
appearance.shadowColor = UIColor.clearColor; appearance.shadowColor = UIColor.clearColor;
this._updateAppearance(navBar, appearance);
navBar.standardAppearance = appearance; } else {
navBar.compactAppearance = appearance;
navBar.scrollEdgeAppearance = appearance;
} else {
navBar.setBackgroundImageForBarMetrics(UIImage.new(), UIBarMetrics.Default); navBar.setBackgroundImageForBarMetrics(UIImage.new(), UIBarMetrics.Default);
navBar.shadowImage = UIImage.new(); navBar.shadowImage = UIImage.new();
navBar.translucent = false; navBar.translucent = false;
} }
} else { } else {
if (majorVersion >= 15) { if (majorVersion >= 15) {
if(navBar.standardAppearance){ // Not flat and never been set do nothing. if (navBar.standardAppearance) {
// Not flat and never been set do nothing.
const appearance = navBar.standardAppearance; const appearance = navBar.standardAppearance;
appearance.shadowColor = UINavigationBarAppearance.new().shadowColor; appearance.shadowColor = UINavigationBarAppearance.new().shadowColor;
this._updateAppearance(navBar, appearance);
navBar.standardAppearance = appearance;
navBar.compactAppearance = appearance;
navBar.scrollEdgeAppearance = appearance;
} }
} else { } else {
navBar.setBackgroundImageForBarMetrics(null, null); navBar.setBackgroundImageForBarMetrics(null, null);
@ -440,6 +430,16 @@ export class ActionBar extends ActionBarBase {
} }
} }
private _getAppearance(navBar: UINavigationBar) {
return navBar.standardAppearance ?? UINavigationBarAppearance.new();
}
private _updateAppearance(navBar: UINavigationBar, appearance: UINavigationBarAppearance) {
navBar.standardAppearance = appearance;
navBar.compactAppearance = appearance;
navBar.scrollEdgeAppearance = appearance;
}
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) { public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
const width = layout.getMeasureSpecSize(widthMeasureSpec); const width = layout.getMeasureSpecSize(widthMeasureSpec);
const height = layout.getMeasureSpecSize(heightMeasureSpec); const height = layout.getMeasureSpecSize(heightMeasureSpec);

View File

@ -1,4 +1,5 @@
import '../../../globals'; import '../../../globals';
import { isCssVariable } from '../../core/properties';
import { isNullOrUndefined } from '../../../utils/types'; import { isNullOrUndefined } from '../../../utils/types';
import * as cssParser from '../../../css'; import * as cssParser from '../../../css';
@ -523,7 +524,7 @@ export function fromAstNodes(astRules: cssParser.Node[]): RuleSet[] {
} }
function createDeclaration(decl: cssParser.Declaration): any { function createDeclaration(decl: cssParser.Declaration): any {
return { property: decl.property.toLowerCase(), value: decl.value }; return { property: isCssVariable(decl.property) ? decl.property : decl.property.toLowerCase(), value: decl.value };
} }
function createSimpleSelectorFromAst(ast: parser.SimpleSelector): SimpleSelector { function createSimpleSelectorFromAst(ast: parser.SimpleSelector): SimpleSelector {

View File

@ -134,7 +134,7 @@ export class TextView extends TextViewBaseCommon {
this.showText(); this.showText();
} }
return true; return this.editable;
} }
public textViewDidBeginEditing(textView: UITextView): void { public textViewDidBeginEditing(textView: UITextView): void {

View File

@ -81,7 +81,7 @@ function getMimeTypeNameFromExtension(filePath: string): string {
* @param {string} filePath * @param {string} filePath
* @returns {boolean} whether opening the file succeeded or not * @returns {boolean} whether opening the file succeeded or not
*/ */
export function openFile(filePath: string): boolean { export function openFile(filePath: string, title: string = 'Open File...'): boolean {
const context = ad.getApplicationContext(); const context = ad.getApplicationContext();
try { try {
// Ensure external storage is available // Ensure external storage is available
@ -108,7 +108,7 @@ Applications cannot access internal storage of other application on Android (see
// Determine file mimetype & start creating intent // Determine file mimetype & start creating intent
const mimeType = getMimeTypeNameFromExtension(filePath); const mimeType = getMimeTypeNameFromExtension(filePath);
const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW); const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW);
const chooserIntent = android.content.Intent.createChooser(intent, 'Open File...'); const chooserIntent = android.content.Intent.createChooser(intent, title);
intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
chooserIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); chooserIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);

View File

@ -242,8 +242,9 @@ export function openUrl(url: string): boolean;
/** /**
* Opens file. * Opens file.
* @param filePath The file. * @param filePath The file.
* @param title Optional title for Android. Default is: 'Open File...'
*/ */
export function openFile(filePath: string): boolean; export function openFile(filePath: string, title?: string): boolean;
/** /**
* Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it. * Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it.

View File

@ -318,6 +318,10 @@ exports[`javascript configuration for android 1`] = `
{ {
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END'
} }
),
/* config.plugin('ContextExclusionPlugin|exclude_files') */
new ContextExclusionPlugin(
/\\\\b_.+\\\\./
) )
], ],
entry: { entry: {
@ -651,6 +655,10 @@ exports[`javascript configuration for ios 1`] = `
{ {
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END'
} }
),
/* config.plugin('ContextExclusionPlugin|exclude_files') */
new ContextExclusionPlugin(
/\\\\b_.+\\\\./
) )
], ],
entry: { entry: {

View File

@ -318,6 +318,10 @@ exports[`typescript configuration for android 1`] = `
{ {
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /\\\\\\\\.(xml|js|(?<!\\\\\\\\.d\\\\\\\\.)ts|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' '__jest__/src/__@nativescript_webpack_virtual_entry_typescript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /\\\\\\\\.(xml|js|(?<!\\\\\\\\.d\\\\\\\\.)ts|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END'
} }
),
/* config.plugin('ContextExclusionPlugin|exclude_files') */
new ContextExclusionPlugin(
/\\\\b_.+\\\\./
) )
], ],
entry: { entry: {
@ -651,6 +655,10 @@ exports[`typescript configuration for ios 1`] = `
{ {
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /\\\\\\\\.(xml|js|(?<!\\\\\\\\.d\\\\\\\\.)ts|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' '__jest__/src/__@nativescript_webpack_virtual_entry_typescript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /\\\\\\\\.(xml|js|(?<!\\\\\\\\.d\\\\\\\\.)ts|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END'
} }
),
/* config.plugin('ContextExclusionPlugin|exclude_files') */
new ContextExclusionPlugin(
/\\\\b_.+\\\\./
) )
], ],
entry: { entry: {

View File

@ -4,6 +4,7 @@ import { getEntryPath, getEntryDirPath } from '../helpers/platform';
import { addVirtualEntry } from '../helpers/virtualModules'; import { addVirtualEntry } from '../helpers/virtualModules';
import { chainedSetAddAfter } from '../helpers/chain'; import { chainedSetAddAfter } from '../helpers/chain';
import { env as _env, IWebpackEnv } from '../index'; import { env as _env, IWebpackEnv } from '../index';
import { ContextExclusionPlugin } from 'webpack';
import base from './base'; import base from './base';
export default function (config: Config, env: IWebpackEnv = _env): Config { export default function (config: Config, env: IWebpackEnv = _env): Config {
@ -22,6 +23,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
` `
); );
// exclude files starting with _ from require.context
config
.plugin(`ContextExclusionPlugin|exclude_files`)
.use(ContextExclusionPlugin, [/\b_.+\./]);
chainedSetAddAfter( chainedSetAddAfter(
config.entry('bundle'), config.entry('bundle'),
'@nativescript/core/globals/index.js', '@nativescript/core/globals/index.js',

View File

@ -4,6 +4,7 @@ import { getEntryDirPath, getEntryPath } from '../helpers/platform';
import { addVirtualEntry } from '../helpers/virtualModules'; import { addVirtualEntry } from '../helpers/virtualModules';
import { chainedSetAddAfter } from '../helpers/chain'; import { chainedSetAddAfter } from '../helpers/chain';
import { env as _env, IWebpackEnv } from '../index'; import { env as _env, IWebpackEnv } from '../index';
import { ContextExclusionPlugin } from 'webpack';
import base from './base'; import base from './base';
export default function (config: Config, env: IWebpackEnv = _env): Config { export default function (config: Config, env: IWebpackEnv = _env): Config {
@ -22,6 +23,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
` `
); );
// exclude files starting with _ from require.context
config
.plugin(`ContextExclusionPlugin|exclude_files`)
.use(ContextExclusionPlugin, [/\b_.+\./]);
chainedSetAddAfter( chainedSetAddAfter(
config.entry('bundle'), config.entry('bundle'),
'@nativescript/core/globals/index.js', '@nativescript/core/globals/index.js',