diff --git a/angular-growl-v2/angular-growl-v2-tests.ts b/angular-growl-v2/angular-growl-v2-tests.ts index c9297932e..fdb661161 100644 --- a/angular-growl-v2/angular-growl-v2-tests.ts +++ b/angular-growl-v2/angular-growl-v2-tests.ts @@ -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]); }); diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts index 039490e3d..a8e262071 100644 --- a/angular-growl-v2/angular-growl-v2.d.ts +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -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 // 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; + + } } diff --git a/angular-material/angular-material-tests.ts b/angular-material/angular-material-tests.ts index 238d906db..a9cd52437 100644 --- a/angular-material/angular-material-tests.ts +++ b/angular-material/angular-material-tests.ts @@ -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('Alert!')); }; $scope['confirmDialog'] = () => { - $mdDialog.show($mdDialog.confirm().content('Confirm!')); + $mdDialog.show($mdDialog.confirm().textContent('Confirm!')); + }; + $scope['confirmDialog'] = () => { + $mdDialog.show($mdDialog.confirm().htmlContent('Confirm!')); }; $scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide'); $scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel'); diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 3b9a896c9..54ef2507b 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -28,7 +28,8 @@ declare module angular.material { interface IPresetDialog { 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; diff --git a/argparse/argparse-tests.ts b/argparse/argparse-tests.ts new file mode 100644 index 000000000..bf565c5f5 --- /dev/null +++ b/argparse/argparse-tests.ts @@ -0,0 +1,306 @@ +/// +// 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(); diff --git a/argparse/argparse.d.ts b/argparse/argparse.d.ts new file mode 100644 index 000000000..7585015a2 --- /dev/null +++ b/argparse/argparse.d.ts @@ -0,0 +1,90 @@ +// Type definitions for argparse v1.0.3 +// Project: https://github.com/nodeca/argparse +// Definitions by: Andrew Schurman +// 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; + } +} diff --git a/boolify-string/boolify-string-tests.ts b/boolify-string/boolify-string-tests.ts new file mode 100644 index 000000000..1436a1aea --- /dev/null +++ b/boolify-string/boolify-string-tests.ts @@ -0,0 +1,61 @@ +/// + +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 diff --git a/boolify-string/boolify-string.d.ts b/boolify-string/boolify-string.d.ts new file mode 100644 index 000000000..d4ab286a5 --- /dev/null +++ b/boolify-string/boolify-string.d.ts @@ -0,0 +1,8 @@ +// Type definitions for boolify-string +// Project: https://github.com/sanemat/node-boolify-string +// Definitions by: Tobias Henöckl +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module "boolify-string" { + function boolifyString(obj: any): boolean; + export = boolifyString; +} diff --git a/c3/c3.d.ts b/c3/c3.d.ts index 160e0b169..7ff889073 100644 --- a/c3/c3.d.ts +++ b/c3/c3.d.ts @@ -1067,3 +1067,7 @@ declare module c3 { export function generate(config: ChartConfiguration): ChartAPI; } + +declare module "c3" { + export = c3; +} diff --git a/change-case/change-case-tests.ts b/change-case/change-case-tests.ts index 24276654c..2e80c8a0d 100644 --- a/change-case/change-case-tests.ts +++ b/change-case/change-case-tests.ts @@ -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); diff --git a/change-case/change-case.d.ts b/change-case/change-case.d.ts index e61d70de6..5551b4d3d 100644 --- a/change-case/change-case.d.ts +++ b/change-case/change-case.d.ts @@ -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; } diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index cab51f72c..efd0ecaf2 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -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; } diff --git a/cordova-plugin-app-version/cordova-plugin-app-version.d.ts b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts index a754368e3..8f4210eb8 100644 --- a/cordova-plugin-app-version/cordova-plugin-app-version.d.ts +++ b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts @@ -3,13 +3,14 @@ // Definitions by: Markus Wagner // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// interface Cordova { - getAppVersion: { - getAppName: () => Q.IPromise; - getPackageName: () => Q.IPromise; - getVersionCode: () => Q.IPromise; - getVersionNumber: () => Q.IPromise; + getAppVersion: { + getAppName: () => Q.IPromise | JQueryPromise; + getPackageName: () => Q.IPromise | JQueryPromise; + getVersionCode: () => Q.IPromise | JQueryPromise; + getVersionNumber: () => Q.IPromise | JQueryPromise; }; } \ No newline at end of file diff --git a/form-serializer/form-serializer-tests.ts b/form-serializer/form-serializer-tests.ts new file mode 100644 index 000000000..e262d0742 --- /dev/null +++ b/form-serializer/form-serializer-tests.ts @@ -0,0 +1,4 @@ +/// + +$("#form").serializeObject(); +$("#form").serializeJSON(); diff --git a/form-serializer/form-serializer.d.ts b/form-serializer/form-serializer.d.ts new file mode 100644 index 000000000..61f3b3b00 --- /dev/null +++ b/form-serializer/form-serializer.d.ts @@ -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 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; + +} diff --git a/gulp-rev/gulp-rev.d.ts b/gulp-rev/gulp-rev.d.ts index 6cd432b0d..e04a765b7 100644 --- a/gulp-rev/gulp-rev.d.ts +++ b/gulp-rev/gulp-rev.d.ts @@ -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 // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index bfcbc9137..33c3c9e75 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// function originalTests() { diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index c7ce6a2d4..94277ca25 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -3,8 +3,6 @@ // Definitions by: Damiano Gambarotto , Dan Lewi Harkestad // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// - interface HighchartsPosition { align?: string; verticalAlign?: string; diff --git a/highcharts/highstock-tests.ts b/highcharts/highstock-tests.ts index fac6fa676..5e7013f96 100644 --- a/highcharts/highstock-tests.ts +++ b/highcharts/highstock-tests.ts @@ -1,4 +1,5 @@ -/// +/// +/// 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 () { }] }); }); - diff --git a/highcharts/highstock.d.ts b/highcharts/highstock.d.ts index f5133c54a..a4560099b 100644 --- a/highcharts/highstock.d.ts +++ b/highcharts/highstock.d.ts @@ -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 // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts new file mode 100644 index 000000000..b49eb5078 --- /dev/null +++ b/intro.js/intro.js-tests.ts @@ -0,0 +1,54 @@ +/// + +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'); + }); diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts new file mode 100644 index 000000000..d54a5456e --- /dev/null +++ b/intro.js/intro.js.d.ts @@ -0,0 +1,70 @@ +// Type definitions for intro.js 1.0.0 +// Project: https://github.com/usablica/intro.js +// Definitions by: Maxime Fabre +// 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; +} diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index b596274f8..91bac2987 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -580,3 +580,23 @@ customActionResourceInstance.DSLoadRelations('myRelation'); customActionResourceInstance.DSRefresh(); customActionResourceInstance.DSSave(); customActionResourceInstance.DSUpdate(); + +/** + * Events + */ + +function myEvtHandler(definition:JSData.DSResourceDefinition, 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); diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index dbb9a3b44..54b3a77b6 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -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 extends DSResourceDefinitionConfiguration { + interface DSResourceDefinition extends DSResourceDefinitionConfiguration, DSEvents { changeHistory(id:string | number):Array; changes(id:string | number, options?:{ignoredChanges:Array}):Object; clear():Array>; @@ -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 { + export interface DSInstanceShorthands extends DSEvents { DSCompute():void; DSRefresh(options?:DSAdapterOperationConfiguration):JSDataPromise>; DSSave(options?:DSSaveConfiguration):JSDataPromise>; diff --git a/line-reader/line-reader-tests.ts b/line-reader/line-reader-tests.ts new file mode 100644 index 000000000..4d6ce4246 --- /dev/null +++ b/line-reader/line-reader-tests.ts @@ -0,0 +1,29 @@ +/// + +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(''); +}); diff --git a/line-reader/line-reader.d.ts b/line-reader/line-reader.d.ts new file mode 100644 index 000000000..f744dec6f --- /dev/null +++ b/line-reader/line-reader.d.ts @@ -0,0 +1,27 @@ +// Type definitions for line-reader +// Project: https://github.com/nickewing/line-reader +// Definitions by: Sam Saint-Pettersen +// 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; +} diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 85020b5df..6d047d3d0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1575,25 +1575,44 @@ module TestWithout { module TestXor { let array: TResult[]; let list: _.List; - let result: TResult[]; - result = _.xor(); + { + let result: TResult[]; - result = _.xor(array); - result = _.xor(array, list); - result = _.xor(array, list, array); + result = _.xor(); - result = _.xor(list); - result = _.xor(list, array); - result = _.xor(list, array, list); + result = _.xor(array); + result = _.xor(array, list); + result = _.xor(array, list, array); - result = _(array).xor().value(); - result = _(array).xor(list).value(); - result = _(array).xor(list, array).value(); + result = _.xor(list); + result = _.xor(list, array); + result = _.xor(list, array, list); + } - result = _(list).xor().value(); - result = _(list).xor(array).value(); - result = _(list).xor(array, list).value(); + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).xor(); + result = _(array).xor(list); + result = _(array).xor(list, array); + + result = _(list).xor(); + result = _(list).xor(array); + result = _(list).xor(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().xor(); + result = _(array).chain().xor(list); + result = _(array).chain().xor(list, array); + + result = _(list).chain().xor(); + result = _(list).chain().xor(array); + result = _(list).chain().xor(array, list); + } } result = _.zip(['moe', 'larry'], [30, 40], [true, false]); @@ -4164,8 +4183,34 @@ module TestAfter { } // _.ary -result = ['6', '8', '10'].map(_.ary<(s: string) => number>(parseInt, 1)); -result = ['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(func); + result = _.ary(func, 2); + result = _.ary(func); + result = _.ary(func, 2); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).ary(); + result = _(func).ary(2); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().ary(); + result = _(func).chain().ary(2); + } +} // _.backflow module TestBackflow { @@ -4371,9 +4416,36 @@ returnedThrottled(4); result = _.defer(function () { console.log('deferred'); }); result = <_.LoDashImplicitWrapper>_(function () { console.log('deferred'); }).defer(); -var log = _.bind(console.log, console); -result = _.delay(log, 1000, 'logged later'); -result = <_.LoDashImplicitWrapper>_(log).delay(1000, 'logged later'); +// _.delay +module TestDelay { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.delay(func, 1); + result = _.delay(func, 1, 2); + result = _.delay(func, 1, 2, ''); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).delay(1); + result = _(func).delay(1, 2); + result = _(func).delay(1, 2, ''); + } + + { + let result: _.LoDashExplicitWrapper; + + 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 = _.gt(1, 2); -result = _(1).gt(2); -result = _([]).gt(2); -result = _({}).gt(2); +module TestGt { + { + let result: boolean; + + result = _.gt(any, any); + result = _(1).gt(any); + result = _([]).gt(any); + result = _({}).gt(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().gt(any); + result = _([]).chain().gt(any); + result = _({}).chain().gt(any); + } +} // _.gte module TestGte { @@ -4985,7 +5071,6 @@ result = _([]).isUndefined(); result = _({}).isUndefined(); // _.lt - module TestLt { { let result: boolean; @@ -5006,10 +5091,24 @@ module TestLt { } // _.lte -result = _.lte(1, 2); -result = _(1).lte(2); -result = _([]).lte(2); -result = _({}).lte(2); +module TestLte { + { + let result: boolean; + + result = _.lte(any, any); + result = _(1).lte(any); + result = _([]).lte(any); + result = _({}).lte(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().lte(any); + result = _([]).chain().lte(any); + result = _({}).chain().lte(any); + } +} // _.toArray module TestToArray { @@ -5972,13 +6071,48 @@ module TestForIn { } } -result = _.forInRight(new Dog('Dagny'), function (value, key) { - console.log(key); -}); +// _.forInRight +module TestForInRight { + type SampleObject = {a: number; b: string; c: boolean;}; -result = <_.LoDashImplicitObjectWrapper>_(new Dog('Dagny')).forInRight(function (value, key) { - console.log(key); -}); + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forInRight(dictionary); + result = _.forInRight(dictionary, dictionaryIterator); + result = _.forInRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forInRight(object); + result = _.forInRight(object, objectIterator); + result = _.forInRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forInRight(); + result = _(dictionary).forInRight(dictionaryIterator); + result = _(dictionary).forInRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forInRight(); + result = _(dictionary).chain().forInRight(dictionaryIterator); + result = _(dictionary).chain().forInRight(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; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forOwnRight(dictionary); + result = _.forOwnRight(dictionary, dictionaryIterator); + result = _.forOwnRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forOwnRight(object); + result = _.forOwnRight(object, objectIterator); + result = _.forOwnRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forOwnRight(); + result = _(dictionary).forOwnRight(dictionaryIterator); + result = _(dictionary).forOwnRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forOwnRight(); + result = _(dictionary).chain().forOwnRight(dictionaryIterator); + result = _(dictionary).chain().forOwnRight(dictionaryIterator, any); + } } -result = _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function (num, key) { - console.log(key); -}); - -result = <_.LoDashImplicitObjectWrapper>_({ '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(true).value(); } -class Stooge { - constructor( - public name: string, - public age: number - ) { } -} +// _.keys +module TestKeys { + let object: _.Dictionary; -result = _.keys({ 'one': 1, 'two': 2, 'three': 3 }); -result = _({ 'one': 1, 'two': 2, 'three': 3 }).keys().value(); + { + let result: string[]; + + result = _.keys(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keys(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keys(); + } +} result = _.keysIn({ 'one': 1, 'two': 2, 'three': 3 }); result = _({ 'one': 1, 'two': 2, 'three': 3 }).keysIn().value(); @@ -6138,43 +6314,80 @@ module TestMapKeys { let listIterator: (value: TResult, index: number, collection: _.List) => string; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => string; - let result: _.Dictionary; + { + let result: _.Dictionary; - result = _.mapKeys(array); - result = _.mapKeys(array, listIterator); - result = _.mapKeys(array, listIterator, any); - result = _.mapKeys(array, ''); - result = _.mapKeys(array, {}); + result = _.mapKeys(array); + result = _.mapKeys(array, listIterator); + result = _.mapKeys(array, listIterator, any); + result = _.mapKeys(array, ''); + result = _.mapKeys(array, '', any); + result = _.mapKeys(array, {}); - result = _.mapKeys(list); - result = _.mapKeys(list, listIterator); - result = _.mapKeys(list, listIterator, any); - result = _.mapKeys(list, ''); - result = _.mapKeys(list, {}); + result = _.mapKeys(list); + result = _.mapKeys(list, listIterator); + result = _.mapKeys(list, listIterator, any); + result = _.mapKeys(list, ''); + result = _.mapKeys(list, '', any); + result = _.mapKeys(list, {}); - result = _.mapKeys(dictionary); - result = _.mapKeys(dictionary, dictionaryIterator); - result = _.mapKeys(dictionary, dictionaryIterator, any); - result = _.mapKeys(dictionary, ''); - result = _.mapKeys(dictionary, {}); + result = _.mapKeys(dictionary); + result = _.mapKeys(dictionary, dictionaryIterator); + result = _.mapKeys(dictionary, dictionaryIterator, any); + result = _.mapKeys(dictionary, ''); + result = _.mapKeys(dictionary, '', any); + result = _.mapKeys(dictionary, {}); + } - result = _(array).mapKeys().value(); - result = _(array).mapKeys(listIterator).value(); - result = _(array).mapKeys(listIterator, any).value(); - result = _(array).mapKeys('').value(); - result = _(array).mapKeys<{}>({}).value(); + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(list).mapKeys().value(); - result = _(list).mapKeys(listIterator).value(); - result = _(list).mapKeys(listIterator, any).value(); - result = _(list).mapKeys('').value(); - result = _(list).mapKeys({}).value(); + result = _(array).mapKeys(); + result = _(array).mapKeys(listIterator); + result = _(array).mapKeys(listIterator, any); + result = _(array).mapKeys(''); + result = _(array).mapKeys('', any); + result = _(array).mapKeys<{}>({}); - result = _(dictionary).mapKeys().value(); - result = _(dictionary).mapKeys(dictionaryIterator).value(); - result = _(dictionary).mapKeys(dictionaryIterator, any).value(); - result = _(dictionary).mapKeys('').value(); - result = _(dictionary).mapKeys({}).value(); + result = _(list).mapKeys(); + result = _(list).mapKeys(listIterator); + result = _(list).mapKeys(listIterator, any); + result = _(list).mapKeys(''); + result = _(list).mapKeys('', any); + result = _(list).mapKeys({}); + + result = _(dictionary).mapKeys(); + result = _(dictionary).mapKeys(dictionaryIterator); + result = _(dictionary).mapKeys(dictionaryIterator, any); + result = _(dictionary).mapKeys(''); + result = _(dictionary).mapKeys('', any); + result = _(dictionary).mapKeys({}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().mapKeys(); + result = _(array).chain().mapKeys(listIterator); + result = _(array).chain().mapKeys(listIterator, any); + result = _(array).chain().mapKeys(''); + result = _(array).chain().mapKeys('', any); + result = _(array).chain().mapKeys<{}>({}); + + result = _(list).chain().mapKeys(); + result = _(list).chain().mapKeys(listIterator); + result = _(list).chain().mapKeys(listIterator, any); + result = _(list).chain().mapKeys(''); + result = _(list).chain().mapKeys('', any); + result = _(list).chain().mapKeys({}); + + result = _(dictionary).chain().mapKeys(); + result = _(dictionary).chain().mapKeys(dictionaryIterator); + result = _(dictionary).chain().mapKeys(dictionaryIterator, any); + result = _(dictionary).chain().mapKeys(''); + result = _(dictionary).chain().mapKeys('', any); + result = _(dictionary).chain().mapKeys({}); + } } // _.merge @@ -6434,16 +6647,27 @@ module TestTransform { } // _.values -class TestValues { - public a = 1; - public b = 2; - public c: string; +module TestValues { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.values(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).values(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().values(); + } } -TestValues.prototype.c = 'a'; -result = _.values(new TestValues()); -// → [1, 2] (iteration order is not guaranteed) -result = _(new TestValues()).values().value(); -// → [1, 2] (iteration order is not guaranteed) // _.valueIn class TestValueIn { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e1216dd47..e4e027fba 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2911,7 +2911,21 @@ declare module _ { /** * @see _.xor */ - xor(...arrays: List[]): LoDashImplicitArrayWrapper; + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; } //_.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(func: Function, n?: number, guard?: Object): TResult; + ary( + func: Function, + n?: number + ): TResult; + + ary( + func: T, + n?: number + ): TResult; } interface LoDashImplicitObjectWrapper { /** * @see _.ary */ - ary(n?: number, guard?: Object): LoDashImplicitObjectWrapper; + ary(n?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashExplicitObjectWrapper; } //_.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 it’s 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( + func: T, wait: number, - ...args: any[]): number; + ...args: any[] + ): number; } interface LoDashImplicitObjectWrapper { /** - * @see _.delay - **/ + * @see _.delay + */ delay( wait: number, - ...args: any[]): LoDashImplicitWrapper; + ...args: any[] + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashExplicitWrapper; } //_.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 { + interface LoDashImplicitWrapperBase { /** * @see _.gt */ gt(other: any): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): LoDashExplicitWrapper; + } + //_.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 { + interface LoDashImplicitWrapperBase { /** * @see _.lte */ lte(other: any): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): LoDashExplicitWrapper; + } + //_.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( + * 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( object: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.forInRight - **/ + * @see _.forInRight + */ forInRight( object: T, - callback?: ObjectIterator, - thisArg?: any): T; + iteratee?: ObjectIterator, + thisArg?: any + ): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.forInRight - **/ - forInRight( - callback: ObjectIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper; + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; } //_.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( + * 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( object: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + /** - * @see _.forOwnRight - **/ + * @see _.forOwnRight + */ forOwnRight( object: T, - callback?: ObjectIterator, - thisArg?: any): T; + iteratee?: ObjectIterator, + thisArg?: any + ): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.forOwnRight - **/ - forOwnRight( - callback: ObjectIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper; + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; } //_.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 { /** - * @see _.keys - **/ - keys(): LoDashImplicitArrayWrapper + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; } //_.keysIn @@ -10723,7 +10821,8 @@ declare module _ { */ mapKeys( object: List|Dictionary, - iteratee?: string + iteratee?: string, + thisArg?: any ): Dictionary; } @@ -10747,7 +10846,8 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string + iteratee?: string, + thisArg?: any ): LoDashImplicitObjectWrapper>; } @@ -10771,10 +10871,61 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string + iteratee?: string, + thisArg?: any ): LoDashImplicitObjectWrapper>; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + //_.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(object?: any): T[]; } interface LoDashImplicitObjectWrapper { /** - * @see _.values - **/ - values(): LoDashImplicitArrayWrapper; + * @see _.values + */ + values(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashExplicitArrayWrapper; } //_.valuesIn diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 8c3f7d953..641ce5fcf 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -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 ; // "http://material-ui.com/#/components/date-picker" - + element = ; + element = ; // "http://material-ui.com/#/components/dialog" let standardActions = [ diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index bad7c346f..4fb4861a2 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -306,6 +306,8 @@ declare namespace __MaterialUI { autoOk?: boolean; defaultDate?: Date; formatDate?: string; + hintText?: string; + floatingLabelText?: string; hideToolbarYearChange?: boolean; maxDate?: Date; minDate?: Date; diff --git a/ng-cordova/app-version-tests.ts b/ng-cordova/app-version-tests.ts new file mode 100644 index 000000000..b83fb9ebb --- /dev/null +++ b/ng-cordova/app-version-tests.ts @@ -0,0 +1,16 @@ +/// + +module ngCordova { + function test($cordovaAppVersion: IAppVersionService) { + + $cordovaAppVersion.getVersionNumber() + .then((versionNumber) => { + console.log(versionNumber.toLowerCase()); + }); + + $cordovaAppVersion.getVersionCode() + .then((versionCode) => { + console.log(versionCode.toLowerCase()); + }); + } +} diff --git a/ng-cordova/app-version.d.ts b/ng-cordova/app-version.d.ts new file mode 100644 index 000000000..b81c71b94 --- /dev/null +++ b/ng-cordova/app-version.d.ts @@ -0,0 +1,13 @@ +// Type definitions for ngCordova datepicker plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Jacques Kang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IAppVersionService { + getVersionNumber(): ng.IPromise; + getVersionCode(): ng.IPromise; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index 899452ad8..d79755679 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -13,3 +13,4 @@ /// /// /// +/// diff --git a/openpgp/openpgp.d.ts b/openpgp/openpgp.d.ts index 0ae8445a2..1384b3f29 100644 --- a/openpgp/openpgp.d.ts +++ b/openpgp/openpgp.d.ts @@ -1,4 +1,4 @@ -// Type definitions for openpgpjs +// Type definitions for openpgpjs // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // 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; + getPreferredHashAlgorithm(): string; + getPrimaryUser(): any; + getUserIds(): Array; + 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; -} \ No newline at end of file +} diff --git a/pixi.js/pixi.js-tests.ts b/pixi.js/pixi.js-tests.ts index 6a462fc2e..3d3098c38 100644 --- a/pixi.js/pixi.js-tests.ts +++ b/pixi.js/pixi.js-tests.ts @@ -1,5 +1,4 @@ /// - module basics { export class Basics { diff --git a/pixi.js/pixi.js.d.ts b/pixi.js/pixi.js.d.ts index d3f268d2f..5886fc419 100644 --- a/pixi.js/pixi.js.d.ts +++ b/pixi.js/pixi.js.d.ts @@ -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 // 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; -} \ No newline at end of file +} diff --git a/react-day-picker/react-day-picker-tests.tsx b/react-day-picker/react-day-picker-tests.tsx new file mode 100644 index 000000000..4889d51b7 --- /dev/null +++ b/react-day-picker/react-day-picker-tests.tsx @@ -0,0 +1,27 @@ +/// +/// + +import DayPicker2 from 'react-day-picker'; + +function isSunday(day: Date) { + return day.getDay() === 0; +} + +// make sure global variable version works +function MyComponent2() { + return +} + +// make sure imported version works +function MyComponent() { + return +} + +const localeUtils = { + formatMonthTitle: (d: Date) => 'month_title', + formatWeekdayShort: (i: number) => 'weekday_short', + formatWeekdayLong: (i: number) => 'weekday_long', + getFirstDayOfWeek: () => 0 +}; + +let element = diff --git a/react-day-picker/react-day-picker-tests.tsx.tscparams b/react-day-picker/react-day-picker-tests.tsx.tscparams new file mode 100644 index 000000000..0fa3ed717 --- /dev/null +++ b/react-day-picker/react-day-picker-tests.tsx.tscparams @@ -0,0 +1 @@ +--target es5 --noImplicitAny --jsx react diff --git a/react-day-picker/react-day-picker.d.ts b/react-day-picker/react-day-picker.d.ts new file mode 100644 index 000000000..8d45d0f49 --- /dev/null +++ b/react-day-picker/react-day-picker.d.ts @@ -0,0 +1,53 @@ +// Type definitions for react-day-picker +// Project: https://github.com/gpbl/react-day-picker +// Definitions by: Giampaolo Bellavite , Jason Killian +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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 { + showMonth(month: Date): void; + showPreviousMonth(): void; + showNextMonth(): void; + } +} diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 5430ed21e..60f8afd1a 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -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; @@ -573,12 +577,177 @@ declare namespace ReactNative { value?: string } - export interface TextInputStatic extends React.ComponentClass { + export interface TextInputStatic extends NativeComponent, React.ComponentClass { 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 { + export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, React.Props { /** * 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,
, android.view, etc. */ - export interface ViewStatic extends React.ComponentClass { + export interface ViewStatic extends NativeComponent, React.ComponentClass { } @@ -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 { - 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 { + fetch: () => Promise + + /** + * 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 { + + /** + * + * Available on all platforms. + * Asynchronously fetch a boolean to determine internet connectivity. + */ + isConnected: FetchableListenable + + //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 + + 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; - 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; ////////////////////////////////////////////////////////////////////////// diff --git a/react/react.d.ts b/react/react.d.ts index e3d0f43f7..d8f3d512d 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -448,6 +448,1235 @@ declare namespace __React { strokeOpacity?: number; strokeWidth?: number; + // Remaining properties auto-extracted from http://docs.webplatform.org. + // License: http://docs.webplatform.org/wiki/Template:CC-by-3.0 + /** + * Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. + */ + alignContent?: any; + + /** + * Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis. + */ + alignItems?: any; + + /** + * Allows the default alignment to be overridden for individual flex items. + */ + alignSelf?: any; + + /** + * This property allows precise alignment of elements, such as graphics, that do not have a baseline-table or lack the desired baseline in their baseline-table. With the alignment-adjust property, the position of the baseline identified by the alignment-baseline can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element. + */ + alignmentAdjust?: any; + + alignmentBaseline?: any; + + /** + * Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied. + */ + animationDelay?: any; + + /** + * Defines whether an animation should run in reverse on some or all cycles. + */ + animationDirection?: any; + + /** + * Specifies how many times an animation cycle should play. + */ + animationIterationCount?: any; + + /** + * Defines the list of animations that apply to the element. + */ + animationName?: any; + + /** + * Defines whether an animation is running or paused. + */ + animationPlayState?: any; + + /** + * Allows changing the style of any element to platform-based interface elements or vice versa. + */ + appearance?: any; + + /** + * Determines whether or not the “back” side of a transformed element is visible when facing the viewer. + */ + backfaceVisibility?: any; + + /** + * This property describes how the element's background images should blend with each other and the element's background color. + * The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough. + */ + backgroundBlendMode?: any; + + backgroundComposite?: any; + + /** + * Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients. + */ + backgroundImage?: any; + + /** + * Specifies what the background-position property is relative to. + */ + backgroundOrigin?: any; + + /** + * Sets the horizontal position of a background image. + */ + backgroundPositionX?: any; + + /** + * Background-repeat defines if and how background images will be repeated after they have been sized and positioned + */ + backgroundRepeat?: any; + + /** + * Obsolete - spec retired, not implemented. + */ + baselineShift?: any; + + /** + * Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior. + */ + behavior?: any; + + /** + * Shorthand property that defines the different properties of all four sides of an element's border in a single declaration. It can be used to set border-width, border-style and border-color, or a subset of these. + */ + border?: any; + + /** + * Defines the shape of the border of the bottom-left corner. + */ + borderBottomLeftRadius?: any; + + /** + * Defines the shape of the border of the bottom-right corner. + */ + borderBottomRightRadius?: any; + + /** + * Sets the width of an element's bottom border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderBottomWidth?: any; + + /** + * Border-collapse can be used for collapsing the borders between table cells + */ + borderCollapse?: any; + + /** + * The CSS border-color property sets the color of an element's four borders. This property can have from one to four values, made up of the elementary properties: • border-top-color + * • border-right-color + * • border-bottom-color + * • border-left-color The default color is the currentColor of each of these values. + * If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values, respectively. Providing three values sets the top, vertical, and bottom values, in that order. Four values set all for sides: top, right, bottom, and left, in that order. + */ + borderColor?: any; + + /** + * Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles). Works along with border-radius to specify the size of each corner effect. + */ + borderCornerShape?: any; + + /** + * The property border-image-source is used to set the image to be used instead of the border style. If this is set to none the border-style is used instead. + */ + borderImageSource?: any; + + /** + * The border-image-width CSS property defines the offset to use for dividing the border image in nine parts, the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge, bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges. + */ + borderImageWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width, border-left-style and border-left-color. + */ + borderLeft?: any; + + /** + * The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value, but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderLeftColor?: any; + + /** + * Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderLeftStyle?: any; + + /** + * Sets the width of an element's left border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderLeftWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's right border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the right border — border-right-width, border-right-style and border-right-color. + */ + borderRight?: any; + + /** + * Sets the color of an element's right border. This page explains the border-right-color value, but often you will find it more convenient to fix the border's right color as part of a shorthand set, either border-right or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderRightColor?: any; + + /** + * Sets the style of an element's right border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderRightStyle?: any; + + /** + * Sets the width of an element's right border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderRightWidth?: any; + + /** + * Specifies the distance between the borders of adjacent cells. + */ + borderSpacing?: any; + + /** + * Sets the style of an element's four borders. This property can have from one to four values. With only one value, the value will be applied to all four borders; otherwise, this works as a shorthand property for each of border-top-style, border-right-style, border-bottom-style, border-left-style, where each border style may be assigned a separate value. + */ + borderStyle?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's top border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the top border — border-top-width, border-top-style and border-top-color. + */ + borderTop?: any; + + /** + * Sets the color of an element's top border. This page explains the border-top-color value, but often you will find it more convenient to fix the border's top color as part of a shorthand set, either border-top or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderTopColor?: any; + + /** + * Sets the rounding of the top-left corner of the element. + */ + borderTopLeftRadius?: any; + + /** + * Sets the rounding of the top-right corner of the element. + */ + borderTopRightRadius?: any; + + /** + * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderTopStyle?: any; + + /** + * Sets the width of an element's top border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderTopWidth?: any; + + /** + * Sets the width of an element's four borders. This property can have from one to four values. This is a shorthand property for setting values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderWidth?: any; + + /** + * Obsolete. + */ + boxAlign?: any; + + /** + * Breaks a box into fragments creating new borders, padding and repeating backgrounds or lets it stay as a continuous box on a page break, column break, or, for inline elements, at a line break. + */ + boxDecorationBreak?: any; + + /** + * Deprecated + */ + boxDirection?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple. + */ + boxLineProgression?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object. + */ + boxLines?: any; + + /** + * Do not use. This property has been replaced by flex-order. + * Specifies the ordinal group that a child element of the object belongs to. This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group. + */ + boxOrdinalGroup?: any; + + /** + * The CSS break-after property allows you to force a break on multi-column layouts. More specifically, it allows you to force a break after an element. It allows you to determine if a break should occur, and what type of break it should be. The break-after CSS property describes how the page, column or region break behaves after the generated box. If there is no generated box, the property is ignored. + */ + breakAfter?: any; + + /** + * Control page/column/region breaks that fall above a block of content + */ + breakBefore?: any; + + /** + * Control page/column/region breaks that fall within a block of content + */ + breakInside?: any; + + /** + * The clear CSS property specifies if an element can be positioned next to or must be positioned below the floating elements that precede it in the markup. + */ + clear?: any; + + /** + * Deprecated; see clip-path. + * Lets you specify the dimensions of an absolutely positioned element that should be visible, and the element is clipped into this shape, and displayed. + */ + clip?: any; + + /** + * Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled. This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm, to use when filling the different parts of a graphics. + */ + clipRule?: any; + + /** + * The color property sets the color of an element's foreground content (usually text), accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a). + */ + color?: any; + + /** + * Specifies how to fill columns (balanced or sequential). + */ + columnFill?: any; + + /** + * The column-gap property controls the width of the gap between columns in multi-column elements. + */ + columnGap?: any; + + /** + * Sets the width, style, and color of the rule between columns. + */ + columnRule?: any; + + /** + * Specifies the color of the rule between columns. + */ + columnRuleColor?: any; + + /** + * Specifies the width of the rule between columns. + */ + columnRuleWidth?: any; + + /** + * The column-span CSS property makes it possible for an element to span across all columns when its value is set to all. An element that spans more than one column is called a spanning element. + */ + columnSpan?: any; + + /** + * Specifies the width of columns in multi-column elements. + */ + columnWidth?: any; + + /** + * This property is a shorthand property for setting column-width and/or column-count. + */ + columns?: any; + + /** + * The counter-increment property accepts one or more names of counters (identifiers), each one optionally followed by an integer which specifies the value by which the counter should be incremented (e.g. if the value is 2, the counter increases by 2 each time it is invoked). + */ + counterIncrement?: any; + + /** + * The counter-reset property contains a list of one or more names of counters, each one optionally followed by an integer (otherwise, the integer defaults to 0.) Each time the given element is invoked, the counters specified by the property are set to the given integer. + */ + counterReset?: any; + + /** + * The cue property specifies sound files (known as an "auditory icon") to be played by speech media agents before and after presenting an element's content; if only one file is specified, it is played both before and after. The volume at which the file(s) should be played, relative to the volume of the main element, may also be specified. The icon files may also be set separately with the cue-before and cue-after properties. + */ + cue?: any; + + /** + * The cue-after property specifies a sound file (known as an "auditory icon") to be played by speech media agents after presenting an element's content; the volume at which the file should be played may also be specified. The shorthand property cue sets cue sounds for both before and after the element is presented. + */ + cueAfter?: any; + + /** + * The direction CSS property specifies the text direction/writing direction. The rtl is used for Hebrew or Arabic text, the ltr is for other languages. + */ + direction?: any; + + /** + * This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties. + */ + display?: any; + + /** + * The ‘fill’ property paints the interior of the given graphical element. The area to be painted consists of any areas inside the outline of the shape. To determine the inside of the shape, all subpaths are considered, and the interior is determined according to the rules associated with the current value of the ‘fill-rule’ property. The zero-width geometric outline of a shape is included in the area to be painted. + */ + fill?: any; + + /** + * The ‘fill-rule’ property indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape. For a simple, non-intersecting path, it is intuitively clear what region lies "inside"; however, for a more complex path, such as a path that intersects itself or where one subpath encloses another, the interpretation of "inside" is not so obvious. + * The ‘fill-rule’ property provides two options for how the inside of a shape is determined: + */ + fillRule?: any; + + /** + * Applies various image processing effects. This property is largely unsupported. See Compatibility section for more information. + */ + filter?: any; + + /** + * Obsolete, do not use. This property has been renamed to align-items. + * Specifies the alignment (perpendicular to the layout axis defined by the flex-direction property) of child elements of the object. + */ + flexAlign?: any; + + /** + * The flex-basis CSS property describes the initial main size of the flex item before any free space is distributed according to the flex factors described in the flex property (flex-grow and flex-shrink). + */ + flexBasis?: any; + + /** + * The flex-direction CSS property describes how flex items are placed in the flex container, by setting the direction of the flex container's main axis. + */ + flexDirection?: any; + + /** + * The flex-flow CSS property defines the flex container's main and cross axis. It is a shorthand property for the flex-direction and flex-wrap properties. + */ + flexFlow?: any; + + /** + * Do not use. This property has been renamed to align-self + * Specifies the alignment (perpendicular to the layout axis defined by flex-direction) of child elements of the object. + */ + flexItemAlign?: any; + + /** + * Do not use. This property has been renamed to align-content. + * Specifies how a flexbox's lines align within the flexbox when there is extra space along the axis that is perpendicular to the axis defined by the flex-direction property. + */ + flexLinePack?: any; + + /** + * Gets or sets a value that specifies the ordinal group that a flexbox element belongs to. This ordinal value identifies the display order for the group. + */ + flexOrder?: any; + + /** + * Elements which have the style float are floated horizontally. These elements can move as far to the left or right of the containing element. All elements after the floating element will flow around it, but elements before the floating element are not impacted. If several floating elements are placed after each other, they will float next to each other as long as there is room. + */ + float?: any; + + /** + * Flows content from a named flow (specified by a corresponding flow-into) through selected elements to form a dynamic chain of layout regions. + */ + flowFrom?: any; + + /** + * The font property is shorthand that allows you to do one of two things: you can either set up six of the most mature font properties in one line, or you can set one of a choice of keywords to adopt a system font setting. + */ + font?: any; + + /** + * The font-family property allows one or more font family names and/or generic family names to be specified for usage on the selected element(s)' text. The browser then goes through the list; for each character in the selection it applies the first font family that has an available glyph for that character. + */ + fontFamily?: any; + + /** + * The font-kerning property allows contextual adjustment of inter-glyph spacing, i.e. the spaces between the characters in text. This property controls metric kerning - that utilizes adjustment data contained in the font. Optical Kerning is not supported as yet. + */ + fontKerning?: any; + + /** + * The font-size-adjust property adjusts the font-size of the fallback fonts defined with font-family, so that the x-height is the same no matter what font is used. This preserves the readability of the text when fallback happens. + */ + fontSizeAdjust?: any; + + /** + * Allows you to expand or condense the widths for a normal, condensed, or expanded font face. + */ + fontStretch?: any; + + /** + * The font-style property allows normal, italic, or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face. + */ + fontStyle?: any; + + /** + * This value specifies whether the user agent is allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces. + */ + fontSynthesis?: any; + + /** + * The font-variant property enables you to select the small-caps font within a font family. + */ + fontVariant?: any; + + /** + * Fonts can provide alternate glyphs in addition to default glyph for a character. This property provides control over the selection of these alternate glyphs. + */ + fontVariantAlternates?: any; + + /** + * Lays out one or more grid items bound by 4 grid lines. Shorthand for setting grid-column-start, grid-column-end, grid-row-start, and grid-row-end in a single declaration. + */ + gridArea?: any; + + /** + * Controls a grid item's placement in a grid area, particularly grid position and a grid span. Shorthand for setting grid-column-start and grid-column-end in a single declaration. + */ + gridColumn?: any; + + /** + * Controls a grid item's placement in a grid area as well as grid position and a grid span. The grid-column-end property (with grid-row-start, grid-row-end, and grid-column-start) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridColumnEnd?: any; + + /** + * Determines a grid item's placement by specifying the starting grid lines of a grid item's grid area . A grid item's placement in a grid area consists of a grid position and a grid span. See also ( grid-row-start, grid-row-end, and grid-column-end) + */ + gridColumnStart?: any; + + /** + * Gets or sets a value that indicates which row an element within a Grid should appear in. Shorthand for setting grid-row-start and grid-row-end in a single declaration. + */ + gridRow?: any; + + /** + * Determines a grid item’s placement by specifying the block-end. A grid item's placement in a grid area consists of a grid position and a grid span. The grid-row-end property (with grid-row-start, grid-column-start, and grid-column-end) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridRowEnd?: any; + + /** + * Specifies a row position based upon an integer location, string value, or desired row size. + * css/properties/grid-row is used as short-hand for grid-row-position and grid-row-position + */ + gridRowPosition?: any; + + gridRowSpan?: any; + + /** + * Specifies named grid areas which are not associated with any particular grid item, but can be referenced from the grid-placement properties. The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand. + */ + gridTemplateAreas?: any; + + /** + * Specifies (with grid-template-rows) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateColumns?: any; + + /** + * Specifies (with grid-template-columns) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateRows?: any; + + /** + * Sets the height of an element. The content area of the element height does not include the padding, border, and margin of the element. + */ + height?: any; + + /** + * Specifies the minimum number of characters in a hyphenated word + */ + hyphenateLimitChars?: any; + + /** + * Indicates the maximum number of successive hyphenated lines in an element. The ‘no-limit’ value means that there is no limit. + */ + hyphenateLimitLines?: any; + + /** + * Specifies the maximum amount of trailing whitespace (before justification) that may be left in a line before hyphenation is triggered to pull part of a word from the next line back up into the current one. + */ + hyphenateLimitZone?: any; + + /** + * Specifies whether or not words in a sentence can be split by the use of a manual or automatic hyphenation mechanism. + */ + hyphens?: any; + + imeMode?: any; + + layoutGrid?: any; + + layoutGridChar?: any; + + layoutGridLine?: any; + + layoutGridMode?: any; + + layoutGridType?: any; + + /** + * Sets the left edge of an element + */ + left?: any; + + /** + * The letter-spacing CSS property specifies the spacing behavior between text characters. + */ + letterSpacing?: any; + + /** + * Deprecated. Gets or sets line-breaking rules for text in selected languages such as Japanese, Chinese, and Korean. + */ + lineBreak?: any; + + /** + * Shorthand property that sets the list-style-type, list-style-position and list-style-image properties in one declaration. + */ + listStyle?: any; + + /** + * This property sets the image that will be used as the list item marker. When the image is available, it will replace the marker set with the 'list-style-type' marker. That also means that if the image is not available, it will show the style specified by list-style-property + */ + listStyleImage?: any; + + /** + * Specifies if the list-item markers should appear inside or outside the content flow. + */ + listStylePosition?: any; + + /** + * Specifies the type of list-item marker in a list. + */ + listStyleType?: any; + + /** + * The margin property is shorthand to allow you to set all four margins of an element at once. Its equivalent longhand properties are margin-top, margin-right, margin-bottom and margin-left. Negative values are also allowed. + */ + margin?: any; + + /** + * margin-bottom sets the bottom margin of an element. + */ + marginBottom?: any; + + /** + * margin-left sets the left margin of an element. + */ + marginLeft?: any; + + /** + * margin-right sets the right margin of an element. + */ + marginRight?: any; + + /** + * margin-top sets the top margin of an element. + */ + marginTop?: any; + + /** + * The marquee-direction determines the initial direction in which the marquee content moves. + */ + marqueeDirection?: any; + + /** + * The 'marquee-style' property determines a marquee's scrolling behavior. + */ + marqueeStyle?: any; + + /** + * This property is shorthand for setting mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-composite and mask-size. Omitted values are set to their original properties' initial values. + */ + mask?: any; + + /** + * This property is shorthand for setting mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, and mask-border-repeat. Omitted values are set to their original properties' initial values. + */ + maskBorder?: any; + + /** + * This property specifies how the images for the sides and the middle part of the mask image are scaled and tiled. The first keyword applies to the horizontal sides, the second one applies to the vertical ones. If the second keyword is absent, it is assumed to be the same as the first, similar to the CSS border-image-repeat property. + */ + maskBorderRepeat?: any; + + /** + * This property specifies inward offsets from the top, right, bottom, and left edges of the mask image, dividing it into nine regions: four corners, four edges, and a middle. The middle image part is discarded and treated as fully transparent black unless the fill keyword is present. The four values set the top, right, bottom and left offsets in that order, similar to the CSS border-image-slice property. + */ + maskBorderSlice?: any; + + /** + * Specifies an image to be used as a mask. An image that is empty, fails to download, is non-existent, or cannot be displayed is ignored and does not mask the element. + */ + maskBorderSource?: any; + + /** + * This property sets the width of the mask box image, similar to the CSS border-image-width property. + */ + maskBorderWidth?: any; + + /** + * Determines the mask painting area, which defines the area that is affected by the mask. The painted content of an element may be restricted to this area. + */ + maskClip?: any; + + /** + * For elements rendered as a single box, specifies the mask positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes box-decoration-break operates on to determine the mask positioning area(s). + */ + maskOrigin?: any; + + /** + * This property must not be used. It is no longer included in any standard or standard track specification, nor is it implemented in any browser. It is only used when the text-align-last property is set to size. It controls allowed adjustments of font-size to fit line content. + */ + maxFontSize?: any; + + /** + * Sets the maximum height for an element. It prevents the height of the element to exceed the specified value. If min-height is specified and is greater than max-height, max-height is overridden. + */ + maxHeight?: any; + + /** + * Sets the maximum width for an element. It limits the width property to be larger than the value specified in max-width. + */ + maxWidth?: any; + + /** + * Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width. + */ + minWidth?: any; + + /** + * The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient. + * Outlines differ from borders in the following ways: • Outlines do not take up space, they are drawn above the content. + * • Outlines may be non-rectangular. They are rectangular in Gecko/Firefox. Internet Explorer attempts to place the smallest contiguous outline around all elements or shapes that are indicated to have an outline. Opera draws a non-rectangular shape around a construct. + */ + outline?: any; + + /** + * The outline-color property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out. + */ + outlineColor?: any; + + /** + * The outline-offset property offsets the outline and draw it beyond the border edge. + */ + outlineOffset?: any; + + /** + * The overflow property controls how extra content exceeding the bounding box of an element is rendered. It can be used in conjunction with an element that has a fixed width and height, to eliminate text-induced page distortion. + */ + overflow?: any; + + /** + * Specifies the preferred scrolling methods for elements that overflow. + */ + overflowStyle?: any; + + /** + * The overflow-x property is a specific case of the generic overflow property. It controls how extra content exceeding the x-axis of the bounding box of an element is rendered. + */ + overflowX?: any; + + /** + * The padding optional CSS property sets the required padding space on one to four sides of an element. The padding area is the space between an element and its border. Negative values are not allowed but decimal values are permitted. The element size is treated as fixed, and the content of the element shifts toward the center as padding is increased. + * The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left). + */ + padding?: any; + + /** + * The padding-bottom CSS property of an element sets the padding space required on the bottom of an element. The padding area is the space between the content of the element and its border. Contrary to margin-bottom values, negative values of padding-bottom are invalid. + */ + paddingBottom?: any; + + /** + * The padding-left CSS property of an element sets the padding space required on the left side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-left values, negative values of padding-left are invalid. + */ + paddingLeft?: any; + + /** + * The padding-right CSS property of an element sets the padding space required on the right side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-right values, negative values of padding-right are invalid. + */ + paddingRight?: any; + + /** + * The padding-top CSS property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and its border. Contrary to margin-top values, negative values of padding-top are invalid. + */ + paddingTop?: any; + + /** + * The page-break-after property is supported in all major browsers. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakAfter?: any; + + /** + * The page-break-before property sets the page-breaking behavior before an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakBefore?: any; + + /** + * Sets the page-breaking behavior inside an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakInside?: any; + + /** + * The pause property determines how long a speech media agent should pause before and after presenting an element. It is a shorthand for the pause-before and pause-after properties. + */ + pause?: any; + + /** + * The pause-after property determines how long a speech media agent should pause after presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseAfter?: any; + + /** + * The pause-before property determines how long a speech media agent should pause before presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseBefore?: any; + + /** + * The perspective property defines how far an element is placed from the view on the z-axis, from the screen to the viewer. + * Perspective defines how an object is viewed. In graphic arts, perspective is the representation on a flat surface of what the viewer's eye would see in a 3D space. (See Wikipedia for more information about graphical perspective and for related illustrations.) + * The illusion of perspective on a flat surface, such as a computer screen, is created by projecting points on the flat surface as they would appear if the flat surface were a window through which the viewer was looking at the object. In discussion of virtual environments, this flat surface is called a projection plane. + */ + perspective?: any; + + /** + * The perspective-origin property establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element. + * When used with perspective, perspective-origin changes the appearance of an object, as if a viewer were looking at it from a different origin. An object appears differently if a viewer is looking directly at it versus looking at it from below, above, or from the side. Thus, the perspective-origin is like a vanishing point. + * The default value of perspective-origin is 50% 50%. This displays an object as if the viewer's eye were positioned directly at the center of the screen, both top-to-bottom and left-to-right. A value of 0% 0% changes the object as if the viewer was looking toward the top left angle. A value of 100% 100% changes the appearance as if viewed toward the bottom right angle. + */ + perspectiveOrigin?: any; + + /** + * The pointer-events property allows you to control whether an element can be the target for the pointing device (e.g, mouse, pen) events. + */ + pointerEvents?: any; + + /** + * The position property controls the type of positioning used by an element within its parent elements. The effect of the position property depends on a lot of factors, for example the position property of parent elements. + */ + position?: any; + + /** + * Obsolete: unsupported. + * This property determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line, so that its "ink" lines up with the first glyph in the line above and below. + */ + punctuationTrim?: any; + + /** + * Sets the type of quotation marks for embedded quotations. + */ + quotes?: any; + + /** + * Controls whether the last region in a chain displays additional 'overset' content according its default overflow property, or if it displays a fragment of content as if it were flowing into a subsequent region. + */ + regionFragment?: any; + + /** + * The rest-after property determines how long a speech media agent should pause after presenting an element's main content, before presenting that element's exit cue sound. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restAfter?: any; + + /** + * The rest-before property determines how long a speech media agent should pause after presenting an intro cue sound for an element, before presenting that element's main content. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restBefore?: any; + + /** + * Specifies the position an element in relation to the right side of the containing element. + */ + right?: any; + + rubyAlign?: any; + + rubyPosition?: any; + + /** + * Defines the alpha channel threshold used to extract a shape from an image. Can be thought of as a "minimum opacity" threshold; that is, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. + */ + shapeImageThreshold?: any; + + /** + * A future level of CSS Shapes will define a shape-inside property, which will define a shape to wrap content within the element. See Editor's Draft and CSSWG wiki page on next-level plans + */ + shapeInside?: any; + + /** + * Adds a margin to a shape-outside. In effect, defines a new shape that is the smallest contour around all the points that are the shape-margin distance outward perpendicular to each point on the underlying shape. For points where a perpendicular direction is not defined (e.g., a triangle corner), takes all points on a circle centered at the point and with a radius of the shape-margin distance. This property accepts only non-negative values. + */ + shapeMargin?: any; + + /** + * Declares a shape around which text should be wrapped, with possible modifications from the shape-margin property. The shape defined by shape-outside and shape-margin changes the geometry of a float element's float area. + */ + shapeOutside?: any; + + /** + * The speak property determines whether or not a speech synthesizer will read aloud the contents of an element. + */ + speak?: any; + + /** + * The speak-as property determines how the speech synthesizer interprets the content: words as whole words or as a sequence of letters, numbers as a numerical value or a sequence of digits, punctuation as pauses in speech or named punctuation characters. + */ + speakAs?: any; + + /** + * The tab-size CSS property is used to customise the width of a tab (U+0009) character. + */ + tabSize?: any; + + /** + * The 'table-layout' property controls the algorithm used to lay out the table cells, rows, and columns. + */ + tableLayout?: any; + + /** + * The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content. + */ + textAlign?: any; + + /** + * The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element. + */ + textAlignLast?: any; + + /** + * The text-decoration CSS property is used to set the text formatting to underline, overline, line-through or blink. + * underline and overline decorations are positioned under the text, line-through over it. + */ + textDecoration?: any; + + /** + * Sets the color of any text decoration, such as underlines, overlines, and strike throughs. + */ + textDecorationColor?: any; + + /** + * Sets what kind of line decorations are added to an element, such as underlines, overlines, etc. + */ + textDecorationLine?: any; + + textDecorationLineThrough?: any; + + textDecorationNone?: any; + + textDecorationOverline?: any; + + /** + * Specifies what parts of an element’s content are skipped over when applying any text decoration. + */ + textDecorationSkip?: any; + + /** + * This property specifies the style of the text decoration line drawn on the specified element. The intended meaning for the values are the same as those of the border-style-properties. + */ + textDecorationStyle?: any; + + textDecorationUnderline?: any; + + /** + * The text-emphasis property will apply special emphasis marks to the elements text. Slightly similar to the text-decoration property only that this property can have affect on the line-height. It also is noted that this is shorthand for text-emphasis-style and for text-emphasis-color. + */ + textEmphasis?: any; + + /** + * The text-emphasis-color property specifies the foreground color of the emphasis marks. + */ + textEmphasisColor?: any; + + /** + * The text-emphasis-style property applies special emphasis marks to an element's text. + */ + textEmphasisStyle?: any; + + /** + * This property helps determine an inline box's block-progression dimension, derived from the text-height and font-size properties for non-replaced elements, the height or the width for replaced elements, and the stacked block-progression dimension for inline-block elements. The block-progression dimension determines the position of the padding, border and margin for the element. + */ + textHeight?: any; + + /** + * Specifies the amount of space horizontally that should be left on the first line of the text of an element. This horizontal spacing is at the beginning of the first line and is in respect to the left edge of the containing block box. + */ + textIndent?: any; + + textJustifyTrim?: any; + + textKashidaSpace?: any; + + /** + * The text-line-through property is a shorthand property for text-line-through-style, text-line-through-color and text-line-through-mode. (Considered obsolete; use text-decoration instead.) + */ + textLineThrough?: any; + + /** + * Specifies the line colors for the line-through text decoration. + * (Considered obsolete; use text-decoration-color instead.) + */ + textLineThroughColor?: any; + + /** + * Sets the mode for the line-through text decoration, determining whether the text decoration affects the space characters or not. + * (Considered obsolete; use text-decoration-skip instead.) + */ + textLineThroughMode?: any; + + /** + * Specifies the line style for line-through text decoration. + * (Considered obsolete; use text-decoration-style instead.) + */ + textLineThroughStyle?: any; + + /** + * Specifies the line width for the line-through text decoration. + */ + textLineThroughWidth?: any; + + /** + * The text-overflow shorthand CSS property determines how overflowed content that is not displayed is signaled to the users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-mode and text-overflow-ellipsis + */ + textOverflow?: any; + + /** + * The text-overline property is the shorthand for the text-overline-style, text-overline-width, text-overline-color, and text-overline-mode properties. + */ + textOverline?: any; + + /** + * Specifies the line color for the overline text decoration. + */ + textOverlineColor?: any; + + /** + * Sets the mode for the overline text decoration, determining whether the text decoration affects the space characters or not. + */ + textOverlineMode?: any; + + /** + * Specifies the line style for overline text decoration. + */ + textOverlineStyle?: any; + + /** + * Specifies the line width for the overline text decoration. + */ + textOverlineWidth?: any; + + /** + * The text-rendering CSS property provides information to the browser about how to optimize when rendering text. Options are: legibility, speed or geometric precision. + */ + textRendering?: any; + + /** + * Obsolete: unsupported. + */ + textScript?: any; + + /** + * The CSS text-shadow property applies one or more drop shadows to the text and of an element. Each shadow is specified as an offset from the text, along with optional color and blur radius values. + */ + textShadow?: any; + + /** + * This property transforms text for styling purposes. (It has no effect on the underlying content.) + */ + textTransform?: any; + + /** + * Unsupported. + * This property will add a underline position value to the element that has an underline defined. + */ + textUnderlinePosition?: any; + + /** + * After review this should be replaced by text-decoration should it not? + * This property will set the underline style for text with a line value for underline, overline, and line-through. + */ + textUnderlineStyle?: any; + + /** + * This property specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the top edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). + */ + top?: any; + + /** + * Determines whether touch input may trigger default behavior supplied by the user agent, such as panning or zooming. + */ + touchAction?: any; + + /** + * CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space. Using this property, elements can be translated, rotated, scaled, and skewed. The value list may consist of 2D and/or 3D transform values. + */ + transform?: any; + + /** + * This property defines the origin of the transformation axes relative to the element to which the transformation is applied. + */ + transformOrigin?: any; + + /** + * This property allows you to define the relative position of the origin of the transformation grid along the z-axis. + */ + transformOriginZ?: any; + + /** + * This property specifies how nested elements are rendered in 3D space relative to their parent. + */ + transformStyle?: any; + + /** + * The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. It allows to define the transition between two states of an element. + */ + transition?: any; + + /** + * Defines when the transition will start. A value of ‘0s’ means the transition will execute as soon as the property is changed. Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset. + */ + transitionDelay?: any; + + /** + * The 'transition-duration' property specifies the length of time a transition animation takes to complete. + */ + transitionDuration?: any; + + /** + * The 'transition-property' property specifies the name of the CSS property to which the transition is applied. + */ + transitionProperty?: any; + + /** + * Sets the pace of action within a transition + */ + transitionTimingFunction?: any; + + /** + * The unicode-bidi CSS property specifies the level of embedding with respect to the bidirectional algorithm. + */ + unicodeBidi?: any; + + /** + * unicode-range allows you to set a specific range of characters to be downloaded from a font (embedded using @font-face) and made available for use on the current page. + */ + unicodeRange?: any; + + /** + * This is for all the high level UX stuff. + */ + userFocus?: any; + + /** + * For inputing user content + */ + userInput?: any; + + /** + * The vertical-align property controls how inline elements or text are vertically aligned compared to the baseline. If this property is used on table-cells it controls the vertical alignment of content of the table cell. + */ + verticalAlign?: any; + + /** + * The visibility property specifies whether the boxes generated by an element are rendered. + */ + visibility?: any; + + /** + * The voice-balance property sets the apparent position (in stereo sound) of the synthesized voice for spoken media. + */ + voiceBalance?: any; + + /** + * The voice-duration property allows the author to explicitly set the amount of time it should take a speech synthesizer to read an element's content, for example to allow the speech to be synchronized with other media. With a value of auto (the default) the length of time it takes to read the content is determined by the content itself and the voice-rate property. + */ + voiceDuration?: any; + + /** + * The voice-family property sets the speaker's voice used by a speech media agent to read an element. The speaker may be specified as a named character (to match a voice option in the speech reading software) or as a generic description of the age and gender of the voice. Similar to the font-family property for visual media, a comma-separated list of fallback options may be given in case the speech reader does not recognize the character name or cannot synthesize the requested combination of generic properties. + */ + voiceFamily?: any; + + /** + * The voice-pitch property sets pitch or tone (high or low) for the synthesized speech when reading an element; the pitch may be specified absolutely or relative to the normal pitch for the voice-family used to read the text. + */ + voicePitch?: any; + + /** + * The voice-range property determines how much variation in pitch or tone will be created by the speech synthesize when reading an element. Emphasized text, grammatical structures and punctuation may all be rendered as changes in pitch, this property determines how strong or obvious those changes are; large ranges are associated with enthusiastic or emotional speech, while small ranges are associated with flat or mechanical speech. + */ + voiceRange?: any; + + /** + * The voice-rate property sets the speed at which the voice synthesized by a speech media agent will read content. + */ + voiceRate?: any; + + /** + * The voice-stress property sets the level of vocal emphasis to be used for synthesized speech reading the element. + */ + voiceStress?: any; + + /** + * The voice-volume property sets the volume for spoken content in speech media. It replaces the deprecated volume property. + */ + voiceVolume?: any; + + /** + * The white-space property controls whether and how white space inside the element is collapsed, and whether lines may wrap at unforced "soft wrap" opportunities. + */ + whiteSpace?: any; + + /** + * Obsolete: unsupported. + */ + whiteSpaceTreatment?: any; + + /** + * Specifies the width of the content area of an element. The content area of the element width does not include the padding, border, and margin of the element. + */ + width?: any; + + /** + * The word-break property is often used when there is long generated content that is strung together without and spaces or hyphens to beak apart. A common case of this is when there is a long URL that does not have any hyphens. This case could potentially cause the breaking of the layout as it could extend past the parent element. + */ + wordBreak?: any; + + /** + * The word-spacing CSS property specifies the spacing behavior between "words". + */ + wordSpacing?: any; + + /** + * An alias of css/properties/overflow-wrap, word-wrap defines whether to break words when the content exceeds the boundaries of its container. + */ + wordWrap?: any; + + /** + * Specifies how exclusions affect inline content within block-level elements. Elements lay out their inline content in their content area but wrap around exclusion areas. + */ + wrapFlow?: any; + + /** + * Set the value that is used to offset the inner wrap shape from other shapes. Inline content that intersects a shape with this property will be pushed by this shape's margin. + */ + wrapMargin?: any; + + /** + * Obsolete and unsupported. Do not use. + * This CSS property controls the text when it reaches the end of the block in which it is enclosed. + */ + wrapOption?: any; + + /** + * writing-mode specifies if lines of text are laid out horizontally or vertically, and the direction which lines of text and blocks progress. + */ + writingMode?: any; + + [propertyName: string]: any; } diff --git a/request-promise/request-promise-tests.ts b/request-promise/request-promise-tests.ts index 347cca818..8c7840ad4 100644 --- a/request-promise/request-promise-tests.ts +++ b/request-promise/request-promise-tests.ts @@ -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', diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index 94e3d3152..d442e527f 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -19,12 +19,12 @@ declare module 'request-promise' { promise(): Promise; } - 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; + var requestPromise: request.RequestAPI; export = requestPromise; } diff --git a/request/request-tests.ts b/request/request-tests.ts index 2e878893b..1f638d864 100644 --- a/request/request-tests.ts +++ b/request/request-tests.ts @@ -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); diff --git a/request/request.d.ts b/request/request.d.ts index bba684856..d47ed5f9a 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -16,35 +16,40 @@ declare module 'request' { import fs = require('fs'); namespace request { - export interface RequestAPI { - defaults(options: TOptions): RequestAPI; + export interface RequestAPI { + + defaults(options: TOptions): RequestAPI; + defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi; + (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 extends RequestAPI { + + defaults(options: TOptions): DefaultUriUrlRequestApi; + (): 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; + var request: request.RequestAPI; export = request; } diff --git a/statuses/statuses.d.ts b/statuses/statuses.d.ts index 7aacc2f61..2347eba0e 100644 --- a/statuses/statuses.d.ts +++ b/statuses/statuses.d.ts @@ -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 // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index fe88fec4f..e89f180b9 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -130,3 +130,14 @@ anotherGridInstance.scrollTo(rowEntityToScrollTo, columnDefToScrollTo); var selectedRowEntities: Array = gridApi.selection.getSelectedRows(); var selectedGridRows: Array = 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(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index c6571435d..06d6314c0 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -1558,6 +1558,18 @@ declare module uiGrid { */ (row: IGridRowOf): 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; export interface IGridRowOf 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 */ diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 13410c23b..051e000d0 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -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(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) => value === 'b'; + let result: string; + + result = _.find('abc', iterator); + result = _.find('abc', iterator, context); + + result = _('abc').find(iterator); + result = _('abc').find(iterator, context); + + result = _('abc').chain().find(iterator).value(); + result = _('abc').chain().find(iterator, context).value(); + + result = _.detect('abc', iterator); + result = _.detect('abc', iterator, context); + + result = _('abc').detect(iterator); + result = _('abc').detect(iterator, context); + + result = _('abc').chain().detect(iterator).value(); + result = _('abc').chain().detect(iterator, context).value(); + } +} var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 7dea66a84..8cf98071b 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -254,6 +254,20 @@ interface UnderscoreStatic { iterator: _.ObjectIterator, context?: any): T; + /** + * @see _.find + **/ + find( + object: _.List|_.Dictionary, + iterator: U): T; + + /** + * @see _.find + **/ + find( + object: _.List|_.Dictionary, + iterator: string): T; + /** * @see _.find **/ @@ -270,6 +284,20 @@ interface UnderscoreStatic { iterator: _.ObjectIterator, context?: any): T; + /** + * @see _.find + **/ + detect( + object: _.List|_.Dictionary, + iterator: U): T; + + /** + * @see _.find + **/ + detect( + object: _.List|_.Dictionary, + 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 { * Wrapped type `any[]`. * @see _.find **/ - find(iterator: _.ListIterator, context?: any): T; + find(iterator: _.ListIterator|_.ObjectIterator, context?: any): T; /** * @see _.find **/ - detect(iterator: _.ListIterator, context?: any): T; + find(interator: U): T; + + /** + * @see _.find + **/ + find(interator: string): T; + + /** + * @see _.find + **/ + detect(iterator: _.ListIterator|_.ObjectIterator, context?: any): T; + + /** + * @see _.find + **/ + detect(interator?: U): T; + + /** + * @see _.find + **/ + detect(interator?: string): T; /** * Wrapped type `any[]`. @@ -2554,12 +2602,32 @@ interface _Chain { * Wrapped type `any[]`. * @see _.find **/ - find(iterator: _.ListIterator, context?: any): _ChainSingle; + find(iterator: _.ListIterator|_.ObjectIterator, context?: any): _ChainSingle; /** * @see _.find **/ - detect(iterator: _.ListIterator, context?: any): _Chain; + find(interator: U): _ChainSingle; + + /** + * @see _.find + **/ + find(interator: string): _ChainSingle; + + /** + * @see _.find + **/ + detect(iterator: _.ListIterator|_.ObjectIterator, context?: any): _ChainSingle; + + /** + * @see _.find + **/ + detect(interator: U): _ChainSingle; + + /** + * @see _.find + **/ + detect(interator: string): _ChainSingle; /** * Wrapped type `any[]`. diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index b6bae3066..75fead12d 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -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) { promise.then((response) => { if (response.type === 'basic') { diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index c6d95e87a..a1d82c55f 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -83,3 +83,5 @@ declare type RequestInfo = Request|string; interface Window { fetch(url: string|Request, init?: RequestInit): Promise; } + +declare var fetch: typeof window.fetch;