This commit is contained in:
emmanuel
2015-11-20 11:08:25 +01:00
52 changed files with 3621 additions and 474 deletions
+23 -15
View File
@@ -8,25 +8,27 @@ app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IH
error: 4000
};
growlProvider.globalTimeToLive(ttl);
growlProvider.globalTimeToLive(5000);
growlProvider.globalDisableCloseButton(true);
growlProvider.globalDisableIcons(true);
growlProvider.globalReversedOrder(false);
growlProvider.globalDisableCountDown(true);
growlProvider.messageVariableKey("someKey");
growlProvider.globalInlineMessages(false);
growlProvider.globalPosition("top-center");
growlProvider.messagesKey("someKey");
growlProvider.messageTextKey("someKey");
growlProvider.messageTitleKey("someKey");
growlProvider.messageSeverityKey("someKey");
growlProvider.onlyUniqueMessages(false);
growlProvider.globalTimeToLive(ttl)
.globalTimeToLive(5000)
.globalDisableCloseButton(true)
.globalDisableIcons(true)
.globalReversedOrder(false)
.globalDisableCountDown(true)
.messageVariableKey("someKey")
.globalInlineMessages(false)
.globalPosition("top-center")
.messagesKey("someKey")
.messageTextKey("someKey")
.messageTitleKey("someKey")
.messageSeverityKey("someKey")
.onlyUniqueMessages(false);
$httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor);
});
app.controller("Ctrl", ($scope:angular.IScope, growl:angular.growl.IGrowlService) => {
app.controller("Ctrl", ($scope:angular.IScope,
growl:angular.growl.IGrowlService,
growlMessages:angular.growl.IGrowlMessagesService) => {
var config:angular.growl.IGrowlMessageConfig = {
ttl: 5000,
disableCountDown: true,
@@ -50,4 +52,10 @@ app.controller("Ctrl", ($scope:angular.IScope, growl:angular.growl.IGrowlService
growl.reverseOrder();
growl.inlineMessages();
growl.position();
growlMessages.initDirective(1, 10);
var messages:angular.growl.IGrowlMessage[] = growlMessages.getAllMessages(2);
growlMessages.destroyAllMessages(0);
growlMessages.addMessage(messages[0]);
growlMessages.deleteMessage(messages[1]);
});
+50 -15
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Growl 2 v.0.7.3
// Type definitions for Angular Growl 2 v.0.7.5
// Project: http://janstevens.github.io/angular-growl-2
// Definitions by: Tadeusz Hucal <https://github.com/mkp05>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -54,73 +54,73 @@ declare module angular.growl {
* Set default TTL settings.
* @param ttl configuration of TTL for different type of message
*/
globalTimeToLive(ttl: IGrowlTTLConfig): void;
globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider;
/**
* Set default TTL settings.
* @param ttl ttl in milliseconds
*/
globalTimeToLive(ttl: number): void;
globalTimeToLive(ttl: number): IGrowlProvider;
/**
* Set default setting for disabling close button.
* @param disableCloseButton
*/
globalDisableCloseButton(disableCloseButton: boolean): void;
globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider;
/**
* Set default setting for disabling icons.
* @param disableIcons
*/
globalDisableIcons(disableIcons: boolean): void;
globalDisableIcons(disableIcons: boolean): IGrowlProvider;
/**
* Set reversing order of displaying new messages.
* @param reverseOrder
*/
globalReversedOrder(reverseOrder: boolean): void
globalReversedOrder(reverseOrder: boolean): IGrowlProvider;
/**
* Set default setting for displaying message disappear countdown.
* @param disableCountDown
*/
globalDisableCountDown(disableCountDown: boolean): void;
globalDisableCountDown(disableCountDown: boolean): IGrowlProvider;
/**
* Set default allowance for inline messages.
* @param inline
*/
globalInlineMessages(inline: boolean): void;
globalInlineMessages(inline: boolean): IGrowlProvider;
/**
* Set default message position.
* @param position
*/
globalPosition(position: string): void;
globalPosition(position: string): IGrowlProvider;
/**
* Enable/disable displaying only unique messages.
* @param onlyUniqueMessages
*/
onlyUniqueMessages(onlyUniqueMessages: boolean): void;
onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider;
/**
* Set key where messages are stored (for http interceptor).
* @param messageVariableKey
*/
messagesKey(messageKey: string): void;
messagesKey(messageKey: string): IGrowlProvider;
/**
* Set key where message text is stored (for http interceptor).
* @param messageVariableKey
*/
messageTextKey(messageTextKey: string): void;
messageTextKey(messageTextKey: string): IGrowlProvider;
/**
* Set key where title of message is stored (for http interceptor).
* @param messageVariableKey
*/
messageTitleKey(messageTitleKey: string): void;
messageTitleKey(messageTitleKey: string): IGrowlProvider;
/**
* Set key where severity of message is stored (for http interceptor).
* @param messageVariableKey
*/
messageSeverityKey(messageSeverityKey: string): void;
messageSeverityKey(messageSeverityKey: string): IGrowlProvider;
/**
* Set key where variables for message are stored (for http interceptor).
* @param messageVariableKey
*/
messageVariableKey(messageVariableKey: string): void;
messageVariableKey(messageVariableKey: string): IGrowlProvider;
}
/**
@@ -211,4 +211,39 @@ declare module angular.growl {
*/
position(): string;
}
/**
* GrowlMessages service.
*/
interface IGrowlMessagesService {
/**
* Initialize a directive
* We look at the preloaded directive and use this else we
* create a new blank object
* @param referenceId
* @param limitMessages
*/
initDirective(referenceId: number, limitMessages: number): ng.IDirective;
/**
* Get current messages
*/
getAllMessages(referenceId?: number): IGrowlMessage[];
/**
* Destroy all messages
*/
destroyAllMessages(referenceId?: number): void;
/**
* Add a message
*/
addMessage(message: IGrowlMessage): IGrowlMessage;
/**
* Delete a message
*/
deleteMessage(message: IGrowlMessage): void;
}
}
+8 -2
View File
@@ -44,10 +44,16 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
});
};
$scope['alertDialog'] = () => {
$mdDialog.show($mdDialog.alert().content('Alert!'));
$mdDialog.show($mdDialog.alert().textContent('Alert!'));
};
$scope['alertDialog'] = () => {
$mdDialog.show($mdDialog.alert().htmlContent('<span>Alert!</span>'));
};
$scope['confirmDialog'] = () => {
$mdDialog.show($mdDialog.confirm().content('Confirm!'));
$mdDialog.show($mdDialog.confirm().textContent('Confirm!'));
};
$scope['confirmDialog'] = () => {
$mdDialog.show($mdDialog.confirm().htmlContent('<span>Confirm!</span>'));
};
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
+2 -1
View File
@@ -28,7 +28,8 @@ declare module angular.material {
interface IPresetDialog<T> {
title(title: string): T;
content(content: string): T;
textContent(textContent: string): T;
htmlContent(htmlContent: string): T;
ok(ok: string): T;
theme(theme: string): T;
templateUrl(templateUrl?: string): T;
+306
View File
@@ -0,0 +1,306 @@
/// <reference path="argparse.d.ts" />
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
import {ArgumentParser, RawDescriptionHelpFormatter} from 'argparse';
var args: any;
var simpleExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse example',
});
simpleExample.addArgument(
['-f', '--foo'],
{
help: 'foo bar',
}
);
simpleExample.addArgument(
['-b', '--bar'],
{
help: 'bar foo',
}
);
simpleExample.printHelp();
console.log('-----------');
args = simpleExample.parseArgs('-f 1 -b2'.split(' '));
console.dir(args);
console.log('-----------');
args = simpleExample.parseArgs('-f=3 --bar=4'.split(' '));
console.dir(args);
console.log('-----------');
args = simpleExample.parseArgs('--foo 5 --bar 6'.split(' '));
console.dir(args);
console.log('-----------');
var choicesExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: choice'
});
choicesExample.addArgument(['foo'], { choices: 'abc' });
choicesExample.printHelp();
console.log('-----------');
args = choicesExample.parseArgs(['c']);
console.dir(args);
console.log('-----------');
// choicesExample.parseArgs(['X']);
// console.dir(args);
var constantExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: constant'
});
constantExample.addArgument(
['-a'],
{
action: 'storeConst',
dest: 'answer',
help: 'store constant',
constant: 42
}
);
constantExample.addArgument(
['--str'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "str" to types',
constant: 'str'
}
);
constantExample.addArgument(
['--int'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "int" to types',
constant: 'int'
}
);
constantExample.addArgument(
['--true'],
{
action: 'storeTrue',
help: 'store true constant'
}
);
constantExample.addArgument(
['--false'],
{
action: 'storeFalse',
help: 'store false constant'
}
);
constantExample.printHelp();
console.log('-----------');
args = constantExample.parseArgs('-a --str --int --true'.split(' '));
console.dir(args);
var nargsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: nargs'
});
nargsExample.addArgument(
['-f', '--foo'],
{
help: 'foo bar',
nargs: 1
}
);
nargsExample.addArgument(
['-b', '--bar'],
{
help: 'bar foo',
nargs: '*'
}
);
nargsExample.printHelp();
console.log('-----------');
args = nargsExample.parseArgs('--foo a --bar c d'.split(' '));
console.dir(args);
console.log('-----------');
args = nargsExample.parseArgs('--bar b c f --foo a'.split(' '));
console.dir(args);
var parent_parser = new ArgumentParser({ addHelp: false });
// note addHelp:false to prevent duplication of the -h option
parent_parser.addArgument(
['--parent'],
{ type: 'int', help: 'parent' }
);
var foo_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child1'
});
foo_parser.addArgument(['foo']);
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
console.log(args);
var bar_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child2'
});
bar_parser.addArgument(['--bar']);
args = bar_parser.parseArgs(['--bar', 'YYY']);
console.log(args);
var prefixCharsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: prefix_chars',
prefixChars: '-+'
});
prefixCharsExample.addArgument(['+f', '++foo']);
prefixCharsExample.addArgument(['++bar'], { action: 'storeTrue' });
prefixCharsExample.printHelp();
console.log('-----------');
args = prefixCharsExample.parseArgs(['+f', '1']);
console.dir(args);
args = prefixCharsExample.parseArgs(['++bar']);
console.dir(args);
args = prefixCharsExample.parseArgs(['++foo', '2', '++bar']);
console.dir(args);
var subparserExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: sub-commands'
});
var subparsers = subparserExample.addSubparsers({
title: 'subcommands',
dest: "subcommand_name"
});
var bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
bar.addArgument(
['-f', '--foo'],
{
action: 'store',
help: 'foo3 bar3'
}
);
var bar = subparsers.addParser(
'c2',
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
);
bar.addArgument(
['-b', '--bar'],
{
action: 'store',
type: 'int',
help: 'foo3 bar3'
}
);
subparserExample.printHelp();
console.log('-----------');
args = subparserExample.parseArgs('c1 -f 2'.split(' '));
console.dir(args);
console.log('-----------');
args = subparserExample.parseArgs('c2 -b 1'.split(' '));
console.dir(args);
console.log('-----------');
args = subparserExample.parseArgs('co -b 1'.split(' '));
console.dir(args);
console.log('-----------');
subparserExample.parseArgs(['c1', '-h']);
var functionExample = new ArgumentParser({ description: 'Process some integers.' });
function sum(arr: number[]) {
return arr.reduce(function(a, b) {
return a + b;
}, 0);
}
function max(arr: number[]) {
return Math.max.apply(Math, arr);
}
functionExample.addArgument(['integers'], {
metavar: 'N',
type: 'int',
nargs: '+',
help: 'an integer for the accumulator'
});
functionExample.addArgument(['--sum'], {
dest: 'accumulate',
action: 'storeConst',
constant: sum,
defaultValue: max,
help: 'sum the integers (default: find the max)'
});
args = functionExample.parseArgs('--sum 1 2 -1'.split(' '));
console.log(args.accumulate(args.integers));
var formatterExample = new ArgumentParser({
prog: 'PROG',
formatterClass: RawDescriptionHelpFormatter,
description: 'Keep the formatting\n' +
' exactly as it is written\n' +
'\n' +
'here\n'
});
formatterExample.addArgument(['--foo'], {
help: ' foo help should not\n' +
' retain this odd formatting'
});
formatterExample.addArgument(['spam'], {
'help': 'spam help'
});
var group = formatterExample.addArgumentGroup({
title: 'title',
description: ' This text\n' +
' should be indented\n' +
' exactly like it is here\n'
});
group.addArgument(['--bar'], {
help: 'bar help'
});
formatterExample.printHelp();
+90
View File
@@ -0,0 +1,90 @@
// Type definitions for argparse v1.0.3
// Project: https://github.com/nodeca/argparse
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "argparse" {
export class ArgumentParser extends ArgumentGroup {
constructor(options? : ArgumentParserOptions);
addSubparsers(options? : SubparserOptions) : SubParser;
parseArgs(args? : string[], ns? : Namespace|Object) : any;
printUsage() : void;
printHelp() : void;
formatUsage() : string;
formatHelp() : string;
parseKnownArgs(args? : string[], ns? : Namespace|Object) : any[];
convertArgLineToArg(argLine : string) : string[];
exit(status : number, message : string) : void;
error(err : string|Error) : void;
}
interface Namespace {}
class SubParser {
addParser(name : string, options? : SubArgumentParserOptions) : ArgumentParser;
}
class ArgumentGroup {
addArgument(args : string[], options? : ArgumentOptions) : void;
addArgumentGroup(options? : ArgumentGroupOptions) : ArgumentGroup;
addMutuallyExclusiveGroup(options? : {required : boolean}) : ArgumentGroup;
setDefaults(options? : {}) : void;
getDefault(dest : string) : any;
}
interface SubparserOptions {
title? : string;
description? : string;
prog? : string;
parserClass? : {new() : any};
action? : string;
dest? : string;
help? : string;
metavar? : string;
}
interface SubArgumentParserOptions extends ArgumentParserOptions {
aliases? : string[];
help? : string;
}
interface ArgumentParserOptions {
description? : string;
epilog? : string;
addHelp? : boolean;
argumentDefault? : any;
parents? : ArgumentParser[];
prefixChars? : string;
formatterClass? : {new() : HelpFormatter|ArgumentDefaultsHelpFormatter|RawDescriptionHelpFormatter|RawTextHelpFormatter};
prog? : string;
usage? : string;
version? : string;
}
interface ArgumentGroupOptions {
prefixChars? : string;
argumentDefault? : any;
title? : string;
description? : string;
}
export class HelpFormatter {}
export class ArgumentDefaultsHelpFormatter {}
export class RawDescriptionHelpFormatter {}
export class RawTextHelpFormatter {}
interface ArgumentOptions {
action? : string;
optionStrings? : string[];
dest? : string;
nargs? : string|number;
constant? : any;
defaultValue? : any;
type? : string|Function;
choices? : string|string[];
required? : boolean;
help? : string;
metavar? : string;
}
}
+61
View File
@@ -0,0 +1,61 @@
/// <reference path="boolify-string.d.ts" />
import boolifyString = require('boolify-string');
console.log(boolifyString('true')); // #=> true
console.log(boolifyString('TRUE')); // #=> true
console.log(boolifyString('True')); // #=> true
console.log(boolifyString('false')); // #=> false
console.log(boolifyString('{}')); // #=> true
console.log(boolifyString('foo')); // #=> true
console.log(boolifyString('')); // #=> false
console.log(boolifyString('1')); // #=> true
console.log(boolifyString('-1')); // #=> true
console.log(boolifyString('0')); // #=> false
console.log(boolifyString('[]')); // #=> true
console.log(boolifyString('undefined')); // #=> false
console.log(boolifyString('null')); // #=> false
// primitive values as is
console.log(boolifyString(true)); // #=> true
console.log(boolifyString(false)); // #=> false
console.log(boolifyString({})); // #=> true
console.log(boolifyString(1)); // #=> true
console.log(boolifyString(-1)); // #=> true
console.log(boolifyString(0)); // #=> false
console.log(boolifyString([])); // #=> true
console.log(boolifyString(undefined)); // #=> false
console.log(boolifyString(null)); // #=> false
// string constructor
console.log(boolifyString(new String('true'))); // #=> true
console.log(boolifyString(new String('false'))); // #=> false
// YAML's specification
// http://yaml.org/type/bool.html
// y|Y|yes|Yes|YES|n|N|no|No|NO
// |true|True|TRUE|false|False|FALSE
// |on|On|ON|off|Off|OFF
console.log(boolifyString('y')); // #=> true
console.log(boolifyString('Y')); // #=> true
console.log(boolifyString('yes')); // #=> true
console.log(boolifyString('Yes')); // #=> true
console.log(boolifyString('YES')); // #=> true
console.log(boolifyString('n')); // #=> false
console.log(boolifyString('N')); // #=> false
console.log(boolifyString('no')); // #=> false
console.log(boolifyString('No')); // #=> false
console.log(boolifyString('NO')); // #=> false
console.log(boolifyString('true')); // #=> true
console.log(boolifyString('True')); // #=> true
console.log(boolifyString('TRUE')); // #=> true
console.log(boolifyString('false')); // #=> false
console.log(boolifyString('False')); // #=> false
console.log(boolifyString('FALSE')); // #=> false
console.log(boolifyString('on')); // #=> true
console.log(boolifyString('On')); // #=> true
console.log(boolifyString('ON')); // #=> true
console.log(boolifyString('off')); // #=> false
console.log(boolifyString('Off')); // #=> false
console.log(boolifyString('OFF')); // #=> false
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for boolify-string
// Project: https://github.com/sanemat/node-boolify-string
// Definitions by: Tobias Henöckl <http://www.sisyphus.de/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "boolify-string" {
function boolifyString(obj: any): boolean;
export = boolifyString;
}
Vendored
+4
View File
@@ -1067,3 +1067,7 @@ declare module c3 {
export function generate(config: ChartConfiguration): ChartAPI;
}
declare module "c3" {
export = c3;
}
+2
View File
@@ -35,3 +35,5 @@ b = changeCase.isLower(s);
b = changeCase.isLowerCase(s);
s = changeCase.ucFirst(s);
s = changeCase.upperCaseFirst(s);
s = changeCase.lcFirst(s);
s = changeCase.lowerCaseFirst(s);
+2
View File
@@ -34,4 +34,6 @@ declare module "change-case" {
function isLowerCase(s: string): boolean;
function ucFirst(s: string): string;
function upperCaseFirst(s: string): string;
function lcFirst(s: string): string;
function lowerCaseFirst(s: string): string;
}
+22 -14
View File
@@ -74,6 +74,7 @@ declare module CKEDITOR {
function appendTo(element: string, config?: config, data?: string): editor;
function appendTo(element: HTMLTextAreaElement, config?: config, data?: string): editor;
function domReady(): void;
function dialogCommand(dialogName: string): void;
function editorConfig(config: config): void;
function getCss(): string;
function getTemplate(name: string): template;
@@ -556,29 +557,33 @@ declare module CKEDITOR {
groups?: string[];
}
// Currently very incomplete. See here for all options that should be included:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fileTools_defaultFileName
interface config {
allowedContent?: string | boolean;
colorButton_enableMore?: boolean;
colorButton_colors?: string;
contentsCss?: string | string[];
customConfig?: string;
extraPlugins?: string;
font_names?: string;
font_defaultLabel?: string;
fontSize_sizes?: string;
fontSize_defaultLabel?: string;
height?: string | number;
language?: string;
on?: any;
plugins?: string;
startupFocus?: boolean;
startupMode?: string;
removeButtons?: string;
removePlugins?: string;
toolbar?: any;
toolbarGroups?: toolbarGroups[];
skin?: string;
language?: string;
plugins?: string;
font_names?: string;
font_defaultLabel?: string;
fontSize_sizes?: string;
fontSize_defaultLabel?: string;
colorButton_enableMore?: boolean;
colorButton_colors?: string;
startupFocus?: boolean;
on?: any;
extraPlugins?: string;
height?: string | number;
toolbarLocation?: string;
readOnly?: boolean;
customConfig?: string;
skin?: string;
width?: string | number;
}
@@ -745,6 +750,7 @@ declare module CKEDITOR {
beforeInit?(editor: editor): any;
init?(editor: editor): any;
onLoad?(): any;
icons?: string;
}
function add(name: string, definition?: IPluginDefinition): void;
@@ -933,6 +939,8 @@ declare module CKEDITOR {
interface button extends uiElement {
disabled?: boolean;
label?: string;
command?: string;
toolbar?: string;
}
+6 -5
View File
@@ -3,13 +3,14 @@
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../q/Q.d.ts" />
interface Cordova {
getAppVersion: {
getAppName: () => Q.IPromise<string>;
getPackageName: () => Q.IPromise<string>;
getVersionCode: () => Q.IPromise<string>;
getVersionNumber: () => Q.IPromise<string>;
getAppVersion: {
getAppName: () => Q.IPromise<string> | JQueryPromise<string>;
getPackageName: () => Q.IPromise<string> | JQueryPromise<string>;
getVersionCode: () => Q.IPromise<string> | JQueryPromise<string>;
getVersionNumber: () => Q.IPromise<string> | JQueryPromise<string>;
};
}
+4
View File
@@ -0,0 +1,4 @@
/// <reference path="form-serializer.d.ts" />
$("#form").serializeObject();
$("#form").serializeJSON();
+42
View File
@@ -0,0 +1,42 @@
// Type definitions for jquery.serialize-object 2.5.0
// Project: https://github.com/macek/jquery-serialize-object
// Definitions by: Florian Wagner <https://github.com/flqw>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare module FormSerializer {
interface FormSerializerPatterns {
validate: RegExp;
key: RegExp;
push: RegExp;
fixed: RegExp;
named: RegExp;
}
export var patterns: FormSerializerPatterns;
}
declare module "jquery-serialize-object" {
export = FormSerializer;
}
declare module "form-serializer" {
export = FormSerializer;
}
interface JQuery {
/**
* Serializes the selected form into a JavaScript object.
*/
serializeObject(): Object;
/**
* Serializes the selected form into JSON.
*/
serializeJSON(): string;
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for gulp-csso v5.0.1
// Type definitions for gulp-rev v5.0.1
// Project: https://github.com/sindresorhus/gulp-rev
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="highcharts.d.ts" />
/// <reference path="highcharts.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
function originalTests() {
-2
View File
@@ -3,8 +3,6 @@
// Definitions by: Damiano Gambarotto <http://github.com/damianog>, Dan Lewi Harkestad <http://github.com/baltie>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../jquery/jquery.d.ts' />
interface HighchartsPosition {
align?: string;
verticalAlign?: string;
+3 -3
View File
@@ -1,4 +1,5 @@
/// <reference path="highstock.d.ts" />
/// <reference path="highstock.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
@@ -46,7 +47,7 @@ $(function () {
inputBoxHeight: 18,
inputStyle: {
color: '#039',
fontWeight: 'bold'
fontWeight: 'bold'
},
labelStyle: {
color: 'silver',
@@ -61,4 +62,3 @@ $(function () {
}]
});
});
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Highstock 2.1.5
// Type definitions for Highstock 2.1.5
// Project: http://www.highcharts.com/
// Definitions by: David Deutsch <http://github.com/DavidKDeutsch>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+54
View File
@@ -0,0 +1,54 @@
/// <reference path="intro.js.d.ts" />
var intro = introJs();
intro.setOption('doneLabel', 'Next page');
intro.setOptions({
steps: [
{
intro: "Hello world!"
},
{
element: document.querySelector('#step1'),
intro : "This is a tooltip."
},
{
element : document.querySelectorAll('#step2')[0],
intro : "Ok, wasn't that fun?",
position: 'right'
},
{
element : '#step3',
intro : 'More features, more fun.',
position: 'left'
},
{
element : '#step4',
intro : "Another step.",
position: 'bottom'
},
{
element: '#step5',
intro : 'Get it, use it.'
}
]
});
intro.start()
.nextStep()
.previousStep()
.goToStep(2)
.exit()
.refresh()
.onbeforechange(function (element) {
element.getAttribute('class');
})
.onafterchange(function (element) {
element.getAttribute('class');
})
.onchange(function () {
alert('Changed');
})
.oncomplete(function () {
alert('Done');
});
+70
View File
@@ -0,0 +1,70 @@
// Type definitions for intro.js 1.0.0
// Project: https://github.com/usablica/intro.js
// Definitions by: Maxime Fabre <https://github.com/anahkiasen/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module IntroJs {
enum Positions {
top,
left,
right,
bottom
}
interface Step {
intro: string;
element?: string|HTMLElement;
position?: Positions;
}
interface Options {
nextLabel?: string;
prevLabel?: string;
skipLabel?: string;
doneLabel?: string;
tooltipPosition?: string;
tooltipClass?: string;
highlightClass?: string;
exitOnEsc?: boolean;
exitOnOverlayClick?: boolean;
showStepNumbers?: boolean;
keyboardNavigation?: boolean;
showButtons?: boolean;
showBullets?: boolean;
showProgress?: boolean;
scrollToElement?: boolean;
overlayOpacity?: number;
positionPrecedence?: string[];
disableInteraction?: boolean;
steps: Step[];
}
interface IntroJs {
start(): IntroJs;
exit(): IntroJs;
goToStep(step: number): IntroJs;
nextStep(): IntroJs;
previousStep(): IntroJs;
refresh(): IntroJs;
setOption(option: string, value: string|number): IntroJs;
setOptions(options: Options): IntroJs;
onexit(callback: Function): IntroJs;
onbeforechange(callback: (element: HTMLElement) => any): IntroJs;
onafterchange(callback: (element: HTMLElement) => any): IntroJs;
onchange(callback: Function): IntroJs;
oncomplete(callback: Function): IntroJs;
}
interface Factory {
(element?: string): IntroJs;
}
}
declare var introJs: IntroJs.Factory;
declare module 'intro.js' {
export = IntroJs;
}
+20
View File
@@ -580,3 +580,23 @@ customActionResourceInstance.DSLoadRelations('myRelation');
customActionResourceInstance.DSRefresh();
customActionResourceInstance.DSSave();
customActionResourceInstance.DSUpdate();
/**
* Events
*/
function myEvtHandler(definition:JSData.DSResourceDefinition<Resource>, item:Resource) {
}
store.on("DS.change", myEvtHandler);
store.off("DS.change", myEvtHandler);
store.emit("DS.change", customActionResource, customActionResourceInstance);
customActionResource.on("DS.change", myEvtHandler);
customActionResource.off("DS.change", myEvtHandler);
customActionResource.emit("DS.change", customActionResource, customActionResourceInstance);
customActionResourceInstance.on("DS.change", myEvtHandler);
customActionResourceInstance.off("DS.change", myEvtHandler);
customActionResourceInstance.emit("DS.change", customActionResource, customActionResourceInstance);
+9 -3
View File
@@ -105,7 +105,13 @@ declare module JSData {
resourceName:string;
}
interface DS {
interface DSEvents {
on(name:string, handler:(...args:any[])=>void):void;
off(name:string, handler:(...args:any[])=>void):void;
emit(name:string, ...args:any[]):void;
}
interface DS extends DSEvents {
new(config?:DSConfiguration):DS;
// rather undocumented
@@ -155,7 +161,7 @@ declare module JSData {
registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void;
}
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration {
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration, DSEvents {
changeHistory(id:string | number):Array<Object>;
changes(id:string | number, options?:{ignoredChanges:Array<string|RegExp>}):Object;
clear():Array<T & DSInstanceShorthands<T>>;
@@ -191,7 +197,7 @@ declare module JSData {
}
// cannot specify T at interface level because the interface is used as generic constraint itself which ends up being recursive
export interface DSInstanceShorthands<T> {
export interface DSInstanceShorthands<T> extends DSEvents {
DSCompute():void;
DSRefresh(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
DSSave(options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
+29
View File
@@ -0,0 +1,29 @@
/// <reference path="line-reader.d.ts" />
import lineReader = require('line-reader');
lineReader.open('line-reader-tests.ts', function(err: Error, reader: LineReader) {
if (err) throw err;
if (reader.hasNextLine()) {
try {
reader.nextLine(function(err: Error, line: string) {
if (err) throw err;
console.log(line);
});
} finally {
reader.close(function(err: Error) {
if (err) throw err;
})
}
}
else {
reader.close(function(err: Error) {
if (err) throw err;
});
}
});
lineReader.eachLine('line-reader.d.ts', {encoding: 'utf8'}, function(line: string, last: boolean) {
console.log(line);
if (last) console.log('<EOF>');
});
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for line-reader
// Project: https://github.com/nickewing/line-reader
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface LineReaderOptions {
separator?: any;
encoding?: string;
bufferSize?: number;
}
interface LineReader {
eachLine(): Function; // For Promise.promisify;
open(): Function;
eachLine(file: string, cb: (line: string, last?: boolean, cb?: Function) => void): LineReader;
eachLine(file: string, options: LineReaderOptions, cb: (line: string, last?: boolean, cb?: Function) => void): LineReader;
open(file: string, cb: (err: Error, reader: LineReader) => void): void;
open(file: string, options: LineReaderOptions, cb: (err: Error, reader: LineReader) => void): void;
hasNextLine(): boolean;
nextLine(cb: (err: Error, line: string) => void): void;
close(cb: (err: Error) => void): void;
}
declare module "line-reader" {
var lr: LineReader;
export = lr;
}
+318 -94
View File
@@ -1575,25 +1575,44 @@ module TestWithout {
module TestXor {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult[];
result = _.xor<TResult>();
{
let result: TResult[];
result = _.xor<TResult>(array);
result = _.xor<TResult>(array, list);
result = _.xor<TResult>(array, list, array);
result = _.xor<TResult>();
result = _.xor<TResult>(list);
result = _.xor<TResult>(list, array);
result = _.xor<TResult>(list, array, list);
result = _.xor<TResult>(array);
result = _.xor<TResult>(array, list);
result = _.xor<TResult>(array, list, array);
result = _(array).xor().value();
result = _(array).xor(list).value();
result = _(array).xor(list, array).value();
result = _.xor<TResult>(list);
result = _.xor<TResult>(list, array);
result = _.xor<TResult>(list, array, list);
}
result = _(list).xor<TResult>().value();
result = _(list).xor<TResult>(array).value();
result = _(list).xor<TResult>(array, list).value();
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _(array).xor();
result = _(array).xor(list);
result = _(array).xor(list, array);
result = _(list).xor<TResult>();
result = _(list).xor<TResult>(array);
result = _(list).xor<TResult>(array, list);
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _(array).chain().xor();
result = _(array).chain().xor(list);
result = _(array).chain().xor(list, array);
result = _(list).chain().xor<TResult>();
result = _(list).chain().xor<TResult>(array);
result = _(list).chain().xor<TResult>(array, list);
}
}
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
@@ -4164,8 +4183,34 @@ module TestAfter {
}
// _.ary
result = <number[]>['6', '8', '10'].map(_.ary<(s: string) => number>(parseInt, 1));
result = <number[]>['6', '8', '10'].map(_(parseInt).ary<(s: string) => number>(1).value());
module TestAry {
type SampleFunc = (a: number, b: string) => boolean;
let func: SampleFunc;
{
let result: SampleFunc;
result = _.ary<SampleFunc>(func);
result = _.ary<SampleFunc>(func, 2);
result = _.ary<SampleFunc, SampleFunc>(func);
result = _.ary<SampleFunc, SampleFunc>(func, 2);
}
{
let result: _.LoDashImplicitObjectWrapper<SampleFunc>;
result = _(func).ary<SampleFunc>();
result = _(func).ary<SampleFunc>(2);
}
{
let result: _.LoDashExplicitObjectWrapper<SampleFunc>;
result = _(func).chain().ary<SampleFunc>();
result = _(func).chain().ary<SampleFunc>(2);
}
}
// _.backflow
module TestBackflow {
@@ -4371,9 +4416,36 @@ returnedThrottled(4);
result = <number>_.defer(function () { console.log('deferred'); });
result = <_.LoDashImplicitWrapper<number>>_(function () { console.log('deferred'); }).defer();
var log = _.bind(console.log, console);
result = <number>_.delay(log, 1000, 'logged later');
result = <_.LoDashImplicitWrapper<number>>_(log).delay(1000, 'logged later');
// _.delay
module TestDelay {
type SampleFunc = (a: number, b: string) => boolean;
let func: SampleFunc;
{
let result: number;
result = _.delay<SampleFunc>(func, 1);
result = _.delay<SampleFunc>(func, 1, 2);
result = _.delay<SampleFunc>(func, 1, 2, '');
}
{
let result: _.LoDashImplicitWrapper<number>;
result = _(func).delay(1);
result = _(func).delay(1, 2);
result = _(func).delay(1, 2, '');
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(func).chain().delay(1);
result = _(func).chain().delay(1, 2);
result = _(func).chain().delay(1, 2, '');
}
}
// _.flow
var testFlowSquareFn = (n: number) => n * n;
@@ -4718,10 +4790,24 @@ module TestEq {
}
// _.gt
result = <boolean>_.gt(1, 2);
result = <boolean>_(1).gt(2);
result = <boolean>_([]).gt(2);
result = <boolean>_({}).gt(2);
module TestGt {
{
let result: boolean;
result = _.gt(any, any);
result = _(1).gt(any);
result = _([]).gt(any);
result = _({}).gt(any);
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().gt(any);
result = _([]).chain().gt(any);
result = _({}).chain().gt(any);
}
}
// _.gte
module TestGte {
@@ -4985,7 +5071,6 @@ result = <boolean>_<any>([]).isUndefined();
result = <boolean>_({}).isUndefined();
// _.lt
module TestLt {
{
let result: boolean;
@@ -5006,10 +5091,24 @@ module TestLt {
}
// _.lte
result = <boolean>_.lte(1, 2);
result = <boolean>_(1).lte(2);
result = <boolean>_([]).lte(2);
result = <boolean>_({}).lte(2);
module TestLte {
{
let result: boolean;
result = _.lte(any, any);
result = _(1).lte(any);
result = _([]).lte(any);
result = _({}).lte(any);
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().lte(any);
result = _([]).chain().lte(any);
result = _({}).chain().lte(any);
}
}
// _.toArray
module TestToArray {
@@ -5972,13 +6071,48 @@ module TestForIn {
}
}
result = <Dog>_.forInRight(new Dog('Dagny'), function (value, key) {
console.log(key);
});
// _.forInRight
module TestForInRight {
type SampleObject = {a: number; b: string; c: boolean;};
result = <_.LoDashImplicitObjectWrapper<Dog>>_(new Dog('Dagny')).forInRight(function (value, key) {
console.log(key);
});
let dictionary: _.Dictionary<number>;
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => any;
let object: SampleObject;
let objectIterator: (element: any, key?: string, collection?: any) => any;
{
let result: _.Dictionary<number>;
result = _.forInRight<number>(dictionary);
result = _.forInRight<number>(dictionary, dictionaryIterator);
result = _.forInRight<number>(dictionary, dictionaryIterator, any);
}
{
let result: SampleObject;
result = _.forInRight<SampleObject>(object);
result = _.forInRight<SampleObject>(object, objectIterator);
result = _.forInRight<SampleObject>(object, objectIterator, any);
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).forInRight<number>();
result = _(dictionary).forInRight<number>(dictionaryIterator);
result = _(dictionary).forInRight<number>(dictionaryIterator, any);
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).chain().forInRight<number>();
result = _(dictionary).chain().forInRight<number>(dictionaryIterator);
result = _(dictionary).chain().forInRight<number>(dictionaryIterator, any);
}
}
// _.forOwn
module TestForOwn {
@@ -6023,20 +6157,49 @@ module TestForOwn {
}
}
interface ZeroOne {
0: string;
1: string;
one: string;
// _.forOwnRight
module TestForOwnRight {
type SampleObject = {a: number; b: string; c: boolean;};
let dictionary: _.Dictionary<number>;
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => any;
let object: SampleObject;
let objectIterator: (element: any, key?: string, collection?: any) => any;
{
let result: _.Dictionary<number>;
result = _.forOwnRight<number>(dictionary);
result = _.forOwnRight<number>(dictionary, dictionaryIterator);
result = _.forOwnRight<number>(dictionary, dictionaryIterator, any);
}
{
let result: SampleObject;
result = _.forOwnRight<SampleObject>(object);
result = _.forOwnRight<SampleObject>(object, objectIterator);
result = _.forOwnRight<SampleObject>(object, objectIterator, any);
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).forOwnRight<number>();
result = _(dictionary).forOwnRight<number>(dictionaryIterator);
result = _(dictionary).forOwnRight<number>(dictionaryIterator, any);
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).chain().forOwnRight<number>();
result = _(dictionary).chain().forOwnRight<number>(dictionaryIterator);
result = _(dictionary).chain().forOwnRight<number>(dictionaryIterator, any);
}
}
result = <any>_.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function (num, key) {
console.log(key);
});
result = <_.LoDashImplicitObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) {
console.log(key);
});
// _.functions
module TestFunctions {
type SampleObject = {a: number; b: string; c: boolean;};
@@ -6116,15 +6279,28 @@ module TestHas {
result = _({}).invert<TResult>(true).value();
}
class Stooge {
constructor(
public name: string,
public age: number
) { }
}
// _.keys
module TestKeys {
let object: _.Dictionary<any>;
result = <string[]>_.keys({ 'one': 1, 'two': 2, 'three': 3 });
result = <string[]>_({ 'one': 1, 'two': 2, 'three': 3 }).keys().value();
{
let result: string[];
result = _.keys(object);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _(object).keys();
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _(object).chain().keys();
}
}
result = <string[]>_.keysIn({ 'one': 1, 'two': 2, 'three': 3 });
result = <string[]>_({ 'one': 1, 'two': 2, 'three': 3 }).keysIn().value();
@@ -6138,43 +6314,80 @@ module TestMapKeys {
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => string;
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => string;
let result: _.Dictionary<TResult>;
{
let result: _.Dictionary<TResult>;
result = _.mapKeys<TResult, string>(array);
result = _.mapKeys<TResult, string>(array, listIterator);
result = _.mapKeys<TResult, string>(array, listIterator, any);
result = _.mapKeys<TResult>(array, '');
result = _.mapKeys<TResult, {}>(array, {});
result = _.mapKeys<TResult, string>(array);
result = _.mapKeys<TResult, string>(array, listIterator);
result = _.mapKeys<TResult, string>(array, listIterator, any);
result = _.mapKeys<TResult>(array, '');
result = _.mapKeys<TResult>(array, '', any);
result = _.mapKeys<TResult, {}>(array, {});
result = _.mapKeys<TResult, string>(list);
result = _.mapKeys<TResult, string>(list, listIterator);
result = _.mapKeys<TResult, string>(list, listIterator, any);
result = _.mapKeys<TResult>(list, '');
result = _.mapKeys<TResult, {}>(list, {});
result = _.mapKeys<TResult, string>(list);
result = _.mapKeys<TResult, string>(list, listIterator);
result = _.mapKeys<TResult, string>(list, listIterator, any);
result = _.mapKeys<TResult>(list, '');
result = _.mapKeys<TResult>(list, '', any);
result = _.mapKeys<TResult, {}>(list, {});
result = _.mapKeys<TResult, string>(dictionary);
result = _.mapKeys<TResult, string>(dictionary, dictionaryIterator);
result = _.mapKeys<TResult, string>(dictionary, dictionaryIterator, any);
result = _.mapKeys<TResult>(dictionary, '');
result = _.mapKeys<TResult, {}>(dictionary, {});
result = _.mapKeys<TResult, string>(dictionary);
result = _.mapKeys<TResult, string>(dictionary, dictionaryIterator);
result = _.mapKeys<TResult, string>(dictionary, dictionaryIterator, any);
result = _.mapKeys<TResult>(dictionary, '');
result = _.mapKeys<TResult>(dictionary, '', any);
result = _.mapKeys<TResult, {}>(dictionary, {});
}
result = _(array).mapKeys<string>().value();
result = _(array).mapKeys<string>(listIterator).value();
result = _(array).mapKeys<string>(listIterator, any).value();
result = _(array).mapKeys('').value();
result = _(array).mapKeys<{}>({}).value();
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<TResult>>;
result = _(list).mapKeys<TResult, string>().value();
result = _(list).mapKeys<TResult, string>(listIterator).value();
result = _(list).mapKeys<TResult, string>(listIterator, any).value();
result = _(list).mapKeys<TResult>('').value();
result = _(list).mapKeys<TResult, {}>({}).value();
result = _(array).mapKeys<string>();
result = _(array).mapKeys<string>(listIterator);
result = _(array).mapKeys<string>(listIterator, any);
result = _(array).mapKeys('');
result = _(array).mapKeys('', any);
result = _(array).mapKeys<{}>({});
result = _(dictionary).mapKeys<TResult, string>().value();
result = _(dictionary).mapKeys<TResult, string>(dictionaryIterator).value();
result = _(dictionary).mapKeys<TResult, string>(dictionaryIterator, any).value();
result = _(dictionary).mapKeys<TResult>('').value();
result = _(dictionary).mapKeys<TResult, {}>({}).value();
result = _(list).mapKeys<TResult, string>();
result = _(list).mapKeys<TResult, string>(listIterator);
result = _(list).mapKeys<TResult, string>(listIterator, any);
result = _(list).mapKeys<TResult>('');
result = _(list).mapKeys<TResult>('', any);
result = _(list).mapKeys<TResult, {}>({});
result = _(dictionary).mapKeys<TResult, string>();
result = _(dictionary).mapKeys<TResult, string>(dictionaryIterator);
result = _(dictionary).mapKeys<TResult, string>(dictionaryIterator, any);
result = _(dictionary).mapKeys<TResult>('');
result = _(dictionary).mapKeys<TResult>('', any);
result = _(dictionary).mapKeys<TResult, {}>({});
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<TResult>>;
result = _(array).chain().mapKeys<string>();
result = _(array).chain().mapKeys<string>(listIterator);
result = _(array).chain().mapKeys<string>(listIterator, any);
result = _(array).chain().mapKeys('');
result = _(array).chain().mapKeys('', any);
result = _(array).chain().mapKeys<{}>({});
result = _(list).chain().mapKeys<TResult, string>();
result = _(list).chain().mapKeys<TResult, string>(listIterator);
result = _(list).chain().mapKeys<TResult, string>(listIterator, any);
result = _(list).chain().mapKeys<TResult>('');
result = _(list).chain().mapKeys<TResult>('', any);
result = _(list).chain().mapKeys<TResult, {}>({});
result = _(dictionary).chain().mapKeys<TResult, string>();
result = _(dictionary).chain().mapKeys<TResult, string>(dictionaryIterator);
result = _(dictionary).chain().mapKeys<TResult, string>(dictionaryIterator, any);
result = _(dictionary).chain().mapKeys<TResult>('');
result = _(dictionary).chain().mapKeys<TResult>('', any);
result = _(dictionary).chain().mapKeys<TResult, {}>({});
}
}
// _.merge
@@ -6434,16 +6647,27 @@ module TestTransform {
}
// _.values
class TestValues {
public a = 1;
public b = 2;
public c: string;
module TestValues {
let object: _.Dictionary<TResult>;
{
let result: TResult[];
result = _.values<TResult>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _(object).values<TResult>();
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _(object).chain().values<TResult>();
}
}
TestValues.prototype.c = 'a';
result = <number[]>_.values<number>(new TestValues());
// → [1, 2] (iteration order is not guaranteed)
result = <number[]>_(new TestValues()).values<number>().value();
// → [1, 2] (iteration order is not guaranteed)
// _.valueIn
class TestValueIn {
+235 -76
View File
@@ -2911,7 +2911,21 @@ declare module _ {
/**
* @see _.xor
*/
xor<TValue>(...arrays: List<TValue>[]): LoDashImplicitArrayWrapper<TValue>;
xor<T>(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.xor
*/
xor(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.xor
*/
xor<T>(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>;
}
//_.zip
@@ -7425,19 +7439,34 @@ declare module _ {
interface LoDashStatic {
/**
* Creates a function that accepts up to n arguments ignoring any additional arguments.
*
* @param func The function to cap arguments for.
* @param n The arity cap.
* @param guard Enables use as a callback for functions like `_.map`.
* @returns Returns the new function.
*/
ary<TResult extends Function>(func: Function, n?: number, guard?: Object): TResult;
ary<TResult extends Function>(
func: Function,
n?: number
): TResult;
ary<T extends Function, TResult extends Function>(
func: T,
n?: number
): TResult;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.ary
*/
ary<TResult extends Function>(n?: number, guard?: Object): LoDashImplicitObjectWrapper<TResult>;
ary<TResult extends Function>(n?: number): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.ary
*/
ary<TResult extends Function>(n?: number): LoDashExplicitObjectWrapper<TResult>;
}
//_.backflow
@@ -7861,26 +7890,38 @@ declare module _ {
//_.delay
interface LoDashStatic {
/**
* Executes the func function after wait milliseconds. Additional arguments will be provided
* to func when it is invoked.
* @param func The function to delay.
* @param wait The number of milliseconds to delay execution.
* @param args Arguments to invoke the function with.
* @return The timer id.
**/
delay(
func: Function,
* Invokes func after wait milliseconds. Any additional arguments are provided to func when its invoked.
*
* @param func The function to delay.
* @param wait The number of milliseconds to delay invocation.
* @param args The arguments to invoke the function with.
* @return Returns the timer id.
*/
delay<T extends Function>(
func: T,
wait: number,
...args: any[]): number;
...args: any[]
): number;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.delay
**/
* @see _.delay
*/
delay(
wait: number,
...args: any[]): LoDashImplicitWrapper<number>;
...args: any[]
): LoDashImplicitWrapper<number>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.delay
*/
delay(
wait: number,
...args: any[]
): LoDashExplicitWrapper<number>;
}
//_.flow
@@ -8496,20 +8537,31 @@ declare module _ {
interface LoDashStatic {
/**
* Checks if value is greater than other.
*
* @param value The value to compare.
* @param other The other value to compare.
* @return Returns true if value is greater than other, else false.
*/
gt(value: any, other: any): boolean;
gt(
value: any,
other: any
): boolean;
}
interface LoDashImplicitWrapperBase<T,TWrapper> {
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.gt
*/
gt(other: any): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.gt
*/
gt(other: any): LoDashExplicitWrapper<boolean>;
}
//_.gte
interface LoDashStatic {
/**
@@ -8986,20 +9038,31 @@ declare module _ {
interface LoDashStatic {
/**
* Checks if value is less than or equal to other.
*
* @param value The value to compare.
* @param other The other value to compare.
* @return Returns true if value is less than or equal to other, else false.
*/
lte(value: any, other: any): boolean;
lte(
value: any,
other: any
): boolean;
}
interface LoDashImplicitWrapperBase<T,TWrapper> {
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.lte
*/
lte(other: any): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.lte
*/
lte(other: any): LoDashExplicitWrapper<boolean>;
}
//_.toArray
interface LoDashStatic {
/**
@@ -10439,34 +10502,47 @@ declare module _ {
//_.forInRight
interface LoDashStatic {
/**
* This method is like _.forIn except that it iterates over elements of a collection in the
* opposite order.
* @param object The object to iterate over.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
* @return object
**/
forInRight<T extends {}>(
* This method is like _.forIn except that it iterates over properties of object in the opposite order.
*
* @param object The object to iterate over.
* @param iteratee The function invoked per iteration.
* @param thisArg The this binding of iteratee.
* @return Returns object.
*/
forInRight<T>(
object: Dictionary<T>,
callback?: DictionaryIterator<T, void>,
thisArg?: any): Dictionary<T>;
iteratee?: DictionaryIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.forInRight
**/
* @see _.forInRight
*/
forInRight<T extends {}>(
object: T,
callback?: ObjectIterator<T, void>,
thisArg?: any): T;
iteratee?: ObjectIterator<any, any>,
thisArg?: any
): T;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.forInRight
**/
forInRight<T extends {}>(
callback: ObjectIterator<T, void>,
thisArg?: any): _.LoDashImplicitObjectWrapper<T>;
* @see _.forInRight
*/
forInRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashImplicitObjectWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.forInRight
*/
forInRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashExplicitObjectWrapper<T>;
}
//_.forOwn
@@ -10520,33 +10596,47 @@ declare module _ {
//_.forOwnRight
interface LoDashStatic {
/**
* This method is like _.forOwn except that it iterates over elements of a collection in the
* opposite order.
* @param object The object to iterate over.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
* @return object
**/
forOwnRight<T extends {}>(
* This method is like _.forOwn except that it iterates over properties of object in the opposite order.
*
* @param object The object to iterate over.
* @param iteratee The function invoked per iteration.
* @param thisArg The this binding of iteratee.
* @return Returns object.
*/
forOwnRight<T>(
object: Dictionary<T>,
callback?: DictionaryIterator<T, void>,
thisArg?: any): Dictionary<T>;
iteratee?: DictionaryIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.forOwnRight
**/
* @see _.forOwnRight
*/
forOwnRight<T extends {}>(
object: T,
callback?: ObjectIterator<any, void>,
thisArg?: any): T;
iteratee?: ObjectIterator<any, any>,
thisArg?: any
): T;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.forOwnRight
**/
forOwnRight<T extends {}>(
callback: ObjectIterator<T, void>,
thisArg?: any): _.LoDashImplicitObjectWrapper<T>;
* @see _.forOwnRight
*/
forOwnRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashImplicitObjectWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.forOwnRight
*/
forOwnRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashExplicitObjectWrapper<T>;
}
//_.functions
@@ -10653,18 +10743,26 @@ declare module _ {
//_.keys
interface LoDashStatic {
/**
* Creates an array composed of the own enumerable property names of an object.
* @param object The object to inspect.
* @return An array of property names.
**/
* Creates an array of the own enumerable property names of object.
*
* @param object The object to query.
* @return Returns the array of property names.
*/
keys(object?: any): string[];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.keys
**/
keys(): LoDashImplicitArrayWrapper<string>
* @see _.keys
*/
keys(): LoDashImplicitArrayWrapper<string>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.keys
*/
keys(): LoDashExplicitArrayWrapper<string>;
}
//_.keysIn
@@ -10723,7 +10821,8 @@ declare module _ {
*/
mapKeys<T>(
object: List<T>|Dictionary<T>,
iteratee?: string
iteratee?: string,
thisArg?: any
): Dictionary<T>;
}
@@ -10747,7 +10846,8 @@ declare module _ {
* @see _.mapKeys
*/
mapKeys(
iteratee?: string
iteratee?: string,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
}
@@ -10771,10 +10871,61 @@ declare module _ {
* @see _.mapKeys
*/
mapKeys<TResult>(
iteratee?: string
iteratee?: string,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<TResult>>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.mapKeys
*/
mapKeys<TKey>(
iteratee?: ListIterator<T, TKey>,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.mapKeys
*/
mapKeys<TObject extends {}>(
iteratee?: TObject
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.mapKeys
*/
mapKeys(
iteratee?: string,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.mapKeys
*/
mapKeys<TResult, TKey>(
iteratee?: ListIterator<TResult, TKey>|DictionaryIterator<TResult, TKey>,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<TResult>>;
/**
* @see _.mapKeys
*/
mapKeys<TResult, TObject extends {}>(
iteratee?: TObject
): LoDashExplicitObjectWrapper<Dictionary<TResult>>;
/**
* @see _.mapKeys
*/
mapKeys<TResult>(
iteratee?: string,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<TResult>>;
}
//_.mapValues
interface LoDashStatic {
/**
@@ -11271,18 +11422,26 @@ declare module _ {
//_.values
interface LoDashStatic {
/**
* Creates an array of the own enumerable property values of object.
* @param object The object to query.
* @return Returns an array of property values.
**/
* Creates an array of the own enumerable property values of object.
*
* @param object The object to query.
* @return Returns an array of property values.
*/
values<T>(object?: any): T[];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.values
**/
values<TResult>(): LoDashImplicitArrayWrapper<TResult>;
* @see _.values
*/
values<T>(): LoDashImplicitArrayWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.values
*/
values<T>(): LoDashExplicitArrayWrapper<T>;
}
//_.valuesIn
+5 -1
View File
@@ -16,6 +16,7 @@ import RaisedButton = require("material-ui/lib/raised-button");
import FloatingActionButton = require("material-ui/lib/floating-action-button");
import Card = require("material-ui/lib/card/card");
import CardHeader = require("material-ui/lib/card/card-header");
import DatePicker = require("material-ui/lib/date-picker/date-picker");
import CardText = require("material-ui/lib/card/card-text");
import CardActions = require("material-ui/lib/card/card-actions");
import Dialog = require("material-ui/lib/dialog");
@@ -165,7 +166,10 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
</Card>;
// "http://material-ui.com/#/components/date-picker"
element = <DatePicker
floatingLabelText="Floating Label Text" />;
element = <DatePicker
hintText="Hint Text" />;
// "http://material-ui.com/#/components/dialog"
let standardActions = [
+2
View File
@@ -306,6 +306,8 @@ declare namespace __MaterialUI {
autoOk?: boolean;
defaultDate?: Date;
formatDate?: string;
hintText?: string;
floatingLabelText?: string;
hideToolbarYearChange?: boolean;
maxDate?: Date;
minDate?: Date;
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="app-version.d.ts" />
module ngCordova {
function test($cordovaAppVersion: IAppVersionService) {
$cordovaAppVersion.getVersionNumber()
.then((versionNumber) => {
console.log(versionNumber.toLowerCase());
});
$cordovaAppVersion.getVersionCode()
.then((versionCode) => {
console.log(versionCode.toLowerCase());
});
}
}
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for ngCordova datepicker plugin
// Project: https://github.com/driftyco/ng-cordova
// Definitions by: Jacques Kang <https://www.linkedin.com/in/jacqueskang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module ngCordova {
export interface IAppVersionService {
getVersionNumber(): ng.IPromise<string>;
getVersionCode(): ng.IPromise<string>;
}
}
+1
View File
@@ -13,3 +13,4 @@
/// <reference path="deviceOrientation.d.ts"/>
/// <reference path="appAvailability.d.ts"/>
/// <reference path="datepicker.d.ts"/>
/// <reference path="app-version.d.ts"/>
+42 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for openpgpjs
// Type definitions for openpgpjs
// Project: http://openpgpjs.org/
// Definitions by: Guillaume Lacasa <https://blog.lacasa.fr>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -364,6 +364,14 @@ declare module openpgp.enums {
aes256,
twofish
}
enum keyStatus {
invalid,
expired,
revoked,
valid,
no_self_cert
}
}
declare module openpgp.key {
@@ -376,8 +384,19 @@ declare module openpgp.key {
/** Class that represents an OpenPGP key. Must contain a primary key. Can contain additional subkeys, signatures, user ids, user attributes.
*/
interface Key {
armor(): String,
decrypt(passphrase: String): Boolean,
armor(): string,
decrypt(passphrase: string): boolean;
getExpirationTime(): Date;
getKeyIds(): Array<Keyid>;
getPreferredHashAlgorithm(): string;
getPrimaryUser(): any;
getUserIds(): Array<string>;
isPrivate(): boolean;
isPublic(): boolean;
primaryKey: packet.PublicKey;
toPublic(): Key;
update(key: Key): void;
verifyPrimaryKey(): enums.keyStatus;
}
/** Generates a new OpenPGP key. Currently only supports RSA keys. Primary and subkey will be of same type.
@@ -462,6 +481,25 @@ declare module openpgp.message {
declare module openpgp.packet {
interface PublicKey {
algorithm: enums.publicKey;
created: Date;
fingerprint: string;
getBitSize(): number;
getFingerprint(): string;
getKeyId(): string;
read(input: string): any;
write(): any;
}
interface SecretKey extends PublicKey {
read(bytes:string): void;
write(): string;
clearPrivateMPIs(str_passphrase: string): boolean;
encrypt(passphrase:string): void;
}
/** Allocate a new packet from structured packet clone
@param packetClone packet clone
*/
@@ -549,4 +587,4 @@ declare module openpgp.util {
function Uint8Array2str(bin: Uint8Array): String;
}
}
-1
View File
@@ -1,5 +1,4 @@
/// <reference path="pixi.js.d.ts" />
module basics {
export class Basics {
+44 -21
View File
@@ -1,4 +1,4 @@
// Type definitions for Pixi.js 3.0.7
// Type definitions for Pixi.js 3.0.9 dev
// Project: https://github.com/GoodBoyDigital/pixi.js/
// Definitions by: clark-stevenson <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -10,7 +10,7 @@ declare class PIXI {
static RAD_TO_DEG: number;
static DEG_TO_RAD: number;
static TARGET_FPMS: number;
static RENDER_TYPE: {
static RENDERER_TYPE: {
UNKNOWN: number;
WEBGL: number;
CANVAS: number;
@@ -155,6 +155,8 @@ declare module PIXI {
toGlobal(position: Point): Point;
toLocal(position: Point, from?: DisplayObject): Point;
generateTexture(renderer: CanvasRenderer | WebGLRenderer, scaleMode: number, resolution: number): Texture;
setParent(container: Container): Container;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, pivotX?: number, pivotY?: number): DisplayObject;
destroy(): void;
getChildByName(name: string): DisplayObject;
getGlobalPosition(point: Point): Point;
@@ -290,7 +292,7 @@ declare module PIXI {
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
drawCircle(x: number, y: number, radius: number): Graphics;
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
drawPolygon(path: number[]| Point[]): Graphics;
drawPolygon(path: number[] | Point[]): Graphics;
clear(): Graphics;
//todo
generateTexture(renderer: WebGLRenderer | CanvasRenderer, resolution?: number, scaleMode?: number): Texture;
@@ -344,6 +346,8 @@ declare module PIXI {
identity(): Matrix;
clone(): Matrix;
copy(matrix: Matrix): Matrix;
set(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
setTransform(a: number, b: number, c: number, d: number, sr: number, cr: number, cy: number, sy: number, nsx: number, cs: number): PIXI.Matrix;
static IDENTITY: Matrix;
static TEMP_MATRIX: Matrix;
@@ -444,6 +448,7 @@ declare module PIXI {
rotation?: boolean;
uvs?: boolean;
alpha?: boolean;
}
export class ParticleContainer extends Container {
@@ -451,8 +456,11 @@ declare module PIXI {
protected _maxSize: number;
protected _batchSize: number;
protected _properties: boolean[];
protected _buffers: WebGLBuffer[];
protected _bufferToUpdate: number;
protected onChildrenChange: () => void;
protected onChildrenChange: (smallestChildIndex?: number) => void;
interactiveChildren: boolean;
blendMode: number;
@@ -492,18 +500,17 @@ declare module PIXI {
//renderers
export interface RendererOptions {
view?: HTMLCanvasElement;
transparent?: boolean
antialias?: boolean;
resolution?: number;
clearBeforeRendering?: boolean;
preserveDrawingBuffer?: boolean;
forceFXAA?: boolean;
roundPixels?: boolean;
autoResize?: boolean;
backgroundColor?: number;
blendModes?: { [s: string]: any; };
clearBeforeRender?: boolean;
}
export class SystemRenderer extends EventEmitter {
@@ -525,6 +532,7 @@ declare module PIXI {
blendModes: any; //todo?
preserveDrawingBuffer: boolean;
clearBeforeRender: boolean;
roundPixels: boolean;
backgroundColor: number;
render(object: DisplayObject): void;
@@ -543,8 +551,6 @@ declare module PIXI {
refresh: boolean;
maskManager: CanvasMaskManager;
roundPixels: boolean;
currentScaleMode: number;
currentBlendMode: number;
smoothProperty: string;
render(object: DisplayObject): void;
@@ -612,6 +618,7 @@ declare module PIXI {
protected _createContext(): void;
protected handleContextLost: (event: WebGLContextEvent) => void;
protected _mapGlModes(): void;
protected _managedTextures: Texture[];
constructor(width?: number, height?: number, options?: RendererOptions);
@@ -629,7 +636,7 @@ declare module PIXI {
setObjectRenderer(objectRenderer: ObjectRenderer): void;
setRenderTarget(renderTarget: RenderTarget): void;
updateTexture(texture: BaseTexture | Texture): BaseTexture | Texture;
destroyTexture(texture: BaseTexture | Texture): void;
destroyTexture(texture: BaseTexture | Texture, _skipRemove?: boolean): void;
}
export class AbstractFilter {
@@ -764,7 +771,7 @@ declare module PIXI {
fragmentSrc: string;
init(): void;
cacheUniformLocations(keys: string): void;
cachUniformLocations(keys: string): void;
cacheAttributeLocations(keys: string): void;
compile(): WebGLProgram;
syncUniform(uniform: any): void;
@@ -841,6 +848,7 @@ declare module PIXI {
map(rect: Rectangle, rect2: Rectangle): void;
upload(): void;
destroy(): void;
}
@@ -954,7 +962,7 @@ declare module PIXI {
static fromImage(imageUrl: string, crossorigin?: boolean, scaleMode?: number): BaseTexture;
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number): BaseTexture;
protected _glTextures: any[];
protected _glTextures: any;
protected _sourceLoaded(): void;
@@ -969,7 +977,7 @@ declare module PIXI {
scaleMode: number;
hasLoaded: boolean;
isLoading: boolean;
source: HTMLImageElement | HTMLCanvasElement;
source: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
premultipliedAlpha: boolean;
imageUrl: string;
isPowerOfTwo: boolean;
@@ -1072,10 +1080,9 @@ declare module PIXI {
export class VideoBaseTexture extends BaseTexture {
static fromVideo(video: HTMLVideoElement, scaleMode?: number): VideoBaseTexture;
static fromUrl(videoSrc: string | any | string[]| any[]): VideoBaseTexture;
static fromUrl(videoSrc: string | any | string[] | any[]): VideoBaseTexture;
protected _loaded: boolean;
protected _onUpdate(): void;
protected _onPlayStart(): void;
protected _onPlayStop(): void;
@@ -1096,11 +1103,11 @@ declare module PIXI {
static uuid(): number;
static hex2rgb(hex: number, out?: number[]): number[];
static hex2String(hex: number): string;
static rbg2hex(rgb: Number[]): number;
static rgb2hex(rgb: Number[]): number;
static canUseNewCanvasBlendModel(): boolean;
static getNextPowerOfTwo(number: number): number;
static isPowerOfTwo(width: number, height: number): boolean;
static getResolutionOfUrl(url: string): boolean;
static getResolutionOfUrl(url: string): number;
static sayHello(type: string): void;
static isWebGLSupported(): boolean;
static sign(n: number): number;
@@ -1147,6 +1154,7 @@ declare module PIXI {
textWidth: number;
textHeight: number;
maxWidth: number;
maxLineHeight: number;
dirty: boolean;
tint: number;
@@ -1165,7 +1173,8 @@ declare module PIXI {
static fromFrames(frame: string[]): MovieClip;
static fromImages(images: string[]): MovieClip;
protected _textures: Texture;
protected _textures: Texture[];
protected _durations: number[];
protected _currentTime: number;
protected update(deltaTime: number): void;
@@ -1527,6 +1536,10 @@ declare module PIXI {
xhrType?: string;
}
export interface ResourceDictionary {
[index: string]: PIXI.loaders.Resource;
}
export class Loader extends EventEmitter {
constructor(baseUrl?: string, concurrency?: number);
@@ -1534,7 +1547,7 @@ declare module PIXI {
baseUrl: string;
progress: number;
loading: boolean;
resources: Resource[];
resources: ResourceDictionary;
add(name: string, url: string, options?: LoaderOptions, cb?: () => void): Loader;
add(url: string, options?: LoaderOptions, cb?: () => void): Loader;
@@ -1633,6 +1646,7 @@ declare module PIXI {
blendMode: number;
canvasPadding: number;
drawMode: number;
shader: Shader;
getBounds(matrix?: Matrix): Rectangle;
containsPoint(point: Point): boolean;
@@ -1660,6 +1674,15 @@ declare module PIXI {
refresh(): void;
}
export class Plane extends Mesh {
segmentsX: number;
segmentsY: number;
constructor(texture: Texture, segmentsX?: number, segmentsY?: number);
}
export class MeshRenderer extends ObjectRenderer {
@@ -1719,4 +1742,4 @@ declare module PIXI {
declare module 'pixi.js' {
export = PIXI;
}
}
@@ -0,0 +1,27 @@
/// <reference path="react-day-picker.d.ts" />
/// <reference path="../react/react-global.d.ts" />
import DayPicker2 from 'react-day-picker';
function isSunday(day: Date) {
return day.getDay() === 0;
}
// make sure global variable version works
function MyComponent2() {
return <DayPicker initialMonth={ new Date(2016, 1) } modifiers={{ isSunday }} />
}
// make sure imported version works
function MyComponent() {
return <DayPicker2 initialMonth={ new Date(2016, 1) } modifiers={{ isSunday }} />
}
const localeUtils = {
formatMonthTitle: (d: Date) => 'month_title',
formatWeekdayShort: (i: number) => 'weekday_short',
formatWeekdayLong: (i: number) => 'weekday_long',
getFirstDayOfWeek: () => 0
};
let element = <DayPicker2 initialMonth= { new Date(2016, 1) } localeUtils={localeUtils} modifiers= {{ isSunday }} />
@@ -0,0 +1 @@
--target es5 --noImplicitAny --jsx react
+53
View File
@@ -0,0 +1,53 @@
// Type definitions for react-day-picker
// Project: https://github.com/gpbl/react-day-picker
// Definitions by: Giampaolo Bellavite <https://github.com/gpbl>, Jason Killian <https://github.com/jkillian>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
declare module "react-day-picker" {
export default ReactDayPicker.DayPicker;
}
declare var DayPicker: typeof ReactDayPicker.DayPicker;
declare namespace ReactDayPicker {
interface LocaleUtils {
formatMonthTitle: (month: Date, locale: string) => string;
formatWeekdayShort: (weekday: number, locale: string) => string;
formatWeekdayLong: (weekday: number, locale: string) => string;
getFirstDayOfWeek: (locale: string) => number;
}
interface Modifiers {
[name: string]: (date: Date) => boolean;
}
interface Props {
modifiers?: Modifiers;
initialMonth?: Date;
numberOfMonths?: number;
renderDay?: (date: Date) => number | string | JSX.Element;
enableOutsideDays?: boolean;
canChangeMonth?: boolean;
fromMonth?: Date;
toMonth?: Date;
localeUtils?: LocaleUtils;
locale?: string;
onDayClick?: (e: __React.SyntheticEvent, day: Date, modifiers: string[]) => any;
onDayTouchTap?: (e: __React.SyntheticEvent, day: Date, modifiers: string[]) => any;
onDayMouseEnter?: (e: __React.SyntheticEvent, day: Date, modifiers: string[]) => any;
onDayMouseLeave?: (e: __React.SyntheticEvent, day: Date, modifiers: string[]) => any;
onMonthChange?: (month: Date) => any;
onCaptionClick?: (e: __React.SyntheticEvent, month: Date) => any;
className?: string;
style?: __React.CSSProperties;
tabIndex?: number;
}
export class DayPicker extends __React.Component<Props, {}> {
showMonth(month: Date): void;
showPreviousMonth(): void;
showNextMonth(): void;
}
}
+478 -185
View File
@@ -47,7 +47,7 @@ declare namespace ReactNative {
// not in lib.es6.d.ts but called by react-native
done(): void;
done(callback?: (value: T) => void): void;
}
export interface PromiseConstructor {
@@ -147,6 +147,10 @@ declare namespace ReactNative {
right?: number
}
export interface NativeComponent {
setNativeProps: (props: Object) => void
}
export type AppConfig = {
appKey: string;
component: ReactClass<any, any, any>;
@@ -573,12 +577,177 @@ declare namespace ReactNative {
value?: string
}
export interface TextInputStatic extends React.ComponentClass<TextInputProperties> {
export interface TextInputStatic extends NativeComponent, React.ComponentClass<TextInputProperties> {
blur: () => void
focus: () => void
}
export interface GestureResponderEvent {
nativeEvent : {
/**
* Array of all touch events that have changed since the last event
*/
changedTouches: any[]
/**
* The ID of the touch
*/
identifier: string
/**
* The X position of the touch, relative to the element
*/
locationX: number
/**
* The Y position of the touch, relative to the element
*/
locationY: number
/**
* The X position of the touch, relative to the screen
*/
pageX: number
/**
* The Y position of the touch, relative to the screen
*/
pageY: number
/**
* The node id of the element receiving the touch event
*/
target: string
/**
* A time identifier for the touch, useful for velocity calculation
*/
timestamp: number
/**
* Array of all current touches on the screen
*/
touches : any[]
}
}
/**
* Gesture recognition on mobile devices is much more complicated than web.
* A touch can go through several phases as the app determines what the user's intention is.
* For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
* This can even change during the duration of a touch. There can also be multiple simultaneous touches.
*
* The touch responder system is needed to allow components to negotiate these touch interactions
* without any additional knowledge about their parent or child components.
* This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
*
* Best Practices
* Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
* Every action should have the following attributes:
* Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
* Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
*
* These features make users more comfortable while using an app,
* because it allows people to experiment and interact without fear of making mistakes.
*
* TouchableHighlight and Touchable*
* The responder system can be complicated to use.
* So we have provided an abstract Touchable implementation for things that should be "tappable".
* This uses the responder system and allows you to easily configure tap interactions declaratively.
* Use TouchableHighlight anywhere where you would use a button or link on web.
*/
export interface GestureResponderHandlers {
/**
* A view can become the touch responder by implementing the correct negotiation methods.
* There are two methods to ask the view if it wants to become responder:
*/
/**
* Does this view want to become responder on the start of a touch?
*/
onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean
/**
* Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
*/
onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean
/**
* If the View returns true and attempts to become the responder, one of the following will happen:
*/
/**
* The View is now responding for touch events.
* This is the time to highlight and show the user what is happening
*/
onResponderGrant?: (event: GestureResponderEvent) => void
/**
* Something else is the responder right now and will not release it
*/
onResponderReject?: (event: GestureResponderEvent) => void
/**
* If the view is responding, the following handlers can be called:
*/
/**
* The user is moving their finger
*/
onResponderMove?: (event: GestureResponderEvent) => void
/**
* Fired at the end of the touch, ie "touchUp"
*/
onResponderRelease?: (event: GestureResponderEvent) => void
/**
* Something else wants to become responder.
* Should this view release the responder? Returning true allows release
*/
onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean
/**
* The responder has been taken from the View.
* Might be taken by other views after a call to onResponderTerminationRequest,
* or might be taken by the OS without asking (happens with control center/ notification center on iOS)
*/
onResponderTerminate?: (event: GestureResponderEvent) => void
/**
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
* where the deepest node is called first.
* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
* This is desirable in most cases, because it makes sure all controls and buttons are usable.
*
* However, sometimes a parent will want to make sure that it becomes responder.
* This can be handled by using the capture phase.
* Before the responder system bubbles up from the deepest component,
* it will do a capture phase, firing on*ShouldSetResponderCapture.
* So if a parent View wants to prevent the child from becoming responder on a touch start,
* it should have a onStartShouldSetResponderCapture handler which returns true.
*/
onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean
/**
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
* where the deepest node is called first.
* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
* This is desirable in most cases, because it makes sure all controls and buttons are usable.
*
* However, sometimes a parent will want to make sure that it becomes responder.
* This can be handled by using the capture phase.
* Before the responder system bubbles up from the deepest component,
* it will do a capture phase, firing on*ShouldSetResponderCapture.
* So if a parent View wants to prevent the child from becoming responder on a touch start,
* it should have a onStartShouldSetResponderCapture handler which returns true.
*/
onMoveShouldSetResponderCapture?: () => void;
}
// @see https://facebook.github.io/react-native/docs/view.html#style
export interface ViewStyle extends FlexStyle, TransformsStyle {
backgroundColor?: string;
@@ -695,7 +864,7 @@ declare namespace ReactNative {
/**
* @see https://facebook.github.io/react-native/docs/view.html#props
*/
export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, React.Props<ViewStatic> {
export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, React.Props<ViewStatic> {
/**
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
@@ -725,31 +894,6 @@ declare namespace ReactNative {
*/
onMagicTap?: () => void;
onMoveShouldSetResponder?: () => void;
onMoveShouldSetResponderCapture?: () => void;
/**
* For most touch interactions, you'll simply want to wrap your component in TouchableHighlight or TouchableOpacity.
* Check out Touchable.js, ScrollResponder.js and ResponderEventPlugin.js for more discussion.
*/
onResponderGrant?: () => void;
onResponderMove?: () => void;
onResponderReject?: () => void;
onResponderRelease?: () => void;
onResponderTerminate?: () => void;
onResponderTerminationRequest?: () => void;
onStartShouldSetResponder?: () => void;
onStartShouldSetResponderCapture?: () => void;
/**
*
* In the absence of auto property, none is much like CSS's none value. box-none is as if you had applied the CSS class:
@@ -797,7 +941,7 @@ declare namespace ReactNative {
* View maps directly to the native view equivalent on whatever platform React is running on,
* whether that is a UIView, <div>, android.view, etc.
*/
export interface ViewStatic extends React.ComponentClass<ViewProperties> {
export interface ViewStatic extends NativeComponent, React.ComponentClass<ViewProperties> {
}
@@ -1255,12 +1399,6 @@ declare namespace ReactNative {
}
/**
* @see
*/
export interface CameraRollProperties {
/// TODO
}
/**
* @see ImageResizeMode.js
@@ -2284,114 +2422,7 @@ declare namespace ReactNative {
Item: TabBarItemStatic;
}
export interface CameraRollFetchParams {
first: number;
groupTypes: string;
after?: string;
}
export interface CameraRollNodeInfo {
image: Image;
group_name: string;
timestamp: number;
location: any;
}
export interface CameraRollEdgeInfo {
node: CameraRollNodeInfo;
}
export interface CameraRollAssetInfo {
edges: CameraRollEdgeInfo[];
page_info: {
has_next_page: boolean;
end_cursor: string;
};
}
export interface CameraRollStatic extends React.ComponentClass<CameraRollProperties> {
getPhotos( fetch: CameraRollFetchParams,
onAsset: ( assetInfo: CameraRollAssetInfo ) => void,
logError: ()=> void ): void;
}
export interface PanHandlers {
}
export interface PanResponderEvent {
}
export interface PanResponderGestureState {
stateID: number;
moveX: number;
moveY: number;
x0: number;
y0: number;
dx: number;
dy: number;
vx: number;
vy: number;
numberActiveTouches: number;
// All `gestureState` accounts for timeStamps up until:
_accountsForMovesUpTo: number;
}
/**
* @param {object} config Enhanced versions of all of the responder callbacks
* that provide not only the typical `ResponderSyntheticEvent`, but also the
* `PanResponder` gesture state. Simply replace the word `Responder` with
* `PanResponder` in each of the typical `onResponder*` callbacks. For
* example, the `config` object would look like:
*
* - `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
* - `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
* - `onStartShouldSetPanResponder: (e, gestureState) => {...}`
* - `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
* - `onPanResponderReject: (e, gestureState) => {...}`
* - `onPanResponderGrant: (e, gestureState) => {...}`
* - `onPanResponderStart: (e, gestureState) => {...}`
* - `onPanResponderEnd: (e, gestureState) => {...}`
* - `onPanResponderRelease: (e, gestureState) => {...}`
* - `onPanResponderMove: (e, gestureState) => {...}`
* - `onPanResponderTerminate: (e, gestureState) => {...}`
* - `onPanResponderTerminationRequest: (e, gestureState) => {...}`
*
* In general, for events that have capture equivalents, we update the
* gestureState once in the capture phase and can use it in the bubble phase
* as well.
*
* Be careful with onStartShould* callbacks. They only reflect updated
* `gestureState` for start/end events that bubble/capture to the Node.
* Once the node is the responder, you can rely on every start/end event
* being processed by the gesture and `gestureState` being updated
* accordingly. (numberActiveTouches) may not be totally accurate unless you
* are the responder.
*/
export interface PanResponderCallbacks {
onMoveShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean;
onStartShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderGrant?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderMove?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderRelease?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderTerminate?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onMoveShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean;
onStartShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean;
onPanResponderReject?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderStart?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderEnd?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
onPanResponderTerminationRequest?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void;
}
export interface PanResponderInstance {
panHandlers: PanHandlers;
}
export interface PanResponderStatic {
create( callbacks: PanResponderCallbacks ): PanResponderInstance;
}
export interface PixelRatioStatic {
get(): number;
@@ -2862,6 +2893,260 @@ declare namespace ReactNative {
}
export interface CameraRollFetchParams {
first: number;
after?: string;
groupTypes: string; // 'Album','All','Event','Faces','Library','PhotoStream','SavedPhotos'
groupName?: string
assetType?: string
}
export interface CameraRollNodeInfo {
image: Image;
group_name: string;
timestamp: number;
location: any;
}
export interface CameraRollEdgeInfo {
node: CameraRollNodeInfo;
}
export interface CameraRollAssetInfo {
edges: CameraRollEdgeInfo[];
page_info: {
has_next_page: boolean;
end_cursor: string;
};
}
/**
* CameraRoll provides access to the local camera roll / gallery.
*/
export interface CameraRollStatic {
GroupTypesOptions: string[] //'Album','All','Event','Faces','Library','PhotoStream','SavedPhotos'
/**
* Saves the image to the camera roll / gallery.
*
* The CameraRoll API is not yet implemented for Android.
*
* @tag On Android, this is a local URI, such as "file:///sdcard/img.png".
* On iOS, the tag can be one of the following:
* local URI
* assets-library tag
* a tag not maching any of the above, which means the image data will be stored in memory (and consume memory as long as the process is alive)
*
* @param successCallback Invoked with the value of tag on success.
* @param errorCallback Invoked with error message on error.
*/
saveImageWithTag( tag: string, successCallback: ( tag?: string ) => void, errorCallback: ( error: Error ) => void ): void
/**
* Invokes callback with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker.
*
* @param {object} params See getPhotosParamChecker.
* @param {function} callback Invoked with arg of shape defined by getPhotosReturnChecker on success.
* @param {function} errorCallback Invoked with error message on error.
*/
getPhotos( fetch: CameraRollFetchParams,
callback: ( assetInfo: CameraRollAssetInfo ) => void,
errorCallback: ( error: Error )=> void ): void;
}
export interface FetchableListenable<T> {
fetch: () => Promise<T>
/**
* eventName is expected to be `change`
* //FIXME: No doc - inferred from NetInfo.js
*/
addEventListener: (eventName: string, listener: (result: T) => void) => void
/**
* eventName is expected to be `change`
* //FIXME: No doc - inferred from NetInfo.js
*/
removeEventListener: (eventName: string, listener: (result: T) => void) => void
}
/**
* NetInfo exposes info about online/offline status
*
* Asynchronously determine if the device is online and on a cellular network.
*
* - `none` - device is offline
* - `wifi` - device is online and connected via wifi, or is the iOS simulator
* - `cell` - device is connected via Edge, 3G, WiMax, or LTE
* - `unknown` - error case and the network status is unknown
* @see https://facebook.github.io/react-native/docs/netinfo.html#content
*/
export interface NetInfoStatic extends FetchableListenable<string> {
/**
*
* Available on all platforms.
* Asynchronously fetch a boolean to determine internet connectivity.
*/
isConnected: FetchableListenable<boolean>
//FIXME: Documentation missing
isConnectionMetered: any
}
/**
* //FIXME: Documentation ?
*/
export interface PanResponderEvent {
bubbles: boolean
cancelable: boolean
currentTarget: number
defaultPrevented: boolean
dispatchConfig: any
dispatchMarker: any
eventPhase: any
isDefaultPrevented: () => boolean
isPropagationStopped: () => boolean
isTrusted: boolean
nativeEvent: GestureResponderEvent
path: any
target: number
timeStamp: number
touchHistory: any[]
type: any
}
export interface PanResponderGestureState {
/**
* ID of the gestureState- persisted as long as there at least one touch on
*/
stateID: number
/**
* the latest screen coordinates of the recently-moved touch
*/
moveX: number
/**
* the latest screen coordinates of the recently-moved touch
*/
moveY: number
/**
* the screen coordinates of the responder grant
*/
x0: number
/**
* the screen coordinates of the responder grant
*/
y0: number
/**
* accumulated distance of the gesture since the touch started
*/
dx: number
/**
* accumulated distance of the gesture since the touch started
*/
dy: number
/**
* current velocity of the gesture
*/
vx: number
/**
* current velocity of the gesture
*/
vy: number
/**
* Number of touches currently on screeen
*/
numberActiveTouches: number
// All `gestureState` accounts for timeStamps up until:
_accountsForMovesUpTo: number
}
/**
* @see documentation of GestureResponderHandlers
*/
export interface PanResponderCallbacks {
onMoveShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
onStartShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderGrant?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderMove?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderRelease?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderTerminate?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onMoveShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
onStartShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
onPanResponderReject?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderStart?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderEnd?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
onPanResponderTerminationRequest?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
}
export interface PanResponderInstance {
panHandlers: GestureResponderHandlers
}
/**
* PanResponder reconciles several touches into a single gesture.
* It makes single-touch gestures resilient to extra touches,
* and can be used to recognize simple multi-touch gestures.
*
* It provides a predictable wrapper of the responder handlers provided by the gesture responder system.
* For each handler, it provides a new gestureState object alongside the normal event.
*/
export interface PanResponderStatic {
/**
* @param config Enhanced versions of all of the responder callbacks
* that provide not only the typical `ResponderSyntheticEvent`, but also the
* `PanResponder` gesture state. Simply replace the word `Responder` with
* `PanResponder` in each of the typical `onResponder*` callbacks. For
* example, the `config` object would look like:
*
* - `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
* - `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
* - `onStartShouldSetPanResponder: (e, gestureState) => {...}`
* - `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
* - `onPanResponderReject: (e, gestureState) => {...}`
* - `onPanResponderGrant: (e, gestureState) => {...}`
* - `onPanResponderStart: (e, gestureState) => {...}`
* - `onPanResponderEnd: (e, gestureState) => {...}`
* - `onPanResponderRelease: (e, gestureState) => {...}`
* - `onPanResponderMove: (e, gestureState) => {...}`
* - `onPanResponderTerminate: (e, gestureState) => {...}`
* - `onPanResponderTerminationRequest: (e, gestureState) => {...}`
*
* In general, for events that have capture equivalents, we update the
* gestureState once in the capture phase and can use it in the bubble phase
* as well.
*
* Be careful with onStartShould* callbacks. They only reflect updated
* `gestureState` for start/end events that bubble/capture to the Node.
* Once the node is the responder, you can rely on every start/end event
* being processed by the gesture and `gestureState` being updated
* accordingly. (numberActiveTouches) may not be totally accurate unless you
* are the responder.
*/
create( config: PanResponderCallbacks ): PanResponderInstance
}
//////////////////////////////////////////////////////////////////////////
//
// R E - E X P O R T S
@@ -2871,71 +3156,68 @@ declare namespace ReactNative {
// export var AppRegistry: AppRegistryStatic;
export var ActivityIndicatorIOS: ActivityIndicatorIOSStatic;
export type ActivityIndicatorIOS = ActivityIndicatorIOSStatic;
export var CameraRoll: CameraRollStatic;
export type CameraRoll = CameraRollStatic;
export var ActivityIndicatorIOS: ActivityIndicatorIOSStatic
export type ActivityIndicatorIOS = ActivityIndicatorIOSStatic
export var DatePickerIOS: DatePickerIOSStatic
export type DatePickerIOS = DatePickerIOSStatic
export var Image: ImageStatic;
export type Image = ImageStatic;
export var Image: ImageStatic
export type Image = ImageStatic
export var LayoutAnimation: LayoutAnimationStatic;
export type LayoutAnimation = LayoutAnimationStatic;
export var LayoutAnimation: LayoutAnimationStatic
export type LayoutAnimation = LayoutAnimationStatic
export var ListView: ListViewStatic;
export type ListView = ListViewStatic;
export var ListView: ListViewStatic
export type ListView = ListViewStatic
export var MapView: MapViewStatic;
export type MapView = MapViewStatic;
export var MapView: MapViewStatic
export type MapView = MapViewStatic
export var Navigator: NavigatorStatic;
export type Navigator = NavigatorStatic;
export var Navigator: NavigatorStatic
export type Navigator = NavigatorStatic
export var NavigatorIOS: NavigatorIOSStatic;
export type NavigatorIOS = NavigatorIOSStatic;
export var NavigatorIOS: NavigatorIOSStatic
export type NavigatorIOS = NavigatorIOSStatic
export var PickerIOS: PickerIOSStatic
export type PickerIOS = PickerIOSStatic
export var SliderIOS: SliderIOSStatic;
export type SliderIOS = SliderIOSStatic;
export var SliderIOS: SliderIOSStatic
export type SliderIOS = SliderIOSStatic
export var ScrollView: ScrollViewStatic
export type ScrollView = ScrollViewStatic
export var StyleSheet: StyleSheetStatic;
export type StyleSheet = StyleSheetStatic;
export var StyleSheet: StyleSheetStatic
export type StyleSheet = StyleSheetStatic
export var SwitchIOS: SwitchIOSStatic
export type SwitchIOS = SwitchIOSStatic
export var TabBarIOS: TabBarIOSStatic;
export type TabBarIOS = TabBarIOSStatic;
export var TabBarIOS: TabBarIOSStatic
export type TabBarIOS = TabBarIOSStatic
export var Text: TextStatic;
export type Text = TextStatic;
export var Text: TextStatic
export type Text = TextStatic
export var TextInput: TextInputStatic
export type TextInput = TextInputStatic
export var TouchableHighlight: TouchableHighlightStatic;
export type TouchableHighlight = TouchableHighlightStatic;
export var TouchableHighlight: TouchableHighlightStatic
export type TouchableHighlight = TouchableHighlightStatic
export var TouchableNativeFeedback: TouchableNativeFeedbackStatic;
export type TouchableNativeFeedback = TouchableNativeFeedbackStatic;
export var TouchableNativeFeedback: TouchableNativeFeedbackStatic
export type TouchableNativeFeedback = TouchableNativeFeedbackStatic
export var TouchableOpacity: TouchableOpacityStatic;
export type TouchableOpacity = TouchableOpacityStatic;
export var TouchableOpacity: TouchableOpacityStatic
export type TouchableOpacity = TouchableOpacityStatic
export var TouchableWithoutFeedback: TouchableWithoutFeedbackStatic;
export type TouchableWithoutFeedback= TouchableWithoutFeedbackStatic;
export var TouchableWithoutFeedback: TouchableWithoutFeedbackStatic
export type TouchableWithoutFeedback= TouchableWithoutFeedbackStatic
export var View: ViewStatic;
export type View = ViewStatic;
export var View: ViewStatic
export type View = ViewStatic
export var WebView: WebViewStatic
export type WebView = WebViewStatic
@@ -2951,19 +3233,30 @@ declare namespace ReactNative {
export var AlertIOS: AlertIOSStatic
export type AlertIOS = AlertIOSStatic
export var AppStateIOS: AppStateIOSStatic
export type AppStateIOS = AppStateIOSStatic
export var AsyncStorage: AsyncStorageStatic
export type AsyncStorage = AsyncStorageStatic
export var CameraRoll: CameraRollStatic
export type CameraRoll = CameraRollStatic
export var NetInfo: NetInfoStatic
export type NetInfo = NetInfoStatic
export var PanResponder: PanResponderStatic
export type PanResponder = PanResponderStatic
export var SegmentedControlIOS: React.ComponentClass<SegmentedControlIOSProperties>
export var PixelRatio: PixelRatioStatic
export var DeviceEventEmitter: DeviceEventEmitterStatic
export var DeviceEventSubscription: DeviceEventSubscriptionStatic
export type DeviceEventSubscription = DeviceEventSubscriptionStatic
export var InteractionManager: InteractionManagerStatic
export var SegmentedControlIOS: React.ComponentClass<SegmentedControlIOSProperties>;
export var PixelRatio: PixelRatioStatic;
export var DeviceEventEmitter: DeviceEventEmitterStatic;
export var DeviceEventSubscription: DeviceEventSubscriptionStatic;
export type DeviceEventSubscription = DeviceEventSubscriptionStatic;
export var InteractionManager: InteractionManagerStatic;
export var PanResponder: PanResponderStatic;
export var AppStateIOS: AppStateIOSStatic;
//////////////////////////////////////////////////////////////////////////
+1229
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -20,6 +20,21 @@ rp(options)
// --> Displays length of response from server after post
//Defaults tests
(() => {
const githubUrl = 'https://github.com';
const defaultJarRequest = rp.defaults({ jar: true });
defaultJarRequest.get(githubUrl).then(() => {});
//defaultJarRequest(); //this line doesn't compile (and shouldn't)
const defaultUrlRequest = rp.defaults({ url: githubUrl });
defaultUrlRequest().then(() => {});
defaultUrlRequest.get().then(() => {});
const defaultBodyRequest = defaultUrlRequest.defaults({body: '{}', json: true});
defaultBodyRequest.get().then(() => {});
defaultBodyRequest.post().then(() => {});
defaultBodyRequest.put().then(() => {});
})();
// Get full response after DELETE
options = {
method: 'DELETE',
+2 -2
View File
@@ -19,12 +19,12 @@ declare module 'request-promise' {
promise(): Promise<any>;
}
interface RequestPromiseOptions extends request.OptionalOptions {
interface RequestPromiseOptions extends request.CoreOptions {
simple?: boolean;
transform?: (body: any, response: http.IncomingMessage) => any;
resolveWithFullResponse?: boolean;
}
var requestPromise: request.RequestAPI<RequestPromise, RequestPromiseOptions>;
var requestPromise: request.RequestAPI<RequestPromise, RequestPromiseOptions, request.RequiredUriUrl>;
export = requestPromise;
}
+19
View File
@@ -31,6 +31,22 @@ var bodyArr: request.RequestPart[] = [{
body: value
}];
//Defaults tests
(() => {
const githubUrl = 'https://github.com';
const defaultJarRequest = request.defaults({ jar: true });
defaultJarRequest.get(githubUrl);
//defaultJarRequest(); //this line doesn't compile (and shouldn't)
const defaultUrlRequest = request.defaults({ url: githubUrl });
defaultUrlRequest();
defaultUrlRequest.get();
const defaultBodyRequest = defaultUrlRequest.defaults({body: '{}', json: true});
defaultBodyRequest.get();
defaultBodyRequest.post();
defaultBodyRequest.put();
})();
// --- --- --- --- --- --- --- --- --- --- --- ---
obj = req.toJSON();
@@ -526,6 +542,9 @@ var specialRequest = baseRequest.defaults({
headers: {special: 'special value'}
});
const urlRequest = specialRequest.defaults({url: 'https://github.com'});
urlRequest({}, function(error, response, body) {console.log(body);});
request.put(url);
request.patch(url);
request.post(url);
+42 -19
View File
@@ -16,35 +16,40 @@ declare module 'request' {
import fs = require('fs');
namespace request {
export interface RequestAPI<TRequest extends Request, TOptions extends OptionalOptions> {
defaults(options: TOptions): RequestAPI<TRequest, TOptions>;
export interface RequestAPI<TRequest extends Request,
TOptions extends CoreOptions,
TUriUrlOptions> {
defaults(options: TOptions): RequestAPI<TRequest, TOptions, RequiredUriUrl>;
defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
(uri: string, callback?: RequestCallback): TRequest;
(options?: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
get(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
get(uri: string, callback?: RequestCallback): TRequest;
get(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
get(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
post(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
post(uri: string, callback?: RequestCallback): TRequest;
post(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
post(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
put(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
put(uri: string, callback?: RequestCallback): TRequest;
put(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
put(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
head(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
head(uri: string, callback?: RequestCallback): TRequest;
head(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
head(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
patch(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
patch(uri: string, callback?: RequestCallback): TRequest;
patch(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
patch(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
del(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
del(uri: string, callback?: RequestCallback): TRequest;
del(options: RequiredOptions & TOptions, callback?: RequestCallback): TRequest;
del(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
forever(agentOptions: any, optionsArg: any): TRequest;
jar(): CookieJar;
@@ -54,15 +59,22 @@ declare module 'request' {
debug: boolean;
}
interface UriOptions {
uri: string;
interface DefaultUriUrlRequestApi<TRequest extends Request,
TOptions extends CoreOptions,
TUriUrlOptions> extends RequestAPI<TRequest, TOptions, TUriUrlOptions> {
defaults(options: TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
(): TRequest;
get(): TRequest;
post(): TRequest;
put(): TRequest;
head(): TRequest;
patch(): TRequest;
del(): TRequest;
}
interface UrlOptions {
url: string;
}
interface OptionalOptions {
interface CoreOptions {
baseUrl?: string;
callback?: (error: any, response: http.IncomingMessage, body: any) => void;
jar?: any; // CookieJar
formData?: any; // Object
@@ -100,8 +112,19 @@ declare module 'request' {
har?: HttpArchiveRequest;
}
export type RequiredOptions = UriOptions | UrlOptions;
export type Options = RequiredOptions & OptionalOptions;
interface UriOptions {
uri: string;
}
interface UrlOptions {
url: string;
}
export type RequiredUriUrl = UriOptions | UrlOptions;
interface OptionalUriUrl {
uri?: string;
url?: string;
}
export type Options = RequiredUriUrl & CoreOptions;
export interface RequestCallback {
(error: any, response: http.IncomingMessage, body: any): void;
@@ -223,6 +246,6 @@ declare module 'request' {
toString(): string;
}
}
var request: request.RequestAPI<request.Request, request.OptionalOptions>;
var request: request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>;
export = request;
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for http-errors v1.2.1
// Type definitions for statuses v1.2.1
// Project: https://github.com/jshttp/statuses
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+11
View File
@@ -130,3 +130,14 @@ anotherGridInstance.scrollTo(rowEntityToScrollTo, columnDefToScrollTo);
var selectedRowEntities: Array<IMyEntity> = gridApi.selection.getSelectedRows();
var selectedGridRows: Array<uiGrid.IGridRow> = gridApi.selection.getSelectedGridRows();
gridApi.expandable.on.rowExpandedStateChanged(null, (row) => {
if (row.isExpanded) {
console.log('expanded', row.entity);
} else {
gridApi.expandable.toggleRowExpansion(row.entity);
}
});
gridApi.expandable.expandAllRows();
gridApi.expandable.collapseAllRows();
gridApi.expandable.toggleAllRows();
+13 -1
View File
@@ -1558,6 +1558,18 @@ declare module uiGrid {
*/
(row: IGridRowOf<TEntity>): void;
}
/**
* GridRow settings for expandable
*/
export interface IGridRow {
/**
* If set to true, the row is expanded and the expanded view is visible
* Defaults to false
* @default false
*/
isExpanded?: boolean;
}
}
export module exporter {
@@ -3418,7 +3430,7 @@ declare module uiGrid {
}
export type IGridRow = IGridRowOf<any>;
export interface IGridRowOf<TEntity> extends cellNav.IGridRow, edit.IGridRow, exporter.IGridRow,
selection.IGridRow {
selection.IGridRow, expandable.IGridRow {
/** A reference to an item in gridOptions.data[] */
entity: TEntity;
/** A reference back to the grid */
+128 -2
View File
@@ -17,9 +17,135 @@ var list = [[0, 1], [2, 3], [4, 5]];
//var flat = _.reduceRight(list, (a, b) => a.concat(b), []); // https://typescript.codeplex.com/workitem/1960
var flat = _.reduceRight<number[], number[]>(list, (a, b) => a.concat(b), []);
var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
module TestFind {
let array: {a: string}[] = [{a: 'a'}, {a: 'b'}];
let list: _.List<{a: string}> = {0: {a: 'a'}, 1: {a: 'b'}, length: 2};
let dict: _.Dictionary<{a: string}> = {a: {a: 'a'}, b: {a: 'b'}};
let context = {};
var firstCapitalLetter = _.find({ a: 'a', b: 'B', c: 'C', d: 'd' }, l => l === l.toUpperCase());
{
let iterator = (value: {a: string}, index: number, list: _.List<{a: string}>) => value.a === 'b';
let result: {a: string};
result = _.find<{a: string}>(array, iterator);
result = _.find<{a: string}>(array, iterator, context);
result = _.find<{a: string}, {a: string}>(array, {a: 'b'});
result = _.find<{a: string}>(array, 'a');
result = _(array).find<{a: string}>(iterator);
result = _(array).find<{a: string}>(iterator, context);
result = _(array).find<{a: string}, {a: string}>({a: 'b'});
result = _(array).find<{a: string}>('a');
result = _(array).chain().find<{a: string}>(iterator).value();
result = _(array).chain().find<{a: string}>(iterator, context).value();
result = _(array).chain().find<{a: string}, {a: string}>({a: 'b'}).value();
result = _(array).chain().find<{a: string}>('a').value();
result = _.find<{a: string}>(list, iterator);
result = _.find<{a: string}>(list, iterator, context);
result = _.find<{a: string}, {a: string}>(list, {a: 'b'});
result = _.find<{a: string}>(list, 'a');
result = _(list).find<{a: string}>(iterator);
result = _(list).find<{a: string}>(iterator, context);
result = _(list).find<{a: string}, {a: string}>({a: 'b'});
result = _(list).find<{a: string}>('a');
result = _(list).chain().find<{a: string}>(iterator).value();
result = _(list).chain().find<{a: string}>(iterator, context).value();
result = _(list).chain().find<{a: string}, {a: string}>({a: 'b'}).value();
result = _(list).chain().find<{a: string}>('a').value();
result = _.detect<{a: string}>(array, iterator);
result = _.detect<{a: string}>(array, iterator, context);
result = _.detect<{a: string}, {a: string}>(array, {a: 'b'});
result = _.detect<{a: string}>(array, 'a');
result = _(array).detect<{a: string}>(iterator);
result = _(array).detect<{a: string}>(iterator, context);
result = _(array).detect<{a: string}, {a: string}>({a: 'b'});
result = _(array).detect<{a: string}>('a');
result = _(array).chain().detect<{a: string}>(iterator).value();
result = _(array).chain().detect<{a: string}>(iterator, context).value();
result = _(array).chain().detect<{a: string}, {a: string}>({a: 'b'}).value();
result = _(array).chain().detect<{a: string}>('a').value();
result = _.detect<{a: string}>(list, iterator);
result = _.detect<{a: string}>(list, iterator, context);
result = _.detect<{a: string}, {a: string}>(list, {a: 'b'});
result = _.detect<{a: string}>(list, 'a');
result = _(list).detect<{a: string}>(iterator);
result = _(list).detect<{a: string}>(iterator, context);
result = _(list).detect<{a: string}, {a: string}>({a: 'b'});
result = _(list).detect<{a: string}>('a');
result = _(list).chain().detect<{a: string}>(iterator).value();
result = _(list).chain().detect<{a: string}>(iterator, context).value();
result = _(list).chain().detect<{a: string}, {a: string}>({a: 'b'}).value();
result = _(list).chain().detect<{a: string}>('a').value();
}
{
let iterator = (element: {a: string}, key: string, list: _.Dictionary<{a: string}>) => element.a === 'b';
let result: {a: string};
result = _.find<{a: string}>(dict, iterator);
result = _.find<{a: string}>(dict, iterator, context);
result = _.find<{a: string}, {a: string}>(dict, {a: 'b'});
result = _.find<{a: string}>(dict, 'a');
result = _(dict).find<{a: string}>(iterator);
result = _(dict).find<{a: string}>(iterator, context);
result = _(dict).find<{a: string}, {a: string}>({a: 'b'});
result = _(dict).find<{a: string}>('a');
result = _(dict).chain().find<{a: string}>(iterator).value();
result = _(dict).chain().find<{a: string}>(iterator, context).value();
result = _(dict).chain().find<{a: string}, {a: string}>({a: 'b'}).value();
result = _(dict).chain().find<{a: string}>('a').value();
result = _.detect<{a: string}>(dict, iterator);
result = _.detect<{a: string}>(dict, iterator, context);
result = _.detect<{a: string}, {a: string}>(dict, {a: 'b'});
result = _.detect<{a: string}>(dict, 'a');
result = _(dict).detect<{a: string}>(iterator);
result = _(dict).detect<{a: string}>(iterator, context);
result = _(dict).detect<{a: string}, {a: string}>({a: 'b'});
result = _(dict).detect<{a: string}>('a');
result = _(dict).chain().detect<{a: string}>(iterator).value();
result = _(dict).chain().detect<{a: string}>(iterator, context).value();
result = _(dict).chain().detect<{a: string}, {a: string}>({a: 'b'}).value();
result = _(dict).chain().detect<{a: string}>('a').value();
}
{
let iterator = (value: string, index: number, list: _.List<string>) => value === 'b';
let result: string;
result = _.find<string>('abc', iterator);
result = _.find<string>('abc', iterator, context);
result = _('abc').find<string>(iterator);
result = _('abc').find<string>(iterator, context);
result = _('abc').chain().find<string>(iterator).value();
result = _('abc').chain().find<string>(iterator, context).value();
result = _.detect<string>('abc', iterator);
result = _.detect<string>('abc', iterator, context);
result = _('abc').detect<string>(iterator);
result = _('abc').detect<string>(iterator, context);
result = _('abc').chain().detect<string>(iterator).value();
result = _('abc').chain().detect<string>(iterator, context).value();
}
}
var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
+72 -4
View File
@@ -254,6 +254,20 @@ interface UnderscoreStatic {
iterator: _.ObjectIterator<T, boolean>,
context?: any): T;
/**
* @see _.find
**/
find<T, U extends {}>(
object: _.List<T>|_.Dictionary<T>,
iterator: U): T;
/**
* @see _.find
**/
find<T>(
object: _.List<T>|_.Dictionary<T>,
iterator: string): T;
/**
* @see _.find
**/
@@ -270,6 +284,20 @@ interface UnderscoreStatic {
iterator: _.ObjectIterator<T, boolean>,
context?: any): T;
/**
* @see _.find
**/
detect<T, U extends {}>(
object: _.List<T>|_.Dictionary<T>,
iterator: U): T;
/**
* @see _.find
**/
detect<T>(
object: _.List<T>|_.Dictionary<T>,
iterator: string): T;
/**
* Looks through each value in the list, returning the index of the first one that passes a truth
* test (iterator). The function returns as soon as it finds an acceptable element,
@@ -1696,12 +1724,32 @@ interface Underscore<T> {
* Wrapped type `any[]`.
* @see _.find
**/
find(iterator: _.ListIterator<T, boolean>, context?: any): T;
find<T>(iterator: _.ListIterator<T, boolean>|_.ObjectIterator<T, boolean>, context?: any): T;
/**
* @see _.find
**/
detect(iterator: _.ListIterator<T, boolean>, context?: any): T;
find<T, U extends {}>(interator: U): T;
/**
* @see _.find
**/
find<T>(interator: string): T;
/**
* @see _.find
**/
detect<T>(iterator: _.ListIterator<T, boolean>|_.ObjectIterator<T, boolean>, context?: any): T;
/**
* @see _.find
**/
detect<T, U extends {}>(interator?: U): T;
/**
* @see _.find
**/
detect<T>(interator?: string): T;
/**
* Wrapped type `any[]`.
@@ -2554,12 +2602,32 @@ interface _Chain<T> {
* Wrapped type `any[]`.
* @see _.find
**/
find(iterator: _.ListIterator<T, boolean>, context?: any): _ChainSingle<T>;
find<T>(iterator: _.ListIterator<T, boolean>|_.ObjectIterator<T, boolean>, context?: any): _ChainSingle<T>;
/**
* @see _.find
**/
detect(iterator: _.ListIterator<T, boolean>, context?: any): _Chain<T>;
find<T, U extends {}>(interator: U): _ChainSingle<T>;
/**
* @see _.find
**/
find<T>(interator: string): _ChainSingle<T>;
/**
* @see _.find
**/
detect<T>(iterator: _.ListIterator<T, boolean>|_.ObjectIterator<T, boolean>, context?: any): _ChainSingle<T>;
/**
* @see _.find
**/
detect<T, U extends {}>(interator: U): _ChainSingle<T>;
/**
* @see _.find
**/
detect<T>(interator: string): _ChainSingle<T>;
/**
* Wrapped type `any[]`.
+7
View File
@@ -39,6 +39,13 @@ function test_fetchUrlWithRequestObject() {
handlePromise(window.fetch(request));
}
function test_globalFetchVar() {
fetch('http://test.com', {})
.then(response => {
// for test only
});
}
function handlePromise(promise: Promise<Response>) {
promise.then((response) => {
if (response.type === 'basic') {
+2
View File
@@ -83,3 +83,5 @@ declare type RequestInfo = Request|string;
interface Window {
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
}
declare var fetch: typeof window.fetch;