No more ambient modules for tns-core-modules/* subpackages.

- Use path mappings in tsconfig.json to resolve module typings
- Only use ambient mobules for global API's
- Move single-file modules to a subdir with the same name so that
we can provide a hand-written typing next to it (via package.json)
- Delete all mentions of tns-core-modules.d.ts
- Delete reference d.ts assembly build steps. Not needed anymore.
- HACK! Use a <reference> for global typings in application.d.ts
to avoid publishing a separate @types/tns-core-modules package.
- Rename declarations.d.ts to tns-core-modules.d.ts to preserve
JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
Hristo Deshev
2017-03-02 13:50:23 +02:00
committed by Hristo Deshev
parent 1af8c6ca8e
commit b45cbe929b
230 changed files with 9170 additions and 10028 deletions

View File

@ -1,5 +1,4 @@
/// <reference path="../tns-platform-declarations/android.d.ts" />
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@ -78,33 +78,6 @@ module.exports = function(grunt) {
return localCfg.mainPackageContent.version + "-" + buildVersion;
};
var writeDtsFile = function writeDtsFile(dtsFiles, outDir, outFile) {
var dtsLines = dtsFiles.map(function(dtsFile) {
return '/// <reference path="' + dtsFile + '" />';
});
var combinedDtsPath = path.join(outDir, outFile);
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
};
var generateModulesDts = function generateModulesDts(outDir, srcDir) {
var dtsFiles = grunt.file.expand({cwd: srcDir }, [
"**/*.d.ts",
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
"!docs-shims.d.ts",
"!node-tests/**",
"!org.nativescript.widgets.d.ts",
"!android17.d.ts",
"!**/*.android.d.ts",
"!ios/**",
"!**/*.ios.d.ts",
"!tns-core-modules.d.ts",
"!references.d.ts",
].concat(localCfg.defaultExcludes));
dtsFiles.sort();
writeDtsFile(dtsFiles, outDir, "tns-core-modules/tns-core-modules.d.ts");
};
// Configure localCfg
var outDir = "./bin/dist";
var srcDir = ".";
@ -300,9 +273,8 @@ module.exports = function(grunt) {
}
},
compileAll: "npm run compile-all",
setupLinks: "npm run setup",
compileNodeTests: "npm run compile-node-tests",
compileCheckBaseDts: "npm run compile-check-base-dts",
compileCheckCombinedDts: "npm run compile-check-combined-dts",
tslint: "npm run tslint",
},
simplemocha: {
@ -348,7 +320,7 @@ module.exports = function(grunt) {
]);
grunt.registerTask("compile-ts", [
"shell:compileCheckBaseDts",
"shell:setupLinks",
"shell:compileAll",
"clean:typeScriptLeftovers",
"copy:childPackageFiles"
@ -388,10 +360,6 @@ module.exports = function(grunt) {
});
});
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, ".", localCfg.srcTnsCoreModules));
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outDir, localCfg.outTnsCoreModules));
//aliasing pack-modules for backwards compatibility
grunt.registerTask("pack-modules", [
"compile-modules",
@ -409,8 +377,6 @@ module.exports = function(grunt) {
"collect-modules-raw-files",
"copy:definitionFiles",
"copy:jsLibs",
"generate-tns-core-modules-dts",
"shell:compileCheckCombinedDts",
]);
grunt.registerTask("node-tests", [

View File

@ -1,5 +1,5 @@
require("globals");
import http = require("http");
import * as http from "tns-core-modules/http";
declare var postMessage : any;

View File

@ -1,6 +1,6 @@
/* tslint:disable:no-unused-variable */
import * as TKUnit from "./TKUnit";
import * as http from "http";
import * as http from "tns-core-modules/http";
import * as types from "utils/types";
import * as fs from "file-system";
import { addHeader } from "http/http-request";

View File

@ -3,13 +3,13 @@ import * as helper from "../ui/helper";
import * as platform from "platform";
import * as trace from "trace";
import { Color } from "color";
import { NavigationEntry, NavigationTransition, topmost as topmostFrame, traceEnabled } from "ui/frame";
import { NavigationEntry, NavigationTransition, topmost as topmostFrame } from "ui/frame";
import { Page } from "ui/page";
import { AnimationCurve } from "ui/enums"
function _testTransition(navigationTransition: NavigationTransition) {
var testId = `Transition[${JSON.stringify(navigationTransition)}]`;
if (traceEnabled()) {
if (trace.isEnabled()) {
trace.write(`Testing ${testId}`, trace.categories.Test);
}
var navigationEntry: NavigationEntry = {

View File

@ -4,7 +4,7 @@ import * as stacks from "ui/layouts/stack-layout";
import * as scroll from "ui/scroll-view";
import * as textView from "ui/text-view";
import * as timer from "timer";
import * as http from "http";
import * as http from "tns-core-modules/http";
import * as trace from "trace";
trace.enable();
trace.setCategories(trace.categories.Style);

View File

@ -2,7 +2,7 @@ import * as observable from "data/observable";
import * as view from "ui/core/view";
import * as label from "ui/label";
import * as pages from "ui/page";
import * as http from "http";
import * as http from "tns-core-modules/http";
var obj = new observable.Observable();
obj.set("id", 0);

View File

@ -1,5 +1,4 @@
/// <reference path="../tns-platform-declarations/android.d.ts" />
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@ -1,63 +1,61 @@
/**
* Allows you to save and restore any kind of information related to your application.
*/
declare module "application-settings" {
/**
* Checks whether such a key exists.
* @param key The key to check for.
*/
export function hasKey(key: string): boolean;
/**
* Checks whether such a key exists.
* @param key The key to check for.
*/
export function hasKey(key: string): boolean;
/**
* Gets a value (if existing) for a key as a Boolean Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getBoolean(key: string, defaultValue?: boolean): boolean;
/**
* Gets a value (if existing) for a key as a Boolean Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getBoolean(key: string, defaultValue?: boolean): boolean;
/**
* Gets a value (if existing) for a key as a String Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getString(key: string, defaultValue?: string): string;
/**
* Gets a value (if existing) for a key as a String Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getString(key: string, defaultValue?: string): string;
/**
* Gets a value (if existing) for a key as a Number Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getNumber(key: string, defaultValue?: number): number;
/**
* Gets a value (if existing) for a key as a Number Object. A default value can be provided in case there is no existing value.
* @param key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value.
*/
export function getNumber(key: string, defaultValue?: number): number;
/**
* Sets a Boolean Object for a key.
* @param key The key.
* @param value The value.
*/
export function setBoolean(key: string, value: boolean): void;
/**
* Sets a Boolean Object for a key.
* @param key The key.
* @param value The value.
*/
export function setBoolean(key: string, value: boolean): void;
/**
* Sets a String Object for a key.
* @param key The key.
* @param value The value.
*/
export function setString(key: string, value: string): void;
/**
* Sets a String Object for a key.
* @param key The key.
* @param value The value.
*/
export function setString(key: string, value: string): void;
/**
* Sets a Number Object for a key.
* @param key The key.
* @param value The value.
*/
export function setNumber(key: string, value: number): void;
/**
* Sets a Number Object for a key.
* @param key The key.
* @param value The value.
*/
export function setNumber(key: string, value: number): void;
/**
* Removes a value (if existing) for a key.
* @param key The key to check for.
*/
export function remove(key: string): void;
/**
* Removes a value (if existing) for a key.
* @param key The key to check for.
*/
export function remove(key: string): void;
/**
/**
* Removes all values.
*/
export function clear(): void;
}
export function clear(): void;

View File

@ -1,5 +1,6 @@
{
"name" : "application-settings",
"main" : "application-settings",
"types": "application-settings.d.ts",
"nativescript": {}
}

View File

@ -9,7 +9,7 @@ global.moduleMerge(events, exports);
export { Observable };
import { NativeScriptError, UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from "application";
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from "application";
import { NavigationEntry } from "ui/frame";
export const launchEvent = "launch";

View File

@ -1,181 +1,48 @@
/**
///<reference path="../tns-core-modules.d.ts" /> Include global typings
/**
* Contains the application abstraction with all related methods.
*/
declare module "application" {
import { NavigationEntry, View, Observable, EventData } from "ui/frame";
import { NavigationEntry, View, Observable, EventData } from "ui/frame";
/**
/**
* String value used when hooking to launch event.
*/
export const launchEvent: string;
export var launchEvent: string;
/**
/**
* String value used when hooking to uncaughtError event.
*/
export const uncaughtErrorEvent: string;
export var uncaughtErrorEvent: string;
/**
/**
* String value used when hooking to suspend event.
*/
export const suspendEvent: string;
export var suspendEvent: string;
/**
/**
* String value used when hooking to resume event.
*/
export const resumeEvent: string;
export var resumeEvent: string;
/**
/**
* String value used when hooking to exitevent.
*/
export const exitEvent: string;
export var exitEvent: string;
/**
/**
* String value used when hooking to lowMemory event.
*/
export const lowMemoryEvent: string;
export var lowMemoryEvent: string;
/**
/**
* String value used when hooking to orientationChanged event.
*/
export const orientationChangedEvent: string;
export var orientationChangedEvent: string;
/**
* The main page path (without the file extension) for the application starting from the application root.
* For example if you have page called "main.js" in a folder called "subFolder" and your root folder is "app" you can specify mainModule like this:
* var application = require("application");
* application.mainModule = "app/subFolder/main";
* application.start();
*/
export let mainModule: string;
/**
* The main navigation entry to be used when loading the main Page.
*/
export let mainEntry: NavigationEntry;
/**
* An application level static resources.
*/
export let resources: any;
/**
* The application level css file name (starting from the application root). Used to set css across all pages.
* Css will be applied for every page and page css will be applied after.
*/
export let cssFile: string;
/**
* Sets application level static resources.
*/
export function setResources(resources: any);
/**
* Sets css file name for the application.
*/
export function setCssFileName(cssFile: string): void;
export function addCss(cssText: string): void;
/**
* Notifies all the registered listeners for the event provided in the data.eventName.
* @param data The data associated with the event.
*/
export function notify(data: any): void;
/**
* Call this method to start the application. Important: All code after this method call will not be executed!
*/
export function start(entry?: NavigationEntry);
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
export function on(eventNames: string, callback: (data: any) => void, thisArg?: any);
/**
* Shortcut alias to the removeEventListener method.
* @param eventNames - String corresponding to events (e.g. "onLaunch").
* @param callback - Callback function which will be removed.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
export function off(eventNames: string, callback?: any, thisArg?: any);
/**
* This event is raised when application css is changed.
*/
export function on(event: "cssChanged", callback: (args: CssChangedEventData) => void, thisArg?: any);
/**
* Event raised then livesync operation is performed.
*/
export function on(event: "livesync", callback: (args: EventData) => void);
/**
* This event is raised on application launchEvent.
*/
export function on(event: "launch", callback: (args: LaunchEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is suspended.
*/
export function on(event: "suspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is resumed after it has been suspended.
*/
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is about to exitEvent.
*/
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when there is low memory on the target device.
*/
export function on(event: "lowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when an uncaught error occurs while the application is running.
*/
export function on(event: "uncaughtError", callback: (args: UnhandledErrorEventData) => void, thisArg?: any);
/**
* This event is raised the orientation of the current device has changed.
*/
export function on(event: "orientationChanged", callback: (args: OrientationChangedEventData) => void, thisArg?: any);
/**
* This is the Android-specific application object instance.
* Encapsulates methods and properties specific to the Android platform.
* Will be undefined when TargetOS is iOS.
*/
export const android: AndroidApplication;
/**
* This is the iOS-specific application object instance.
* Encapsulates methods and properties specific to the iOS platform.
* Will be undefined when TargetOS is Android.
*/
export const ios: iOSApplication;
/**
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
*/
export interface NativeScriptError extends Error {
/**
* Represents the native error object.
*/
nativeError: any;
}
/**
/**
* Event data containing information for the application events.
*/
export interface ApplicationEventData extends EventData {
export interface ApplicationEventData extends EventData {
/**
* Gets the native iOS event arguments. Valid only when running on iOS.
*/
@ -195,50 +62,179 @@ declare module "application" {
* The instance that has raised the event.
*/
object: any;
}
}
/**
/**
* Event data containing information for launch event.
*/
export interface LaunchEventData extends ApplicationEventData {
export interface LaunchEventData extends ApplicationEventData {
/**
* The root view for this Window on iOS or Activity for Android.
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
*/
root?: View;
}
}
/**
/**
* Event data containing information for orientation changed event.
*/
export interface OrientationChangedEventData extends ApplicationEventData {
export interface OrientationChangedEventData extends ApplicationEventData {
/**
* New orientation value.
*/
newValue: "portrait" | "landscape" | "unknown";
}
}
/**
/**
* Event data containing information about unhandled application errors.
*/
export interface UnhandledErrorEventData extends ApplicationEventData {
export interface UnhandledErrorEventData extends ApplicationEventData {
ios?: NativeScriptError;
android?: NativeScriptError;
error: NativeScriptError;
}
}
/**
/**
* Event data containing information about application css change.
*/
export interface CssChangedEventData extends EventData {
export interface CssChangedEventData extends EventData {
cssFile?: string;
cssText?: string;
}
}
/**
/**
* The main page path (without the file extension) for the application starting from the application root.
* For example if you have page called "main.js" in a folder called "subFolder" and your root folder is "app" you can specify mainModule like this:
* var application = require("application");
* application.mainModule = "app/subFolder/main";
* application.start();
*/
export var mainModule: string;
/**
* The main navigation entry to be used when loading the main Page.
*/
export var mainEntry: NavigationEntry;
/**
* An application level static resources.
*/
export var resources: any;
/**
* Sets application level static resources.
*/
export function setResources(resources: any);
/**
* The application level css file name (starting from the application root). Used to set css across all pages.
* Css will be applied for every page and page css will be applied after.
*/
export var cssFile: string;
/**
* Sets css file name for the application.
*/
export function setCssFileName(cssFile: string): void;
export function addCss(cssText: string): void;
/**
* This event is raised when application css is changed.
*/
export function on(event: "cssChanged", callback: (args: CssChangedEventData) => void, thisArg?: any);
/**
* Event raised then livesync operation is performed.
*/
export function on(event: "livesync", callback: (args: EventData) => void);
/**
* Call this method to start the application. Important: All code after this method call will not be executed!
*/
export function start(entry?: NavigationEntry);
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
export function on(eventNames: string, callback: (data: any) => void, thisArg?: any);
/**
* Shortcut alias to the removeEventListener method.
* @param eventNames - String corresponding to events (e.g. "onLaunch").
* @param callback - Callback function which will be removed.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
export function off(eventNames: string, callback?: any, thisArg?: any);
/**
* Notifies all the registered listeners for the event provided in the data.eventName.
* @param data The data associated with the event.
*/
export function notify(data: any): void;
/**
* Checks whether a listener is registered for the specified event name.
* @param eventName The name of the event to check for.
*/
export function hasListeners(eventName: string): boolean;
/**
* This event is raised on application launchEvent.
*/
export function on(event: "launch", callback: (args: LaunchEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is suspended.
*/
export function on(event: "suspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is resumed after it has been suspended.
*/
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is about to exitEvent.
*/
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when there is low memory on the target device.
*/
export function on(event: "lowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when an uncaught error occurs while the application is running.
*/
export function on(event: "uncaughtError", callback: (args: UnhandledErrorEventData) => void, thisArg?: any);
/**
* This event is raised the orientation of the current device has changed.
*/
export function on(event: "orientationChanged", callback: (args: OrientationChangedEventData) => void, thisArg?: any);
/**
* This is the Android-specific application object instance.
* Encapsulates methods and properties specific to the Android platform.
* Will be undefined when TargetOS is iOS.
*/
export let android: AndroidApplication;
/**
* This is the iOS-specific application object instance.
* Encapsulates methods and properties specific to the iOS platform.
* Will be undefined when TargetOS is Android.
*/
export let ios: iOSApplication;
/**
* Data for the Android activity events.
*/
export interface AndroidActivityEventData {
export interface AndroidActivityEventData {
/**
* The activity.
*/
@ -253,22 +249,22 @@ declare module "application" {
* The instance that has raised the event.
*/
object: any;
}
}
/**
/**
* Data for the Android activity events with bundle.
*/
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
/**
* The bundle.
*/
bundle: any /* android.os.Bundle */;
}
}
/**
/**
* Data for the Android activity onRequestPermissions callback
*/
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
/**
* The request code.
*/
@ -283,12 +279,12 @@ declare module "application" {
* The Granted.
*/
grantResults: Array<number>
}
}
/**
/**
* Data for the Android activity result event.
*/
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
/**
* The request code.
*/
@ -303,22 +299,22 @@ declare module "application" {
* The intent.
*/
intent: any /* android.content.Intent */;
}
}
/**
/**
* Data for the Android activity back pressed event.
*/
export interface AndroidActivityBackPressedEventData extends AndroidActivityEventData {
export interface AndroidActivityBackPressedEventData extends AndroidActivityEventData {
/**
* In the event handler, set this value to true if you want to cancel the back navigation and do something else instead.
*/
cancel: boolean;
}
}
/**
/**
* The abstraction of an Android-specific application object.
*/
export class AndroidApplication extends Observable {
export class AndroidApplication extends Observable {
/**
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
*/
@ -483,13 +479,13 @@ declare module "application" {
* @param intentFilter A string containing the intent filter with which the receiver was originally registered.
*/
unregisterBroadcastReceiver(intentFilter: string): void;
}
}
/* tslint:disable */
/**
/* tslint:disable */
/**
* The abstraction of an iOS-specific application object.
*/
export interface iOSApplication {
export interface iOSApplication {
/* tslint:enable */
/**
* The root view controller for the application.
@ -528,12 +524,11 @@ declare module "application" {
* @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
*/
removeNotificationObserver(observer: any, notificationName: string): void;
}
/* tslint:disable */
export interface RootViewControllerImpl {
contentController: any;
}
export function getNativeApplication(): any;
}
/* tslint:disable */
export interface RootViewControllerImpl {
contentController: any;
}
export function getNativeApplication(): any;

View File

@ -1,5 +1,6 @@
{
"name" : "application",
"main" : "application",
"types": "application.d.ts",
"nativescript": {}
}

View File

@ -1,11 +1,10 @@
/**
* Allows creating colors to be used when styling the UI.
*/
declare module "color" {
/**
/**
* Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range.
*/
class Color {
export class Color {
constructor(knownColor: string);
constructor(hex: string);
constructor(argb: number);
@ -74,5 +73,4 @@ declare module "color" {
* @param value Input string.
*/
public static isValid(value: any): boolean;
}
}

View File

@ -1,145 +1,143 @@
declare module "color/known-colors" {
export var AliceBlue;
export var AntiqueWhite;
export var Aqua;
export var Aquamarine;
export var Azure;
export var Beige;
export var Bisque;
export var Black;
export var BlanchedAlmond;
export var Blue;
export var BlueViolet;
export var Brown;
export var BurlyWood;
export var CadetBlue;
export var Chartreuse;
export var Chocolate;
export var Coral;
export var CornflowerBlue;
export var Cornsilk;
export var Crimson;
export var Cyan;
export var DarkBlue;
export var DarkCyan;
export var DarkGoldenRod;
export var DarkGray;
export var DarkGreen;
export var DarkKhaki;
export var DarkMagenta;
export var DarkOliveGreen;
export var DarkOrange;
export var DarkOrchid;
export var DarkRed;
export var DarkSalmon;
export var DarkSeaGreen;
export var DarkSlateBlue;
export var DarkSlateGray;
export var DarkTurquoise;
export var DarkViolet;
export var DeepPink;
export var DeepSkyBlue;
export var DimGray;
export var DodgerBlue;
export var FireBrick;
export var FloralWhite;
export var ForestGreen;
export var Fuchsia;
export var Gainsboro;
export var GhostWhite;
export var Gold;
export var GoldenRod;
export var Gray;
export var Green;
export var GreenYellow;
export var HoneyDew;
export var HotPink;
export var IndianRed;
export var Indigo;
export var Ivory;
export var Khaki;
export var Lavender;
export var LavenderBlush;
export var LawnGreen;
export var LemonChiffon;
export var LightBlue;
export var LightCoral;
export var LightCyan;
export var LightGoldenRodYellow;
export var LightGray;
export var LightGreen;
export var LightPink;
export var LightSalmon;
export var LightSeaGreen;
export var LightSkyBlue;
export var LightSlateGray;
export var LightSteelBlue;
export var LightYellow;
export var Lime;
export var LimeGreen;
export var Linen;
export var Magenta;
export var Maroon;
export var MediumAquaMarine;
export var MediumBlue;
export var MediumOrchid;
export var MediumPurple;
export var MediumSeaGreen;
export var MediumSlateBlue;
export var MediumSpringGreen;
export var MediumTurquoise;
export var MediumVioletRed;
export var MidnightBlue;
export var MintCream;
export var MistyRose;
export var Moccasin;
export var NavajoWhite;
export var Navy;
export var OldLace;
export var Olive;
export var OliveDrab;
export var Orange;
export var OrangeRed;
export var Orchid;
export var PaleGoldenRod;
export var PaleGreen;
export var PaleTurquoise;
export var PaleVioletRed;
export var PapayaWhip;
export var PeachPuff;
export var Peru;
export var Pink;
export var Plum;
export var PowderBlue;
export var Purple;
export var Red;
export var RosyBrown;
export var RoyalBlue;
export var SaddleBrown;
export var Salmon;
export var SandyBrown;
export var SeaGreen;
export var SeaShell;
export var Sienna;
export var Silver;
export var SkyBlue;
export var SlateBlue;
export var SlateGray;
export var Snow;
export var SpringGreen;
export var SteelBlue;
export var Tan;
export var Teal;
export var Thistle;
export var Tomato;
export var Turquoise;
export var Violet;
export var Wheat;
export var White;
export var WhiteSmoke;
export var Yellow;
export var YellowGreen;
export var AliceBlue;
export var AntiqueWhite;
export var Aqua;
export var Aquamarine;
export var Azure;
export var Beige;
export var Bisque;
export var Black;
export var BlanchedAlmond;
export var Blue;
export var BlueViolet;
export var Brown;
export var BurlyWood;
export var CadetBlue;
export var Chartreuse;
export var Chocolate;
export var Coral;
export var CornflowerBlue;
export var Cornsilk;
export var Crimson;
export var Cyan;
export var DarkBlue;
export var DarkCyan;
export var DarkGoldenRod;
export var DarkGray;
export var DarkGreen;
export var DarkKhaki;
export var DarkMagenta;
export var DarkOliveGreen;
export var DarkOrange;
export var DarkOrchid;
export var DarkRed;
export var DarkSalmon;
export var DarkSeaGreen;
export var DarkSlateBlue;
export var DarkSlateGray;
export var DarkTurquoise;
export var DarkViolet;
export var DeepPink;
export var DeepSkyBlue;
export var DimGray;
export var DodgerBlue;
export var FireBrick;
export var FloralWhite;
export var ForestGreen;
export var Fuchsia;
export var Gainsboro;
export var GhostWhite;
export var Gold;
export var GoldenRod;
export var Gray;
export var Green;
export var GreenYellow;
export var HoneyDew;
export var HotPink;
export var IndianRed;
export var Indigo;
export var Ivory;
export var Khaki;
export var Lavender;
export var LavenderBlush;
export var LawnGreen;
export var LemonChiffon;
export var LightBlue;
export var LightCoral;
export var LightCyan;
export var LightGoldenRodYellow;
export var LightGray;
export var LightGreen;
export var LightPink;
export var LightSalmon;
export var LightSeaGreen;
export var LightSkyBlue;
export var LightSlateGray;
export var LightSteelBlue;
export var LightYellow;
export var Lime;
export var LimeGreen;
export var Linen;
export var Magenta;
export var Maroon;
export var MediumAquaMarine;
export var MediumBlue;
export var MediumOrchid;
export var MediumPurple;
export var MediumSeaGreen;
export var MediumSlateBlue;
export var MediumSpringGreen;
export var MediumTurquoise;
export var MediumVioletRed;
export var MidnightBlue;
export var MintCream;
export var MistyRose;
export var Moccasin;
export var NavajoWhite;
export var Navy;
export var OldLace;
export var Olive;
export var OliveDrab;
export var Orange;
export var OrangeRed;
export var Orchid;
export var PaleGoldenRod;
export var PaleGreen;
export var PaleTurquoise;
export var PaleVioletRed;
export var PapayaWhip;
export var PeachPuff;
export var Peru;
export var Pink;
export var Plum;
export var PowderBlue;
export var Purple;
export var Red;
export var RosyBrown;
export var RoyalBlue;
export var SaddleBrown;
export var Salmon;
export var SandyBrown;
export var SeaGreen;
export var SeaShell;
export var Sienna;
export var Silver;
export var SkyBlue;
export var SlateBlue;
export var SlateGray;
export var Snow;
export var SpringGreen;
export var SteelBlue;
export var Tan;
export var Teal;
export var Thistle;
export var Tomato;
export var Turquoise;
export var Violet;
export var Wheat;
export var White;
export var WhiteSmoke;
export var Yellow;
export var YellowGreen;
export function isKnownName(name: string): boolean;
export function getKnownColor(name: string): string
}
export function isKnownName(name: string): boolean;
export function getKnownColor(name: string): string

View File

@ -1,6 +1,7 @@
{
"name" : "color",
"main" : "color",
"types": "color.d.ts",
"nativescript": {}
}

View File

@ -1,18 +1,17 @@
/**
* Contains connectivity utility methods.
*/
declare module "connectivity" {
/**
/**
* Gets the type of connection.
* Returns a value from the connectivity.connectionType enumeration.
* To use this method on Android you need to have the android.permission.ACCESS_NETWORK_STATE permission added to the AndroidManifest.xml file.
*/
export function getConnectionType(): number;
export function getConnectionType(): number;
/**
/**
* Defines the different connection types.
*/
export const enum connectionType {
export const enum connectionType {
/**
* Denotes no connection.
*/
@ -27,16 +26,15 @@ declare module "connectivity" {
* Denotes a mobile connection, i.e. cellular network or WAN
*/
mobile = 2
}
}
/**
/**
* Starts monitoring the connection type.
* @param connectionChangedCallback A function that will be called when the connection type changes.
*/
export function startMonitoring(connectionTypeChangedCallback: (newConnectionType: number) => void): void;
export function startMonitoring(connectionTypeChangedCallback: (newConnectionType: number) => void): void;
/**
/**
* Stops monitoring the connection type.
*/
export function stopMonitoring(): void;
}
export function stopMonitoring(): void;

View File

@ -1,5 +1,6 @@
{
"name" : "connectivity",
"main" : "connectivity",
"types": "connectivity.d.ts",
"nativescript": {}
}

View File

@ -14,5 +14,6 @@
"should": "~1.2.2"
},
"main": "index",
"types": "reworkcss-value.d.ts",
"nativescript": {}
}

View File

@ -1,10 +1,8 @@
declare module "css-value" {
interface CSSValue {
interface CSSValue {
type: string;
string: string;
unit?: string;
value?: number;
}
export function parse(cssValue: string): Array<CSSValue>;
}
export function parse(cssValue: string): Array<CSSValue>;

View File

@ -31,5 +31,6 @@
"stringifier",
"stylesheet"
],
"types": "reworkcss.d.ts",
"nativescript": {}
}

View File

@ -1,35 +1,33 @@
declare module "css" {
export interface Position {
export interface Position {
start: { line: number; column: number };
end: { line: number; column: number };
}
}
export interface Node {
export interface Node {
type: "rule" | "keyframes" | "declaration" | "import";
position: Position;
}
}
export interface Declaration extends Node {
export interface Declaration extends Node {
property: string;
value: string;
}
}
export interface Rule extends Node {
export interface Rule extends Node {
selectors: string[];
declarations: Node[];
}
export interface Keyframes extends Rule {
name: string;
}
export interface StyleSheet {
rules: Node[];
}
export interface SyntaxTree {
stylesheet: StyleSheet;
}
export function parse(css: string, options: any): SyntaxTree;
}
export interface Keyframes extends Rule {
name: string;
}
export interface StyleSheet {
rules: Node[];
}
export interface SyntaxTree {
stylesheet: StyleSheet;
}
export function parse(css: string, options: any): SyntaxTree;

View File

@ -3,13 +3,12 @@
/**
* Contains the ObservableArray class, which is capable of detecting and responding to changes of a collection of objects.
*/
declare module "data/observable-array" {
import * as observable from "data/observable";
import * as observable from "data/observable";
/**
/**
* Event args for "changed" event.
*/
interface ChangedData<T> extends observable.EventData {
export interface ChangedData<T> extends observable.EventData {
/**
* Change type.
*/
@ -29,22 +28,22 @@ declare module "data/observable-array" {
* Number of added items.
*/
addedCount: number;
}
}
/**
/**
* Change types.
*/
class ChangeType {
export class ChangeType {
static Add: string;
static Delete: string;
static Update: string;
static Splice: string;
}
}
/**
/**
* Advanced array like class used when you want to be notified when a change occurs.
*/
class ObservableArray<T> extends observable.Observable {
export class ObservableArray<T> extends observable.Observable {
/**
* String value used when hooking to change event.
*/
@ -241,5 +240,4 @@ declare module "data/observable-array" {
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
*/
length: number;
}
}

View File

@ -1,4 +1,5 @@
{
"types": "observable-array.d.ts",
"name" : "observable-array",
"main" : "observable-array"
}

View File

@ -1,11 +1,10 @@
/**
* Contains the Observable class, which represents an observable object, or "data" in the model-view paradigm.
*/
declare module "data/observable" {
/**
/**
* Base event data.
*/
interface EventData {
export interface EventData {
/**
* The name of the event.
*/
@ -14,12 +13,12 @@ declare module "data/observable" {
* The Observable instance that has raised the event.
*/
object: Observable;
}
}
/**
/**
* Data for the "propertyChange" event.
*/
interface PropertyChangeData extends EventData {
export interface PropertyChangeData extends EventData {
/**
* The name of the property that has changed.
*/
@ -28,14 +27,14 @@ declare module "data/observable" {
* The new value of the property.
*/
value: any;
}
}
/**
/**
* Helper class that is used to fire property change even when real object is the same.
* By default property change will not be fired for a same object.
* By wrapping object into a WrappedValue instance `same object restriction` will be passed.
*/
class WrappedValue {
export class WrappedValue {
/**
* Property which holds the real value.
*/
@ -59,12 +58,12 @@ declare module "data/observable" {
*/
static wrap(value: any): WrappedValue
}
}
/**
/**
* Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener.
*/
class Observable {
export class Observable {
/**
* Please note that should you be using the `new Observable({})` constructor, it is **obsolete** since v3.0,
@ -145,18 +144,17 @@ declare module "data/observable" {
_createPropertyChangeData(name: string, value: any): PropertyChangeData;
_emit(eventNames: string);
//@endprivate
}
}
/**
/**
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
* param obj - A JavaScript object used to initialize nativescript Observable instance.
*/
export function fromObject(obj: any): Observable;
export function fromObject(obj: any): Observable;
/**
/**
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
* This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object.
* param obj - A JavaScript object used to initialize nativescript Observable instance.
*/
export function fromObjectRecursive(obj: any): Observable;
}
export function fromObjectRecursive(obj: any): Observable;

View File

@ -1,4 +1,5 @@
{
"types": "observable.d.ts",
"name" : "observable",
"main" : "observable"
}

View File

@ -1,4 +1,5 @@
{
"name" : "virtual-array",
"types": "virtual-array.d.ts",
"main" : "virtual-array"
}

View File

@ -1,28 +1,27 @@
/**
* Contains the VirtualArray class, which is an advanced array like class that helps loading items on demand.
*/
declare module "data/virtual-array" {
import * as observable from "data/observable";
import * as observableArray from "data/observable-array";
import * as observable from "data/observable";
import * as observableArray from "data/observable-array";
/**
/**
* Provides event args for "changed" event.
*/
export interface ChangedData<T> extends observableArray.ChangedData<T> {
export interface ChangedData<T> extends observableArray.ChangedData<T> {
//
}
}
/**
/**
* Change types (Add, Delete, Update, Splice).
*/
export class ChangeType extends observableArray.ChangeType {
export class ChangeType extends observableArray.ChangeType {
//
}
}
/**
/**
* Advanced array like class that helps loading items on demand.
*/
export class VirtualArray<T> extends observable.Observable {
export class VirtualArray<T> extends observable.Observable {
/**
* String value used when hooking to change event.
*/
@ -77,12 +76,12 @@ declare module "data/virtual-array" {
* Raised when a change occurs.
*/
on(event: "change", callback: (args: ChangedData<T>) => void, thisArg?: any);
}
}
/**
/**
* Event args for "itemsLoading" event.
*/
export interface ItemsLoading extends observable.EventData {
export interface ItemsLoading extends observable.EventData {
/**
* Start index.
*/
@ -92,5 +91,4 @@ declare module "data/virtual-array" {
* Number of items to load.
*/
count: number;
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "debugger",
"main" : "debugger",
"types": "debugger.d.ts",
"nativescript": {}
}

View File

@ -1,119 +0,0 @@
/* tslint:disable:no-unused-variable */
declare enum RequestContext {
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
"xmlhttprequest", "xslt"
}
// Extend the lib.dom.d.ts Body interface with `formData`
interface Body {
formData() : Promise<FormData>;
}
declare enum RequestMode { "same-origin", "no-cors", "cors" }
declare enum RequestCredentials { "omit", "same-origin", "include" }
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
interface Blob {
readonly size: number;
readonly type: string;
msClose(): void;
msDetachStream(): any;
slice(start?: number, end?: number, contentType?: string): Blob;
}
declare var Blob: {
prototype: Blob;
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
}
declare type HeaderInit = Headers|Array<string>;
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
declare var console: Console;
declare var require: NodeRequire;
declare var __dirname: string;
declare var __filename: string;
declare var module: NodeModule;
// Same as module.exports
declare var exports: any;
// Global functions
declare function Deprecated(target: Object, key?: string | symbol, value?: any): void;
declare function Experimental(target: Object, key?: string | symbol, value?: any): void;
/**
* Decorates class that implements native Java interfaces.
* @param interfaces Implemented interfaces.
*/
declare function Interfaces(...interfaces): ClassDecorator;
/**
* Decorates class that extends native Java class
* @param nativeClassName The name of the newly generated class. Must be unique in the application.
*/
declare function JavaProxy(nativeClassName: string): ClassDecorator;
/**
* Important: Not applicable to Objective-C classes (iOS platform)
* Decorates class that extends native Java class
* @param interfaces An array of fully-classified Java interface names that the class must implement.
*/
declare function Interfaces(interfaces: any[]): ClassDecorator;
declare function Log(data: any): void;
declare function log(data: any): void;
declare function fail(data: any): void;
/**
* Calls a function after a specified delay.
* @param callback The function to be called.
* @param milliseconds The time to wait before the function is called. Defaults to 0.
*/
declare function setTimeout(callback: Function, milliseconds?: number): number;
/**
* Clears the delay set by a call to the setTimeout function.
* @param id The identifier returned by the previously called setTimeout() method.
*/
declare function clearTimeout(id: number): void;
/**
* Calls a function repeatedly with a delay between each call.
* @param callback The function to be called.
* @param milliseconds The delay between each function call.
*/
declare function setInterval(callback: Function, milliseconds?: number): number;
/**
* Clears repeated function which was set up by calling setInterval().
* @param id The identifier returned by the setInterval() method.
*/
declare function clearInterval(id: number): void;
declare function zonedCallback(callback: Function): Function;
declare class WeakRef<T> {
constructor(obj: T);
get(): T;
clear(): void;
}
interface Array<T> {
filter<U extends T>(pred: (a: T) => a is U): U[];
}
//Dialogs
declare function alert(message?: any): void;
declare function confirm(message?: string): boolean;

View File

@ -1,20 +0,0 @@
/**
* Provides FileNameResolver class used for loading files based on device capabilities.
*/
declare module "file-system/file-name-resolver" {
export interface PlatformContext {
width: number;
height: number;
os: string;
deviceType: string;
}
export class FileNameResolver {
constructor(context: PlatformContext);
resolveFileName(path: string, ext: string): string;
clearCache(): void;
}
export function resolveFileName(path: string, ext: string): string;
export function clearCache(): void;
}

View File

@ -0,0 +1,19 @@
/**
* Provides FileNameResolver class used for loading files based on device capabilities.
*/
export interface PlatformContext {
width: number;
height: number;
os: string;
deviceType: string;
}
export class FileNameResolver {
constructor(context: PlatformContext);
resolveFileName(path: string, ext: string): string;
clearCache(): void;
}
export function resolveFileName(path: string, ext: string): string;
export function clearCache(): void;
export function _findFileMatch(path: string, ext: string, candidates: Array<string>, context: PlatformContext): string;

View File

@ -1,13 +1,9 @@
import { PlatformContext, FileNameResolver as FileNameResolverDefinition } from "file-system/file-name-resolver";
import { PlatformContext, FileNameResolver as FileNameResolverDefinition } from "../file-name-resolver";
import { screen, device } from "platform";
import { path as fsPath, Folder, File } from "file-system";
import * as trace from "trace";
import * as appModule from "application";
declare module "file-system/file-name-resolver" {
export function _findFileMatch(path: string, ext: string, candidates: Array<string>, context: PlatformContext): string
}
const MIN_WH: string = "minWH";
const MIN_W: string = "minW";
const MIN_H: string = "minH";

View File

@ -0,0 +1,5 @@
{
"name" : "file-name_resolver",
"main" : "file-name-resolver",
"types" : "file-name-resolver.d.ts"
}

View File

@ -1,8 +1,7 @@
declare module "file-system/file-system-access" {
/**
/**
* An utility class used to provide methods to access and work with the file system.
*/
export class FileSystemAccess {
export class FileSystemAccess {
/**
* Gets the last modified date of a file with a given path.
* @param path Path to the file.
@ -175,5 +174,4 @@
* Joins an array of file paths.
*/
joinPaths(paths: string[]): string;
}
}

View File

@ -1,12 +1,11 @@
/**
* Provides high-level abstractions for file system entities such as files, folders, known folders, paths, separators, etc.
*/
declare module "file-system" {
/**
/**
* Represents a single entity on the file system.
*/
export class FileSystemEntity {
export class FileSystemEntity {
/**
* Gets the Date object specifying the last time this entity was modified.
*/
@ -50,12 +49,12 @@ declare module "file-system" {
* @param newName The new name to be applied to the entity.
*/
renameSync(newName: string, onError?: (error: any) => any): void;
}
}
/**
/**
* Represents a File entity on the file system.
*/
export class File extends FileSystemEntity {
export class File extends FileSystemEntity {
/**
* Checks whether a File with the specified path already exists.
* @param path The path to check for.
@ -118,12 +117,12 @@ declare module "file-system" {
* @param onError An optional function to be called if some IO-error occurs.
*/
writeSync(content: any, onError?: (error: any) => any): void;
}
}
/**
/**
* Represents a Folder (directory) entity on the file system.
*/
export class Folder extends FileSystemEntity {
export class Folder extends FileSystemEntity {
/**
* Determines whether this instance is a KnownFolder (accessed through the KnownFolders object).
*/
@ -187,12 +186,12 @@ declare module "file-system" {
* @param onEntity A callback that receives the current entity. If the callback returns false this will mean for the iteration to stop.
*/
eachEntity(onEntity: (entity: FileSystemEntity) => boolean);
}
}
/**
/**
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
*/
module knownFolders {
export module knownFolders {
/**
* Gets the Documents folder available for the current application. This Folder is private for the application and not accessible from Users/External apps.
*/
@ -253,12 +252,12 @@ declare module "file-system" {
*/
export function sharedPublic(): Folder;
}
}
}
/**
/**
* Enables path-specific operations like join, extension, etc.
*/
export module path {
export module path {
/**
* Normalizes a path, taking care of occurrances like ".." and "//".
* @param path The path to be normalized.
@ -275,5 +274,4 @@ declare module "file-system" {
* Gets the string used to separate file paths.
*/
export var separator: string;
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "file-system",
"main" : "file-system",
"types": "file-system.d.ts",
"nativescript": {}
}

View File

@ -1,30 +1,28 @@
/**
* Allows you to capture the frames-per-second metrics of your application.
*/
declare module "fps-meter" {
/**
* Starts the frames-per-second meter.
*/
export function start(): void;
/**
* Starts the frames-per-second meter.
*/
export function start(): void;
/**
* Stops the frames-per-second meter.
*/
export function stop(): void;
/**
* Stops the frames-per-second meter.
*/
export function stop(): void;
/**
* Returns a valid indicating whether the frames-per-second meter is currently running.
*/
export function running(): boolean;
/**
* Returns a valid indicating whether the frames-per-second meter is currently running.
*/
export function running(): boolean;
/**
* Adds a callback function to be called each time FPS data is due to be reported. Returns an unique id which can be used to remove this callback later.
*/
export function addCallback(callback: (fps: number, minFps?: number) => void): number;
/**
* Adds a callback function to be called each time FPS data is due to be reported. Returns an unique id which can be used to remove this callback later.
*/
export function addCallback(callback: (fps: number, minFps?: number) => void): number;
/**
* Removes the callback with the specified id.
*/
export function removeCallback(id: number);
}
/**
* Removes the callback with the specified id.
*/
export function removeCallback(id: number);

View File

@ -1,9 +1,8 @@
declare module "fps-meter/fps-native" {
/**

/**
* An utility class used to measure frames per second.
*/
export class FPSCallback {
export class FPSCallback {
/**
* Initializes a new instance of FPSCallback class.
@ -24,5 +23,4 @@
* Gets if the current instance of FPSCallback is running.
*/
running: boolean;
}
}

View File

@ -1,6 +1,7 @@
{
"name" : "fps-meter",
"main" : "fps-meter",
"types": "fps-meter.d.ts",
"nativescript": {}
}

View File

@ -1,6 +1,7 @@
{
"name" : "globals",
"main" : "globals",
"types": "globals.d.ts",
"nativescript": {}
}

View File

@ -1,7 +0,0 @@
//@private
declare module "http/http-request" {
import { HttpResponse, HttpRequestOptions, Headers } from "http";
export var request: (options: HttpRequestOptions) => Promise<HttpResponse>;
export function addHeader(headers: Headers, key: string, value: string): void;
}

View File

@ -6,7 +6,7 @@ import * as platformModule from "platform";
import * as fsModule from "file-system";
// this is imported for definition purposes only
import { Headers, HttpRequestOptions, HttpResponse } from "http";
import * as http from "../../http";
export const enum HttpResponseEncoding {
UTF8,
@ -63,7 +63,7 @@ function onRequestComplete(requestId: number, result: org.nativescript.widgets.A
}
// read the headers
var headers: Headers = {};
var headers: http.Headers = {};
if (result.headers) {
var jHeaders = result.headers;
var length = jHeaders.size();
@ -140,7 +140,7 @@ function onRequestComplete(requestId: number, result: org.nativescript.widgets.A
});
}
function buildJavaOptions(options: HttpRequestOptions) {
function buildJavaOptions(options: http.HttpRequestOptions) {
if (typeof options.url !== "string") {
throw new Error("Http request must provide a valid url.");
}
@ -183,13 +183,13 @@ function buildJavaOptions(options: HttpRequestOptions) {
return javaOptions;
}
export function request(options: HttpRequestOptions): Promise<HttpResponse> {
export function request(options: http.HttpRequestOptions): Promise<http.HttpResponse> {
if (options === undefined || options === null) {
// TODO: Shouldn't we throw an error here - defensive programming
return;
}
return new Promise<HttpResponse>((resolve, reject) => {
return new Promise<http.HttpResponse>((resolve, reject) => {
try {
// initialize the options
var javaOptions = buildJavaOptions(options);
@ -222,7 +222,7 @@ function decodeResponse(raw: any, encoding?: HttpResponseEncoding) {
return raw.toString(charsetName)
}
export function addHeader(headers: Headers, key: string, value: string): void {
export function addHeader(headers: http.Headers, key: string, value: string): void {
if (!headers[key]) {
headers[key] = value;
} else if (Array.isArray(headers[key])) {

View File

@ -0,0 +1,5 @@
//@private
import * as http from "..";
export var request: (options: http.HttpRequestOptions) => Promise<http.HttpResponse>;
export function addHeader(headers: http.Headers, key: string, value: string): void;

View File

@ -2,8 +2,7 @@
* iOS specific http request implementation.
*/
import { HttpRequestOptions, HttpResponse, Headers } from "http";
import * as http from "../../http";
import * as types from "utils/types";
import * as imageSourceModule from "image-source";
import * as fsModule from "file-system";
@ -11,7 +10,7 @@ import * as fsModule from "file-system";
import * as utils from "utils/utils";
import getter = utils.ios.getter;
import * as domainDebugger from "./../debugger/debugger";
import * as domainDebugger from "../../debugger/debugger";
export const enum HttpResponseEncoding {
UTF8,
@ -64,8 +63,8 @@ function ensureImageSource() {
}
}
export function request(options: HttpRequestOptions): Promise<HttpResponse> {
return new Promise<HttpResponse>((resolve, reject) => {
export function request(options: http.HttpRequestOptions): Promise<http.HttpResponse> {
return new Promise<http.HttpResponse>((resolve, reject) => {
try {
var network = domainDebugger.getNetwork();
@ -106,7 +105,7 @@ export function request(options: HttpRequestOptions): Promise<HttpResponse> {
if (error) {
reject(new Error(error.localizedDescription));
} else {
var headers: Headers = {};
var headers: http.Headers = {};
if (response && response.allHeaderFields) {
var headerFields = response.allHeaderFields;
@ -191,7 +190,7 @@ function NSDataToString(data: any, encoding?: HttpResponseEncoding): string {
return NSString.alloc().initWithDataEncoding(data, code).toString();
}
export function addHeader(headers: Headers, key: string, value: string): void {
export function addHeader(headers: http.Headers, key: string, value: string): void {
if (!headers[key]) {
headers[key] = value;
} else if (Array.isArray(headers[key])) {

View File

@ -0,0 +1,7 @@
{
"name" : "http-request",
"main" : "http-request",
"types": "http-request.d.ts",
"nativescript": {}
}

View File

@ -1,70 +1,69 @@
/**
* Allows you to send web requests and receive the responses.
*/
declare module "http" {
import * as image from "image-source";
import * as fs from "file-system";
import * as image from "image-source";
import * as fs from "file-system";
/**
/**
* Downloads the content from the specified URL as a string.
* @param url The URL to request from.
*/
export function getString(url: string): Promise<string>
export function getString(url: string): Promise<string>;
/**
/**
* Downloads the content from the specified URL as a string.
* @param options An object that specifies various request options.
*/
export function getString(options: HttpRequestOptions): Promise<string>
export function getString(options: HttpRequestOptions): Promise<string>;
/**
/**
* Downloads the content from the specified URL as a string and returns its JSON.parse representation.
* @param url The URL to request from.
*/
export function getJSON<T>(url: string): Promise<T>
export function getJSON<T>(url: string): Promise<T>;
/**
/**
* Downloads the content from the specified URL as a string and returns its JSON.parse representation.
* @param options An object that specifies various request options.
*/
export function getJSON<T>(options: HttpRequestOptions): Promise<T>
export function getJSON<T>(options: HttpRequestOptions): Promise<T>;
/**
/**
* Downloads the content from the specified URL and attempts to decode it as an image.
* @param url The URL to request from.
*/
export function getImage(url: string): Promise<image.ImageSource>
export function getImage(url: string): Promise<image.ImageSource>;
/**
/**
* Downloads the content from the specified URL and attempts to decode it as an image.
* @param options An object that specifies various request options.
*/
export function getImage(options: HttpRequestOptions): Promise<image.ImageSource>
export function getImage(options: HttpRequestOptions): Promise<image.ImageSource>;
/**
/**
* Downloads the content from the specified URL and attempts to save it as file.
* @param url The URL to request from.
* @param destinationFilePath Optional. The downloaded file path.
*/
export function getFile(url: string, destinationFilePath?: string): Promise<fs.File>
export function getFile(url: string, destinationFilePath?: string): Promise<fs.File>;
/**
/**
* Downloads the content from the specified URL and attempts to save it as file.
* @param options An object that specifies various request options.
* @param destinationFilePath Optional. The downloaded file path.
*/
export function getFile(options: HttpRequestOptions, destinationFilePath?: string): Promise<fs.File>
export function getFile(options: HttpRequestOptions, destinationFilePath?: string): Promise<fs.File>;
/**
/**
* Makes a generic http request using the provided options and returns a HttpResponse Object.
* @param options An object that specifies various request options.
*/
export function request(options: HttpRequestOptions): Promise<HttpResponse>;
export function request(options: HttpRequestOptions): Promise<HttpResponse>;
/**
/**
* Provides options for the http requests.
*/
export interface HttpRequestOptions {
export interface HttpRequestOptions {
/**
* Gets or sets the request url.
*/
@ -94,12 +93,12 @@ declare module "http" {
* Gets or sets wether to *not* follow server's redirection responses.
*/
dontFollowRedirects?: boolean;
}
}
/**
/**
* Encapsulates HTTP-response information from an HTTP-request.
*/
export interface HttpResponse {
export interface HttpResponse {
/**
* Gets the response status code.
*/
@ -114,19 +113,18 @@ declare module "http" {
* Gets the response content.
*/
content?: HttpContent;
}
}
export type Headers = { [key: string]: string | string[] };
export type Headers = { [key: string]: string | string[] };
export const enum HttpResponseEncoding {
export const enum HttpResponseEncoding {
UTF8,
GBK
}
/**
}
/**
* Encapsulates the content of an HttpResponse.
*/
export interface HttpContent {
export interface HttpContent {
/**
* Gets the response body as raw data.
*/
@ -151,5 +149,4 @@ declare module "http" {
* Gets the response body as file.
*/
toFile: (destinationFilePath?: string) => fs.File;
}
}

View File

@ -1,5 +1,5 @@
import * as image from "image-source";
import * as httpRequest from "http/http-request";
import * as httpRequest from "./http-request";
global.moduleMerge(httpRequest, exports);

View File

@ -1,6 +1,7 @@
{
"name" : "http",
"main" : "http",
"types": "http.d.ts",
"nativescript": {}
}

View File

@ -1,18 +1,16 @@
declare module "image-asset" {
import { Observable } from "data/observable";
import { Observable } from "data/observable";
export class ImageAsset extends Observable {
export class ImageAsset extends Observable {
constructor(asset: any);
getImageAsync(callback: (image: any, error: any) => void); //UIImage for iOS and android.graphics.Bitmap for Android
ios: any; //PHAsset
nativeImage: any; //UIImage for iOS and android.graphics.Bitmap for Android
android: any;
options: ImageAssetOptions;
}
}
export interface ImageAssetOptions {
export interface ImageAssetOptions {
width?: number;
height?: number;
keepAspectRatio?: boolean;
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "image-asset",
"main" : "image-asset",
"types": "image-asset.d.ts",
"nativescript": {}
}

View File

@ -1,7 +1,7 @@
// Definitions.
import { ImageSource as ImageSourceDefinition } from "image-source";
import { ImageAsset } from "image-asset";
import * as httpModule from "http";
import * as httpModule from "../http";
// Types.
import { path as fsPath, knownFolders } from "file-system";
@ -13,7 +13,7 @@ export { isFileOrResourcePath };
let http: typeof httpModule;
function ensureHttp() {
if (!http) {
http = require("http");
http = require("../http");
}
}

View File

@ -1,12 +1,11 @@
/**
* Contains the ImageSource class, which encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
*/
declare module "image-source" {
import * as imageAssetModule from "image-asset";
/**
import * as imageAssetModule from "image-asset";
/**
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
*/
export class ImageSource {
export class ImageSource {
/**
* Gets the height of this instance. This is a read-only property.
*/
@ -107,56 +106,55 @@ declare module "image-source" {
* @param quality Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
*/
toBase64String(format: "png" | "jpeg" | "jpg", quality?: number): string;
}
}
export function fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
export function fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param name The name of the resource (without its extension).
*/
export function fromResource(name: string): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param name The name of the resource (without its extension).
*/
export function fromResource(name: string): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified file.
* @param path The location of the file on the file system.
*/
export function fromFile(path: string): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified file.
* @param path The location of the file on the file system.
*/
export function fromFile(path: string): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
*/
export function fromData(data: any): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
*/
export function fromData(data: any): ImageSource;
/**
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param source The Base64 string to load the image from.
*/
export function fromBase64(source: string): ImageSource;
export function fromBase64(source: string): ImageSource;
/**
* Creates a new ImageSource instance and sets the provided native source object (typically a Bitmap).
* The native source object will update either the android or ios properties, depending on the target os.
* @param source The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
*/
export function fromNativeSource(source: any): ImageSource;
/**
* Creates a new ImageSource instance and sets the provided native source object (typically a Bitmap).
* The native source object will update either the android or ios properties, depending on the target os.
* @param source The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
*/
export function fromNativeSource(source: any): ImageSource;
/**
* Downloads the image from the provided Url and creates a new ImageSource instance from it.
* @param url The link to the remote image object. This operation will download and decode the image.
*/
export function fromUrl(url: string): Promise<ImageSource>;
/**
* Downloads the image from the provided Url and creates a new ImageSource instance from it.
* @param url The link to the remote image object. This operation will download and decode the image.
*/
export function fromUrl(url: string): Promise<ImageSource>;
/**
/**
* Creates a new ImageSource instance and loads it from the specified local file or resource(if spexified with "res://" prefix)
* @param path The location of the file on the file system.
*/
export function fromFileOrResource(path: string): ImageSource;
export function fromFileOrResource(path: string): ImageSource;
/**
/**
* [Obsolete. Please use utils.isFileOrResourcePath instead!] Returns true if the specified path points to a resource or local file.
* @param path The path.
*/
export function isFileOrResourcePath(path: string): boolean
}
export function isFileOrResourcePath(path: string): boolean

View File

@ -1,7 +1,7 @@
// Definitions.
import { ImageSource as ImageSourceDefinition } from "image-source";
import { ImageAsset } from "image-asset";
import * as httpModule from "http";
import * as httpModule from "../http";
// Types.
import { path as fsPath, knownFolders } from "file-system";
@ -12,7 +12,7 @@ export { isFileOrResourcePath };
let http: typeof httpModule;
function ensureHttp() {
if (!http) {
http = require("http");
http = require("../http");
}
}

View File

@ -1,6 +1,7 @@
{
"name" : "image-source",
"main" : "image-source",
"types" : "image-source.d.ts",
"nativescript": {}
}

View File

@ -1,10 +1,8 @@
//@private
declare module "js-libs/easysax" {
class EasySAXParser {
export class EasySAXParser {
constructor();
parse(xml: string): void;
on(name: string, cb: Function): void;
ns(root: string, ns: any): void;
public angularSyntax: boolean;
}
}

View File

@ -9,6 +9,7 @@
],
"version": "0.1.14",
"main": "easysax",
"types": "easysax.d.ts",
"bugs": {
"url": "https://github.com/vflash/easysax/issues"
},

View File

@ -5,17 +5,16 @@
// Definitions by: teppeis <https://github.com/teppeis/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "js-libs/esprima" {
var version: string;
function parse(code: string, options?: Options): Syntax.Program;
function tokenize(code: string, options?: Options): Array<Token>;
export var version: string;
export function parse(code: string, options?: Options): Syntax.Program;
export function tokenize(code: string, options?: Options): Array<Token>;
interface Token {
export interface Token {
type: string
value: string
}
}
interface Options {
export interface Options {
loc?: boolean
range?: boolean
raw?: boolean
@ -24,9 +23,9 @@ declare module "js-libs/esprima" {
attachComment?: boolean
tolerant?: boolean
source?: boolean
}
}
module Syntax {
export module Syntax {
// Node
interface Node {
type: string
@ -270,5 +269,4 @@ declare module "js-libs/esprima" {
interface Literal extends Node, Expression {
value: any // string | boolean | null | number | RegExp
}
}
}

View File

@ -3,6 +3,7 @@
"description": "ECMAScript parsing infrastructure for multipurpose analysis",
"homepage": "http://esprima.org",
"main": "esprima",
"types": "esprima.d.ts",
"bin": {
"esparse": "./bin/esparse.js",
"esvalidate": "./bin/esvalidate.js"

View File

@ -1,2 +1,5 @@
{ "name" : "polymer-expressions",
"main" : "polymer-expressions" }
{
"name" : "polymer-expressions",
"main" : "polymer-expressions",
"types" : "polymer-expressions.d.ts"
}

View File

@ -1,10 +1,9 @@
//@private
declare module "js-libs/polymer-expressions" {
class PolymerExpressions {
export class PolymerExpressions {
static getExpression(expression: string): Expression;
}
}
class Expression {
export class Expression {
/**
* Evaluates a value for an expression.
* @param model - Context of the expression.
@ -12,5 +11,4 @@ declare module "js-libs/polymer-expressions" {
* @param changedModel - A property bag which contains all changed properties (in case of two way binding).
*/
getValue(model, isBackConvert, changedModel);
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "platform",
"main" : "platform",
"types" : "platform.d.ts",
"nativescript": {}
}

View File

@ -2,30 +2,29 @@
/**
* Contains all kinds of information about the device, its operating system and software.
*/
declare module "platform" {
/**
/**
* Gets a value indicating if the app is running on the Android platform.
*/
export var isAndroid: boolean;
export var isAndroid: boolean;
/**
/**
* Gets a value indicating if the app is running on the iOS platform.
*/
export var isIOS: boolean;
export var isIOS: boolean;
/*
/*
* Enum holding platform names.
*/
export module platformNames {
export module platformNames {
export var android: string;
export var ios: string;
}
}
/*
/*
* An object containing device specific information.
*/
export interface Device {
export interface Device {
/**
* Gets the manufacturer of the device.
* For example: "Apple" or "HTC" or "Samsung".
@ -79,12 +78,12 @@ declare module "platform" {
* Gets the preferred region. For example "US"
*/
region: string;
}
}
/**
/**
* An object containing screen information.
*/
export interface ScreenMetrics {
export interface ScreenMetrics {
/**
* Gets the absolute width of the screen in pixels.
*/
@ -109,20 +108,19 @@ declare module "platform" {
* The logical density of the display. This is a scaling factor for the Density Independent Pixel unit.
*/
scale: number;
}
}
/**
/**
* An object describing general information about a display.
*/
export module screen {
export module screen {
/**
* Gets information about the main screen of the current device.
*/
export var mainScreen: ScreenMetrics;
}
}
/**
/**
* Gets the current device information
*/
export var device: Device;
}
export var device: Device;

View File

@ -1,20 +1,19 @@
/**
* Contains the FormattedString and Span classes, which are used to create a formatted (rich text) strings.
*/
declare module "text/formatted-string" {
import { Span } from "text/span";
import { ObservableArray } from "data/observable-array";
import { ViewBase } from "ui/core/view";
import { Color } from "color";
import { FontStyle, FontWeight } from "ui/styling/font";
import { TextDecoration } from "ui/text-base";
import { Span } from "text/span";
import { ObservableArray } from "data/observable-array";
import { ViewBase } from "ui/core/view";
import { Color } from "color";
import { FontStyle, FontWeight } from "ui/styling/font";
import { TextDecoration } from "ui/text-base";
export { Span };
export { Span };
/**
/**
* A class used to create a formatted (rich text) string.
*/
export class FormattedString extends ViewBase {
export class FormattedString extends ViewBase {
/**
* An observable collection of Span objects used to define common text properties.
@ -60,5 +59,4 @@ declare module "text/formatted-string" {
* Gets or sets the font background color which will be used for all spans that doesn't have a specific value.
*/
public backgroundColor: Color;
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "text",
"main" : "text",
"types" : "text.d.ts",
"nativescript": {}
}

View File

@ -1,13 +1,12 @@
declare module "text/span" {
import { Color } from "color";
import { ViewBase } from "ui/core/view-base";
import { FontStyle, FontWeight } from "ui/styling/font";
import { TextDecoration } from "ui/text-base";
import { Color } from "color";
import { ViewBase } from "ui/core/view-base";
import { FontStyle, FontWeight } from "ui/styling/font";
import { TextDecoration } from "ui/text-base";
/**
/**
* A class used to create a single part of formatted string with a common text properties.
*/
class Span extends ViewBase {
export class Span extends ViewBase {
/**
* Gets or sets the font family of the span.
*/
@ -51,5 +50,4 @@
//@private
_setTextInternal(value: string): void;
//@endprivate
}
}

View File

@ -1,11 +1,10 @@
/**
* Defines specific text related enumerations.
*/
declare module "text" {
/**
/**
* Defines the supported character encodings.
*/
module encoding {
export module encoding {
/**
* Denotes ISO-8859-1 character encoding.
*/
@ -35,5 +34,4 @@ declare module "text" {
* Denotes UTF_8 character encoding.
*/
export var UTF_8: any;
}
}

View File

@ -1,5 +1,6 @@
{
"name" : "timer",
"main" : "timer",
"types" : "timer.d.ts",
"nativescript": {}
}

View File

@ -1,30 +1,28 @@
/**
* Allows you to create, start, stop and react to timers.
*/
declare module "timer" {
/**
/**
* Calls a function after a specified delay.
* @param callback The function to be called.
* @param milliseconds The time to wait before the function is called. Defaults to 0.
*/
export function setTimeout(callback: Function, milliseconds?: number): number;
export function setTimeout(callback: Function, milliseconds?: number): number;
/**
/**
* Clears the delay set by a call to the setTimeout function.
* @param id The identifier returned by the previously called setTimeout() method.
*/
export function clearTimeout(id: number): void;
export function clearTimeout(id: number): void;
/**
/**
* Calls a function repeatedly with a delay between each call.
* @param callback The function to be called.
* @param milliseconds The delay between each function call.
*/
export function setInterval(callback: Function, milliseconds?: number): number;
export function setInterval(callback: Function, milliseconds?: number): number;
/**
/**
* Clears repeated function which was set up by calling setInterval().
* @param id The identifier returned by the setInterval() method.
*/
export function clearInterval(id: number): void;
}
export function clearInterval(id: number): void;

View File

@ -1,102 +1,120 @@
/// <reference path="module.d.ts" />
/// <reference path="application-settings/application-settings.d.ts" />
/// <reference path="application/application.d.ts" />
/// <reference path="color/color.d.ts" />
/// <reference path="color/known-colors.d.ts" />
/// <reference path="connectivity/connectivity.d.ts" />
/// <reference path="css-value/reworkcss-value.d.ts" />
/// <reference path="css/reworkcss.d.ts" />
/// <reference path="data/observable-array/observable-array.d.ts" />
/// <reference path="data/observable/observable.d.ts" />
/// <reference path="data/virtual-array/virtual-array.d.ts" />
/// <reference path="declarations.d.ts" />
/// <reference path="file-system/file-name-resolver.d.ts" />
/// <reference path="file-system/file-system-access.d.ts" />
/// <reference path="file-system/file-system.d.ts" />
/// <reference path="fps-meter/fps-meter.d.ts" />
/// <reference path="fps-meter/fps-native.d.ts" />
/// <reference path="http/http-request.d.ts" />
/// <reference path="http/http.d.ts" />
/// <reference path="image-asset/image-asset.d.ts" />
/// <reference path="image-source/image-source.d.ts" />
/// <reference path="js-libs/easysax/easysax.d.ts" />
/// <reference path="js-libs/esprima/esprima.d.ts" />
/// <reference path="js-libs/polymer-expressions/polymer-expressions.d.ts" />
/// <reference path="platform/platform.d.ts" />
/// <reference path="text/formatted-string.d.ts" />
/// <reference path="text/span.d.ts" />
/// <reference path="text/text.d.ts" />
/// <reference path="timer/timer.d.ts" />
/// <reference path="trace/trace.d.ts" />
/// <reference path="ui/core/properties.d.ts" />
/// <reference path="ui/core/view-base.d.ts" />
/// <reference path="ui/action-bar/action-bar.d.ts" />
/// <reference path="ui/activity-indicator/activity-indicator.d.ts" />
/// <reference path="ui/animation/animation.d.ts" />
/// <reference path="ui/animation/keyframe-animation.d.ts" />
/// <reference path="ui/border/border.d.ts" />
/// <reference path="ui/builder/binding-builder.d.ts" />
/// <reference path="ui/builder/builder.d.ts" />
/// <reference path="ui/builder/component-builder.d.ts" />
/// <reference path="ui/builder/special-properties.d.ts" />
/// <reference path="ui/button/button.d.ts" />
/// <reference path="ui/content-view/content-view.d.ts" />
/// <reference path="ui/core/bindable.d.ts" />
/// <reference path="ui/core/control-state-change.d.ts" />
/// <reference path="ui/core/dependency-observable.d.ts" />
/// <reference path="ui/core/properties.d.ts" />
/// <reference path="ui/core/view.d.ts" />
/// <reference path="ui/core/weak-event-listener.d.ts" />
/// <reference path="ui/date-picker/date-picker.d.ts" />
/// <reference path="ui/dialogs/dialogs.d.ts" />
/// <reference path="ui/editable-text-base/editable-text-base.d.ts" />
/// <reference path="ui/enums/enums.d.ts" />
/// <reference path="ui/frame/frame.d.ts" />
/// <reference path="ui/gestures/gestures.d.ts" />
/// <reference path="ui/html-view/html-view.d.ts" />
/// <reference path="ui/image-cache/image-cache.d.ts" />
/// <reference path="ui/image/image.d.ts" />
/// <reference path="ui/label/label.d.ts" />
/// <reference path="ui/layouts/absolute-layout/absolute-layout.d.ts" />
/// <reference path="ui/layouts/dock-layout/dock-layout.d.ts" />
/// <reference path="ui/layouts/grid-layout/grid-layout.d.ts" />
/// <reference path="ui/layouts/flexbox-layout/flexbox-layout.d.ts" />
/// <reference path="ui/layouts/layout-base.d.ts" />
/// <reference path="ui/layouts/layout.d.ts" />
/// <reference path="ui/layouts/stack-layout/stack-layout.d.ts" />
/// <reference path="ui/layouts/wrap-layout/wrap-layout.d.ts" />
/// <reference path="ui/list-picker/list-picker.d.ts" />
/// <reference path="ui/list-view/list-view.d.ts" />
/// <reference path="ui/page/page.d.ts" />
/// <reference path="ui/placeholder/placeholder.d.ts" />
/// <reference path="ui/progress/progress.d.ts" />
/// <reference path="ui/proxy-view-container/proxy-view-container.d.ts" />
/// <reference path="ui/repeater/repeater.d.ts" />
/// <reference path="ui/scroll-view/scroll-view.d.ts" />
/// <reference path="ui/search-bar/search-bar.d.ts" />
/// <reference path="ui/segmented-bar/segmented-bar.d.ts" />
/// <reference path="ui/slider/slider.d.ts" />
/// <reference path="ui/styling/background.d.ts" />
/// <reference path="ui/styling/css-selector.d.ts" />
/// <reference path="ui/styling/font.d.ts" />
/// <reference path="ui/styling/style-property.d.ts" />
/// <reference path="ui/styling/style-properties.d.ts" />
/// <reference path="ui/styling/style-scope.d.ts" />
/// <reference path="ui/styling/style.d.ts" />
/// <reference path="ui/styling/styling.d.ts" />
/// <reference path="ui/switch/switch.d.ts" />
/// <reference path="ui/tab-view/tab-view.d.ts" />
/// <reference path="ui/text-base/text-base.d.ts" />
/// <reference path="ui/text-field/text-field.d.ts" />
/// <reference path="ui/text-view/text-view.d.ts" />
/// <reference path="ui/time-picker/time-picker.d.ts" />
/// <reference path="ui/transition/fade-transition.d.ts" />
/// <reference path="ui/transition/slide-transition.d.ts" />
/// <reference path="ui/transition/transition.d.ts" />
/// <reference path="ui/utils.d.ts" />
/// <reference path="ui/web-view/web-view.d.ts" />
/// <reference path="utils/debug.d.ts" />
/// <reference path="utils/lazy.d.ts" />
/// <reference path="utils/types.d.ts" />
/// <reference path="utils/utils.d.ts" />
/// <reference path="xml/xml.d.ts" />
/* tslint:disable:no-unused-variable */
///<reference path="./module.d.ts" />
declare enum RequestContext {
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
"xmlhttprequest", "xslt"
}
// Extend the lib.dom.d.ts Body interface with `formData`
interface Body {
formData() : Promise<FormData>;
}
declare enum RequestMode { "same-origin", "no-cors", "cors" }
declare enum RequestCredentials { "omit", "same-origin", "include" }
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
interface Blob {
readonly size: number;
readonly type: string;
msClose(): void;
msDetachStream(): any;
slice(start?: number, end?: number, contentType?: string): Blob;
}
declare var Blob: {
prototype: Blob;
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
}
declare type HeaderInit = Headers|Array<string>;
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
declare var console: Console;
declare var require: NodeRequire;
declare var __dirname: string;
declare var __filename: string;
declare var module: NodeModule;
// Same as module.exports
declare var exports: any;
// Global functions
declare function Deprecated(target: Object, key?: string | symbol, value?: any): void;
declare function Experimental(target: Object, key?: string | symbol, value?: any): void;
/**
* Decorates class that implements native Java interfaces.
* @param interfaces Implemented interfaces.
*/
declare function Interfaces(...interfaces): ClassDecorator;
/**
* Decorates class that extends native Java class
* @param nativeClassName The name of the newly generated class. Must be unique in the application.
*/
declare function JavaProxy(nativeClassName: string): ClassDecorator;
/**
* Important: Not applicable to Objective-C classes (iOS platform)
* Decorates class that extends native Java class
* @param interfaces An array of fully-classified Java interface names that the class must implement.
*/
declare function Interfaces(interfaces: any[]): ClassDecorator;
declare function Log(data: any): void;
declare function log(data: any): void;
declare function fail(data: any): void;
/**
* Calls a function after a specified delay.
* @param callback The function to be called.
* @param milliseconds The time to wait before the function is called. Defaults to 0.
*/
declare function setTimeout(callback: Function, milliseconds?: number): number;
/**
* Clears the delay set by a call to the setTimeout function.
* @param id The identifier returned by the previously called setTimeout() method.
*/
declare function clearTimeout(id: number): void;
/**
* Calls a function repeatedly with a delay between each call.
* @param callback The function to be called.
* @param milliseconds The delay between each function call.
*/
declare function setInterval(callback: Function, milliseconds?: number): number;
/**
* Clears repeated function which was set up by calling setInterval().
* @param id The identifier returned by the setInterval() method.
*/
declare function clearInterval(id: number): void;
declare function zonedCallback(callback: Function): Function;
declare class WeakRef<T> {
constructor(obj: T);
get(): T;
clear(): void;
}
interface Array<T> {
filter<U extends T>(pred: (a: T) => a is U): U[];
}
//Dialogs
declare function alert(message?: any): void;
declare function confirm(message?: string): boolean;

View File

@ -1,5 +1,6 @@
{
"name" : "trace",
"main" : "trace",
"types" : "trace.d.ts",
"nativescript": {}
}

View File

@ -1,83 +1,82 @@
/**
* Allows you to trace and print specific information based on categories.
*/
declare module "trace" {
/**
/**
* Enables the trace module.
*/
export function enable(): void;
export function enable(): void;
/**
/**
* Disables the trace module.
*/
export function disable(): void;
export function disable(): void;
/**
/**
* A function that returns whether the tracer is enabled and there is a point in writing messages.
* Check this to avoid writing complex string templates.
* Send error messages even if tracing is disabled.
*/
export function isEnabled(): boolean;
export function isEnabled(): boolean;
/**
/**
* Adds a TraceWriter instance to the trace module.
* @param writer The TraceWriter instance to add.
*/
export function addWriter(writer: TraceWriter);
export function addWriter(writer: TraceWriter);
/**
/**
* Removes a TraceWriter instance from the trace module.
* @param writer The TraceWriter instance to remove.
*/
export function removeWriter(writer: TraceWriter);
export function removeWriter(writer: TraceWriter);
/**
/**
* Clears all the writers from the trace module.
*/
export function clearWriters();
export function clearWriters();
/**
/**
* Sets the categories the module will trace.
* @param categories The comma-separated list of categories. If not specified all messages from all categories will be traced.
*/
export function setCategories(categories: string);
export function setCategories(categories: string);
/**
/**
* Adds categories to existing categories the module will trace.
* @param categories The comma-separated list of categories. If not specified all messages from all categories will be traced.
*/
export function addCategories(categories: string);
export function addCategories(categories: string);
/**
/**
* Check if category is already set in trace module.
* @param category The category to check.
*/
export function isCategorySet(category: string): boolean;
export function isCategorySet(category: string): boolean;
/**
/**
* Writes a message using the available writers.
* @param message The message to be written.
* @param category The category of the message.
* @param type Optional, the type of the message - info, warning, error.
*/
export function write(message: any, category: string, type?: number);
export function write(message: any, category: string, type?: number);
/**
/**
* Notifies all the attached listeners for an event that has occurred in the sender object.
* @param object The Object instance that raised the event.
* @param name The name of the raised event.
* @param data An optional parameter that passes the data associated with the event.
*/
export function notifyEvent(object: Object, name: string, data?: any);
export function notifyEvent(object: Object, name: string, data?: any);
export function addEventListener(listener: EventListener);
export function addEventListener(listener: EventListener);
export function removeEventListener(listener: EventListener);
export function removeEventListener(listener: EventListener);
/**
/**
* An enum that defines all predefined categories.
*/
module categories {
export module categories {
export var VisualTreeEvents: string;
export var Layout: string;
export var Style: string;
@ -95,30 +94,29 @@ declare module "trace" {
export var separator: string;
export function concat(...categories: string[]): string;
}
}
/**
/**
* An enum that defines all predefined message types.
*/
module messageType {
export module messageType {
export var log: number;
export var info: number;
export var warn: number;
export var error: number;
}
}
/**
/**
* An interface used to define a writer used by trace to print (log).
*/
export interface TraceWriter {
export interface TraceWriter {
write(message: any, category: string, type?: number);
}
}
/**
/**
* An interface used to trace information about specific event.
*/
export interface EventListener {
export interface EventListener {
filter: string;
on(object: Object, name: string, data?: any);
}
}

View File

@ -1,13 +1,12 @@
/**
* Contains the action bar related classes.
*/
declare module "ui/action-bar" {
import { EventData, ViewBase, View } from "ui/core/view";
import { EventData, ViewBase, View } from "ui/core/view";
/**
/**
* Provides an abstraction over the ActionBar (android) and NavigationBar (iOS).
*/
export class ActionBar extends View {
export class ActionBar extends View {
/**
* Gets or sets the action bar title.
@ -42,12 +41,12 @@ declare module "ui/action-bar" {
//@private
_isEmpty(): boolean;
//@endprivate
}
}
/**
/**
* Represents a collection of ActionItems.
*/
export class ActionItems {
export class ActionItems {
/**
* Adds an item to the collection.
* @param item - the item to be added
@ -70,12 +69,12 @@ declare module "ui/action-bar" {
* @param index - The index.
*/
getItemAt(index: number): ActionItem;
}
}
/**
/**
* Represents an action item in the action bar.
*/
export class ActionItem extends ViewBase {
export class ActionItem extends ViewBase {
/**
* Gets or sets the text of the action item.
*/
@ -127,12 +126,12 @@ declare module "ui/action-bar" {
* Gets the Android specific options of the action item.
*/
android: AndroidActionItemSettings;
}
}
/**
/**
* Represents Android specific options of the action item.
*/
export interface AndroidActionItemSettings {
export interface AndroidActionItemSettings {
/**
* Gets or sets the position of the action item in the action bar.
* 1. actionBar - item is shown in the action bar.
@ -149,12 +148,12 @@ declare module "ui/action-bar" {
* For a full list of Android drawable names, please visit http://androiddrawables.com
*/
systemIcon: string;
}
}
/**
/**
* Represents iOS specific options of the action item.
*/
export interface IOSActionItemSettings {
export interface IOSActionItemSettings {
/**
* Gets or sets the position of the action item in the action bar.
* 1. left - items is shown at the left part of the navigation bar. This is the default value.
@ -195,12 +194,12 @@ declare module "ui/action-bar" {
* 23: PageCurl
*/
systemIcon: number;
}
}
/**
/**
* Represents Android specific options of the action bar.
*/
export interface AndroidActionBarSettings {
export interface AndroidActionBarSettings {
/**
* Gets or sets the action bar icon.
@ -216,17 +215,16 @@ declare module "ui/action-bar" {
* 3. never - the icon is aways hidden.
*/
iconVisibility: string;
}
}
/**
/**
* Represents the navigation (a.k.a. "back") button.
*/
export class NavigationButton extends ActionItem {
export class NavigationButton extends ActionItem {
}
/** @internal */
export function _setNavBarColor(navBar: any /* UINavigationBar */, color: any /* UIColor */);
/** @internal */
export function _setNavBarBackgroundColor(navBar: any /* UINavigationBar */, color: any /* UIColor */);
}
/** @internal */
export function _setNavBarColor(navBar: any /* UINavigationBar */, color: any /* UIColor */);
/** @internal */
export function _setNavBarBackgroundColor(navBar: any /* UINavigationBar */, color: any /* UIColor */);

View File

@ -1,2 +1,5 @@
{ "name" : "action-bar",
"main" : "action-bar" }
{
"name" : "action-bar",
"main" : "action-bar",
"types" : "action-bar.d.ts"
}

View File

@ -1,13 +1,12 @@
/**
* Contains the ActivityIndicator class, which represents a widget for showing that something is currently busy.
*/
declare module "ui/activity-indicator" {
import { View } from "ui/core/view";
import { View } from "ui/core/view";
/**
/**
* Represents a UI widget which displays a progress indicator hinting the user for some background operation running.
*/
export class ActivityIndicator extends View {
export class ActivityIndicator extends View {
/**
* Gets the native [android widget](http://developer.android.com/reference/android/widget/ProgressBar.html) that represents the user interface for this component. Valid only when running on Android OS.
*/
@ -22,5 +21,4 @@ declare module "ui/activity-indicator" {
* Gets or sets a value indicating whether the widget is currently displaying progress.
*/
busy: boolean;
}
}

View File

@ -1,2 +1,5 @@
{ "name" : "activity-indicator",
"main" : "activity-indicator" }
{
"name" : "activity-indicator",
"main" : "activity-indicator",
"types" : "activity-indicator.d.ts"
}

View File

@ -1,10 +1,9 @@
declare module "ui/animation" {
import { View, Color } from "ui/core/view";
import { View, Color } from "ui/core/view";
/**
/**
* Defines animation options for the View.animate method.
*/
export interface AnimationDefinition {
export interface AnimationDefinition {
/**
* The view whose property is to be animated.
*/
@ -57,48 +56,47 @@
* Alternatively, you can pass an instance of type UIViewAnimationCurve for iOS or android.animation.TimeInterpolator for Android.
*/
curve?: any;
}
}
/**
/**
* Defines a custom animation timing curve by using the cubic-bezier function.
* Possible values are numeric values from 0 to 1
*/
export class CubicBezierAnimationCurve {
export class CubicBezierAnimationCurve {
public x1: number;
public y1: number;
public x2: number;
public y2: number;
constructor(x1: number, y1: number, x2: number, y2: number);
}
}
/**
/**
* Defines a pair of values (horizontal and vertical) for translate and scale animations.
*/
export interface Pair {
export interface Pair {
x: number;
y: number;
}
}
export interface Cancelable {
export interface Cancelable {
cancel(): void;
}
}
/**
/**
* A Promise that can cancel the animation.
*/
export type AnimationPromise = Promise<void> & Cancelable;
export type AnimationPromise = Promise<void> & Cancelable;
/**
/**
* Defines a animation set.
*/
export class Animation {
export class Animation {
constructor(animationDefinitions: Array<AnimationDefinition>, playSequentially?: boolean);
public play: () => AnimationPromise;
public cancel: () => void;
public isPlaying: boolean;
public _resolveAnimationCurve(curve: any): any;
}
export function _resolveAnimationCurve(curve: any): any;
}
export function _resolveAnimationCurve(curve: any): any;

View File

@ -1,21 +1,20 @@
declare module "ui/animation/keyframe-animation" {
import { View } from "ui/core/view";
import { View } from "ui/core/view";
export interface KeyframeDeclaration {
export interface KeyframeDeclaration {
property: string;
value: any;
}
}
export interface KeyframeInfo {
export interface KeyframeInfo {
duration: number;
curve: any;
declarations: Array<KeyframeDeclaration>;
}
}
/**
/**
* Defines animation options for the View.animate method.
*/
export class KeyframeAnimationInfo {
export class KeyframeAnimationInfo {
/**
* The animation name.
@ -59,9 +58,9 @@ declare module "ui/animation/keyframe-animation" {
* Return animation keyframes.
*/
keyframes: Array<KeyframeInfo>;
}
}
export class KeyframeAnimation {
export class KeyframeAnimation {
/**
* The amount of time, in milliseconds, to delay starting the animation.
@ -93,6 +92,5 @@ declare module "ui/animation/keyframe-animation" {
/**
* Creates a keyframe animation from animation definition.
*/
public static keyframeAnimationFromInfo(info: KeyframeAnimationInfo);
}
public static keyframeAnimationFromInfo(info: KeyframeAnimationInfo): KeyframeAnimation;
}

View File

@ -1,2 +1,5 @@
{ "name" : "animation",
"main" : "animation" }
{
"name" : "animation",
"main" : "animation",
"types" : "animation.d.ts"
}

View File

@ -1,16 +1,14 @@
/**
* Contains the Border class, which represents a UI border component.
*/
declare module "ui/border" {
import { ContentView } from "ui/content-view";
import { ContentView } from "ui/content-view";
/**
/**
* Represents a UI border component.
*/
export class Border extends ContentView {
export class Border extends ContentView {
/**
* Gets or sets the corner radius of the border component.
*/
cornerRadius: number;
}
}

View File

@ -1,2 +1,5 @@
{ "name" : "border",
"main" : "border" }
{
"name" : "border",
"main" : "border",
"types" : "border.d.ts"
}

View File

@ -1,6 +1,5 @@
//@private
declare module "ui/builder/binding-builder" {
export module bindingConstants {
export module bindingConstants {
export var sourceProperty: string;
export var targetProperty: string;
export var expression: string;
@ -10,10 +9,9 @@ declare module "ui/builder/binding-builder" {
export var parentValueKey: string;
export var parentsValueKey: string;
export var newPropertyValueKey: string;
}
export function getBindingOptions(name: string, value: string): any;
export var parentsRegex: RegExp;
}
//@endprivate
export function getBindingOptions(name: string, value: string): any;
export var parentsRegex: RegExp;
}

View File

@ -1,18 +1,16 @@
declare module "ui/builder" {
import { View, Template, KeyedTemplate } from "ui/core/view";
import { Page } from "ui/page";
import { View, Template, KeyedTemplate } from "ui/core/view";
import { Page } from "ui/page";
export function loadPage(moduleNamePath: string, fileName: string, moduleExports?: any): Page;
export function load(fileName: string, exports?: any): View;
export function load(options: LoadOptions): View;
export function parse(value: string | Template, exports?: any): View;
export function parseMultipleTemplates(value: string, exports?: any): Array<KeyedTemplate>;
export function loadPage(moduleNamePath: string, fileName: string, moduleExports?: any): Page;
export function load(fileName: string, exports?: any): View;
export function load(options: LoadOptions): View;
export function parse(value: string | Template, exports?: any): View;
export function parseMultipleTemplates(value: string, exports?: any): Array<KeyedTemplate>;
export interface LoadOptions {
export interface LoadOptions {
path: string;
name: string;
attributes?: any;
exports?: any;
page?: Page;
}
}

View File

@ -1,11 +0,0 @@
declare module "ui/builder/component-builder" {
import { View } from "ui/core/view";
export function getComponentModule(elementName: string, namespace: string, attributes: Object, exports: Object, moduleNamePath?: string): ComponentModule;
export function setPropertyValue(instance: View, instanceModuleExports: Object, pageExports: Object, propertyName: string, propertyValue: any): void;
export interface ComponentModule {
component: View;
exports: any;
}
}

View File

@ -0,0 +1,9 @@
import { View } from "ui/core/view";
export function getComponentModule(elementName: string, namespace: string, attributes: Object, exports: Object, moduleNamePath?: string): ComponentModule;
export function setPropertyValue(instance: View, instanceModuleExports: Object, pageExports: Object, propertyName: string, propertyValue: any): void;
export interface ComponentModule {
component: View;
exports: any;
}

View File

@ -5,7 +5,7 @@ import { View } from "ui/core/view";
// Types.
import { isEventOrGesture } from "ui/core/bindable";
import { File, path, knownFolders } from "file-system";
import { getBindingOptions, bindingConstants } from "./binding-builder";
import { getBindingOptions, bindingConstants } from "../binding-builder";
import { resolveFileName } from "file-system/file-name-resolver";
import * as debugModule from "utils/debug";
import * as platform from "platform";

View File

@ -0,0 +1,5 @@
{
"name" : "component-builder",
"main" : "component-builder",
"types" : "component-builder.d.ts"
}

View File

@ -1,2 +1,5 @@
{ "name" : "builder",
"main" : "builder" }
{
"name" : "builder",
"main" : "builder",
"types" : "builder.d.ts"
}

View File

@ -1,7 +1,5 @@
declare module "ui/builder/special-properties" {
import { View } from "ui/core/view";
import { View } from "ui/core/view";
export type PropertySetter = (instance: View, propertyValue: any) => void;
export function registerSpecialProperty(name: string, setter: PropertySetter): void;
export function getSpecialPropertySetter(name: string): PropertySetter;
}
export type PropertySetter = (instance: View, propertyValue: any) => void;
export function registerSpecialProperty(name: string, setter: PropertySetter): void;
export function getSpecialPropertySetter(name: string): PropertySetter;

View File

@ -1,13 +1,12 @@
/**
* Contains the Button class, which represents a standard button widget.
*/
declare module "ui/button" {
import { TextBase, EventData } from "ui/text-base";
import { TextBase, EventData } from "ui/text-base";
/**
/**
* Represents a standard Button widget.
*/
export class Button extends TextBase {
export class Button extends TextBase {
/**
* String value used when hooking to tap event.
*/
@ -40,5 +39,4 @@ declare module "ui/button" {
* Raised when a tap event occurs.
*/
on(event: "tap", callback: (args: EventData) => void, thisArg?: any);
}
}

View File

@ -1,2 +1,5 @@
{ "name" : "button",
"main" : "button" }
{
"name" : "button",
"main" : "button",
"types" : "button.d.ts"
}

View File

@ -1,16 +1,15 @@
/**
* View that can host another view.
*/
declare module "ui/content-view" {
import { View, AddChildFromBuilder } from "ui/core/view";
import { View, AddChildFromBuilder } from "ui/core/view";
export * from "ui/core/view";
export * from "ui/core/view";
/**
/**
* Represents a View that has a single child - content.
* The View itself does not have visual representation and serves as a placeholder for its content in the logical tree.
*/
export class ContentView extends View implements AddChildFromBuilder {
export class ContentView extends View implements AddChildFromBuilder {
/**
* Gets or sets the single child of the view.
*/
@ -28,5 +27,4 @@ declare module "ui/content-view" {
_addChildFromBuilder(name: string, value: any): void;
layoutView: View;
}
}

View File

@ -1,2 +1,5 @@
{ "name" : "content-view",
"main" : "content-view" }
{
"name" : "content-view",
"main" : "content-view",
"types" : "content-view.d.ts"
}

View File

@ -1,60 +0,0 @@
declare module "ui/core/bindable" {
import { ViewBase } from "ui/core/view-base";
import { Observable, WrappedValue, PropertyChangeData, EventData } from "data/observable";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, messageType as traceMessageType, isCategorySet } from "trace";
export {
Observable, WrappedValue, PropertyChangeData, EventData,
traceEnabled, traceWrite, traceCategories, traceNotifyEvent, traceMessageType, isCategorySet
};
/**
* The options object used in the Bindable.bind method.
*/
export interface BindingOptions {
/**
* The property name of the source object (typically the ViewModel) to bind to.
*/
sourceProperty: string;
/**
* The property name of the target object (that is the Bindable instance) to bind the source property to.
*/
targetProperty: string;
/**
* True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
*/
twoWay?: boolean;
/**
* An expression used for calculations (convertions) based on the value of the property.
*/
expression?: string;
}
/**
* An interface which defines methods need to create binding value converter.
*/
export interface ValueConverter {
/**
* A method that will be executed when a value (of the binding property) should be converted to the observable model.
* For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
*/
toModel: (...params: any[]) => any;
/**
* A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
*/
toView: (...params: any[]) => any;
}
export class Binding {
constructor(target: ViewBase, options: BindingOptions);
public bind(source: Object): void;
public unbind();
public sourceIsBindingContext: boolean;
public updateTwoWay(value: any);
}
export function getEventOrGestureName(name: string): string;
export function isEventOrGesture(name: string, view: ViewBase): boolean;
}

View File

@ -0,0 +1,58 @@
import { ViewBase } from "ui/core/view-base";
import { Observable, WrappedValue, PropertyChangeData, EventData } from "data/observable";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, messageType as traceMessageType, isCategorySet } from "trace";
export {
Observable, WrappedValue, PropertyChangeData, EventData,
traceEnabled, traceWrite, traceCategories, traceNotifyEvent, traceMessageType, isCategorySet
};
/**
* The options object used in the Bindable.bind method.
*/
export interface BindingOptions {
/**
* The property name of the source object (typically the ViewModel) to bind to.
*/
sourceProperty: string;
/**
* The property name of the target object (that is the Bindable instance) to bind the source property to.
*/
targetProperty: string;
/**
* True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
*/
twoWay?: boolean;
/**
* An expression used for calculations (convertions) based on the value of the property.
*/
expression?: string;
}
/**
* An interface which defines methods need to create binding value converter.
*/
export interface ValueConverter {
/**
* A method that will be executed when a value (of the binding property) should be converted to the observable model.
* For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
*/
toModel: (...params: any[]) => any;
/**
* A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
*/
toView: (...params: any[]) => any;
}
export class Binding {
constructor(target: ViewBase, options: BindingOptions);
public bind(source: Object): void;
public unbind();
public sourceIsBindingContext: boolean;
public updateTwoWay(value: any);
}
export function getEventOrGestureName(name: string): string;
export function isEventOrGesture(name: string, view: ViewBase): boolean;

View File

@ -4,7 +4,7 @@ import { ViewBase } from "ui/core/view-base";
import { unsetValue } from "ui/core/properties";
import { Observable, WrappedValue, PropertyChangeData, EventData } from "data/observable";
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";
import { bindingConstants, parentsRegex } from "../builder/binding-builder";
import { bindingConstants, parentsRegex } from "../../builder/binding-builder";
import { escapeRegexSymbols } from "utils/utils";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet, messageType as traceMessageType } from "trace";
import * as types from "utils/types";

View File

@ -0,0 +1,5 @@
{
"name" : "bindable",
"main" : "bindable",
"types" : "bindable.d.ts"
}

View File

@ -1,17 +0,0 @@
declare module "ui/core/control-state-change" {
/**
* An utility class used for supporting styling infrastructure.
*/
class ControlStateChangeListener {
/**
* Initializes an instance of ControlStateChangeListener class.
* @param control An instance of the UIControl which state will be watched.
* @param callback A callback called when a visual state of the UIControl is changed.
*/
constructor(control: any /* UIControl */, callback: (state: string) => void);
start();
stop();
}
}

View File

@ -0,0 +1,15 @@
/**
* An utility class used for supporting styling infrastructure.
*/
export class ControlStateChangeListener {
/**
* Initializes an instance of ControlStateChangeListener class.
* @param control An instance of the UIControl which state will be watched.
* @param callback A callback called when a visual state of the UIControl is changed.
*/
constructor(control: any /* UIControl */, callback: (state: string) => void);
start();
stop();
}

Some files were not shown because too many files have changed in this diff Show More