Upgrade to TypeScript 2.1, and latest grunt-ts.

Conflicts:
	package.json
	tests/app/ui/animation/animation-tests.ts
	tns-core-modules/lib.core.d.ts
	tns-core-modules/ui/animation/animation-common.ts
This commit is contained in:
Hristo Deshev
2017-02-08 14:23:49 +02:00
parent 65c3ad59a7
commit 3056ce51c2
24 changed files with 84 additions and 4453 deletions

View File

@@ -2,7 +2,4 @@
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/lib.core.d.ts" />
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@@ -91,15 +91,6 @@ module.exports = function(grunt) {
var angularExcludes = angularConflicts.map(function(file) {
return '!' + file;
});
var nonES6Files = [
'es-collections.d.ts',
'es6-promise.d.ts',
'es6.d.ts',
'weakmap.d.ts',
];
var es6Excludes = nonES6Files.map(function(file) {
return '!' + file;
});
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!
@@ -117,13 +108,13 @@ module.exports = function(grunt) {
"!tns-core-modules.base.d.ts",
"!references.d.ts",
"!webworker.es2016.d.ts"
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
].concat(localCfg.defaultExcludes).concat(angularExcludes));
dtsFiles.sort();
writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts');
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts');
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
var allFiles = angularConflicts.concat(['tns-core-modules.base.d.ts']);
writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts');
}

View File

@@ -17,6 +17,7 @@
"grunt-exec": "1.0.1",
"grunt-mkdir": "1.0.0",
"grunt-shell": "2.1.0",
"grunt-ts": "6.0.0-beta.11",
"grunt-simple-mocha": "0.4.1",
"grunt-typedoc": "0.2.4",
"http-server": "^0.9.0",
@@ -27,7 +28,7 @@
"time-grunt": "1.3.0",
"tslint": "^4.4.2",
"typedoc": "0.4.5",
"typescript": "^2.0.10"
"typescript": "~2.1.5"
},
"scripts": {
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",

View File

@@ -5,6 +5,7 @@ import {Label} from "ui/label";
import {StackLayout} from "ui/layouts/stack-layout";
import * as colorModule from "color";
import * as enums from "ui/enums";
import { AnimationPromise } from "ui/animation";
// >> animation-require
import * as animation from "ui/animation";
@@ -105,7 +106,7 @@ export function test_CancellingAnimate(done) {
}
// << (hide)
});
animation1.cancel();
(<AnimationPromise>animation1).cancel();
// << animation-cancel2
}
@@ -484,4 +485,4 @@ function assertIOSNativeTransformIsCorrect(view: viewModule.View) {
TKUnit.assert(false, errorMessage);
}
}
}
}

View File

@@ -2,7 +2,4 @@
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/lib.core.d.ts" />
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@@ -42,6 +42,24 @@ declare class Headers {
set(name: string, value: string): void;
}
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 class Body {
bodyUsed: boolean;
/*
@@ -80,10 +98,6 @@ declare type RequestInfo = Request|string;
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
interface XMLHttpRequest {
send(data?: FormData): void;
}
interface Console {
time(reportName: string): void;
timeEnd(reportName: string): void;
@@ -172,3 +186,7 @@ declare var exports: any;
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,61 +0,0 @@
/* tslint:disable */
/////////////////////////////
/// IE11 ECMAScript Extensions
/////////////////////////////
interface List<T> extends Array<T> {}
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
size: number;
keys(): Array<K>;
values(): Array<V>;
}
declare var Map: {
new <K, V>(): Map<K, V>;
// needed by Angular
// alexeagle: PATCHED
new<K, V>(m: Map<K, V>): Map<K, V>;
new<K, V>(l: List<any>): Map<K, V>;
prototype: Map<any, any>;
}
//For compatibility - some libs insist on the Map/Set types being named that way
declare type MapConstructor = typeof Map;
declare type SetConstructor = typeof Set;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
}
declare var Set: {
new <T>(): Set<T>;
// needed by Angular
// alexeagle PATCHED
new<T>(s: Set<T>): Set<T>;
new<T>(l: List<T>): Set<T>;
prototype: Set<any>;
}
//Compatibility interfaces for rxjs
interface IteratorResult<T> {
done: boolean;
value?: T;
}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}

View File

@@ -1,146 +0,0 @@
/* tslint:disable */
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface PromiseLike<T> {
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): PromiseLike<U>;
}
interface Promise<T> extends PromiseLike<T> {
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => void): Promise<U>;
}
interface PromiseConstructor {
/**
* A reference to the prototype.
*/
prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Returns promise (only if promise.constructor == Promise)
*/
cast<T>(promise: Promise<T>): Promise<T>;
/**
* Make a promise that fulfills to obj.
*/
cast<T>(object: T): Promise<T>;
/**
* Make a new promise from the PromiseLike.
* A promise-like can be anything as far as it has a "then" method.
* This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast.
*/
resolve<T>(promise?: PromiseLike<T>): Promise<T>;
/**
* Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation.
*/
resolve<T>(object?: T): Promise<T>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
reject(error: any): Promise<any>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
all<T>(promises: Promise<T>[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
race<T>(promises: Promise<T>[]): Promise<T>;
}
declare var Promise: PromiseConstructor;

View File

@@ -1,12 +0,0 @@
interface Symbol {
toString(): string;
valueOf(): Object;
}
interface SymbolConstructor {
prototype: Symbol;
(description?: string | number): symbol;
iterator: symbol;
}
declare var Symbol: SymbolConstructor;

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,201 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
interface Event {
bubbles: boolean;
cancelBubble: boolean;
cancelable: boolean;
currentTarget: EventTarget;
defaultPrevented: boolean;
eventPhase: number;
isTrusted: boolean;
returnValue: boolean;
srcElement: any /* Element */;
target: EventTarget;
timeStamp: number;
type: string;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
AT_TARGET: number;
BUBBLING_PHASE: number;
CAPTURING_PHASE: number;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
}
interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
total?: number;
}
interface ProgressEvent extends Event {
lengthComputable: boolean;
loaded: number;
total: number;
initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;
}
declare var ProgressEvent: {
prototype: ProgressEvent;
new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
}
interface ErrorEvent extends Event {
colno: number;
error: any;
filename: string;
lineno: number;
message: string;
initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;
}
declare var ErrorEvent: {
prototype: ErrorEvent;
new(): ErrorEvent;
}
interface EventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
dispatchEvent(evt: Event): boolean;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var EventTarget: {
prototype: EventTarget;
new(): EventTarget;
}
interface EventListenerObject {
handleEvent(evt: Event): void;
}
interface EventListener {
(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface XMLHttpRequestEventTarget {
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
onload: (ev: Event) => any;
onloadend: (ev: ProgressEvent) => any;
onloadstart: (ev: Event) => any;
onprogress: (ev: ProgressEvent) => any;
ontimeout: (ev: ProgressEvent) => any;
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
msCaching: string;
onreadystatechange: (ev: ProgressEvent) => any;
readyState: number;
response: any;
responseBody: any;
responseText: string;
responseType: string;
responseXML: any;
status: number;
statusText: string;
timeout: number;
upload: XMLHttpRequestUpload;
withCredentials: boolean;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string;
msCachingEnabled(): boolean;
open(method: string, url: string, async?: boolean, user?: string, password?: string): void;
overrideMimeType(mime: string): void;
// send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
LOADING: number;
OPENED: number;
UNSENT: number;
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLHttpRequest: {
prototype: XMLHttpRequest;
new(): XMLHttpRequest;
DONE: number;
HEADERS_RECEIVED: number;
LOADING: number;
OPENED: number;
UNSENT: number;
create(): XMLHttpRequest;
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLHttpRequestUpload: {
prototype: XMLHttpRequestUpload;
new(): XMLHttpRequestUpload;
}
interface FormData {
append(name: any, value: any, blobName?: string): void;
}
declare var FormData: {
prototype: FormData;
new (/* form?: HTMLFormElement */): FormData;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
}
interface Blob {
size: number;
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;
}
declare function alert(message?: any): void;

View File

@@ -1,6 +1,2 @@
/// <reference path="module.d.ts" />
/// <reference path="es-collections.d.ts" />
/// <reference path="es6-promise.d.ts" />
/// <reference path="es6.d.ts" />
/// <reference path="weakmap.d.ts" />
/// <reference path="tns-core-modules.base.d.ts" />

View File

@@ -1,6 +1,4 @@
/// <reference path="./tns-core-modules.base.d.ts" />
/// <reference path="./webworker.es2016.d.ts" />
/// <reference path="./module.d.ts" />
/// <reference path="./lib.dom.d.ts" />
// Use this .d.ts with TypeScript 2+ and compiler options "lib": ["es2016"]
// Use this .d.ts with TypeScript 2+ and compiler options "lib": ["es2016", "dom"]

View File

@@ -5,6 +5,7 @@
AnimationDefinition,
Pair
} from "ui/animation";
export { AnimationPromise } from "ui/animation";
import { View, Color, traceEnabled, traceWrite, traceCategories } from "ui/core/view";
@@ -43,14 +44,6 @@ export class CubicBezierAnimationCurve implements CubicBezierAnimationCurveDefin
}
}
// This is a BOGUS Class to make TypeScript happy - This is not needed other than to make TS happy.
// We didn't want to actually modify Promise; as the cancel() is ONLY valid for animations "Promise"
export class AnimationPromise implements AnimationPromiseDefinition {
public cancel(): void { /* Do Nothing */ }
public then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise { return new AnimationPromise(); }
public catch(onRejected?: (error?: any) => void): AnimationPromise { return new AnimationPromise(); }
}
export abstract class AnimationBase implements AnimationBaseDefinition {
public _propertyAnimations: Array<PropertyAnimation>;
public _playSequentially: boolean;
@@ -87,14 +80,14 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
abstract _resolveAnimationCurve(curve: any): any;
public play(): AnimationPromise {
public play(): AnimationPromiseDefinition {
if (this.isPlaying) {
throw new Error("Animation is already playing.");
}
// We have to actually create a "Promise" due to a bug in the v8 engine and decedent promises
// We just cast it to a animationPromise so that all the rest of the code works fine
var animationFinishedPromise = <AnimationPromise>new Promise<void>((resolve, reject) => {
var animationFinishedPromise = <AnimationPromiseDefinition>new Promise<void>((resolve, reject) => {
this._resolve = resolve;
this._reject = reject;
});
@@ -105,7 +98,7 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
return animationFinishedPromise;
}
private fixupAnimationPromise(promise: AnimationPromise): void {
private fixupAnimationPromise(promise: AnimationPromiseDefinition): void {
// Since we are using function() below because of arguments, TS won't automatically do a _this for those functions.
var _this = this;
promise.cancel = () => {
@@ -255,4 +248,4 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
curve: animation.curve
});
}
}
}

View File

@@ -80,17 +80,15 @@
y: number;
}
/**
* Create Promise that can cancel the animation, we have to pretend our returns itself along with the cancel
*/
export class AnimationPromise extends Promise<void> {
export interface Cancelable {
cancel(): void;
then(onFulfilled?: (value?: any) => PromiseLike<void>, onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise;
catch(onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
catch(onRejected?: (error?: any) => void): AnimationPromise;
}
/**
* A Promise that can cancel the animation.
*/
export type AnimationPromise = Promise<void> & Cancelable;
/**
* Defines a animation set.
*/
@@ -103,4 +101,4 @@
}
export function _resolveAnimationCurve(curve: any): any;
}
}

View File

@@ -409,14 +409,14 @@ class TouchGestureEventData implements TouchGestureEventData {
android: any = undefined;
action: string;
view: View;
ios: { touches: NSSet<any>, event: UIEvent };
ios: { touches: NSSet<any>, event: _UIEvent };
object: any;
private _activePointers: Array<Pointer>;
private _allPointers: Array<Pointer>;
private _mainPointer: UITouch;
public prepare(view: View, action: string, touches: NSSet<any>, event: UIEvent) {
public prepare(view: View, action: string, touches: NSSet<any>, event: _UIEvent) {
this.action = action;
this.view = view;
this.object = view;
@@ -473,4 +473,4 @@ class TouchGestureEventData implements TouchGestureEventData {
getY(): number {
return this.getMainPointer().locationInView(this.view._nativeView).y
}
}
}

View File

@@ -1,13 +0,0 @@
/* tslint:disable:no-unused-variable */
interface WeakMap<K, V> {
clear(): void;
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): WeakMap<K, V>;
}
declare var WeakMap: {
new <K, V>(): WeakMap<K, V>;
}

View File

@@ -1,88 +0,0 @@
/**
* Used to create, destroy and communicate with worker threads
*/
declare class Worker {
/**
* Creates a new worker with the given main script.
* @param script The first module to be loaded on the worker thread.
*/
public constructor(script: string);
/**
* Sends message to the worker thread.
* @param message The message to be serialized and sent to the worker thread.
*/
public postMessage(message: any) : void;
/**
* Terminates the execution the worker thread without calling `onclose` handler.
*/
public terminate() : void;
/**
* Called by the runtime when a new message is received by the worker instance.
*/
public onmessage : Worker.OnMessageHandler;
/**
* Called by the runtime when an uncaught error is propagated to the parent thread.
*/
public onerror : Worker.OnErrorHandler;
}
/**
* Exists only in worker context. Returns the worker global object.
*/
declare var self: any;
/**
* Exists only in worker context. It is called by the runtime when a new message is received by the worker thread.
*/
declare var onmessage : Worker.OnMessageHandler;
/**
* Exists only in worker context. Handles uncaught errors in the worker thread. If return false the error is propagated to the parent context and passed to Worker.onerror handler.
*/
declare var onerror : Worker.OnErrorHandler;
/**
* Exists only in worker context. Called before the worker is closed with the close() function.
*/
declare var onclose : Worker.OnCloseHandler;
/**
* Exists only in worker context. Sends message to the parent thread.
*/
declare function postMessage(message: any) : void;
/**
* Exists only in worker context. Closes the worker thread on the next run loop tick.
*/
declare function close() : void;
declare namespace Worker {
interface MessageEvent {
data: any;
}
interface ErrorEvent {
message: string;
filename: string;
lineno: number;
}
interface OnErrorHandler {
(error: ErrorEvent): boolean;
}
interface OnMessageHandler {
(message: MessageEvent): void;
}
interface OnCloseHandler {
(): void;
}
}

View File

@@ -1,14 +1,14 @@
interface AudioBuffer {
interface _AudioBuffer {
mNumberChannels: number;
mDataByteSize: number;
mData: interop.Pointer | interop.Reference<any>;
}
declare var AudioBuffer: interop.StructType<AudioBuffer>;
declare var _AudioBuffer: interop.StructType<_AudioBuffer>;
interface AudioBufferList {
mNumberBuffers: number;
mBuffers: interop.Reference<AudioBuffer>;
mBuffers: interop.Reference<any /*AudioBuffer*/>;
}
declare var AudioBufferList: interop.StructType<AudioBufferList>;

View File

@@ -1978,9 +1978,9 @@ declare class UIApplication extends UIResponder {
scheduleLocalNotification(notification: UILocalNotification): void;
sendActionToFromForEvent(action: string, target: any, sender: any, event: UIEvent): boolean;
sendActionToFromForEvent(action: string, target: any, sender: any, event: _UIEvent): boolean;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
setKeepAliveTimeoutHandler(timeout: number, keepAliveHandler: () => void): boolean;
@@ -4009,17 +4009,17 @@ declare class UIControl extends UIView {
addTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
beginTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
beginTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
cancelTrackingWithEvent(event: UIEvent): void;
cancelTrackingWithEvent(event: _UIEvent): void;
continueTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
continueTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
endTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): void;
endTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): void;
removeTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
sendActionToForEvent(action: string, target: any, event: UIEvent): void;
sendActionToForEvent(action: string, target: any, event: _UIEvent): void;
sendActionsForControlEvents(controlEvents: UIControlEvents): void;
}
@@ -4951,11 +4951,11 @@ declare function UIEdgeInsetsFromString(string: string): UIEdgeInsets;
declare var UIEdgeInsetsZero: UIEdgeInsets;
declare class UIEvent extends NSObject {
declare class _UIEvent extends NSObject {
static alloc(): UIEvent; // inherited from NSObject
static alloc(): _UIEvent; // inherited from NSObject
static new(): UIEvent; // inherited from NSObject
static new(): _UIEvent; // inherited from NSObject
readonly allTouches: NSSet<UITouch>;
@@ -5456,7 +5456,7 @@ declare class UIGestureRecognizer extends NSObject {
ignorePressForEvent(button: UIPress, event: UIPressesEvent): void;
ignoreTouchForEvent(touch: UITouch, event: UIEvent): void;
ignoreTouchForEvent(touch: UITouch, event: _UIEvent): void;
initWithTargetAction(target: any, action: string): this;
@@ -5482,15 +5482,15 @@ declare class UIGestureRecognizer extends NSObject {
shouldRequireFailureOfGestureRecognizer(otherGestureRecognizer: UIGestureRecognizer): boolean;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
}
interface UIGestureRecognizerDelegate extends NSObjectProtocol {
@@ -6266,7 +6266,7 @@ declare class UIInputViewController extends UIViewController implements UITextIn
dismissKeyboard(): void;
handleInputModeListFromViewWithEvent(view: UIView, event: UIEvent): void;
handleInputModeListFromViewWithEvent(view: UIView, event: _UIEvent): void;
isEqual(object: any): boolean;
@@ -8072,7 +8072,7 @@ declare const enum UIPressType {
PlayPause = 6
}
declare class UIPressesEvent extends UIEvent {
declare class UIPressesEvent extends _UIEvent {
static alloc(): UIPressesEvent; // inherited from NSObject
@@ -8845,11 +8845,11 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
makeTextWritingDirectionRightToLeft(sender: any): void;
motionBeganWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionBeganWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
paste(sender: any): void;
@@ -8869,7 +8869,7 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
reloadInputViews(): void;
remoteControlReceivedWithEvent(event: UIEvent): void;
remoteControlReceivedWithEvent(event: _UIEvent): void;
resignFirstResponder(): boolean;
@@ -8893,15 +8893,15 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
toggleUnderline(sender: any): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
updateUserActivityState(activity: NSUserActivity): void;
}
@@ -9199,7 +9199,7 @@ declare class UIScrollView extends UIView implements NSCoding {
setZoomScaleAnimated(scale: number, animated: boolean): void;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: UIEvent, view: UIView): boolean;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: _UIEvent, view: UIView): boolean;
touchesShouldCancelInContentView(view: UIView): boolean;
@@ -13113,7 +13113,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): boolean;
hitTestWithEvent(point: CGPoint, event: UIEvent): UIView;
hitTestWithEvent(point: CGPoint, event: _UIEvent): UIView;
initWithCoder(aDecoder: NSCoder): this;
@@ -13153,7 +13153,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
pointInsideWithEvent(point: CGPoint, event: UIEvent): boolean;
pointInsideWithEvent(point: CGPoint, event: _UIEvent): boolean;
removeConstraint(constraint: NSLayoutConstraint): void;
@@ -14354,7 +14354,7 @@ declare class UIWindow extends UIView {
resignKeyWindow(): void;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
}
declare var UIWindowDidBecomeHiddenNotification: string;

View File

@@ -13,7 +13,7 @@
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
"es2016", "dom"
]
},
"include": [

View File

@@ -11,7 +11,10 @@
"experimentalDecorators": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder"
"reactNamespace": "UIBuilder",
"lib": [
"es6", "dom"
]
},
"include": [
"bin/dist/tns-core-modules/tns-core-modules.d.ts"

View File

@@ -14,7 +14,7 @@
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
"es6", "dom"
]
},
"exclude": [

View File

@@ -12,7 +12,7 @@
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
"es2016", "dom"
]
},
"include": [