chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-09 23:43:28 -07:00
parent 0ae8dba962
commit 8100cf7089
89 changed files with 493 additions and 704 deletions

View File

@@ -1,7 +1,6 @@
import { time } from "tns-core-modules/profiling";
import { ActionBar } from "tns-core-modules/ui/action-bar";
import { ActivityIndicator } from "tns-core-modules/ui/activity-indicator";
import { Border } from "tns-core-modules/ui/border";
import { Button } from "tns-core-modules/ui/button";
import { ContentView } from "tns-core-modules/ui/content-view";
import { DatePicker } from "tns-core-modules/ui/date-picker";

View File

@@ -430,14 +430,6 @@ import * as module_ui_animation_keyframe_animation_core from "@nativescript/core
import * as module_ui_animation_keyframe_animation_compat from "tns-core-modules/ui/animation/keyframe-animation";
compare("ui/animation/keyframe-animation", module_ui_animation_keyframe_animation_core, module_ui_animation_keyframe_animation_compat);
import * as module_ui_border_core from "@nativescript/core/ui/border";
import * as module_ui_border_compat from "tns-core-modules/ui/border";
compare("ui/border", module_ui_border_core, module_ui_border_compat);
import * as module_ui_border_border_core from "@nativescript/core/ui/border/border";
import * as module_ui_border_border_compat from "tns-core-modules/ui/border/border";
compare("ui/border/border", module_ui_border_border_core, module_ui_border_border_compat);
import * as module_ui_bottom_navigation_core from "@nativescript/core/ui/bottom-navigation";
import * as module_ui_bottom_navigation_compat from "tns-core-modules/ui/bottom-navigation";
compare("ui/bottom-navigation", module_ui_bottom_navigation_core, module_ui_bottom_navigation_compat);

View File

@@ -1,12 +1,9 @@
import * as frame from "tns-core-modules/ui/frame";
import { EventData } from "tns-core-modules/ui/frame";
import { Button } from "tns-core-modules/ui/button";
import { ActionBar } from "tns-core-modules/ui/action-bar";
import { Frame, EventData, Button, ActionBar } from "@nativescript/core";
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
export function navigate(args) {
frame.topmost().navigate("ui-tests-app/action-bar/clean");
Frame.topmost().navigate("ui-tests-app/action-bar/clean");
}
export function onChangeRenderingMode(args: EventData) {

View File

@@ -1,12 +1,9 @@
import * as frame from "tns-core-modules/ui/frame";
import { EventData } from "tns-core-modules/ui/frame";
import { Button } from "tns-core-modules/ui/button";
import { ActionBar } from "tns-core-modules/ui/action-bar";
import { EventData, Frame, Button, ActionBar } from "@nativescript/core";
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
export function navigate() {
frame.topmost().navigate("action-bar/clean-page");
Frame.topmost().navigate("action-bar/clean-page");
}
export function onChangeRenderingMode(args: EventData) {

View File

@@ -1,12 +1,9 @@
import * as frame from "tns-core-modules/ui/frame";
import { EventData } from "tns-core-modules/ui/frame";
import { Button } from "tns-core-modules/ui/button";
import { ActionBar } from "tns-core-modules/ui/action-bar";
import { EventData, Frame, Button, ActionBar } from "@nativescript/core";
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
export function navigate() {
frame.topmost().navigate("action-bar/clean-page");
Frame.topmost().navigate("action-bar/clean-page");
}
export function onChangeRenderingMode(args: EventData) {

View File

@@ -1,7 +1,5 @@
import { EventData } from "tns-core-modules/data/observable";
import { EventData, Frame, Button, ActionBar, WrapLayout, Page } from "@nativescript/core";
import { SubMainPageViewModel } from "../sub-main-page-view-model";
import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
import { Page } from "tns-core-modules/ui/page";
export function pageLoaded(args: EventData) {
const page = <Page>args.object;

View File

@@ -1,4 +1,4 @@
import { ShownModallyData } from "tns-core-modules/ui/page";
import { ShownModallyData } from "@nativescript/core";
let closeCallback: Function;

View File

@@ -1,7 +1,4 @@
import { ShownModallyData } from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
import { Label } from "tns-core-modules/ui/label";
import { Page } from "tns-core-modules/ui/page";
import { EventData, Page, Button, Label, ShownModallyData } from "@nativescript/core";
let closeCallback: Function;

View File

@@ -1,6 +1,4 @@
import { EventData } from "tns-core-modules/data/observable";
import { Page } from "tns-core-modules/ui/page";
import { topmost } from "tns-core-modules/ui/frame";
import { EventData, Frame, Page, ActionBar } from "@nativescript/core";
export function btnClick(args: EventData) {
(<Page>args.object).page.showModal("action-bar/modal-page", {
@@ -11,5 +9,5 @@ export function btnClick(args: EventData) {
}
export function btnBack(args: EventData) {
topmost().goBack();
Frame.topmost().goBack();
}

View File

@@ -1,6 +1,4 @@
import { EventData } from "tns-core-modules/data/observable";
import { Page } from "tns-core-modules/ui/page";
import { topmost } from "tns-core-modules/ui/frame";
import { EventData, Frame, Page } from "@nativescript/core";
export function btnClick(args: EventData) {
(<Page>args.object).page.showModal("action-bar/modal-page-hidden-action-bar-page", {
@@ -11,5 +9,5 @@ export function btnClick(args: EventData) {
}
export function btnBack(args: EventData) {
topmost().goBack();
Frame.topmost().goBack();
}

View File

@@ -1,5 +1,5 @@
import * as frame from "tns-core-modules/ui/frame";
import { Frame } from "@nativescript/core";
export function navigate() {
frame.topmost().navigate("action-bar/clean-page");
Frame.topmost().navigate("action-bar/clean-page");
}

View File

@@ -1,5 +1,5 @@
import * as frame from "tns-core-modules/ui/frame";
import { Frame } from "@nativescript/core";
export function navigate() {
frame.topmost().navigate("action-bar/clean-page");
Frame.topmost().navigate("action-bar/clean-page");
}

View File

@@ -1,16 +1,10 @@
import * as view from "tns-core-modules/ui/core/view";
import { View } from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
import { SegmentedBar, SegmentedBarItem } from "tns-core-modules/ui/segmented-bar";
import { Label } from "tns-core-modules/ui/label";
import { Animation, AnimationDefinition } from "tns-core-modules/ui/animation";
import * as fpsMeter from "tns-core-modules/fps-meter";
import { getViewById, View, Page, Button, SegmentedBar, SegmentedBarItem, Label, Animation, AnimationDefinition } from "@nativescript/core";
import * as fpsMeter from "@nativescript/core/fps-meter";
let fpsCallbackId;
export function onLoaded(args) {
const page = args.object;
const fpsLabel = view.getViewById(page, "fps") as Label;
const fpsLabel = getViewById(page, "fps") as Label;
fpsCallbackId = fpsMeter.addCallback((fps: number, minFps: number) => {
fpsLabel.text = `${fps.toFixed(2)}/${minFps.toFixed(2)}`;
});
@@ -85,13 +79,13 @@ export function getBoxPropertyAnimationData(property: string,
export function easeAnimate(args) {
const clicked = args.object as Button;
const page: pages.Page = clicked.page;
const select = view.getViewById(page, "select") as SegmentedBar;
const page: Page = clicked.page;
const select = getViewById(page, "select") as SegmentedBar;
const item: SegmentedBarItem = select.items[select.selectedIndex];
const animsIn: AnimationDefinition[] = [];
const animsOut: AnimationDefinition[] = [];
for (let i = 0; i < 100; i++) {
const box = view.getViewById(page, "el-" + i) as Label;
const box = getViewById(page, "el-" + i) as Label;
const prop = getBoxPropertyAnimationData(item.title, clicked.text, box, 32, 24);
animsIn.push({
[prop.animateKey]: prop.animateValueTo,

View File

@@ -1,14 +1,10 @@
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
import { SegmentedBar, SegmentedBarItem } from "tns-core-modules/ui/segmented-bar";
import { Label } from "tns-core-modules/ui/label";
import { getViewById, View, Page, Button, SegmentedBar, SegmentedBarItem, Label, Animation, AnimationDefinition } from "@nativescript/core";
export function easeAnimate(args) {
const clicked = args.object as Button;
const page: pages.Page = clicked.page;
const target = view.getViewById(page, "target") as Label;
const select = view.getViewById(page, "select") as SegmentedBar;
const page: Page = clicked.page;
const target = getViewById(page, "target") as Label;
const select = getViewById(page, "select") as SegmentedBar;
const item: SegmentedBarItem = select.items[select.selectedIndex];
const easeType: string = clicked.text;
const extent = 128;

View File

@@ -1,16 +1,12 @@
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import * as platform from "tns-core-modules/platform";
import { getViewById, View, Page, Button, SegmentedBar, SegmentedBarItem, Label, Animation, AnimationDefinition, Screen, TextView } from "@nativescript/core";
// import * as uiUtils from "tns-core-modules/ui/utils";
import { Animation } from "tns-core-modules/ui/animation";
import { TextView } from "tns-core-modules/ui/text-view";
// import { isIOS } from "tns-core-modules/platform";
let toggle = false;
export function pageLoaded(args) {
const page = args.object;
const screenHeight = platform.screen.mainScreen.heightDIPs;
const screenHeight = Screen.mainScreen.heightDIPs;
const screenYCenter = (screenHeight / 2);
page.bindingContext = {
screenHeight,
@@ -42,9 +38,9 @@ http://spaceipsum.com`
}
export function theFinalFrontier(args) {
const clicked = args.object as view.View;
const page: pages.Page = clicked.page;
const details = view.getViewById(page, "details") as TextView;
const clicked = args.object as View;
const page: Page = clicked.page;
const details = getViewById(page, "details") as TextView;
const ctx = page.bindingContext;
const detailHeaderHeight: number = ctx.detailsHeight;

View File

@@ -1,16 +1,13 @@
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { getViewById, View, Page, Button, SegmentedBar, SegmentedBarItem, Label, Animation, AnimationDefinition, Screen, TextView } from "@nativescript/core";
import * as platform from "tns-core-modules/platform";
import * as uiUtils from "tns-core-modules/ui/utils";
import { Animation } from "tns-core-modules/ui/animation";
import { TextView } from "tns-core-modules/ui/text-view";
import { isIOS } from "tns-core-modules/platform";
let toggle = false;
export function pageLoaded(args) {
const page = args.object;
const screenHeight = platform.screen.mainScreen.heightDIPs;
const screenHeight = Screen.mainScreen.heightDIPs;
const screenYCenter = (screenHeight / 2);
page.bindingContext = {
screenHeight,
@@ -42,9 +39,9 @@ http://spaceipsum.com`
}
export function theFinalFrontier(args) {
const clicked = args.object as view.View;
const page: pages.Page = clicked.page;
const details = view.getViewById(page, "details") as TextView;
const clicked = args.object as View;
const page: Page = clicked.page;
const details = getViewById(page, "details") as TextView;
const ctx = page.bindingContext;
const detailHeaderHeight: number = ctx.detailsHeight;

View File

@@ -1,4 +1,4 @@
import { Label } from "tns-core-modules/ui/label";
import { Label } from "@nativescript/core";
let toggle = false;

View File

@@ -1,7 +1,7 @@
import * as view from "tns-core-modules/ui/core/view";
import { View } from "@nativescript/core";
export function tapLabel(args) {
const clicked: view.View = args.object;
const clicked: View = args.object;
const graffiti = clicked as any;
clicked.animate({
height: graffiti.toggle ? 64 : 128,

View File

@@ -1,7 +1,5 @@
import { EventData } from "tns-core-modules/data/observable";
import { SubMainPageViewModel } from "../sub-main-page-view-model";
import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
import { Page } from "tns-core-modules/ui/page";
import { EventData, WrapLayout, Page, ActionBar } from "@nativescript/core";
export function pageLoaded(args: EventData) {
const page = <Page>args.object;

View File

@@ -1,13 +1,12 @@
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { View, Page } from "@nativescript/core";
export function applyTap(args) {
var page = <pages.Page>(<view.View>args.object).page;
var page = <Page>(<View>args.object).page;
var css = "#test-element { " + args.object.tag + " }";
page.css = css;
}
export function resetTap(args) {
var page = <pages.Page>(<view.View>args.object).page;
var page = <Page>(<View>args.object).page;
page.css = "";
}

View File

@@ -1,9 +1,4 @@
import { EventData } from "tns-core-modules/data/observable";
import { View } from "tns-core-modules/ui/core/view";
import { Button } from "tns-core-modules/ui/button";
import { Color } from "tns-core-modules/color";
import { TextView } from "tns-core-modules/ui/text-view";
import { ScrollView } from "tns-core-modules/ui/scroll-view";
import { EventData, Frame, Button, ScrollView, TextView, Color, View } from "@nativescript/core";
let red = new Color("red");
let green = new Color("green");

View File

@@ -1,6 +1,4 @@
import { EventData, Observable } from "tns-core-modules/data/observable";
import { Page } from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import { EventData, Page, Observable, Frame } from "@nativescript/core";
export function navigatingTo(args: EventData) {
const page = <Page>args.object;
@@ -8,7 +6,7 @@ export function navigatingTo(args: EventData) {
}
export function onNavBtnTap(args) {
frame.topmost().goBack();
Frame.topmost().goBack();
}
export class TestPage extends Observable {

View File

@@ -1,7 +1,5 @@
import { EventData } from "tns-core-modules/data/observable";
import { SubMainPageViewModel } from "../sub-main-page-view-model";
import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
import { Page } from "tns-core-modules/ui/page";
import { EventData, Page, WrapLayout } from "@nativescript/core";
export function pageLoaded(args: EventData) {
const page = <Page>args.object;

View File

@@ -1,6 +1,4 @@
import { Label } from "tns-core-modules/ui/label";
import { EventData, TextBase } from "tns-core-modules/ui/text-base";
import { Page } from "tns-core-modules/ui/page";
import { EventData, Page, TextBase, Label } from "@nativescript/core";
export function foxTap(args: EventData) {
let page = <Page>(<any>args.object).page;

View File

@@ -1,15 +1,13 @@
import { isIOS, isAndroid } from "tns-core-modules/platform";
import * as fs from "tns-core-modules/file-system/file-system";
import * as utils from "tns-core-modules/utils/utils";
import { isIOS, isAndroid, knownFolders, path, Utils } from "@nativescript/core";
export function openFile() {
let directory;
if (isIOS) {
directory = fs.knownFolders.ios.downloads();
directory = knownFolders.ios.downloads();
} else if (isAndroid) {
directory = android.os.Environment.getExternalStorageDirectory().getAbsolutePath().toString();
}
const filePath = fs.path.join(directory, "Test_File_Open.txt");
utils.openFile(filePath);
const filePath = path.join(directory, "Test_File_Open.txt");
Utils.openFile(filePath);
}

View File

@@ -13,8 +13,7 @@
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@nativescript/core": "file:../../dist/nativescript-core-7.0.0-rc.6.tgz",
"@nativescript/core-widgets": "^7.0.0-rc.0"
"@nativescript/core": "file:../../dist/nativescript-core-7.0.0-rc.9.tgz"
},
"devDependencies": {
"@testdeck/mocha": "0.0.6",
@@ -29,7 +28,7 @@
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"@nativescript/webpack": "^2.0.0-alpha.3",
"@nativescript/types": "file:../../dist/nativescript-types-7.0.0-rc.0.tgz",
"@nativescript/types": "~7.0.0-rc.0",
"typescript": "~3.9.0"
},
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",

View File

@@ -11,7 +11,6 @@ if (global.TNS_WEBPACK) {
global.registerModule('ui/text-base/span', () => require('./ui/text-base/span'));
global.registerModule('ui/action-bar', () => require('./ui/action-bar'));
global.registerModule('ui/activity-indicator', () => require('./ui/activity-indicator'));
global.registerModule('ui/border', () => require('./ui/border'));
global.registerModule('ui/bottom-navigation', () => require('./ui/bottom-navigation'));
global.registerModule('ui/button', () => require('./ui/button'));
global.registerModule('ui/content-view', () => require('./ui/content-view'));

View File

@@ -55,9 +55,14 @@ function _getConnectionTypeFromFlags(flags: number): number {
return connectionType.mobile;
}
const cfDict = CFNetworkCopySystemProxySettings();
const nsDict = cfDict.takeUnretainedValue();
const keys = nsDict.objectForKey('__SCOPED__');
let keys: any;
if (typeof CFNetworkCopySystemProxySettings !== 'undefined') {
const cfDict = CFNetworkCopySystemProxySettings();
if (cfDict && cfDict.takeUnretainedValue) {
const nsDict = cfDict.takeUnretainedValue();
keys = nsDict.objectForKey('__SCOPED__');
}
}
if (isVPNConnected(keys)) {
return connectionType.vpn;

View File

@@ -149,10 +149,10 @@ export class Observable {
*/
hasListeners(eventName: string): boolean;
//@private
public _emit(eventNames: string);
/**
* This method is intended to be overriden by inheritors to provide additional implementation.
* @private
*/
_createPropertyChangeData(name: string, value: any, oldValue?: any): PropertyChangeData;
@@ -162,11 +162,6 @@ export class Observable {
* @private
*/
public _isViewBase: boolean;
/**
* @private
*/
_emit(eventNames: string);
//@endprivate
}

View File

@@ -1,96 +0,0 @@
import { FileNameResolver as FileNameResolverDefinition } from '.';
import { PlatformContext } from '../../module-name-resolver/qualifier-matcher';
import { screen, Device } from '../../platform';
import { path as fsPath, Folder, File } from '..';
import { Trace } from '../../trace';
import * as appCommonModule from '../../application/application-common';
import { findMatch, stripQualifiers } from '../../module-name-resolver/qualifier-matcher';
export class FileNameResolver implements FileNameResolverDefinition {
private _context: PlatformContext;
private _cache = {};
constructor(context: PlatformContext) {
console.log('FileNameResolver is deprecated; use ModuleNameResolver instead');
this._context = context;
}
public resolveFileName(path: string, ext: string): string {
const key = path + ext;
let result: string = this._cache[key];
if (result === undefined) {
result = this.resolveFileNameImpl(path, ext);
this._cache[key] = result;
}
return result;
}
public clearCache(): void {
this._cache = {};
}
private resolveFileNameImpl(path: string, ext: string): string {
let result: string = null;
path = fsPath.normalize(path);
ext = '.' + ext;
// This call will return a clean path without qualifiers
path = stripQualifiers(path);
const candidates = this.getFileCandidatesFromFolder(path, ext);
result = findMatch(path, ext, candidates, this._context);
return result;
}
private getFileCandidatesFromFolder(path: string, ext: string): Array<string> {
const candidates = new Array<string>();
const folderPath = path.substring(0, path.lastIndexOf(fsPath.separator) + 1);
if (Folder.exists(folderPath)) {
const folder = Folder.fromPath(folderPath);
folder.eachEntity((e) => {
if (e instanceof File) {
const file = e;
if (file.path.indexOf(path) === 0 && file.extension === ext) {
candidates.push(file.path);
}
}
return true;
});
} else {
if (Trace.isEnabled()) {
Trace.write('Could not find folder ' + folderPath + ' when loading ' + path + ext, Trace.categories.Navigation);
}
}
return candidates;
}
}
let resolverInstance: FileNameResolver;
export function resolveFileName(path: string, ext: string): string {
if (!resolverInstance) {
resolverInstance = new FileNameResolver({
width: screen.mainScreen.widthDIPs,
height: screen.mainScreen.heightDIPs,
os: Device.os,
deviceType: Device.deviceType,
});
}
return resolverInstance.resolveFileName(path, ext);
}
export function clearCache() {
if (resolverInstance) {
resolverInstance.clearCache();
}
}
appCommonModule.on('cssChanged', (args) => (resolverInstance = undefined));
appCommonModule.on('livesync', (args) => clearCache());

View File

@@ -41,7 +41,6 @@ export function installPolyfills(moduleName: string, exportNames: string[]) {
}
export function initGlobal() {
console.log('initGlobal called, init:', (<any>global).hasInitGlobal);
if (!(<any>global).hasInitGlobal) {
(<any>global).hasInitGlobal = true;
// ts-helpers

View File

@@ -27,32 +27,6 @@ export declare const Application: {
hasLaunched: typeof hasLaunched;
android: AndroidApplication;
ios: iOSApplication;
} = {
launchEvent: 'launch',
displayedEvent: 'displayed',
uncaughtErrorEvent: 'uncaughtError',
discardedErrorEvent: 'discardedError',
suspendEvent: 'suspend',
resumeEvent: 'resume',
exitEvent: 'exit',
lowMemoryEvent: 'lowMemory',
orientationChangedEvent: 'orientationChanged',
getMainEntry,
getRootView,
resetRootView,
setResources,
setCssFileName,
getCssFileName,
loadAppCss,
addCss,
on,
off,
run,
orientation,
getNativeApplication,
hasLaunched,
android,
ios,
};
import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
export declare const ApplicationSettings: {
@@ -67,18 +41,6 @@ export declare const ApplicationSettings: {
setBoolean: typeof setBoolean;
getNumber: typeof getNumber;
setNumber: typeof setNumber;
} = {
clear,
flush,
hasKey,
remove,
setString,
getString,
getAllKeys,
getBoolean,
setBoolean,
getNumber,
setNumber,
};
export { Color } from './color';
import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
@@ -87,14 +49,9 @@ export declare const Connectivity: {
getConnectionType: typeof getConnectionType;
startMonitoring: typeof startMonitoring;
stopMonitoring: typeof stopMonitoring;
} = {
connectionType,
getConnectionType,
startMonitoring,
stopMonitoring,
};
export { ObservableArray, ChangeType, ChangedData } from './data/observable-array';
export { Observable, PropertyChangeData, EventData } from './data/observable';
export { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from './data/observable';
export { VirtualArray, ItemsLoading } from './data/virtual-array';
export { File, FileSystemEntity, Folder, knownFolders, path } from './file-system';
export { HttpRequestOptions, HttpResponse, Headers, HttpResponseEncoding, HttpContent } from './http';
@@ -105,50 +62,19 @@ export declare const Http: {
getJSON: typeof getJSON;
getString: typeof httpGetString;
request: typeof request;
} = {
getFile,
getImage,
getJSON,
getString,
request,
};
export { ImageAsset, ImageAssetOptions } from './image-asset';
export { ImageSource } from './image-source';
export { ModuleNameResolver, ModuleListProvider, PlatformContext, _setResolver } from './module-name-resolver';
export { isAndroid, isIOS, screen as Screen, IDevice, Device, platformNames } from './platform';
export { InstrumentationMode, TimerInfo } from './profiling';
import { enable as profilingEnable, disable as profilingDisable, time, uptime, start, stop, isRunning, dumpProfiles, resetProfiles, profile, startCPUProfile, stopCPUProfile } from './profiling';
export declare const Profiling: {
enable: typeof profilingEnable;
disable: typeof profilingDisable;
time: typeof time;
uptime: typeof uptime;
start: typeof start;
stop: typeof stop;
isRunning: typeof isRunning;
dumpProfiles: typeof dumpProfiles;
resetProfiles: typeof resetProfiles;
profile: typeof profile;
startCPUProfile: typeof startCPUProfile;
stopCPUProfile: typeof stopCPUProfile;
} = {
enable: profilingEnable,
disable: profilingDisable,
time,
uptime,
start,
stop,
isRunning,
dumpProfiles,
resetProfiles,
profile,
startCPUProfile,
stopCPUProfile,
};
// Profiling
export { InstrumentationMode, TimerInfo, profile, enable as profilingEnable, disable as profilingDisable, time as profilingTime, uptime as profilingUptime, start as profilingStart, stop as profilingStop, isRunning as profilingIsRunning, dumpProfiles as profilingDumpProfiles, resetProfiles as profilingResetProfiles, startCPUProfile as profilingStartCPU, stopCPUProfile as profilingStopCPU } from './profiling';
export { encoding } from './text';
export * from './trace';
export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, ios as iosUtils } from './utils';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, ios as iosUtils, Source } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export declare const Utils: {
GC: typeof GC;
isFontIconURI: typeof isFontIconURI;
@@ -166,22 +92,20 @@ export declare const Utils: {
layout: typeof layout;
android: typeof androidUtils;
ios: typeof iosUtils;
} = {
GC,
isFontIconURI,
isDataURI,
isFileOrResourcePath,
executeOnMainThread,
mainThreadify,
isMainThread,
dispatchToMainThread,
releaseNativeObject,
getModuleName,
openFile,
openUrl,
isRealDevice,
layout,
android,
ios,
Source: typeof Source;
ClassInfo: typeof ClassInfo;
getClass: typeof getClass;
getBaseClasses: typeof getBaseClasses;
getClassInfo: typeof getClassInfo;
isBoolean: typeof isBoolean;
isDefined: typeof isDefined;
isFunction: typeof isFunction;
isNullOrUndefined: typeof isNullOrUndefined;
isNumber: typeof isNumber;
isObject: typeof isObject;
isString: typeof isString;
isUndefined: typeof isUndefined;
toUIString: typeof toUIString;
verifyCallback: typeof verifyCallback;
};
export { XmlParser, ParserEventType, ParserEvent } from './xml';

View File

@@ -68,7 +68,7 @@ export const Connectivity = {
};
export { ObservableArray, ChangeType, ChangedData } from './data/observable-array';
export { Observable, PropertyChangeData, EventData } from './data/observable';
export { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from './data/observable';
export { VirtualArray, ItemsLoading } from './data/virtual-array';
export { File, FileSystemEntity, Folder, knownFolders, path } from './file-system';
@@ -87,26 +87,11 @@ export const Http = {
export { ImageAsset, ImageAssetOptions } from './image-asset';
export { ImageSource } from './image-source';
export { ModuleNameResolver, ModuleListProvider, PlatformContext, _setResolver } from './module-name-resolver';
export { isAndroid, isIOS, screen as Screen, IDevice, Device, platformNames } from './platform';
// Export interfaces from "profiling" module
export { InstrumentationMode, TimerInfo } from './profiling';
// Export methods from "profiling" module
import { enable as profilingEnable, disable as profilingDisable, time, uptime, start, stop, isRunning, dumpProfiles, resetProfiles, profile, startCPUProfile, stopCPUProfile } from './profiling';
export const Profiling = {
enable: profilingEnable,
disable: profilingDisable,
time,
uptime,
start,
stop,
isRunning,
dumpProfiles,
resetProfiles,
profile,
startCPUProfile,
stopCPUProfile,
};
// Profiling
export { InstrumentationMode, TimerInfo, profile, enable as profilingEnable, disable as profilingDisable, time as profilingTime, uptime as profilingUptime, start as profilingStart, stop as profilingStop, isRunning as profilingIsRunning, dumpProfiles as profilingDumpProfiles, resetProfiles as profilingResetProfiles, startCPUProfile as profilingStartCPU, stopCPUProfile as profilingStopCPU } from './profiling';
export { encoding } from './text';
@@ -114,7 +99,8 @@ export * from './trace';
export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, ios as iosUtils } from './utils';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, ios as iosUtils, Source } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export const Utils = {
GC,
@@ -135,6 +121,21 @@ export const Utils = {
layout,
android: androidUtils,
ios: iosUtils,
Source,
ClassInfo,
getClass,
getBaseClasses,
getClassInfo,
isBoolean,
isDefined,
isFunction,
isNullOrUndefined,
isNumber,
isObject,
isString,
isUndefined,
toUIString,
verifyCallback,
};
export { XmlParser, ParserEventType, ParserEvent } from './xml';

View File

@@ -17,4 +17,8 @@ export class ModuleNameResolver {
export function resolveModuleName(path: string, ext: string): string;
export function clearCache(): void;
/**
* Used to set a global singular instance of ModuleNameResolver
* @param resolver instance
*/
export function _setResolver(resolver: ModuleNameResolver);

View File

@@ -1,4 +1,3 @@
import { ModuleNameResolver as ModuleNameResolverDefinition } from './';
import { screen, Device } from '../platform';
import * as appCommonModule from '../application/application-common';
import { PlatformContext, findMatch, stripQualifiers } from './qualifier-matcher';
@@ -9,7 +8,7 @@ export { PlatformContext } from './qualifier-matcher';
export type ModuleListProvider = () => string[];
export class ModuleNameResolver implements ModuleNameResolverDefinition {
export class ModuleNameResolver {
private _cache = {};
constructor(private context: PlatformContext, private moduleListProvider: ModuleListProvider = global.getRegisteredModules) {}

View File

@@ -2,6 +2,9 @@
* Provides ModuleNameResolver class used for loading files based on device capabilities.
*/
/**
* Used with qualifier matchers and module resolution
*/
export interface PlatformContext {
width: number;
height: number;

View File

@@ -3,6 +3,9 @@ const MIN_W: string = 'minW';
const MIN_H: string = 'minH';
const PRIORITY_STEP = 10000;
/**
* Used with qualifier matchers and module resolution
*/
export interface PlatformContext {
width: number;
height: number;

View File

@@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "7.0.0-rc.6",
"version": "7.0.0-rc.9",
"homepage": "https://www.nativescript.org",
"repository": {
"type": "git",
@@ -19,7 +19,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@nativescript/core-widgets": "~7.0.0-rc.0",
"@nativescript/ui-base": "~7.0.0-rc.0",
"@nativescript/hook": "~1.0.0",
"css-tree": "^1.0.0-alpha.39",
"reduce-css-calc": "^2.1.6",

View File

@@ -123,24 +123,24 @@ export namespace Trace {
export const separator = ',';
export const All: Array<string>;
export function concat(): string;
class ConsoleWriter implements TraceWriter {
public write(message: any, category: string, type?: number): void;
}
export class DefaultErrorHandler implements TraceErrorHandler {
handlerError(error: any): void;
}
export function getErrorHandler(): TraceErrorHandler;
export function setErrorHandler(handler: TraceErrorHandler): void;
/**
* Passes an error to the registered ErrorHandler
* @param error The error to be handled.
*/
export function error(error: string | Error): void;
export function concat(...args: any): string;
}
class ConsoleWriter implements TraceWriter {
public write(message: any, category: string, type?: number): void;
}
export class DefaultErrorHandler implements TraceErrorHandler {
handlerError(error: any): void;
}
export function getErrorHandler(): TraceErrorHandler;
export function setErrorHandler(handler: TraceErrorHandler): void;
/**
* Passes an error to the registered ErrorHandler
* @param error The error to be handled.
*/
export function error(error: string | Error): void;
}

View File

@@ -204,7 +204,7 @@ export namespace Trace {
export const separator = ',';
export const All = [VisualTreeEvents, Layout, Style, ViewHierarchy, NativeLifecycle, Debug, Navigation, Test, Binding, Error, Animation, Transition, Livesync, ModuleNameResolver].join(separator);
export function concat(): string {
export function concat(...args: any): string {
let result: string;
for (let i = 0; i < arguments.length; i++) {
if (!result) {

View File

@@ -12,6 +12,7 @@ import { Device, screen } from '../../platform';
import lazy from '../../utils/lazy';
export * from './animation-common';
export { KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './keyframe-animation';
let argbEvaluator: android.animation.ArgbEvaluator;
function ensureArgbEvaluator() {

View File

@@ -2,6 +2,8 @@
import { Color } from '../../color';
import { PercentLength } from '../styling/style-properties';
export { KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './keyframe-animation';
/**
* Defines animation options for the View.animate method.
*/

View File

@@ -12,6 +12,7 @@ import { ios as iosNativeHelper } from '../../utils/native-helper';
import { screen } from '../../platform';
export * from './animation-common';
export { KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './keyframe-animation';
let _transform = '_transform';
let _skip = '_skip';

View File

@@ -1,6 +1,3 @@
// Definitions.
import { Keyframes as KeyframesDefinition, UnparsedKeyframe as UnparsedKeyframeDefinition, KeyframeDeclaration as KeyframeDeclarationDefinition, KeyframeInfo as KeyframeInfoDefinition, KeyframeAnimationInfo as KeyframeAnimationInfoDefinition, KeyframeAnimation as KeyframeAnimationDefinition } from './keyframe-animation';
import { View } from '../core/view';
import { Color } from '../../color';
@@ -13,28 +10,28 @@ import { unsetValue } from '../core/properties';
import { Animation } from '.';
import { backgroundColorProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, rotateProperty, opacityProperty, rotateXProperty, rotateYProperty, widthProperty, heightProperty, PercentLength } from '../styling/style-properties';
export class Keyframes implements KeyframesDefinition {
export class Keyframes {
name: string;
keyframes: Array<UnparsedKeyframe>;
}
export class UnparsedKeyframe implements UnparsedKeyframeDefinition {
export class UnparsedKeyframe {
values: Array<any>;
declarations: Array<KeyframeDeclaration>;
}
export class KeyframeDeclaration implements KeyframeDeclarationDefinition {
export class KeyframeDeclaration {
public property: string;
public value: any;
}
export class KeyframeInfo implements KeyframeInfoDefinition {
export class KeyframeInfo {
public duration: number;
public declarations: Array<KeyframeDeclaration>;
public curve?: any = AnimationCurve.ease;
}
export class KeyframeAnimationInfo implements KeyframeAnimationInfoDefinition {
export class KeyframeAnimationInfo {
public keyframes: Array<KeyframeInfo>;
public name?: string = '';
public duration?: number = 0.3;
@@ -59,7 +56,7 @@ interface Keyframe {
forceLayer?: boolean;
}
export class KeyframeAnimation implements KeyframeAnimationDefinition {
export class KeyframeAnimation {
public animations: Array<Keyframe>;
public delay: number = 0;
public iterations: number = 1;

View File

@@ -1,46 +0,0 @@
import { Border as BorderDefinition } from '.';
import { ContentView } from '../content-view';
import { View, CSSType } from '../core/view';
import { layout } from '../../utils';
@Deprecated
@CSSType('Border')
export class Border extends ContentView implements BorderDefinition {
get cornerRadius(): number {
if (typeof this.borderRadius === 'number') {
return <number>this.borderRadius;
}
return 0;
}
set cornerRadius(value: number) {
this.borderRadius = value;
}
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
const width = layout.getMeasureSpecSize(widthMeasureSpec);
const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
const height = layout.getMeasureSpecSize(heightMeasureSpec);
const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
const horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
const verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
const result = View.measureChild(this, this.layoutView, layout.makeMeasureSpec(width - horizontalBorderLength, widthMode), layout.makeMeasureSpec(height - verticalBorderLength, heightMode));
const widthAndState = View.resolveSizeAndState(result.measuredWidth + horizontalBorderLength, width, widthMode, 0);
const heightAndState = View.resolveSizeAndState(result.measuredHeight + verticalBorderLength, height, heightMode, 0);
this.setMeasuredDimension(widthAndState, heightAndState);
}
public onLayout(left: number, top: number, right: number, bottom: number): void {
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
View.layoutChild(this, this.layoutView, this.effectiveBorderLeftWidth, this.effectiveBorderTopWidth, right - left - horizontalBorderLength, bottom - top - verticalBorderLength);
}
}
Border.prototype.recycleNativeView = 'auto';

View File

@@ -1 +1,6 @@
/**
* Helps sanitize a module name if it is prefixed with '~/', '~' or '/'
* @param moduleName the name
* @param removeExtension whether to remove extension
*/
export function sanitizeModuleName(moduleName: string, removeExtension?: boolean): string;

View File

@@ -1,3 +1,8 @@
/**
* Helps sanitize a module name if it is prefixed with '~/', '~' or '/'
* @param moduleName the name
* @param removeExtension whether to remove extension
*/
export function sanitizeModuleName(moduleName: string, removeExtension: boolean = true): string {
moduleName = moduleName.trim();

View File

@@ -417,10 +417,6 @@ export abstract class ViewBase extends Observable {
*/
public ensureDomNode();
//@private
/**
* @private
*/
public recycleNativeView: 'always' | 'never' | 'auto';
/**

View File

@@ -666,3 +666,38 @@ export module UserInterfaceStyle {
*/
export const dark: string;
}
/**
* Singular rollup for convenience of all enums
*/
export declare const Enums: {
Accuracy: typeof Accuracy;
AndroidActionBarIconVisibility: typeof AndroidActionBarIconVisibility;
AndroidActionItemPosition: typeof AndroidActionItemPosition;
AnimationCurve: typeof AnimationCurve;
AutocapitalizationType: typeof AutocapitalizationType;
BackgroundRepeat: typeof BackgroundRepeat;
DeviceOrientation: typeof DeviceOrientation;
DeviceType: typeof DeviceType;
Dock: typeof Dock;
FontAttributes: typeof FontAttributes;
FontStyle: typeof FontStyle;
FontWeight: typeof FontWeight;
HorizontalAlignment: typeof HorizontalAlignment;
IOSActionItemPosition: typeof IOSActionItemPosition;
ImageFormat: typeof ImageFormat;
KeyboardType: typeof KeyboardType;
NavigationBarVisibility: typeof NavigationBarVisibility;
Orientation: typeof Orientation;
ReturnKeyType: typeof ReturnKeyType;
StatusBarStyle: typeof StatusBarStyle;
Stretch: typeof Stretch;
SystemAppearance: typeof SystemAppearance;
TextAlignment: typeof TextAlignment;
TextDecoration: typeof TextDecoration;
TextTransform: typeof TextTransform;
UpdateTextTrigger: typeof UpdateTextTrigger;
VerticalAlignment: typeof VerticalAlignment;
Visibility: typeof Visibility;
WhiteSpace: typeof WhiteSpace;
};

View File

@@ -195,3 +195,35 @@ export module SystemAppearance {
export const light = 'light';
export const dark = 'dark';
}
export const Enums = {
Accuracy,
AndroidActionBarIconVisibility,
AndroidActionItemPosition,
AnimationCurve,
AutocapitalizationType,
BackgroundRepeat,
DeviceOrientation,
DeviceType,
Dock,
FontAttributes,
FontStyle,
FontWeight,
HorizontalAlignment,
IOSActionItemPosition,
ImageFormat,
KeyboardType,
NavigationBarVisibility,
Orientation,
ReturnKeyType,
StatusBarStyle,
Stretch,
SystemAppearance,
TextAlignment,
TextDecoration,
TextTransform,
UpdateTextTrigger,
VerticalAlignment,
Visibility,
WhiteSpace,
};

View File

@@ -1,5 +1,4 @@
// Types.
import { Frame as FrameDefinition } from '.';
import { BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, NavigationType } from './frame-interfaces';
import { Page } from '../page';
import { View, CustomLayoutView, CSSType } from '../core/view';
@@ -35,7 +34,7 @@ function buildEntryFromArgs(arg: any): NavigationEntry {
}
@CSSType('Frame')
export class FrameBase extends CustomLayoutView implements FrameDefinition {
export class FrameBase extends CustomLayoutView {
public static androidOptionSelectedEvent = 'optionSelected';
private _animated: boolean;

View File

@@ -1,4 +1,4 @@
import { NavigationType } from './frame-common';
import { NavigationType, FrameBase } from './frame-common';
import { Page } from '../page';
import { Observable, EventData } from '../../data/observable';
import { View } from '../core/view';
@@ -10,7 +10,7 @@ export * from './frame-interfaces';
* Represents the logical View unit that is responsible for navigation within an application.
* Nested frames are supported, enabling hierarchical navigation scenarios.
*/
export class Frame extends View {
export class Frame extends FrameBase {
/**
* Gets a frame by id.
*/

View File

@@ -1,10 +1,12 @@
export { ActionBar, ActionItem, ActionItems, NavigationButton } from './action-bar';
export { ActivityIndicator } from './activity-indicator';
export { Animation, AnimationDefinition } from './animation';
export { Animation, AnimationDefinition, KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './animation';
export { BottomNavigation, SelectedIndexChangedEventData } from './bottom-navigation';
export { Builder, LoadOptions } from './builder';
export { sanitizeModuleName } from './builder/module-name-sanitizer';
export { Button } from './button';
export { ContentView } from './content-view';
export { Binding, BindingOptions } from './core/bindable';
export { ViewBase, ShowModalOptions, eachDescendant, getAncestor, getViewById } from './core/view-base';
export { View, Template, KeyedTemplate, ShownModallyData } from './core/view';
export { Property, CoercibleProperty, InheritedProperty, CssProperty, InheritedCssProperty, ShorthandProperty, CssAnimationProperty, unsetValue } from './core/properties';
@@ -14,8 +16,7 @@ export { DatePicker } from './date-picker';
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs, DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions, inputType, capitalizationType } from './dialogs';
export * from './editable-text-base';
import * as enumsModule from './enums';
export const Enums = enumsModule;
export { Enums } from './enums';
export { Frame, NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry } from './frame';
export { GestureEventData, GestureEventDataWithState, GestureStateTypes, GestureTypes, GesturesObserver, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeDirection, SwipeGestureEventData, TouchGestureEventData } from './gestures';
@@ -29,7 +30,7 @@ export * from './layouts'; // barrel export
export { ListPicker } from './list-picker';
export { ListView, ItemEventData, TemplatedItemsView, ItemsSource } from './list-view';
export { Page, NavigatedData } from './page';
export { Page, NavigatedData, PageBase } from './page';
export { Placeholder, CreateViewEventData } from './placeholder';
export { Progress } from './progress';
export { ProxyViewContainer } from './proxy-view-container';
@@ -41,8 +42,11 @@ export { Slider } from './slider';
// TODO: Consider adding APIs from style
// export { addTaggedAdditionalCSS, removeTaggedAdditionalCSS } from "./styling/style-scope";
export { animationTimingFunctionConverter, timeConverter } from './styling/converters';
export { Style, CommonLayoutParams } from './styling/style';
export * from './styling/style-properties';
export { CssAnimationParser, parseKeyframeDeclarations } from './styling/css-animation-parser';
export { CSSHelper } from './styling/css-selector';
export { Switch } from './switch';
export { TabContentItem } from './tab-navigation-base/tab-content-item';
@@ -51,7 +55,7 @@ export { TabStrip, TabStripItemEventData } from './tab-navigation-base/tab-strip
export { TabStripItem } from './tab-navigation-base/tab-strip-item';
export { TabView, TabViewItem } from './tab-view';
export { Tabs } from './tabs';
export { TextBase } from './text-base';
export { TextBase, TextTransform } from './text-base';
export { FormattedString } from './text-base/formatted-string';
export { Span } from './text-base/span';
export { TextField } from './text-field';

View File

@@ -1,10 +1,12 @@
export { ActionBar, ActionItem, ActionItems, NavigationButton } from './action-bar';
export { ActivityIndicator } from './activity-indicator';
export { Animation, AnimationDefinition } from './animation';
export { Animation, AnimationDefinition, KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './animation';
export { BottomNavigation, SelectedIndexChangedEventData } from './bottom-navigation';
export { Builder, LoadOptions } from './builder';
export { sanitizeModuleName } from './builder/module-name-sanitizer';
export { Button } from './button';
export { ContentView } from './content-view';
export { Binding, BindingOptions } from './core/bindable';
export { ViewBase, ShowModalOptions, eachDescendant, getAncestor, getViewById } from './core/view-base';
export { View, Template, KeyedTemplate, ShownModallyData } from './core/view';
export { Property, CoercibleProperty, InheritedProperty, CssProperty, InheritedCssProperty, ShorthandProperty, CssAnimationProperty, unsetValue } from './core/properties';
@@ -14,8 +16,7 @@ export { DatePicker } from './date-picker';
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs, DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions, inputType, capitalizationType } from './dialogs';
export * from './editable-text-base';
import * as enumsModule from './enums';
export const Enums = enumsModule;
export { Enums } from './enums';
export { Frame, NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry } from './frame';
export { GestureEventData, GestureEventDataWithState, GestureStateTypes, GestureTypes, GesturesObserver, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeDirection, SwipeGestureEventData, TouchGestureEventData } from './gestures';
@@ -29,7 +30,7 @@ export * from './layouts'; // barrel export
export { ListPicker } from './list-picker';
export { ListView, ItemEventData, TemplatedItemsView, ItemsSource } from './list-view';
export { Page, NavigatedData } from './page';
export { Page, NavigatedData, PageBase } from './page';
export { Placeholder, CreateViewEventData } from './placeholder';
export { Progress } from './progress';
export { ProxyViewContainer } from './proxy-view-container';
@@ -41,8 +42,11 @@ export { Slider } from './slider';
// TODO: Consider adding APIs from style
// export { addTaggedAdditionalCSS, removeTaggedAdditionalCSS } from "./styling/style-scope";
export { animationTimingFunctionConverter, timeConverter } from './styling/converters';
export { Style, CommonLayoutParams } from './styling/style';
export * from './styling/style-properties';
export { CssAnimationParser, parseKeyframeDeclarations } from './styling/css-animation-parser';
export { CSSHelper } from './styling/css-selector';
export { Switch } from './switch';
export { TabContentItem } from './tab-navigation-base/tab-content-item';

View File

@@ -1,12 +1,14 @@
import { CssProperty, Property } from '../core/properties';
import { PageBase } from './page-common';
import { CssProperty, Property } from '../core/properties';
import { Style } from '../styling/style';
import { EventData } from '../../data/observable';
import { ContentView } from '../content-view';
import { Frame } from '../frame';
import { ActionBar } from '../action-bar';
import { KeyframeAnimationInfo } from '../animation/keyframe-animation';
import { Color } from '../../color';
export * from './page-common';
/**
* Defines the data for the page navigation events.
*/
@@ -29,7 +31,7 @@ export module knownCollections {
/**
* Represents a logical unit for navigation (inside Frame).
*/
export class Page extends ContentView {
export declare class Page extends PageBase {
/**
* String value used when hooking to navigatingTo event.
*/

View File

@@ -0,0 +1,52 @@
import { Page as PageDefinition } from '.';
import { ContentView } from '../content-view';
import { Frame } from '../frame';
import { KeyframeAnimationInfo } from '../animation';
import { NavigatedData } from '.';
import { Color } from '../../color';
import { ActionBar } from '../action-bar';
import { View } from '../core/view';
export declare class PageBase extends ContentView {
static navigatingToEvent: string;
static navigatedToEvent: string;
static navigatingFromEvent: string;
static navigatedFromEvent: string;
_frame: Frame;
actionBarHidden: boolean;
enableSwipeBackNavigation: boolean;
backgroundSpanUnderStatusBar: boolean;
hasActionBar: boolean;
readonly navigationContext: any;
actionBar: ActionBar;
statusBarStyle: 'light' | 'dark';
androidStatusBarBackground: Color;
readonly page: PageDefinition;
_addChildFromBuilder(name: string, value: any): void;
getKeyframeAnimationWithName(animationName: string): KeyframeAnimationInfo;
readonly frame: Frame;
createNavigatedData(eventName: string, isBackNavigation: boolean): NavigatedData {
return {
eventName: eventName,
object: this,
context: this.navigationContext,
isBackNavigation: isBackNavigation,
};
}
onNavigatingTo(context: any, isBackNavigation: boolean, bindingContext?: any): void;
onNavigatedTo(isBackNavigation: boolean): void;
onNavigatingFrom(isBackNavigation: boolean): void;
onNavigatedFrom(isBackNavigation: boolean): void;
eachChildView(callback: (child: View) => boolean): void;
}

View File

@@ -1,4 +1,4 @@
import { Page as PageDefinition, NavigatedData } from '.';
import { Page as PageDefinition } from '.';
import { ContentView } from '../content-view';
import { View, CSSType, ShownModallyData } from '../core/view';
import { booleanConverter } from '../core/view-base';
@@ -12,8 +12,13 @@ import { ActionBar } from '../action-bar';
import { KeyframeAnimationInfo } from '../animation/keyframe-animation';
import { profile } from '../../profiling';
interface NavigatedData extends EventData {
context: any;
isBackNavigation: boolean;
}
@CSSType('Page')
export class PageBase extends ContentView implements PageDefinition {
export class PageBase extends ContentView {
public static navigatingToEvent = 'navigatingTo';
public static navigatedToEvent = 'navigatedTo';
public static navigatingFromEvent = 'navigatingFrom';

View File

@@ -695,3 +695,21 @@ export class SelectorsMatch<T extends Node> implements ChangeAccumulator {
return set;
}
}
export const CSSHelper = {
createSelector,
SelectorCore,
SimpleSelector,
InvalidSelector,
UniversalSelector,
TypeSelector,
ClassSelector,
AttributeSelector,
PseudoClassSelector,
SimpleSelectorSequence,
Selector,
RuleSet,
SelectorsMap,
fromAstNodes,
SelectorsMatch,
};

View File

@@ -10,7 +10,7 @@ import { colorProperty, fontSizeProperty, fontInternalProperty, paddingLeftPrope
import { FormattedString } from './formatted-string';
import { Span } from './span';
import { layout } from '../../utils';
import { isString } from '../../utils/types';
import { isString, isNullOrUndefined } from '../../utils/types';
export * from './text-base-common';
@@ -40,7 +40,7 @@ function initializeTextTransformation(): void {
return createSpannableStringBuilder(formattedText, (<android.widget.TextView>view).getTextSize());
} else {
const text = this.textBase.text;
const stringValue = text === null || text === undefined ? '' : text.toString();
const stringValue = isNullOrUndefined(text) ? '' : text.toString();
return getTransformedText(stringValue, this.textBase.textTransform);
}

View File

@@ -8,7 +8,7 @@ import { Color } from '../../color';
import { FormattedString } from './formatted-string';
import { Span } from './span';
import { colorProperty, fontInternalProperty, VerticalAlignment } from '../styling/style-properties';
import { isString } from '../../utils/types';
import { isString, isDefined, isNullOrUndefined } from '../../utils/types';
import { ios } from '../../utils';
export * from './text-base-common';
@@ -307,7 +307,7 @@ export class TextBase extends TextBaseCommon {
dict.set(NSParagraphStyleAttributeName, paragraphStyle);
}
const source = getTransformedText(this.text ? this.text.toString() : '', this.textTransform);
const source = getTransformedText(isNullOrUndefined(this.text) ? '' : `${this.text}`, this.textTransform);
if (dict.size > 0 || isTextView) {
if (isTextView && this.nativeTextViewProtected.font) {
// UITextView's font seems to change inside.
@@ -349,7 +349,7 @@ export class TextBase extends TextBaseCommon {
const span = formattedString.spans.getItem(i);
const text = span.text;
const textTransform = (<TextBase>formattedString.parent).textTransform;
let spanText = text === null || text === undefined ? '' : text.toString();
let spanText = isNullOrUndefined(text) ? '' : `${text}`;
if (textTransform !== 'none' && textTransform !== 'initial') {
spanText = getTransformedText(spanText, textTransform);
}

View File

@@ -4,6 +4,7 @@ import { ViewBase } from '../core/view-base';
import { FontStyle, FontWeight } from '../styling/font';
import { TextDecoration } from '../text-base';
import { EventData } from '../../data/observable';
import { isNullOrUndefined, isString } from '../../utils/types';
export class Span extends ViewBase implements SpanDefinition {
static linkTapEvent = 'linkTap';
@@ -66,8 +67,12 @@ export class Span extends ViewBase implements SpanDefinition {
}
set text(value: string) {
if (this._text !== value) {
// value can be a number
this._text = `${value}`.replace('\\n', '\n').replace('\\t', '\t');
if (isNullOrUndefined(value)) {
this._text = '';
} else {
// value can be a number
this._text = isString(value) ? `${value}`.replace('\\n', '\n').replace('\\t', '\t') : `${value}`;
}
this.notifyPropertyChange('text', this._text);
}
}

View File

@@ -65,10 +65,15 @@ export abstract class WebViewBase extends ContainerView {
[srcProperty.setNative](src: string) {
this.stopLoading();
// Add file:/// prefix for local files.
// Add file:// prefix for local files.
// They should be loaded with _loadUrl() method as it handles query params.
if (src.indexOf('~/') === 0) {
src = `file:///${knownFolders.currentApp().path}/` + src.substr(2);
let appPath = knownFolders.currentApp().path;
if (appPath && appPath.indexOf('/') !== 0) {
// ensure slash is correct
appPath = `/${appPath}`;
}
src = `file://${appPath}/` + src.substr(2);
} else if (src.indexOf('/') === 0) {
src = 'file://' + src;
}

View File

@@ -5,6 +5,7 @@ import { Trace } from '../trace';
export { ad } from './native-helper';
export * from './utils-common';
export { Source } from './debug';
const MIN_URI_SHARE_RESTRICTED_APK_VERSION = 24;

View File

@@ -1,6 +1,7 @@
import { dip, px } from '../ui/core/view';
export * from './mainthread-helper';
export { Source } from './debug';
export const RESOURCE_PREFIX: string;
export const FILE_PREFIX: string;

View File

@@ -3,6 +3,7 @@ import { Trace } from '../trace';
export { ios } from './native-helper';
export * from './utils-common';
export { Source } from './debug';
export function openFile(filePath: string): boolean {
try {

View File

@@ -27,7 +27,7 @@ export function isObject(value: any): boolean {
}
export function isUndefined(value: any): boolean {
return value === undefined;
return typeof value === 'undefined';
}
export function isDefined(value: any): boolean {
@@ -35,7 +35,7 @@ export function isDefined(value: any): boolean {
}
export function isNullOrUndefined(value: any): boolean {
return value === undefined || value === null;
return typeof value === 'undefined' || value === null;
}
export function verifyCallback(value: any) {

View File

@@ -2,7 +2,7 @@
"name": "NativeScript",
"description": "NativeScript Core Modules",
"homepage": "https://nativescript.org",
"version": "7.0.0-rc.6",
"version": "7.0.0-rc.9",
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/NativeScript"

View File

@@ -43,5 +43,14 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
</dict>
</plist>

View File

@@ -1,10 +1,10 @@
// >> observable-require
import { Observable, fromObject, fromObjectRecursive, PropertyChangeData, EventData, WrappedValue } from "@nativescript/core/data/observable";
import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from "@nativescript/core";
// << observable-require
import * as TKUnit from "../tk-unit";
import * as types from "@nativescript/core/utils/types";
import { ObservableArray } from "@nativescript/core/data/observable-array";
import { ObservableArray } from "@nativescript/core";
var TESTED_NAME = "tested";
class TestObservable extends Observable {

View File

@@ -1,18 +1,16 @@
import * as TKUnit from "../tk-unit";
import * as fs from "@nativescript/core/file-system";
import { knownFolders, path, File, Folder } from "@nativescript/core";
export var test_UTF8_BOM_is_not_returned = function () {
var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "xml.expected");
if (!fs.File.exists(path)) {
TKUnit.assert(false, "Could not read file utf8.txt");
return;
const folder1 = path.join(knownFolders.documents().path, "file-system-access-tests");
if (!Folder.exists(folder1)) {
Folder.fromPath(folder1);
}
var file = fs.File.fromPath(path);
var filePath = path.join(folder1, "xml.expected");
var file = File.fromPath(filePath);
var onError = function (error) {
TKUnit.assert(false, "Could not read file utf8.txt");
TKUnit.assert(false, "Could not read file xml.expected");
};
var text = file.readTextSync(onError);
@@ -24,21 +22,28 @@ export var test_UTF8_BOM_is_not_returned = function () {
};
export var test_file_exists_on_folder = function () {
var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "folder");
const folder1 = path.join(knownFolders.documents().path, "file-system-access-tests");
if (!Folder.exists(folder1)) {
Folder.fromPath(folder1);
}
var filePath = path.join(folder1, "folder");
if (!Folder.exists(filePath)) {
Folder.fromPath(filePath);
}
if (!fs.Folder.exists(path)) {
TKUnit.assert(false, `Could not read path ${path}`);
if (!Folder.exists(filePath)) {
TKUnit.assert(false, `Could not read path ${filePath}`);
return;
}
TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!");
TKUnit.assertTrue(File.exists(filePath), "File.exists() returned false for folder!");
};
export var test_leading_slash_is_not_returned = function () {
var parts = ["app", "tns_modules", "fileName"];
var expected = parts.join("/");
var path = fs.path.join(...parts);
var filePath = path.join(...parts);
TKUnit.assertEqual(path, expected, "Leading slash should not be part of the path");
TKUnit.assertEqual(filePath, expected, "Leading slash should not be part of the path");
};

View File

@@ -1,42 +0,0 @@
import * as TKUnit from "../tk-unit";
import * as fs from "@nativescript/core/file-system";
import { FileNameResolver } from "@nativescript/core/file-system/file-name-resolver";
import {
androidPhonePortraitContext,
androidPhoneLandscapeContext,
androidTabletPortraitContext,
iPhoneLandscapeContext,
iPhonePortraitContext
} from "./qualifier-matcher-tests";
const testFilePath = "~/name-resolvers-tests/files/test".replace("~", fs.knownFolders.currentApp().path);
export function test_file_resolver_with_android_phone_portrait() {
const fileResolver = new FileNameResolver(androidPhonePortraitContext);
const result = fileResolver.resolveFileName(testFilePath, "xml");
TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
}
export function test_file_resolver_with_android_phone_landscape() {
const fileResolver = new FileNameResolver(androidPhoneLandscapeContext);
const result = fileResolver.resolveFileName(testFilePath, "xml");
TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
}
export function test_file_resolver_with_android_tablet_portrait() {
const fileResolver = new FileNameResolver(androidTabletPortraitContext);
const result = fileResolver.resolveFileName(testFilePath, "xml");
TKUnit.assertEqual(result, testFilePath + ".minWH600.xml", "File path");
}
export function test_file_resolver_with_ios_phone_landscape() {
const fileResolver = new FileNameResolver(iPhoneLandscapeContext);
const result = fileResolver.resolveFileName(testFilePath, "xml");
TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
}
export function test_file_resolver_with_ios_phone_portrait() {
const fileResolver = new FileNameResolver(iPhonePortraitContext);
const result = fileResolver.resolveFileName(testFilePath, "xml");
TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
}

View File

@@ -1,5 +1,5 @@
import * as TKUnit from "../tk-unit";
import { ModuleNameResolver, ModuleListProvider } from "@nativescript/core/module-name-resolver";
import { ModuleNameResolver, ModuleListProvider } from "@nativescript/core";
import {
androidPhonePortraitContext,

View File

@@ -1,15 +1,13 @@
import * as label from "@nativescript/core/ui/label";
import * as pages from "@nativescript/core/ui/page";
import * as fs from "@nativescript/core/file-system";
import * as fileResolverModule from "@nativescript/core/file-system/file-name-resolver";
import { Page, Label, knownFolders, path, ModuleNameResolver } from "@nativescript/core";
export function createPage() {
var page = new pages.Page();
var lbl = new label.Label();
var page = new Page();
var lbl = new Label();
var moduleName = "tests/pages/files/test";
var resolver = new fileResolverModule.FileNameResolver({
ModuleNameResolver
var resolver = new ModuleNameResolver({
width: 400,
height: 600,
os: "android",
@@ -17,8 +15,8 @@ export function createPage() {
});
// Current app full path.
var currentAppPath = fs.knownFolders.currentApp().path;
var moduleNamePath = fs.path.join(currentAppPath, moduleName);
var currentAppPath = knownFolders.currentApp().path;
var moduleNamePath = path.join(currentAppPath, moduleName);
var fileName = resolver.resolveFileName(moduleNamePath, "xml");
lbl.text = fileName;

View File

@@ -2,29 +2,20 @@
import * as TKUnit from './tk-unit';
import './ui-test';
import { _resetRootView } from '@nativescript/core/application';
import * as platform from '@nativescript/core/platform';
import { Trace } from '@nativescript/core/trace';
import { Button } from '@nativescript/core/ui/button';
import { Frame } from '@nativescript/core/ui/frame';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { Page } from '@nativescript/core/ui/page';
import { TextView } from '@nativescript/core/ui/text-view';
import { ios } from '@nativescript/core/utils';
import { isIOS, Application, Device, platformNames, Trace, Button, Frame, StackLayout, Page, TextView, Utils } from '@nativescript/core';
Frame.defaultAnimatedNavigation = false;
export function isRunningOnEmulator(): boolean {
// These checks are not good enough to be added to modules but they keep unit tests green.
if (platform.Device.os === platform.platformNames.android) {
if (Device.os === platformNames.android) {
return android.os.Build.FINGERPRINT.indexOf("generic") > -1 ||
android.os.Build.HARDWARE.toLowerCase() === "goldfish" ||
android.os.Build.HARDWARE.toLowerCase() === "donatello" || // VS Emulator
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("sdk") > -1 ||
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("emulator") > -1; // VS Emulator
}
else if (platform.Device.os === platform.platformNames.ios) {
else if (Device.os === platformNames.ios) {
return (__dirname.search("Simulator") > -1);
}
}
@@ -102,9 +93,6 @@ allTests["FILE-SYSTEM-ACCESS"] = fileSystemAccessTests;
import * as qualifierMatcherTests from "./name-resolvers-tests/qualifier-matcher-tests";
allTests["QUALIFIER-MATCHER"] = qualifierMatcherTests;
import * as fileNameResolverTests from "./name-resolvers-tests/file-name-resolver-tests";
allTests["FILE-NAME-RESOLVER"] = fileNameResolverTests;
import * as moduleNameResolverTests from "./name-resolvers-tests/module-name-resolver-tests";
allTests["MODULE-NAME-RESOLVER"] = moduleNameResolverTests;
@@ -154,7 +142,7 @@ import * as scrollViewSafeAreaTests from "./ui/scroll-view/scroll-view-safe-area
import * as repeaterSafeAreaTests from "./ui/repeater/repeater-safe-area-tests";
import * as webViewSafeAreaTests from "./ui/web-view/web-view-safe-area-tests";
if (platform.isIOS && ios.MajorVersion > 10) {
if (isIOS && Utils.ios.MajorVersion > 10) {
allTests["SAFEAREALAYOUT"] = safeAreaLayoutTests;
allTests["SAFEAREA-LISTVIEW"] = safeAreaListViewtTests;
allTests["SAFEAREA-SCROLL-VIEW"] = scrollViewSafeAreaTests;
@@ -186,9 +174,6 @@ allTests["VISUAL-STATE"] = visualStateTests;
import * as valueSourceTests from "./ui/styling/value-source-tests";
allTests["VALUE-SOURCE"] = valueSourceTests;
import * as borderTests from "./ui/border/border-tests";
allTests["BORDER"] = borderTests;
import * as builderTests from "./ui/builder/builder-tests";
allTests["BUILDER"] = builderTests;
@@ -397,7 +382,7 @@ function generateTestFile(allTests: TestInfo[]) {
let testName = testCase.testName;
let duration = (testCase.duration / 1000).toFixed(2);
testCases.push(`<testcase classname="${platform.Device.os}" name="${testName}" time="${duration}">`)
testCases.push(`<testcase classname="${Device.os}" name="${testName}" time="${duration}">`)
if (!testCase.isPassed) {
failedTestCount++;
testCases.push(`<failure type="exceptions.AssertionError"><![CDATA[${testCase.errorMessage}]]></failure>`)
@@ -436,7 +421,7 @@ function showReportPage(finalMessage: string) {
page.content = stack;
messageContainer.focus();
page.style.fontSize = 11;
if (platform.isAndroid) {
if (isAndroid) {
page.on('navigatedTo', () => {
messageContainer.focus();
setTimeout(() => messageContainer.dismissSoftInput());

View File

@@ -4,7 +4,7 @@ import { Trace } from "@nativescript/core";
export var test_DummyTestForSnippetOnly0 = function () {
// >> trace-all-categories
Trace.setCategories(Trace.categories.All);
Trace.setCategories(Trace.categories.All.join(','));
Trace.enable();
// << trace-all-categories
};
@@ -20,7 +20,7 @@ export var test_DummyTestForSnippetOnly1 = function () {
, Trace.categories.Style
, Trace.categories.ViewHierarchy
, Trace.categories.VisualTreeEvents
));
).join(','));
Trace.enable();
// << trace-specific-categories
};

View File

@@ -137,7 +137,7 @@ export function buildUIWithWeakRefAndInteract<T extends View>(createFunc: () =>
// An additional GC and wait are needed since WebKit upgrade to version 12.0
// (TEXT-FIELD.testMemoryLeak test started failing sporadically)
Utils.GC();
TKUnit.wait(0.1);
TKUnit.wait(0.2);
}
Utils.GC();
try {

View File

@@ -1,8 +0,0 @@
// >> border-require
import { Border } from "@nativescript/core/ui/border";
// << border-require
import * as helper from "../../ui-helper";
export function test_recycling() {
helper.nativeView_recycling_test(() => new Border());
}

View File

@@ -1,19 +0,0 @@
---
nav-title: "Border How-To"
title: "border"
environment: nativescript
description: "Examples for using Border"
previous_url: /ApiReference/ui/border/HOW-TO
---
# Border
Using borders requires the Border module.
{%snippet border-require%}
### Declaring a Border.
``` XML
<Page>
<Border borderRadius="10" borderWidth="2" borderColor="#FF0000">
<Button text="OK"/>
</Border>
</Page>
```

View File

@@ -1,9 +1,6 @@
import { Builder } from "@nativescript/core/ui/builder";
import { assertEqual, assertNull, assertThrows, assertNotNull, assert } from "../../tk-unit";
import { _setResolver, ModuleNameResolver, PlatformContext } from "@nativescript/core/module-name-resolver";
import { Button } from "@nativescript/core/ui/button";
import { Button, Builder, Page, Color, _setResolver, ModuleNameResolver, PlatformContext } from "@nativescript/core";
import { navigate } from "../../ui-helper";
import { Page, Color } from "@nativescript/core";
const testPrefix = "bundle-file-qualifiers-tests";
let modulesToCleanup: string[] = [];

View File

@@ -1,5 +1,4 @@
import { Builder } from "@nativescript/core/ui/builder";
import { sanitizeModuleName } from "@nativescript/core/ui/builder/module-name-sanitizer";
import { Builder, sanitizeModuleName } from "@nativescript/core";
import { assertEqual, assertNull, assertThrows, assertNotNull } from "../../tk-unit";

View File

@@ -1,13 +1,10 @@
/* tslint:disable:no-unused-variable */
// >> gestures-require
import * as gestures from "@nativescript/core/ui/gestures";
// << gestures-require
import * as labelModule from "@nativescript/core/ui/label";
import { GestureEventData, Label, GestureTypes, PanGestureEventData, PinchGestureEventData, SwipeGestureEventData, RotationGestureEventData } from "@nativescript/core";
export var test_DummyTestForSnippetOnly0 = function () {
// >> gestures-double-tap
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.doubleTap, function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.doubleTap, function (args: GestureEventData) {
console.log("Double Tap");
});
// << gestures-double-tap
@@ -15,8 +12,8 @@ export var test_DummyTestForSnippetOnly0 = function () {
export var test_DummyTestForSnippetOnly01 = function () {
// >> gestures-double-tap-alt
var label = new labelModule.Label();
var observer = label.on("doubleTap", function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on("doubleTap", function (args: GestureEventData) {
console.log("Double Tap");
});
// << gestures-double-tap-alt
@@ -24,8 +21,8 @@ export var test_DummyTestForSnippetOnly01 = function () {
export var test_DummyTestForSnippetOnly1 = function () {
// >> gestures-long-press
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.longPress, function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.longPress, function (args: GestureEventData) {
console.log("Long Press");
});
// << gestures-long-press
@@ -33,8 +30,8 @@ export var test_DummyTestForSnippetOnly1 = function () {
export var test_DummyTestForSnippetOnly11 = function () {
// >> gestures-long-press-alt
var label = new labelModule.Label();
var observer = label.on("longPress", function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on("longPress", function (args: GestureEventData) {
console.log("Long Press");
});
// << gestures-long-press-alt
@@ -42,8 +39,8 @@ export var test_DummyTestForSnippetOnly11 = function () {
export var test_DummyTestForSnippetOnly2 = function () {
// >> gestures-pan
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.pan, function (args: gestures.PanGestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.pan, function (args: PanGestureEventData) {
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
});
// << gestures-pan
@@ -51,8 +48,8 @@ export var test_DummyTestForSnippetOnly2 = function () {
export var test_DummyTestForSnippetOnly22 = function () {
// >> gestures-pan-alt
var label = new labelModule.Label();
var observer = label.on("pan", function (args: gestures.PanGestureEventData) {
var label = new Label();
var observer = label.on("pan", function (args: PanGestureEventData) {
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
});
// << gestures-pan-alt
@@ -60,8 +57,8 @@ export var test_DummyTestForSnippetOnly22 = function () {
export var test_DummyTestForSnippetOnly3 = function () {
// >> gestures-pan-pinch
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.pinch, function (args: gestures.PinchGestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.pinch, function (args: PinchGestureEventData) {
console.log("Pinch scale: " + args.scale);
});
// << gestures-pan-pinch
@@ -69,8 +66,8 @@ export var test_DummyTestForSnippetOnly3 = function () {
export var test_DummyTestForSnippetOnly33 = function () {
// >> gestures-pan-pinch-alt
var label = new labelModule.Label();
var observer = label.on("pinch", function (args: gestures.PinchGestureEventData) {
var label = new Label();
var observer = label.on("pinch", function (args: PinchGestureEventData) {
console.log("Pinch scale: " + args.scale);
});
// << gestures-pan-pinch-alt
@@ -78,8 +75,8 @@ export var test_DummyTestForSnippetOnly33 = function () {
export var test_DummyTestForSnippetOnly4 = function () {
// >> gestures-rotation
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.rotation, function (args: gestures.RotationGestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.rotation, function (args: RotationGestureEventData) {
console.log("Rotation: " + args.rotation);
});
// << gestures-rotation
@@ -87,8 +84,8 @@ export var test_DummyTestForSnippetOnly4 = function () {
export var test_DummyTestForSnippetOnly44 = function () {
// >> gestures-rotation-alt
var label = new labelModule.Label();
var observer = label.on("rotation", function (args: gestures.RotationGestureEventData) {
var label = new Label();
var observer = label.on("rotation", function (args: RotationGestureEventData) {
console.log("Rotation: " + args.rotation);
});
// << gestures-rotation-alt
@@ -96,8 +93,8 @@ export var test_DummyTestForSnippetOnly44 = function () {
export var test_DummyTestForSnippetOnly5 = function () {
// >> gestures-swipe
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.swipe, function (args: gestures.SwipeGestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.swipe, function (args: SwipeGestureEventData) {
console.log("Swipe direction: " + args.direction);
});
// << gestures-swipe
@@ -105,8 +102,8 @@ export var test_DummyTestForSnippetOnly5 = function () {
export var test_DummyTestForSnippetOnly55 = function () {
// >> gestures-swipe-alt
var label = new labelModule.Label();
var observer = label.on("swipe", function (args: gestures.SwipeGestureEventData) {
var label = new Label();
var observer = label.on("swipe", function (args: SwipeGestureEventData) {
console.log("Swipe direction: " + args.direction);
});
// << gestures-swipe-alt
@@ -114,8 +111,8 @@ export var test_DummyTestForSnippetOnly55 = function () {
export var test_DummyTestForSnippetOnly6 = function () {
// >> gestures-tap
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.tap, function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.tap, function (args: GestureEventData) {
console.log("Tap");
});
// << gestures-tap
@@ -123,8 +120,8 @@ export var test_DummyTestForSnippetOnly6 = function () {
export var test_DummyTestForSnippetOnly66 = function () {
// >> gestures-tap-alt
var label = new labelModule.Label();
var observer = label.on("tap", function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on("tap", function (args: GestureEventData) {
console.log("Tap");
});
// << gestures-tap-alt
@@ -132,8 +129,8 @@ export var test_DummyTestForSnippetOnly66 = function () {
export var test_DummyTestForSnippetOnly7 = function () {
// >> gestures-stop-observe
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.tap, function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.tap, function (args: GestureEventData) {
console.log("Tap");
});
observer.disconnect();
@@ -142,8 +139,8 @@ export var test_DummyTestForSnippetOnly7 = function () {
export var test_DummyTestForSnippetOnly8 = function () {
// >> gestures-multiple
var label = new labelModule.Label();
var observer = label.on(gestures.GestureTypes.tap | gestures.GestureTypes.doubleTap | gestures.GestureTypes.longPress, function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on(GestureTypes.tap | GestureTypes.doubleTap | GestureTypes.longPress, function (args: GestureEventData) {
console.log("Event: " + args.eventName);
});
// << gestures-multiple
@@ -151,8 +148,8 @@ export var test_DummyTestForSnippetOnly8 = function () {
export var test_DummyTestForSnippetOnly88 = function () {
// >> gestures-string
var label = new labelModule.Label();
var observer = label.on("tap, doubleTap, longPress", function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on("tap, doubleTap, longPress", function (args: GestureEventData) {
console.log("Event: " + args.eventName);
});
// << gestures-string
@@ -160,8 +157,8 @@ export var test_DummyTestForSnippetOnly88 = function () {
export var test_DummyTestForSnippetOnly9 = function () {
// >> gestures-events-string
var label = new labelModule.Label();
var observer = label.on("loaded, tap, longPress", function (args: gestures.GestureEventData) {
var label = new Label();
var observer = label.on("loaded, tap, longPress", function (args: GestureEventData) {
console.log("Event: " + args.eventName);
});
// << gestures-events-string

View File

@@ -1,9 +1,5 @@
import * as TKUnit from "../../tk-unit";
import { Page, View } from "@nativescript/core";
import { Frame, NavigationEntry, _stack } from "@nativescript/core/ui/frame";
import { _resetRootView, getRootView } from "@nativescript/core/application";
import { TabView } from "@nativescript/core/ui/tab-view";
import { GridLayout } from "@nativescript/core/ui/layouts/grid-layout";
import { Page, TabView, View, GridLayout, Frame, NavigationEntry, Application } from "@nativescript/core";
import * as helper from "../../ui-helper";
function createTestFrameRootEntry() {
@@ -12,7 +8,7 @@ function createTestFrameRootEntry() {
frameRoot.navigate(() => page);
const entry: NavigationEntry = {
create: () => frameRoot
create: () => <any>frameRoot
};
return {
@@ -27,9 +23,9 @@ export function test_custom_component_rootview_css_applied() {
moduleName: "ui/root-view/root-modules/custom-component-root"
};
_resetRootView(entry);
Application.resetRootView(entry);
var rootView = getRootView();
var rootView = Application.getRootView();
TKUnit.waitUntilReady(() => rootView.isLoaded);
TKUnit.assertNotNull(rootView);
@@ -46,9 +42,9 @@ export function test_tabview_rootview_css_applied() {
moduleName: "ui/root-view/root-modules/tabview-root"
};
_resetRootView(entry);
Application.resetRootView(entry);
var rootView = getRootView();
var rootView = Application.getRootView();
TKUnit.waitUntilReady(() => rootView.isLoaded);
TKUnit.assert(rootView instanceof TabView);
@@ -60,9 +56,9 @@ export function test_gridlayout_rootview_css_applied() {
moduleName: "ui/root-view/root-modules/gridlayout-root"
};
_resetRootView(entry);
Application.resetRootView(entry);
var rootView = getRootView();
var rootView = Application.getRootView();
TKUnit.waitUntilReady(() => rootView.isLoaded);
TKUnit.assert(rootView instanceof GridLayout);
@@ -80,9 +76,9 @@ export function test_tabview_rootview_layout_updates() {
function layout_invalidate_test(moduleName: string) {
var entry = { moduleName };
_resetRootView(entry);
Application.resetRootView(entry);
var rootView = getRootView();
var rootView = Application.getRootView();
TKUnit.waitUntilReady(() => rootView.isLayoutValid);
const lbl = <View>rootView.getViewById("my-test-label");
@@ -101,6 +97,6 @@ export function tearDownModule() {
// reset the root to frame for other tests
const resetFrameRoot = createTestFrameRootEntry();
_resetRootView(resetFrameRoot.entry);
Application.resetRootView(resetFrameRoot.entry);
TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded);
}

View File

@@ -1,8 +1,5 @@
import * as TKUnit from "../../tk-unit";
import { _resetRootView } from "@nativescript/core/application/";
import { Frame, NavigationEntry, } from "@nativescript/core/ui/frame";
import { Page } from "@nativescript/core/ui/page";
import { Tabs, TabContentItem, TabStrip, TabStripItem } from "@nativescript/core/ui/tabs";
import { Page, Frame, Tabs, TabContentItem, TabStrip, TabStripItem, NavigationEntry, Application } from "@nativescript/core";
function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) {
const maxTimeout = 8;
@@ -84,7 +81,7 @@ export function test_frame_topmost_matches_selectedIndex() {
create: () => tabView
};
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
TKUnit.assertEqual(Frame.topmost().id, "Tab0 Frame0");
waitUntilNavigatedToMaxTimeout([items[1].page], () => tabView.selectedIndex = 1);
@@ -131,7 +128,7 @@ export function test_frame_topmost_matches_selectedIndex() {
// create: () => tabView
// };
// waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
// waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
// const expectedEventsRaisedAfterTabCreated = [
// [
@@ -193,5 +190,5 @@ export function tearDownModule() {
create: () => frame
};
waitUntilNavigatedToMaxTimeout([page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([page], () => Application.resetRootView(entry));
}

View File

@@ -1,19 +1,7 @@
import * as TKUnit from "../../tk-unit";
import { View, eachDescendant, getViewById, InheritedProperty, CssProperty, CssAnimationProperty, ShorthandProperty, Property, Style } from "@nativescript/core";
import { Frame } from "@nativescript/core/ui/frame";
import { Page } from "@nativescript/core/ui/page";
import { Button } from "@nativescript/core/ui/button";
import { Label } from "@nativescript/core/ui/label";
import { Color } from "@nativescript/core/color";
import { StackLayout } from "@nativescript/core/ui/layouts/stack-layout";
import { AbsoluteLayout } from "@nativescript/core/ui/layouts/absolute-layout";
import * as types from "@nativescript/core/utils/types";
import { View, eachDescendant, getViewById, InheritedProperty, CssProperty, CssAnimationProperty, ShorthandProperty, Property, Style, Frame, Page, Button, Label, Color, StackLayout, AbsoluteLayout, Observable, Utils, BindingOptions, isAndroid, LayoutBase } from "@nativescript/core";
import * as helper from "../../ui-helper";
import * as observable from "@nativescript/core/data/observable";
import * as bindable from "@nativescript/core/ui/core/bindable";
import * as definition from "./view-tests";
import { isAndroid } from "@nativescript/core/platform";
import { LayoutBase } from "@nativescript/core/ui/layouts/layout-base";
export function test_eachDescendant() {
const test = function (views: Array<View>) {
@@ -27,7 +15,7 @@ export function test_eachDescendant() {
return true;
};
eachDescendant(Frame.topmost(), callback);
eachDescendant(<any>Frame.topmost(), callback);
// Descendants: page, actionBar, button
TKUnit.assertEqual(counter, 3, "descendants");
};
@@ -40,7 +28,7 @@ export function test_getViewById_Static() {
views[1].id = "myLayout";
// traverse the visual tree and verify the hierarchy
const result = getViewById(Frame.topmost(), "myLayout");
const result = getViewById(<any>Frame.topmost(), "myLayout");
TKUnit.assert(result === views[1]);
};
@@ -72,7 +60,7 @@ export function test_eachDescendant_Break_Iteration() {
return false;
};
eachDescendant(Frame.topmost(), callback);
eachDescendant(<any>Frame.topmost(), callback);
TKUnit.assert(counter === 1);
};
@@ -82,11 +70,11 @@ export function test_eachDescendant_Break_Iteration() {
export function test_parent_IsValid_WhenAttached_ToVisualTree() {
const test = function (views: Array<View>) {
// views[0] is a Page instance, its parent should be the topmost frame
TKUnit.assert(types.isDefined(views[0].parent));
TKUnit.assert(views[0].parent === Frame.topmost());
TKUnit.assert(Utils.isDefined(views[0].parent));
TKUnit.assert(views[0].parent === <any>Frame.topmost());
// views[1] is a Button instance, its parent should be the Page (views[0])
TKUnit.assert(types.isDefined(views[1].parent));
TKUnit.assert(Utils.isDefined(views[1].parent));
TKUnit.assert(views[1].parent === views[0]);
};
@@ -102,8 +90,8 @@ export function test_parent_IsReset_WhenDetached_FromVisualTree() {
helper.do_PageTest_WithStackLayout_AndButton(test);
TKUnit.assert(types.isUndefined(cachedViews[1].parent));
TKUnit.assert(types.isDefined(cachedViews[2].parent));
TKUnit.assert(Utils.isUndefined(cachedViews[1].parent));
TKUnit.assert(Utils.isDefined(cachedViews[2].parent));
TKUnit.assert(cachedViews[2].parent === cachedViews[1]);
}
@@ -165,7 +153,7 @@ export function test_bindingContext_IsInherited() {
};
helper.do_PageTest_WithStackLayout_AndButton(test);
Frame.topmost().bindingContext = undefined;
(<any>Frame.topmost()).bindingContext = undefined;
}
export function test_isAddedToNativeVisualTree_IsUpdated() {
@@ -705,10 +693,10 @@ export function test_InheritableProperties_ChangeNotification() {
function property_binding_test(propName: string, firstValue: any, secondValue: any, view?: View) {
let actualResult;
const model = new observable.Observable();
const model = new Observable();
model.set(propName, firstValue);
const options: bindable.BindingOptions = {
const options: BindingOptions = {
sourceProperty: propName,
targetProperty: propName
};
@@ -729,10 +717,10 @@ function property_binding_test(propName: string, firstValue: any, secondValue: a
function property_binding_style_test(propName: string, firstValue: any, secondValue: any, view?: View) {
let actualResult;
const model = new observable.Observable();
const model = new Observable();
model.set(propName, firstValue);
const options: bindable.BindingOptions = {
const options: BindingOptions = {
sourceProperty: propName,
targetProperty: "style." + propName
};

View File

@@ -46,9 +46,6 @@
<TimePicker hour="10" minute="34" />
<Image id="cameraImage" />
<Button tap="setPicture" text="Get picture and set is to the image" />
<Border cornerRadius="10" borderWidth="1" borderColor="#FF0000">
<Button text="{{ text }}" tap="{{ myFunction }}" />
</Border>
<Label id="Label1" text="This is Label!" />
<StackLayout orientation="horizontal">
<Label text="From expression {{ id + 1 }}: " />

View File

@@ -1,6 +1,4 @@
import { Property } from "@nativescript/core/ui/core/properties";
import { LayoutBase } from "@nativescript/core/ui/layouts/layout-base";
import { Builder } from "@nativescript/core/ui/builder";
import { Property, LayoutBase, Builder } from "@nativescript/core";
export module knownTemplates {
export var template = "template";

View File

@@ -1,21 +1,14 @@
import * as TKUnit from "../tk-unit";
import { Builder, Button, Switch, SearchBar, TextField, GridLayout, AbsoluteLayout, Observable, TabView, Page, Label } from "@nativescript/core";
import * as types from "@nativescript/core/utils/types";
import { EventData, ItemEventData, ListView, Builder, Button, Switch, SearchBar, TextField, GridLayout, AbsoluteLayout, Observable, TabView, Page, Label, platformNames, Device, GestureTypes, StackLayout, SegmentedBar, View, getAncestor, eachDescendant, PercentLength, Length, Utils, SegmentedBarItem } from "@nativescript/core";
import { TemplateView } from "./template-builder-tests/template-view";
import * as listViewModule from "@nativescript/core/ui/list-view";
import * as helper from "../ui-helper";
import * as platform from "@nativescript/core/platform";
import * as gesturesModule from "@nativescript/core/ui/gestures";
import * as segmentedBar from "@nativescript/core/ui/segmented-bar";
import { Source } from "@nativescript/core/utils/debug";
import { View, getAncestor, eachDescendant, PercentLength, Length } from "@nativescript/core";
export function test_load_IsDefined() {
TKUnit.assertTrue(types.isFunction(Builder.load), "Builder should have load method!");
TKUnit.assertTrue(Utils.isFunction(Builder.load), "Builder should have load method!");
}
export function test_parse_IsDefined() {
TKUnit.assertTrue(types.isFunction(Builder.parse), "Builder should have parse method!");
TKUnit.assertTrue(Utils.isFunction(Builder.parse), "Builder should have parse method!");
}
export function test_load_ShouldThrowWithInvalidFileName() {
@@ -190,7 +183,7 @@ export function test_parse_ShouldResolveExportsFromCodeFileForTemplates() {
var obj = new Observable();
obj.set("items", [1]);
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
obj.set("itemLoading", function (args: ItemEventData) {
ctrl = args.view;
});
p.bindingContext = obj;
@@ -328,7 +321,7 @@ export function test_parse_ShouldParsePlatformSpecificProperties() {
var p = <Page>Builder.parse("<Page><TextField ios:editable='False' android:editable='True' /></Page>");
var tf = <TextField>p.content;
if (platform.Device.os === platform.platformNames.ios) {
if (Device.os === platformNames.ios) {
TKUnit.assertFalse(tf.editable, "Expected result: false; Actual result: " + tf.editable + "; type: " + typeof (tf.editable));
} else {
TKUnit.assertTrue(tf.editable, "Expected result: true; Actual result: " + tf.editable + "; type: " + typeof (tf.editable));
@@ -337,7 +330,7 @@ export function test_parse_ShouldParsePlatformSpecificProperties() {
export function test_parse_ShouldParsePlatformSpecificComponents() {
var p = <Page>Builder.parse("<Page><ios><TextField /></ios><android><Label /></android></Page>");
if (platform.Device.os === platform.platformNames.ios) {
if (Device.os === platformNames.ios) {
TKUnit.assert(p.content instanceof TextField, "Expected result: TextField; Actual result: " + p.content);
}
else {
@@ -413,7 +406,7 @@ export function test_parse_ShouldParseBindingsToGestures() {
p.bindingContext = context;
var lbl = <Label>p.content;
var observer = (<View>lbl).getGestureObservers(gesturesModule.GestureTypes.tap)[0];
var observer = (<View>lbl).getGestureObservers(GestureTypes.tap)[0];
TKUnit.assert(observer !== undefined, "Expected result: true.");
TKUnit.assert(observer.context === context, "Context should be equal to binding context. Actual result: " + observer.context);
@@ -430,7 +423,7 @@ export function test_parse_ShouldParseBindingsToGesturesWithOn() {
p.bindingContext = context;
var lbl = <Label>p.content;
var observer = (<View>lbl).getGestureObservers(gesturesModule.GestureTypes.tap)[0];
var observer = (<View>lbl).getGestureObservers(GestureTypes.tap)[0];
TKUnit.assert(observer !== undefined, "Expected result: true.");
TKUnit.assert(observer.context === context, "Context should be equal to binding context. Actual result: " + observer.context);
@@ -498,7 +491,7 @@ export function test_parse_ShouldParseLowerCaseDashedComponentDeclaration() {
TKUnit.assert(ctrl instanceof StackLayout, "Expected result: StackLayout!; Actual result: " + ctrl);
TKUnit.assert(ctrl.getChildAt(0) instanceof Label, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
TKUnit.assert(ctrl.getChildAt(1) instanceof segmentedBar.SegmentedBar, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
TKUnit.assert(ctrl.getChildAt(1) instanceof SegmentedBar, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
}
export function test_parse_ShouldParseCustomComponentWithoutXml() {
@@ -573,7 +566,7 @@ export function test_parse_ShouldParseCustomComponentWithoutXmlInListViewTemplat
let ctrl;
let obj = new Observable();
obj.set("items", [1]);
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
obj.set("itemLoading", function (args: ItemEventData) {
ctrl = args.view;
});
p.bindingContext = obj;
@@ -593,12 +586,12 @@ export function test_parse_ShouldParseNestedListViewInListViewTemplate() {
let ctrl;
let obj = new Observable();
obj.set("items", [{ subItems: [1] }]);
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
obj.set("itemLoading", function (args: ItemEventData) {
ctrl = args.view;
});
p.bindingContext = obj;
TKUnit.waitUntilReady(() => !!ctrl);
TKUnit.assert(ctrl instanceof listViewModule.ListView, "Expected result: ListView!; Actual result: " + ctrl);
TKUnit.assert(ctrl instanceof ListView, "Expected result: ListView!; Actual result: " + ctrl);
}
helper.navigate(function () { return p; });
@@ -609,22 +602,22 @@ export function test_parse_ShouldEvaluateEventBindingExpressionInListViewTemplat
var p = <Page>Builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><SegmentedBar items=\"{{ $parents['ListView'].segmentedBarItems }}\" selectedIndexChanged=\"{{ $parents['ListView'].changed }}\" /></ListView.itemTemplate></ListView></Page>");
function testAction(views: Array<View>) {
let ctrl: segmentedBar.SegmentedBar = null;
let ctrl: SegmentedBar = null;
let changed;
let obj = new Observable();
let firstItem = new segmentedBar.SegmentedBarItem();
let firstItem = new SegmentedBarItem();
firstItem.title = "One";
let secondItem = new segmentedBar.SegmentedBarItem();
let secondItem = new SegmentedBarItem();
secondItem.title = "Two";
let thirdItem = new segmentedBar.SegmentedBarItem();
let thirdItem = new SegmentedBarItem();
thirdItem.title = "Tree";
let segmentedBarItems = [firstItem, secondItem, thirdItem];
obj.set("items", [1, 2, 3]);
obj.set("segmentedBarItems", segmentedBarItems);
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
ctrl = <segmentedBar.SegmentedBar>args.view;
obj.set("itemLoading", function (args: ItemEventData) {
ctrl = <SegmentedBar>args.view;
});
obj.set("changed", function (args: EventData) {
@@ -904,10 +897,10 @@ export function test_hasSourceCodeLocations() {
var basePath = "xml-declaration/";
var page = <Page>Builder.load(basePath + "examples/test-page.xml");
var grid = page.getViewById("grid");
var gridSource = Source.get(grid);
var gridSource = Utils.Source.get(grid);
TKUnit.assertEqual(gridSource.toString(), basePath + "examples/test-page.xml:2:3");
var label = page.getViewById("label");
var labelSource = Source.get(label);
var labelSource = Utils.Source.get(label);
TKUnit.assertEqual(labelSource.toString(), basePath + "examples/test-page.xml:3:5");
}

View File

@@ -16,13 +16,13 @@
"clean": "npx rimraf hooks node_modules platforms package-lock.json && npm i"
},
"dependencies": {
"@nativescript/core": "file:../dist/nativescript-core-7.0.0-rc.6.tgz"
"@nativescript/core": "file:../dist/nativescript-core-7.0.0-rc.9.tgz"
},
"devDependencies": {
"circular-dependency-plugin": "~5.2.0",
"@nativescript/webpack": "^2.0.0-alpha.3",
"node-sass": "^4.14.0",
"@nativescript/types": "file:../dist/nativescript-types-7.0.0-rc.0.tgz",
"@nativescript/types": "~7.0.0-rc.0",
"typescript": "~3.9.0"
},
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",

View File

@@ -1,3 +1,2 @@
/// <reference path="./node_modules/@nativescript/core/module.d.ts" />
/// <reference path="./node_modules/@nativescript/types/android.d.ts" />
/// <reference path="./node_modules/@nativescript/types/ios.d.ts" />