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

# Conflicts:
#	package.json
#	packages/core/global-types.d.ts
#	packages/core/platforms/ios/Podfile
#	packages/core/ui/styling/background.android.ts
#	packages/core/ui/styling/style-scope.ts
#	packages/ui-mobile-base/ios/build.sh
This commit is contained in:
Martin Guillon
2021-02-08 10:09:12 +01:00
123 changed files with 2987 additions and 2093 deletions

View File

@ -0,0 +1,47 @@
import { ObservableArray } from '@nativescript/core/data/observable-array';
import { assert } from 'chai';
describe('observable-array', () => {
describe('splice', () => {
it('removes an item', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.splice(0, 1);
assert.equal(2, _array.getItem(0));
});
it('replaces an item', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.splice(0, 1, 3);
assert.equal(3, _array.getItem(0));
});
it('empties on start zero and no delete count', () => {
const _array = new ObservableArray();
_array.push(1);
_array.splice(0);
assert.equal(0, _array.length);
});
it('empties on length set to zero', () => {
const _array = new ObservableArray();
_array.push(1);
_array.push(2);
_array.length = 0;
assert.equal(0, _array.length);
});
});
});

View File

@ -1,7 +1,7 @@
const _allColors:{[k:string]:number} = {};
const _allColors: { [k: string]: number } = {};
function registerColor(name: string | string[], value: number): number {
if (Array.isArray(name)) {
name.forEach(n=>_allColors[n.toLowerCase()] = value)
name.forEach((n) => (_allColors[n.toLowerCase()] = value));
} else {
_allColors[name.toLowerCase()] = value;
}
@ -26,144 +26,144 @@ export function getKnownColor(name: string): number {
}
export const Transparent = registerColor('Transparent', 0x00000000);
export const AliceBlue = registerColor('AliceBlue', 0xffF0F8FF);
export const AntiqueWhite = registerColor('AntiqueWhite', 0xffFAEBD7);
export const Aqua = registerColor('Aqua', 0xff00FFFF);
export const Aquamarine = registerColor('Aquamarine', 0xff7FFFD4);
export const Azure = registerColor('Azure', 0xffF0FFFF);
export const Beige = registerColor('Beige', 0xffF5F5DC);
export const Bisque = registerColor('Bisque', 0xffFFE4C4);
export const AliceBlue = registerColor('AliceBlue', 0xfff0f8ff);
export const AntiqueWhite = registerColor('AntiqueWhite', 0xfffaebd7);
export const Aqua = registerColor('Aqua', 0xff00ffff);
export const Aquamarine = registerColor('Aquamarine', 0xff7fffd4);
export const Azure = registerColor('Azure', 0xfff0ffff);
export const Beige = registerColor('Beige', 0xfff5f5dc);
export const Bisque = registerColor('Bisque', 0xffffe4c4);
export const Black = registerColor('Black', 0xff000000);
export const BlanchedAlmond = registerColor('BlanchedAlmond', 0xffFFEBCD);
export const Blue = registerColor('Blue', 0xff0000FF);
export const BlueViolet = registerColor('BlueViolet', 0xff8A2BE2);
export const Brown = registerColor('Brown', 0xffA52A2A);
export const BurlyWood = registerColor('BurlyWood', 0xffDEB887);
export const CadetBlue = registerColor('CadetBlue', 0xff5F9EA0);
export const Chartreuse = registerColor('Chartreuse', 0xff7FFF00);
export const Chocolate = registerColor('Chocolate', 0xffD2691E);
export const Coral = registerColor('Coral', 0xffFF7F50);
export const CornflowerBlue = registerColor('CornflowerBlue', 0xff6495ED);
export const Cornsilk = registerColor('Cornsilk', 0xffFFF8DC);
export const Crimson = registerColor('Crimson', 0xffDC143C);
export const Cyan = registerColor('Cyan', 0xff00FFFF);
export const DarkBlue = registerColor('DarkBlue', 0xff00008B);
export const DarkCyan = registerColor('DarkCyan', 0xff008B8B);
export const DarkGoldenRod = registerColor('DarkGoldenRod', 0xffB8860B);
export const DarkGray = registerColor(['DarkGray', 'DarkGrey'], 0xffA9A9A9);
export const BlanchedAlmond = registerColor('BlanchedAlmond', 0xffffebcd);
export const Blue = registerColor('Blue', 0xff0000ff);
export const BlueViolet = registerColor('BlueViolet', 0xff8a2be2);
export const Brown = registerColor('Brown', 0xffa52a2a);
export const BurlyWood = registerColor('BurlyWood', 0xffdeb887);
export const CadetBlue = registerColor('CadetBlue', 0xff5f9ea0);
export const Chartreuse = registerColor('Chartreuse', 0xff7fff00);
export const Chocolate = registerColor('Chocolate', 0xffd2691e);
export const Coral = registerColor('Coral', 0xffff7f50);
export const CornflowerBlue = registerColor('CornflowerBlue', 0xff6495ed);
export const Cornsilk = registerColor('Cornsilk', 0xfffff8dc);
export const Crimson = registerColor('Crimson', 0xffdc143c);
export const Cyan = registerColor('Cyan', 0xff00ffff);
export const DarkBlue = registerColor('DarkBlue', 0xff00008b);
export const DarkCyan = registerColor('DarkCyan', 0xff008b8b);
export const DarkGoldenRod = registerColor('DarkGoldenRod', 0xffb8860b);
export const DarkGray = registerColor(['DarkGray', 'DarkGrey'], 0xffa9a9a9);
export const DarkGreen = registerColor('DarkGreen', 0xff006400);
export const DarkKhaki = registerColor('DarkKhaki', 0xffBDB76B);
export const DarkMagenta = registerColor('DarkMagenta', 0xff8B008B);
export const DarkOliveGreen = registerColor('DarkOliveGreen', 0xff556B2F);
export const DarkOrange = registerColor('DarkOrange', 0xffFF8C00);
export const DarkOrchid = registerColor('DarkOrchid', 0xff9932CC);
export const DarkRed = registerColor('DarkRed', 0xff8B0000);
export const DarkSalmon = registerColor('DarkSalmon', 0xffE9967A);
export const DarkSeaGreen = registerColor('DarkSeaGreen', 0xff8FBC8F);
export const DarkSlateBlue = registerColor('DarkSlateBlue', 0xff483D8B);
export const DarkSlateGray = registerColor(['DarkSlateGray', 'DarkSlateGrey'], 0xff2F4F4F);
export const DarkTurquoise = registerColor('DarkTurquoise', 0xff00CED1);
export const DarkViolet = registerColor('DarkViolet', 0xff9400D3);
export const DeepPink = registerColor('DeepPink', 0xffFF1493);
export const DeepSkyBlue = registerColor('DeepSkyBlue', 0xff00BFFF);
export const DarkKhaki = registerColor('DarkKhaki', 0xffbdb76b);
export const DarkMagenta = registerColor('DarkMagenta', 0xff8b008b);
export const DarkOliveGreen = registerColor('DarkOliveGreen', 0xff556b2f);
export const DarkOrange = registerColor('DarkOrange', 0xffff8c00);
export const DarkOrchid = registerColor('DarkOrchid', 0xff9932cc);
export const DarkRed = registerColor('DarkRed', 0xff8b0000);
export const DarkSalmon = registerColor('DarkSalmon', 0xffe9967a);
export const DarkSeaGreen = registerColor('DarkSeaGreen', 0xff8fbc8f);
export const DarkSlateBlue = registerColor('DarkSlateBlue', 0xff483d8b);
export const DarkSlateGray = registerColor(['DarkSlateGray', 'DarkSlateGrey'], 0xff2f4f4f);
export const DarkTurquoise = registerColor('DarkTurquoise', 0xff00ced1);
export const DarkViolet = registerColor('DarkViolet', 0xff9400d3);
export const DeepPink = registerColor('DeepPink', 0xffff1493);
export const DeepSkyBlue = registerColor('DeepSkyBlue', 0xff00bfff);
export const DimGray = registerColor(['DimGray', 'DimGrey'], 0xff696969);
export const DodgerBlue = registerColor('DodgerBlue', 0xff1E90FF);
export const FireBrick = registerColor('FireBrick', 0xffB22222);
export const FloralWhite = registerColor('FloralWhite', 0xffFFFAF0);
export const ForestGreen = registerColor('ForestGreen', 0xff228B22);
export const Fuchsia = registerColor('Fuchsia', 0xffFF00FF);
export const Gainsboro = registerColor('Gainsboro', 0xffDCDCDC);
export const GhostWhite = registerColor('GhostWhite', 0xffF8F8FF);
export const Gold = registerColor('Gold', 0xffFFD700);
export const GoldenRod = registerColor('GoldenRod', 0xffDAA520);
export const DodgerBlue = registerColor('DodgerBlue', 0xff1e90ff);
export const FireBrick = registerColor('FireBrick', 0xffb22222);
export const FloralWhite = registerColor('FloralWhite', 0xfffffaf0);
export const ForestGreen = registerColor('ForestGreen', 0xff228b22);
export const Fuchsia = registerColor('Fuchsia', 0xffff00ff);
export const Gainsboro = registerColor('Gainsboro', 0xffdcdcdc);
export const GhostWhite = registerColor('GhostWhite', 0xfff8f8ff);
export const Gold = registerColor('Gold', 0xffffd700);
export const GoldenRod = registerColor('GoldenRod', 0xffdaa520);
export const Gray = registerColor(['Gray', 'Grey'], 0xff808080);
export const Green = registerColor('Green', 0xff008000);
export const GreenYellow = registerColor('GreenYellow', 0xffADFF2F);
export const HoneyDew = registerColor('HoneyDew', 0xffF0FFF0);
export const HotPink = registerColor('HotPink', 0xffFF69B4);
export const IndianRed = registerColor('IndianRed', 0xffCD5C5C);
export const Indigo = registerColor('Indigo', 0xff4B0082);
export const Ivory = registerColor('Ivory', 0xffFFFFF0);
export const Khaki = registerColor('Khaki', 0xffF0E68C);
export const Lavender = registerColor('Lavender', 0xffE6E6FA);
export const LavenderBlush = registerColor('LavenderBlush', 0xffFFF0F5);
export const LawnGreen = registerColor('LawnGreen', 0xff7CFC00);
export const LemonChiffon = registerColor('LemonChiffon', 0xffFFFACD);
export const LightBlue = registerColor('LightBlue', 0xffADD8E6);
export const LightCoral = registerColor('LightCoral', 0xffF08080);
export const LightCyan = registerColor('LightCyan', 0xffE0FFFF);
export const LightGoldenRodYellow = registerColor('LightGoldenRodYellow', 0xffFAFAD2);
export const LightGray = registerColor(['LightGray', 'LightGrey'], 0xffD3D3D3);
export const LightGreen = registerColor('LightGreen', 0xff90EE90);
export const LightPink = registerColor('LightPink', 0xffFFB6C1);
export const LightSalmon = registerColor('LightSalmon', 0xffFFA07A);
export const LightSeaGreen = registerColor('LightSeaGreen', 0xff20B2AA);
export const LightSkyBlue = registerColor('LightSkyBlue', 0xff87CEFA);
export const GreenYellow = registerColor('GreenYellow', 0xffadff2f);
export const HoneyDew = registerColor('HoneyDew', 0xfff0fff0);
export const HotPink = registerColor('HotPink', 0xffff69b4);
export const IndianRed = registerColor('IndianRed', 0xffcd5c5c);
export const Indigo = registerColor('Indigo', 0xff4b0082);
export const Ivory = registerColor('Ivory', 0xfffffff0);
export const Khaki = registerColor('Khaki', 0xfff0e68c);
export const Lavender = registerColor('Lavender', 0xffe6e6fa);
export const LavenderBlush = registerColor('LavenderBlush', 0xfffff0f5);
export const LawnGreen = registerColor('LawnGreen', 0xff7cfc00);
export const LemonChiffon = registerColor('LemonChiffon', 0xfffffacd);
export const LightBlue = registerColor('LightBlue', 0xffadd8e6);
export const LightCoral = registerColor('LightCoral', 0xfff08080);
export const LightCyan = registerColor('LightCyan', 0xffe0ffff);
export const LightGoldenRodYellow = registerColor('LightGoldenRodYellow', 0xfffafad2);
export const LightGray = registerColor(['LightGray', 'LightGrey'], 0xffd3d3d3);
export const LightGreen = registerColor('LightGreen', 0xff90ee90);
export const LightPink = registerColor('LightPink', 0xffffb6c1);
export const LightSalmon = registerColor('LightSalmon', 0xffffa07a);
export const LightSeaGreen = registerColor('LightSeaGreen', 0xff20b2aa);
export const LightSkyBlue = registerColor('LightSkyBlue', 0xff87cefa);
export const LightSlateGray = registerColor(['LightSlateGray', 'LightSlateGrey'], 0xff778899);
export const LightSteelBlue = registerColor('LightSteelBlue', 0xffB0C4DE);
export const LightYellow = registerColor('LightYellow', 0xffFFFFE0);
export const Lime = registerColor('Lime', 0xff00FF00);
export const LimeGreen = registerColor('LimeGreen', 0xff32CD32);
export const Linen = registerColor('Linen', 0xffFAF0E6);
export const Magenta = registerColor('Magenta', 0xffFF00FF);
export const LightSteelBlue = registerColor('LightSteelBlue', 0xffb0c4de);
export const LightYellow = registerColor('LightYellow', 0xffffffe0);
export const Lime = registerColor('Lime', 0xff00ff00);
export const LimeGreen = registerColor('LimeGreen', 0xff32cd32);
export const Linen = registerColor('Linen', 0xfffaf0e6);
export const Magenta = registerColor('Magenta', 0xffff00ff);
export const Maroon = registerColor('Maroon', 0xff800000);
export const MediumAquaMarine = registerColor('MediumAquaMarine', 0xff66CDAA);
export const MediumBlue = registerColor('MediumBlue', 0xff0000CD);
export const MediumOrchid = registerColor('MediumOrchid', 0xffBA55D3);
export const MediumPurple = registerColor('MediumPurple', 0xff9370DB);
export const MediumSeaGreen = registerColor('MediumSeaGreen', 0xff3CB371);
export const MediumSlateBlue = registerColor('MediumSlateBlue', 0xff7B68EE);
export const MediumSpringGreen = registerColor('MediumSpringGreen', 0xff00FA9A);
export const MediumTurquoise = registerColor('MediumTurquoise', 0xff48D1CC);
export const MediumVioletRed = registerColor('MediumVioletRed', 0xffC71585);
export const MediumAquaMarine = registerColor('MediumAquaMarine', 0xff66cdaa);
export const MediumBlue = registerColor('MediumBlue', 0xff0000cd);
export const MediumOrchid = registerColor('MediumOrchid', 0xffba55d3);
export const MediumPurple = registerColor('MediumPurple', 0xff9370db);
export const MediumSeaGreen = registerColor('MediumSeaGreen', 0xff3cb371);
export const MediumSlateBlue = registerColor('MediumSlateBlue', 0xff7b68ee);
export const MediumSpringGreen = registerColor('MediumSpringGreen', 0xff00fa9a);
export const MediumTurquoise = registerColor('MediumTurquoise', 0xff48d1cc);
export const MediumVioletRed = registerColor('MediumVioletRed', 0xffc71585);
export const MidnightBlue = registerColor('MidnightBlue', 0xff191970);
export const MintCream = registerColor('MintCream', 0xffF5FFFA);
export const MistyRose = registerColor('MistyRose', 0xffFFE4E1);
export const Moccasin = registerColor('Moccasin', 0xffFFE4B5);
export const NavajoWhite = registerColor('NavajoWhite', 0xffFFDEAD);
export const MintCream = registerColor('MintCream', 0xfff5fffa);
export const MistyRose = registerColor('MistyRose', 0xffffe4e1);
export const Moccasin = registerColor('Moccasin', 0xffffe4b5);
export const NavajoWhite = registerColor('NavajoWhite', 0xffffdead);
export const Navy = registerColor('Navy', 0xff000080);
export const OldLace = registerColor('OldLace', 0xffFDF5E6);
export const OldLace = registerColor('OldLace', 0xfffdf5e6);
export const Olive = registerColor('Olive', 0xff808000);
export const OliveDrab = registerColor('OliveDrab', 0xff6B8E23);
export const Orange = registerColor('Orange', 0xffFFA500);
export const OrangeRed = registerColor('OrangeRed', 0xffFF4500);
export const Orchid = registerColor('Orchid', 0xffDA70D6);
export const PaleGoldenRod = registerColor('PaleGoldenRod', 0xffEEE8AA);
export const PaleGreen = registerColor('PaleGreen', 0xff98FB98);
export const PaleTurquoise = registerColor('PaleTurquoise', 0xffAFEEEE);
export const PaleVioletRed = registerColor('PaleVioletRed', 0xffDB7093);
export const PapayaWhip = registerColor('PapayaWhip', 0xffFFEFD5);
export const PeachPuff = registerColor('PeachPuff', 0xffFFDAB9);
export const Peru = registerColor('Peru', 0xffCD853F);
export const Pink = registerColor('Pink', 0xffFFC0CB);
export const Plum = registerColor('Plum', 0xffDDA0DD);
export const PowderBlue = registerColor('PowderBlue', 0xffB0E0E6);
export const OliveDrab = registerColor('OliveDrab', 0xff6b8e23);
export const Orange = registerColor('Orange', 0xffffa500);
export const OrangeRed = registerColor('OrangeRed', 0xffff4500);
export const Orchid = registerColor('Orchid', 0xffda70d6);
export const PaleGoldenRod = registerColor('PaleGoldenRod', 0xffeee8aa);
export const PaleGreen = registerColor('PaleGreen', 0xff98fb98);
export const PaleTurquoise = registerColor('PaleTurquoise', 0xffafeeee);
export const PaleVioletRed = registerColor('PaleVioletRed', 0xffdb7093);
export const PapayaWhip = registerColor('PapayaWhip', 0xffffefd5);
export const PeachPuff = registerColor('PeachPuff', 0xffffdab9);
export const Peru = registerColor('Peru', 0xffcd853f);
export const Pink = registerColor('Pink', 0xffffc0cb);
export const Plum = registerColor('Plum', 0xffdda0dd);
export const PowderBlue = registerColor('PowderBlue', 0xffb0e0e6);
export const Purple = registerColor('Purple', 0xff800080);
export const RebeccaPurple = registerColor('RebeccaPurple', 0xff663399);
export const Red = registerColor('Red', 0xffFF0000);
export const RosyBrown = registerColor('RosyBrown', 0xffBC8F8F);
export const RoyalBlue = registerColor('RoyalBlue', 0xff4169E1);
export const SaddleBrown = registerColor('SaddleBrown', 0xff8B4513);
export const Salmon = registerColor('Salmon', 0xffFA8072);
export const SandyBrown = registerColor('SandyBrown', 0xffF4A460);
export const SeaGreen = registerColor('SeaGreen', 0xff2E8B57);
export const SeaShell = registerColor('SeaShell', 0xffFFF5EE);
export const Sienna = registerColor('Sienna', 0xffA0522D);
export const Silver = registerColor('Silver', 0xffC0C0C0);
export const SkyBlue = registerColor('SkyBlue', 0xff87CEEB);
export const SlateBlue = registerColor('SlateBlue', 0xff6A5ACD);
export const Red = registerColor('Red', 0xffff0000);
export const RosyBrown = registerColor('RosyBrown', 0xffbc8f8f);
export const RoyalBlue = registerColor('RoyalBlue', 0xff4169e1);
export const SaddleBrown = registerColor('SaddleBrown', 0xff8b4513);
export const Salmon = registerColor('Salmon', 0xfffa8072);
export const SandyBrown = registerColor('SandyBrown', 0xfff4a460);
export const SeaGreen = registerColor('SeaGreen', 0xff2e8b57);
export const SeaShell = registerColor('SeaShell', 0xfffff5ee);
export const Sienna = registerColor('Sienna', 0xffa0522d);
export const Silver = registerColor('Silver', 0xffc0c0c0);
export const SkyBlue = registerColor('SkyBlue', 0xff87ceeb);
export const SlateBlue = registerColor('SlateBlue', 0xff6a5acd);
export const SlateGray = registerColor(['SlateGray', 'SlateGrey'], 0xff708090);
export const Snow = registerColor('Snow', 0xffFFFAFA);
export const SpringGreen = registerColor('SpringGreen', 0xff00FF7F);
export const SteelBlue = registerColor('SteelBlue', 0xff4682B4);
export const Tan = registerColor('Tan', 0xffD2B48C);
export const Snow = registerColor('Snow', 0xfffffafa);
export const SpringGreen = registerColor('SpringGreen', 0xff00ff7f);
export const SteelBlue = registerColor('SteelBlue', 0xff4682b4);
export const Tan = registerColor('Tan', 0xffd2b48c);
export const Teal = registerColor('Teal', 0xff008080);
export const Thistle = registerColor('Thistle', 0xffD8BFD8);
export const Tomato = registerColor('Tomato', 0xffFF6347);
export const Turquoise = registerColor('Turquoise', 0xff40E0D0);
export const Violet = registerColor('Violet', 0xffEE82EE);
export const Wheat = registerColor('Wheat', 0xffF5DEB3);
export const White = registerColor('White', 0xffFFFFFF);
export const WhiteSmoke = registerColor('WhiteSmoke', 0xffF5F5F5);
export const Yellow = registerColor('Yellow', 0xffFFFF00);
export const YellowGreen = registerColor('YellowGreen', 0xff9ACD32);
export const Thistle = registerColor('Thistle', 0xffd8bfd8);
export const Tomato = registerColor('Tomato', 0xffff6347);
export const Turquoise = registerColor('Turquoise', 0xff40e0d0);
export const Violet = registerColor('Violet', 0xffee82ee);
export const Wheat = registerColor('Wheat', 0xfff5deb3);
export const White = registerColor('White', 0xffffffff);
export const WhiteSmoke = registerColor('WhiteSmoke', 0xfff5f5f5);
export const Yellow = registerColor('Yellow', 0xffffff00);
export const YellowGreen = registerColor('YellowGreen', 0xff9acd32);

View File

@ -33,7 +33,6 @@ export interface ChangedData<T> extends EventData {
* Number of added items.
*/
addedCount: number;
}
const CHANGE = 'change';
@ -116,8 +115,8 @@ export class ObservableArray<T> extends Observable {
set length(value: number) {
if (types.isNumber(value) && this._array && this._array.length !== value) {
const added=[];
for (let i=this._array.length;i < value;++i) {
const added = [];
for (let i = this._array.length; i < value; ++i) {
added.push(undefined);
}
this.splice(value, this._array.length - value, ...added);
@ -247,7 +246,7 @@ export class ObservableArray<T> extends Observable {
*/
splice(start: number, deleteCount?: number, ...items: any): T[] {
const length = this._array.length;
const result = this._array.splice(start, deleteCount, ...items);
const result = arguments.length === 1 ? this._array.splice(start) : this._array.splice(start, deleteCount, ...items);
this.notify(<ChangedData<T>>{
eventName: CHANGE,

View File

@ -12,13 +12,11 @@ export interface EventData {
object: Observable;
}
export interface NotifyData extends Partial<EventData> {
eventName: string;
object?: Observable;
}
/**
* Data for the "propertyChange" event.
*/

View File

@ -152,13 +152,6 @@ interface ModuleContext {
path: string;
}
// Define a minimal subset of NodeRequire and NodeModule so user apps can compile without
// installing @types/node
interface NodeRequire {
(id: string): any;
}
interface NodeModule {
exports: any;
id: string;
@ -221,12 +214,8 @@ interface RequireContext {
resolve(id: string): string;
}
interface NodeRequire {
context(path: string, deep?: boolean, filter?: RegExp): RequireContext;
}
declare let __dirname: string;
declare let __filename: string;
declare var __dirname: string;
declare var __filename: string;
declare let module: NodeModule;
// Same as module.exports

View File

@ -7,7 +7,7 @@ import { Color } from '../color';
// Types.
import { path as fsPath, knownFolders } from '../file-system';
import { isFileOrResourcePath, RESOURCE_PREFIX, layout } from '../utils';
import { isFileOrResourcePath, RESOURCE_PREFIX, layout, releaseNativeObject } from '../utils';
import { getScaledDimensions } from './image-source-common';

View File

@ -25,7 +25,7 @@ function processFile(file: fs.File) {
const loadContent = () => file.readTextSync();
switch (file.extension.toLocaleLowerCase()) {
case '.js':{
case '.js': {
const noExtPath = filePathRelativeToApp.substr(0, filePathRelativeToApp.length - '.js'.length);
register(filePathRelativeToApp, function () {

View File

@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "7.1.3",
"version": "7.2.1",
"homepage": "https://nativescript.org",
"repository": {
"type": "git",

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>TNSWidgets.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) ())callback;
completion:(void (^) (void))callback;
@end

View File

@ -14,7 +14,7 @@
/**
* Get the milliseconds since the process started.
*/
double __tns_uptime();
double __tns_uptime(void);
/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.

View File

@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (Swizzling)
+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;
@end

View File

@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (PropertyBag)
- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;
@end

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
//
// NSData+Async.h
// TNSWidgets
//
// Created by Peter Staev on 7.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSData (Async)
+ (void)dataWithContentsOfFile:(nonnull NSString*)path
completion:(void (^) (NSData*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
completion:(void (^) (void))callback;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,25 @@
//
// NSString+Async.h
// TNSWidgets
//
// Created by Peter Staev on 5.08.19.
// Copyright © 2019 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (Async)
+ (void)stringWithContentsOfFile:(nonnull NSString*)path
encoding:(NSStringEncoding)enc
completion:(void (^) (NSString*, NSError*))callback;
- (void)writeToFile:(nonnull NSString*) path
atomically:(BOOL)atomically
encoding:(NSStringEncoding)enc
completion:(void (^) (NSError*))callback;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,16 @@
//
// TNSLabel.h
// TNSWidgets
//
// Created by Hristo Hristov on 6/9/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TNSLabel : UILabel
@property(nonatomic) UIEdgeInsets padding;
@property(nonatomic) UIEdgeInsets borderThickness;
@end

View File

@ -0,0 +1,29 @@
//
// TNSProcess.h
// TNSWidgets
//
// Created by Panayot Cankov on 15/05/2017.
// Copyright © 2017 Telerik A D. All rights reserved.
//
#ifndef TNSProcess_h
#define TNSProcess_h
#import <Foundation/Foundation.h>
/**
* Get the milliseconds since the process started.
*/
double __tns_uptime(void);
/**
* Provides access to NSLog. The runtime implementation of console.log is filtered in release.
* We rarely need to log in release but in cases such as when logging app startup times in release,
* this will be convenient shortcut to NSLog, NSLog is not exposed.
*
* Please note the {N} CLI may be filtering app output, prefixing the message with "CONSOLE LOG"
* will make the logs visible in "tns run ios --release" builds.
*/
void __nslog(NSString* message);
#endif /* TNSProcess_h */

View File

@ -0,0 +1,24 @@
//
// TNSWidgets.h
// TNSWidgets
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TNSWidgets.
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;
//! Project version string for TNSWidgets.
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
#import "UIImage+TNSBlocks.h"
#import "UIView+PassThroughParent.h"
#import "TNSLabel.h"
#import "TNSProcess.h"
#import "NSString+Async.h"
#import "NSData+Async.h"

View File

@ -0,0 +1,26 @@
//
// UIImage+UIImage_Async.h
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
@interface UIImage (TNSBlocks)
/**
* Similar to imageNamed: however it runs on a separate queue so the UI thread is not blocked.
* It also draws the UIImage in a small thumb to force decoding potentially avoiding UI hicckups when displayed.
*/
+ (void) tns_safeDecodeImageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;
/**
* Same as imageNamed, however calls to this method are sinchronized to be thread safe in iOS8 along with calls to tns_safeImageNamed and tns_safeDecodeImageNamed:completion:
* imageNamed is thread safe in iOS 9 and later so in later versions this methods simply fallbacks to imageNamed:
*/
+ (UIImage*) tns_safeImageNamed: (NSString*) name;
+ (void) tns_decodeImageWithData: (NSData*) data completion: (void (^) (UIImage*))callback;
+ (void) tns_decodeImageWidthContentsOfFile: (NSString*) file completion: (void (^) (UIImage*))callback;
@end

View File

@ -0,0 +1,17 @@
//
// UIView+PassThroughParent.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (PassThroughParent)
- (BOOL) passThroughParent;
- (void) setPassThroughParent:(BOOL) passThroughParent;
@end

View File

@ -0,0 +1,6 @@
framework module TNSWidgets {
umbrella header "TNSWidgets.h"
export *
module * { export * }
}

View File

@ -0,0 +1,17 @@
//
// NSObject+Swizzling.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (Swizzling)
+ (void)swizzleInstanceMethodWithOriginalSelector:(SEL)originalSelector fromClass:(Class)classContainigOriginalSel withSwizzlingSelector:(SEL)swizzlingSelector;
@end

View File

@ -0,0 +1,18 @@
//
// UIView+PropertyBag.h
// TNSWidgets
//
// Created by Manol Donev on 21.08.18.
// Copyright © 2018 Telerik A D. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (PropertyBag)
- (id) propertyValueForKey:(NSString*) key;
- (void) setPropertyValue:(id) value forKey:(NSString*) key;
@end

View File

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/NSData+Async.h</key>
<data>
9BsuK8QsA57YnHHgpWIgaHygSEk=
</data>
<key>Headers/NSString+Async.h</key>
<data>
o8366y9zYMOVyObC3vtKKy/8jxA=
</data>
<key>Headers/TNSLabel.h</key>
<data>
x8V4jT6oNNls+KE3y/DE6ij9eCk=
</data>
<key>Headers/TNSProcess.h</key>
<data>
dHuocpQ4b8KDApobwYNCqXcC6ZE=
</data>
<key>Headers/TNSWidgets.h</key>
<data>
gUvu5bjZg5Aie5iJ1krxFmDrHwk=
</data>
<key>Headers/UIImage+TNSBlocks.h</key>
<data>
OzGlvoGOJcFC6Z+YR5xThjLTUK4=
</data>
<key>Headers/UIView+PassThroughParent.h</key>
<data>
zdxBV/QJg7NPyx04RmZrXsxbHKU=
</data>
<key>Info.plist</key>
<data>
ADh4pPlA/MlPeoqmSDibKmrOKb0=
</data>
<key>Modules/module.modulemap</key>
<data>
ANIiDnbrCY8YCOtOm1xDrUyt8do=
</data>
<key>PrivateHeaders/NSObject+Swizzling.h</key>
<data>
wRUUMHgrTVWHd/e8bDqN8sYZth4=
</data>
<key>PrivateHeaders/UIView+PropertyBag.h</key>
<data>
3USXIiZgky+5k7en+R6oyZ3pP18=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/NSData+Async.h</key>
<dict>
<key>hash2</key>
<data>
JdjuVUBed00Ged4cSDzYLXONUlESu+dae9KN0PYJ/nM=
</data>
</dict>
<key>Headers/NSString+Async.h</key>
<dict>
<key>hash2</key>
<data>
1Iuk4atAJ89zujXqrLBvGz7Ny52RXNdD5c1ZMK0SFgs=
</data>
</dict>
<key>Headers/TNSLabel.h</key>
<dict>
<key>hash2</key>
<data>
uaE78Ar4SA7jzBIQrT3lTvBQFOQj1sf1ippa8ldUDqQ=
</data>
</dict>
<key>Headers/TNSProcess.h</key>
<dict>
<key>hash2</key>
<data>
E+JvepkSwLMNO6gdhEdwuzkdVTUqmWp8P5LxHYCFim8=
</data>
</dict>
<key>Headers/TNSWidgets.h</key>
<dict>
<key>hash2</key>
<data>
V99t2zLwRPOs90tbGiQbhbdAFJlW7mp7X2R5337ewUA=
</data>
</dict>
<key>Headers/UIImage+TNSBlocks.h</key>
<dict>
<key>hash2</key>
<data>
MgrX2woetySmXcrrDF290WGxNiW5W3E0B0fsjy8BgNI=
</data>
</dict>
<key>Headers/UIView+PassThroughParent.h</key>
<dict>
<key>hash2</key>
<data>
UfHyaUaTFlNcY5M7lUKwq6bPGuQeVIbjhCCInN1ZEYA=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash2</key>
<data>
geXwbECY3V3psdekq89Ia+2j4/OludM5UatqEk+xhhc=
</data>
</dict>
<key>PrivateHeaders/NSObject+Swizzling.h</key>
<dict>
<key>hash2</key>
<data>
S+GqZzjPH/SqyxwzyysFybjZsbwS5lxcTwL04W79IGA=
</data>
</dict>
<key>PrivateHeaders/UIView+PropertyBag.h</key>
<dict>
<key>hash2</key>
<data>
/qFTteGRAX+GloVCipAdNRXPDPDWsNmQ+9USxt99lXE=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.nativescript.TNSWidgets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -19,9 +19,9 @@ export type TransformFunctionsInfo = {
};
export interface AnimationPromise extends Promise<any>, Cancelable {
then(...args):AnimationPromise
catch(...args):AnimationPromise
};
then(...args): AnimationPromise;
catch(...args): AnimationPromise;
}
export interface Pair {
x: number;

View File

@ -340,7 +340,7 @@ export class Animation extends AnimationBase {
animators.push(createObjectAnimator(nativeView, 'alpha', propertyAnimation.value));
break;
case Properties.backgroundColor:{
case Properties.backgroundColor: {
backgroundColorProperty._initDefaultNativeValue(style);
ensureArgbEvaluator();

View File

@ -380,7 +380,7 @@ export class Animation extends AnimationBase {
toValue = NSValue.valueWithCATransform3D(Animation._createNativeAffineTransform(animation));
break;
case Properties.width:
case Properties.height:{
case Properties.height: {
const direction: string = animation.property;
const isHeight: boolean = direction === 'height';
propertyNameToAnimate = 'bounds';

View File

@ -47,7 +47,7 @@ export interface ShowModalOptions {
/**
* A function that will be called when the view is closed. Any arguments provided when calling ShownModallyData.closeCallback will be available here.
*/
closeCallback: (...args)=>void;
closeCallback: (...args) => void;
/**
* An optional parameter specifying whether to show the modal view in full-screen mode.
@ -100,7 +100,7 @@ export interface ShowModalOptions {
cancelable?: boolean;
}
export function getAncestor(view: ViewBaseDefinition, criterion: string | { new() }): ViewBaseDefinition {
export function getAncestor(view: ViewBaseDefinition, criterion: string | { new () }): ViewBaseDefinition {
let matcher: (view: ViewBaseDefinition) => boolean = null;
if (typeof criterion === 'string') {
matcher = (view: ViewBaseDefinition) => view.typeName === criterion;

View File

@ -393,6 +393,11 @@ export abstract class View extends ViewBase {
*/
iosOverflowSafeAreaEnabled: boolean;
/**
* Gets or sets a value indicating whether the the view should totally ignore safe areas computation. This property is iOS specific. Default value: false
*/
iosIgnoreSafeArea: boolean;
/**
* Gets is layout is valid. This is a read-only property.
*/

View File

@ -275,8 +275,8 @@ export class View extends ViewCommon implements ViewDefinition {
return null;
}
if (this.iosIgnoreSafeArea) {
return frame;
}
return frame;
}
if (!this.iosOverflowSafeArea || !this.iosOverflowSafeAreaEnabled) {
return IOSHelper.shrinkToSafeArea(this, frame);
} else if (this.nativeViewProtected && this.nativeViewProtected.window) {
@ -290,8 +290,8 @@ export class View extends ViewCommon implements ViewDefinition {
const safeAreaInsets = this.nativeViewProtected && this.nativeViewProtected.safeAreaInsets;
const insets = { left: 0, top: 0, right: 0, bottom: 0 };
if (this.iosIgnoreSafeArea) {
return insets;
}
return insets;
}
if (safeAreaInsets) {
insets.left = layout.round(layout.toDevicePixels(safeAreaInsets.left));
insets.top = layout.round(layout.toDevicePixels(safeAreaInsets.top));

View File

@ -765,7 +765,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
public iosOverflowSafeArea: boolean;
public iosOverflowSafeAreaEnabled: boolean;
public iosIgnoreSafeArea: boolean;
get isLayoutValid(): boolean {
return this._isLayoutValid;
}
@ -1063,8 +1063,8 @@ export const iosOverflowSafeAreaEnabledProperty = new InheritedProperty<ViewComm
});
iosOverflowSafeAreaEnabledProperty.register(ViewCommon);
export const iosIgnoreSafeAreaProperty = new InheritedProperty({
name: 'iosIgnoreSafeArea',
defaultValue: false,
valueConverter: booleanConverter,
name: 'iosIgnoreSafeArea',
defaultValue: false,
valueConverter: booleanConverter,
});
iosIgnoreSafeAreaProperty.register(ViewCommon);
iosIgnoreSafeAreaProperty.register(ViewCommon);

View File

@ -338,7 +338,7 @@ export class IOSHelper {
let fullscreen = null;
let safeArea = null;
let controllerInWindow = {x: 0, y: 0};
let controllerInWindow = { x: 0, y: 0 };
if (viewControllerView) {
safeArea = viewControllerView.safeAreaLayoutGuide.layoutFrame;

View File

@ -23,6 +23,7 @@ export abstract class EditableTextBase extends TextBase implements EditableTextB
public abstract dismissSoftInput();
public abstract _setInputType(inputType: number): void;
public abstract setSelection(start: number, stop?: number);
private _focusHandler = () => this._goToVisualState('focus');
private _blurHandler = () => this._goToVisualState('blur');

View File

@ -144,6 +144,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
/* tslint:enable */
nativeViewProtected: android.widget.EditText;
nativeTextViewProtected: android.widget.EditText;
private _keyListenerCache: android.text.method.KeyListener;
private _inputType: number;
@ -327,7 +328,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
case 'send':
newImeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_SEND;
break;
default:{
default: {
const ime = +value;
if (!isNaN(ime)) {
newImeOptions = ime;
@ -382,7 +383,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
case 'allcharacters':
inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; //4096 (0x00010000) 13th bit
break;
default:{
default: {
const number = +value;
// We set the default value.
if (!isNaN(number)) {
@ -466,4 +467,15 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
this.nativeTextViewProtected.setFilters(newFilters);
}
}
public setSelection(start: number, stop?: number) {
const view = this.nativeTextViewProtected;
if (view) {
if (stop !== undefined) {
view.setSelection(start, stop);
} else {
view.setSelection(start);
}
}
}
}

View File

@ -64,6 +64,11 @@ export class EditableTextBase extends TextBase {
*/
public _setInputType(inputType: number): void;
//@endprivate
/**
* Set the selection anchor to start and the selection edge to stop
*/
public setSelection(start: number, stop?: number);
}
export type ReturnKeyType = 'done' | 'next' | 'go' | 'search' | 'send';

View File

@ -5,6 +5,7 @@ export * from './editable-text-base-common';
export abstract class EditableTextBase extends EditableTextBaseCommon {
public nativeViewProtected: UITextField | UITextView;
public readonly nativeTextViewProtected: UITextField | UITextView;
public dismissSoftInput() {
this.nativeTextViewProtected.resignFirstResponder();
this.notify({ eventName: EditableTextBase.blurEvent, object: this });
@ -189,6 +190,21 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
this.nativeTextViewProtected.autocorrectionType = newValue;
}
public setSelection(start: number, stop?: number) {
const view = this.nativeTextViewProtected;
if (view) {
if (stop !== undefined) {
const begin = view.beginningOfDocument;
const fromPosition = view.positionFromPositionOffset(begin, start);
const toPosition = view.positionFromPositionOffset(begin, stop);
view.selectedTextRange = view.textRangeFromPositionToPosition(fromPosition, toPosition);
} else {
const begin = view.beginningOfDocument;
const pos = view.positionFromPositionOffset(begin, start);
view.selectedTextRange = view.textRangeFromPositionToPosition(pos, pos);
}
}
}
}
export function _updateCharactersInRangeReplacementString(formattedText: FormattedString, rangeLocation: number, rangeLength: number, replacementString: string): void {

View File

@ -10,6 +10,7 @@ import { getAncestor } from '../core/view-base';
import { Builder } from '../builder';
import { sanitizeModuleName } from '../builder/module-name-sanitizer';
import { profile } from '../../profiling';
import { FRAME_SYMBOL } from './frame-helpers';
export { NavigationType } from './frame-interfaces';
export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame } from './frame-interfaces';
@ -424,7 +425,7 @@ export class FrameBase extends CustomLayoutView {
object: this,
isBack,
entry: backstackEntry.entry,
fromEntry:this.currentEntry
fromEntry: this.currentEntry,
});
}
@ -696,6 +697,9 @@ export class FrameBase extends CustomLayoutView {
}
}
// Mark as a Frame with an unique Symbol
FrameBase.prototype[FRAME_SYMBOL] = true;
export function getFrameById(id: string): FrameBase {
console.log('getFrameById() is deprecated. Use Frame.getFrameById() instead.');

View File

@ -0,0 +1,19 @@
/**
* Unique symbol to mark Frame instances.
*
* We use a symbol because in some cases importing the Frame to do
* instanceof checks introduces circular references.
*
* Having the symbol in it's own file prevents any potential circular
* references and allows checking if an object is a frame
*/
export const FRAME_SYMBOL = Symbol('FRAME_SYMBOL');
/**
* Helper to determine if the passed object is a Frame
*
* @param object
*/
export function isFrame(object: any) {
return object && object[FRAME_SYMBOL] === true;
}

View File

@ -6,7 +6,7 @@ import { Transition } from '../transition';
export * from './frame-interfaces';
export interface NavigationData extends EventData {
export interface NavigationData extends EventData {
entry?: NavigationEntry;
fromEntry?: NavigationEntry;
isBack?: boolean;

View File

@ -54,7 +54,7 @@ export class Frame extends FrameBase {
public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
const current = this._currentEntry;
const currentEntryChanged = current !== entry;
if (currentEntryChanged) {
if (entry?.resolvedPage && currentEntryChanged) {
this._updateBackstack(entry, navigationType);
super.setCurrent(entry, navigationType);
@ -249,7 +249,7 @@ export class Frame extends FrameBase {
case 'never':
return false;
case 'auto':{
case 'auto': {
let newValue: boolean;
if (page && page.actionBarHidden !== undefined) {

View File

@ -565,7 +565,7 @@ class CustomRotateGestureDetector {
switch (event.getActionMasked()) {
case android.view.MotionEvent.ACTION_DOWN:
case android.view.MotionEvent.ACTION_POINTER_DOWN:{
case android.view.MotionEvent.ACTION_POINTER_DOWN: {
let assigned = false;
if (this.trackedPtrId1 === INVALID_POINTER_ID && pointerID !== this.trackedPtrId2) {
this.trackedPtrId1 = pointerID;

View File

@ -36,7 +36,7 @@ export namespace JustifyContent {
export const FLEX_END = 'flex-end' as const;
export const CENTER = 'center' as const;
export const SPACE_BETWEEN = 'space-between';
export const SPACE_AROUND= 'space-around';
export const SPACE_AROUND = 'space-around';
export const isValid = makeValidator<JustifyContent>(FLEX_START, FLEX_END, CENTER, SPACE_BETWEEN, SPACE_AROUND);
export const parse = makeParser<JustifyContent>(isValid);
@ -50,7 +50,7 @@ export namespace FlexBasisPercent {
export type AlignItems = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
export namespace AlignItems {
export const FLEX_START = 'flex-start';
export const FLEX_END= 'flex-end';
export const FLEX_END = 'flex-end';
export const CENTER = 'center';
export const BASELINE = 'baseline';
export const STRETCH = 'stretch';

View File

@ -463,7 +463,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
switch (flexDirection) {
case FlexDirection.ROW:
case FlexDirection.ROW_REVERSE:{
case FlexDirection.ROW_REVERSE: {
const widthMode = getMeasureSpecMode(widthMeasureSpec);
const widthSize = getMeasureSpecSize(widthMeasureSpec);
if (widthMode === EXACTLY) {
@ -475,7 +475,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
break;
}
case FlexDirection.COLUMN:
case FlexDirection.COLUMN_REVERSE:{
case FlexDirection.COLUMN_REVERSE: {
const heightMode = getMeasureSpecMode(heightMeasureSpec);
const heightSize = getMeasureSpecSize(heightMeasureSpec);
if (heightMode === EXACTLY) {
@ -1019,7 +1019,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
childLeft = paddingLeft + spaceBetweenItem / 2.0;
childRight = width - paddingRight - spaceBetweenItem / 2.0;
break;
case JustifyContent.SPACE_BETWEEN:{
case JustifyContent.SPACE_BETWEEN: {
childLeft = paddingLeft;
const denominator = flexLine.itemCount !== 1 ? flexLine.itemCount - 1 : 1.0;
spaceBetweenItem = (width - insets.left - insets.right - flexLine.mainSize) / denominator;
@ -1110,7 +1110,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
view.layout(left, top - crossSize + view.getMeasuredHeight() + lp.effectiveMarginTop, right, bottom - crossSize + view.getMeasuredHeight() + lp.effectiveMarginTop);
}
break;
case AlignItems.CENTER:{
case AlignItems.CENTER: {
const topFromCrossAxis = (crossSize - view.getMeasuredHeight()) / 2;
if (flexWrap !== FlexWrap.WRAP_REVERSE) {
view.layout(left, top + topFromCrossAxis + lp.effectiveMarginTop - lp.effectiveMarginBottom, right, top + topFromCrossAxis + view.getMeasuredHeight() + lp.effectiveMarginTop - lp.effectiveMarginBottom);
@ -1163,7 +1163,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
childTop = paddingTop + spaceBetweenItem / 2.0;
childBottom = height - paddingBottom - spaceBetweenItem / 2.0;
break;
case JustifyContent.SPACE_BETWEEN:{
case JustifyContent.SPACE_BETWEEN: {
childTop = paddingTop;
const denominator = flexLine.itemCount !== 1 ? flexLine.itemCount - 1 : 1.0;
spaceBetweenItem = (height - insets.top - insets.bottom - flexLine.mainSize) / denominator;
@ -1244,7 +1244,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
view.layout(left - crossSize + view.getMeasuredWidth() + lp.effectiveMarginLeft, top, right - crossSize + view.getMeasuredWidth() + lp.effectiveMarginLeft, bottom);
}
break;
case AlignItems.CENTER:{
case AlignItems.CENTER: {
const leftFromCrossAxis = (crossSize - view.getMeasuredWidth()) / 2;
if (!isRtl) {
view.layout(left + leftFromCrossAxis + lp.effectiveMarginLeft - lp.effectiveMarginRight, top, right + leftFromCrossAxis + lp.effectiveMarginLeft - lp.effectiveMarginRight, bottom);

View File

@ -214,7 +214,7 @@ class UIViewControllerImpl extends UIViewController {
// or because we are closing a modal page,
// or because we are in tab and another controller is selected.
const tab = this.tabBarController;
if (owner.onNavigatingFrom && !owner._presentedViewController && !this.presentingViewController && frame && frame.currentPage === owner) {
if (owner.onNavigatingFrom && !owner._presentedViewController && frame && (!this.presentingViewController || frame.backStack.length > 0) && frame.currentPage === owner) {
const willSelectViewController = tab && (<any>tab)._willSelectViewController;
if (!willSelectViewController || willSelectViewController === tab.selectedViewController) {
const isBack = isBackNavigationFrom(this, owner);

View File

@ -7,6 +7,7 @@ import { Style } from '../styling/style';
import { Color } from '../../color';
import { EventData } from '../../data/observable';
import type { Frame } from '../frame';
import { isFrame } from '../frame/frame-helpers';
import { ActionBar } from '../action-bar';
import { KeyframeAnimationInfo } from '../animation/keyframe-animation';
import { profile } from '../../profiling';
@ -92,9 +93,9 @@ export class PageBase extends ContentView {
}
get frame(): Frame {
const frame = this.parent;
const parent = this.parent;
return (frame && frame.constructor.name === 'Frame') ? frame as Frame : undefined;
return isFrame(parent) ? (parent as Frame) : undefined;
}
private createNavigatedData(eventName: string, isBackNavigation: boolean): NavigatedData {

View File

@ -44,12 +44,13 @@ export namespace ad {
const constantState = drawable.getConstantState();
androidView._cachedDrawable = constantState || drawable;
}
const isBorderDrawable = drawable instanceof org.nativescript.widgets.BorderDrawable;
const onlyColor = !background.hasBorderWidth() && !background.hasBorderRadius() && !background.clipPath && !background.image && !!background.color;
if (drawable instanceof android.graphics.drawable.ColorDrawable && onlyColor) {
if (!isBorderDrawable && drawable instanceof android.graphics.drawable.ColorDrawable && onlyColor) {
drawable.setColor(background.color.android);
drawable.invalidateSelf();
} else if (isSetColorFilterOnlyWidget(nativeView) && drawable && onlyColor) {
if (drawable instanceof org.nativescript.widgets.BorderDrawable && androidView._cachedDrawable) {
if (isBorderDrawable && androidView._cachedDrawable) {
if (!(androidView._cachedDrawable instanceof android.graphics.drawable.Drawable.ConstantState)) {
return;
}
@ -63,12 +64,12 @@ export namespace ad {
drawable.setColorFilter(backgroundColor, android.graphics.PorterDuff.Mode.SRC_IN);
drawable.invalidateSelf(); // Make sure the drawable is invalidated. Android forgets to invalidate it in some cases: toolbar
(<any>drawable).backgroundColor = backgroundColor;
} else if (onlyColor) {
} else if (!isBorderDrawable && onlyColor) {
// this is the fastest way to change only background color
nativeView.setBackgroundColor(background.color.android);
} else if (!background.isEmpty()) {
let backgroundDrawable = drawable as org.nativescript.widgets.BorderDrawable;
if (!(drawable instanceof org.nativescript.widgets.BorderDrawable)) {
if (!isBorderDrawable) {
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(layout.getDisplayDensity(), view.toString());
refreshBorderDrawable(view, backgroundDrawable);
nativeView.setBackground(backgroundDrawable);

View File

@ -216,7 +216,7 @@ class CSSSource {
const cssTreeParse = require('../../css/css-tree-parser').cssTreeParse;
this._ast = cssTreeParse(this._source, this._file);
return;
case 'nativescript':{
case 'nativescript': {
const CSS3Parser = require('../../css/parser').CSS3Parser;
const CSSNativeScript = require('../../css/parser').CSSNativeScript;
const cssparser = new CSS3Parser(this._source);
@ -475,7 +475,10 @@ export class CssState {
const matchingSelectors = this._match.selectors.filter((sel) => (sel.dynamic ? sel.match(view) : true));
if (!matchingSelectors || matchingSelectors.length === 0) {
return;
// Ideally we should return here if there are no matching selectors, however
// if there are property removals, returning here would not remove them
// this is seen in STYLE test in automated.
// return;
}
view._batchUpdate(() => {
this.stopKeyframeAnimations();
@ -578,23 +581,23 @@ export class CssState {
}
if (isCssVariableExpression(value) || isCssCalcExpression(value)) {
value = evaluateCssExpressions(view, property, newPropertyValues[property]);
}
if (value === unsetValue) {
delete newPropertyValues[property];
continue;
}
}
if (value === unsetValue) {
delete newPropertyValues[property];
continue;
}
valuesToApply[property] = value;
}
// Unset removed values
for (const property in oldProperties) {
if (property in view.style) {
view.style[`css:${property}`] = unsetValue;
if (property in view.style) {
view.style[`css:${property}`] = unsetValue;
}
else {
// TRICKY: How do we unset local value?
// TRICKY: How do we unset local value?
}
}
}
// Set new values to the style
for (const property in valuesToApply) {
const value = valuesToApply[property];

View File

@ -217,7 +217,10 @@ export class TextField extends TextFieldBase {
if (this.formattedText) {
_updateCharactersInRangeReplacementString(this.formattedText, range.location, range.length, replacementString);
}
if (this.width === 'auto') {
// if the textfield is in auto size we need to request a layout to take the new text width into account
this.requestLayout();
}
this.firstEdit = false;
return true;

View File

@ -168,9 +168,9 @@ export namespace iOSNativeHelper {
*/
export function applyRotateTransform(transform: any /* CATransform3D*/, x: number, y: number, z: number): any; /* CATransform3D*/
/**
* Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController
*/
/**
* Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController
*/
export function createUIDocumentInteractionControllerDelegate(): any;
/**

View File

@ -96,19 +96,12 @@ export namespace iOSNativeHelper {
}
export function getVisibleViewController(rootViewController: UIViewController): UIViewController {
if (rootViewController.presentedViewController) {
return getVisibleViewController(rootViewController.presentedViewController);
}
let viewController = rootViewController;
if (rootViewController.isKindOfClass(UINavigationController.class())) {
return getVisibleViewController((<UINavigationController>rootViewController).visibleViewController);
while (viewController && viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}
if (rootViewController.isKindOfClass(UITabBarController.class())) {
return getVisibleViewController(<UITabBarController>rootViewController);
}
return rootViewController;
return viewController;
}
export function applyRotateTransform(transform: CATransform3D, x: number, y: number, z: number): CATransform3D {
@ -125,33 +118,33 @@ export namespace iOSNativeHelper {
}
return transform;
}
export function createUIDocumentInteractionControllerDelegate(): NSObject {
@NativeClass
class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate {
public static ObjCProtocols = [UIDocumentInteractionControllerDelegate];
public getViewController(): UIViewController {
const app = UIApplication.sharedApplication;
return app.keyWindow.rootViewController;
}
public documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) {
return this.getViewController();
}
public documentInteractionControllerViewForPreview(controller: UIDocumentInteractionController) {
return this.getViewController().view;
}
public documentInteractionControllerRectForPreview(controller: UIDocumentInteractionController): CGRect {
return this.getViewController().view.frame;
}
}
return new UIDocumentInteractionControllerDelegateImpl();
}
}
export function createUIDocumentInteractionControllerDelegate(): NSObject {
@NativeClass
class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate {
public static ObjCProtocols = [UIDocumentInteractionControllerDelegate];
public getViewController(): UIViewController {
const app = UIApplication.sharedApplication;
return app.keyWindow.rootViewController;
}
public documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) {
return this.getViewController();
}
public documentInteractionControllerViewForPreview(controller: UIDocumentInteractionController) {
return this.getViewController().view;
}
public documentInteractionControllerRectForPreview(controller: UIDocumentInteractionController): CGRect {
return this.getViewController().view.frame;
}
}
return new UIDocumentInteractionControllerDelegateImpl();
}
export function isRealDevice() {
try {