diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5292ba4bf..b8aecd835 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -125,6 +125,7 @@ All definitions files include a header with the author and editors, so at some p * [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee)) * [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov)) * [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn)) +* [htmlparser2](https://github.com/fb55/htmlparser2/) (by [James Roland Cabresos](https://github.com/staticfunction)) * [http-string-parser](https://github.com/apiaryio/http-string-parser) (by [MIZUNE Pine](https://github.com/pine613)) * [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac)) * [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter)) @@ -138,6 +139,7 @@ All definitions files include a header with the author and editors, so at some p * [IxJS (Interactive extensions)](https://github.com/Reactive-Extensions/IxJS) (by [Igor Oleinikov](https://github.com/Igorbek)) * [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/)) * [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Jasmine-data_driven_tests](https://github.com/gburghardt/jasmine-data_driven_tests) (by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon)) * [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac)) * [jDataView](https://github.com/jDataView/jDataView) (by [Ingvar Stepanyan](https://github.com/RReverser)) * [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel)) @@ -247,6 +249,7 @@ All definitions files include a header with the author and editors, so at some p * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) * [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee)) * [mongoose](http://mongoosejs.com/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [morgan](https://github.com/expressjs/morgan/) (by [James Roland Cabresos](https://github.com/staticfunction/)) * [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz)) * [msgpack.js](https://github.com/uupaa/msgpack.js) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki)) * [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov)) @@ -272,6 +275,7 @@ All definitions files include a header with the author and editors, so at some p * [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/)) * [Optimist](https://github.com/substack/node-optimist) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [passport-facebook](https://github.com/jaredhanson/passport-facebook) (by [James Roland Cabresos](https://github.com/staticfunction/)) * [passport-strategy](https://github.com/jaredhanson/passport-strategy) (by [Lior Mualem](https://github.com/liorm)) * [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame)) * [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin)) @@ -286,8 +290,10 @@ All definitions files include a header with the author and editors, so at some p * [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/)) * [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [ProgressJs](http://usablica.github.io/progress.js/) (by [Shunsuke Ohtani](https://github.com/zaneli)) +* [promise-pool](https://github.com/vilic/promise-pool) (by [VILIC VANE](https://github.com/vilic)) * [Q](https://github.com/kriskowal/q) (by Barrie Nemetchek, Andrew Gaspar) * [Q-io](https://github.com/kriskowal/q-io) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [q-retry](https://github.com/vilic/q-retry) (by [VILIC VANE](https://github.com/vilic)) * [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei)) * [Raven.js](https://github.com/getsentry/raven-js) (by [Santi Albo](https://github.com/santialbo)) * [Recaptcha.js](https://www.google.com/recaptcha) (by [Brent Jenkins](https://github.com/brentj73)) diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 081d35723..0f8eb5c57 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -13,6 +13,7 @@ declare module ng.ui { templateUrl?: any; templateProvider?: () => string; controller?: any; + controllerAs?: string; controllerProvider?: any; resolve?: {}; url?: string; diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index a1577856e..220a63dec 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -231,11 +231,11 @@ foo.then((x) => { }).then((x) => { // Object is inferred here x.a = 123; - //Try a promise + //Try a promise var y: ng.IPromise; - return y; + return y; }).then((x) => { - // x is infered to be a number, which is the resolved value of a promise + // x is infered to be a number, which is the resolved value of a promise x.toFixed(); }); @@ -281,252 +281,291 @@ test_IAttributes({ $attr: {} }); +class SampleDirective implements ng.IDirective { + public restrict = 'A'; + name = 'doh'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + post: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective(); + } + + link(scope: ng.IScope) { + + } +} + +class SampleDirective2 implements ng.IDirective { + public restrict = 'EAC'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + pre: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective2(); + } + + link(scope: ng.IScope) { + + } +} + +angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); + // test from https://docs.angularjs.org/guide/directive angular.module('docsSimpleDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - template: 'Name: {{customer.name}} Address: {{customer.address}}' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + template: 'Name: {{customer.name}} Address: {{customer.address}}' + }; + }); angular.module('docsTemplateUrlDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - templateUrl: 'my-customer.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + templateUrl: 'my-customer.html' + }; + }); angular.module('docsRestrictDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); angular.module('docsScopeProblemExample', []) - .controller('NaomiController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .controller('IgorController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Igor', - address: '123 Somewhere' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); + .controller('NaomiController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .controller('IgorController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Igor', + address: '123 Somewhere' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); angular.module('docsIsolateScopeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.igor = { name: 'Igor', address: '123 Somewhere' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-iso.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.igor = { name: 'Igor', address: '123 Somewhere' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-iso.html' + }; + }); angular.module('docsIsolationExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-plus-vojta.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-plus-vojta.html' + }; + }); angular.module('docsTimeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.format = 'M/d/yy h:mm:ss a'; - }]) - .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any): ng.IDirective { + .controller('Controller', ['$scope', function($scope: any) { + $scope.format = 'M/d/yy h:mm:ss a'; + }]) + .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) { - return { - link: function(scope: any, element: any, attrs: any) { - var format: any, - timeoutId: any; + return { + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) { + var format: any, + timeoutId: any; - function updateTime() { - element.text(dateFilter(new Date(), format)); - } + function updateTime() { + element.text(dateFilter(new Date(), format)); + } - scope.$watch(attrs.myCurrentTime, function (value: any) { - format = value; - updateTime(); - }); + scope.$watch(attrs['myCurrentTime'], function (value: any) { + format = value; + updateTime(); + }); - element.on('$destroy', function () { - $interval.cancel(timeoutId); - }); + element.on('$destroy', function () { + $interval.cancel(timeoutId); + }); - // start the UI update process; save the timeoutId for canceling - timeoutId = $interval(function () { - updateTime(); // update DOM - }, 1000); - } - }; - }]); + // start the UI update process; save the timeoutId for canceling + timeoutId = $interval(function () { + updateTime(); // update DOM + }, 1000); + } + }; + }]); angular.module('docsTransclusionDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - templateUrl: 'my-dialog.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + templateUrl: 'my-dialog.html' + }; + }); angular.module('docsTransclusionExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - templateUrl: 'my-dialog.html', - link: function (scope: any, element: any) { - scope.name = 'Jeff'; - } - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + templateUrl: 'my-dialog.html', + link: function (scope: ng.IScope, element: ng.IAugmentedJQuery) { + scope['name'] = 'Jeff'; + } + }; + }); angular.module('docsIsoFnBindExample', []) - .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { - $scope.name = 'Tobias'; - $scope.hideDialog = function () { - $scope.dialogIsHidden = true; - $timeout(function () { - $scope.dialogIsHidden = false; - }, 2000); - }; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: { - 'close': '&onClose' - }, - templateUrl: 'my-dialog-close.html' - }; - }); + .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { + $scope.name = 'Tobias'; + $scope.hideDialog = function () { + $scope.dialogIsHidden = true; + $timeout(function () { + $scope.dialogIsHidden = false; + }, 2000); + }; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: { + 'close': '&onClose' + }, + templateUrl: 'my-dialog-close.html' + }; + }); angular.module('dragModule', []) - .directive('myDraggable', ['$document', function($document: any) { - return function(scope: any, element: any, attr: any) { - var startX = 0, startY = 0, x = 0, y = 0; + .directive('myDraggable', ['$document', function($document: any) { + return function(scope: any, element: any, attr: any) { + var startX = 0, startY = 0, x = 0, y = 0; - element.css({ - position: 'relative', - border: '1px solid red', - backgroundColor: 'lightgrey', - cursor: 'pointer' - }); + element.css({ + position: 'relative', + border: '1px solid red', + backgroundColor: 'lightgrey', + cursor: 'pointer' + }); - element.on('mousedown', function(event: any) { - // Prevent default dragging of selected content - event.preventDefault(); - startX = event.pageX - x; - startY = event.pageY - y; - $document.on('mousemove', mousemove); - $document.on('mouseup', mouseup); - }); + element.on('mousedown', function(event: any) { + // Prevent default dragging of selected content + event.preventDefault(); + startX = event.pageX - x; + startY = event.pageY - y; + $document.on('mousemove', mousemove); + $document.on('mouseup', mouseup); + }); - function mousemove(event: any) { - y = event.pageY - startY; - x = event.pageX - startX; - element.css({ - top: y + 'px', - left: x + 'px' - }); - } + function mousemove(event: any) { + y = event.pageY - startY; + x = event.pageX - startX; + element.css({ + top: y + 'px', + left: x + 'px' + }); + } - function mouseup() { - $document.off('mousemove', mousemove); - $document.off('mouseup', mouseup); - } - }; - }]); + function mouseup() { + $document.off('mousemove', mousemove); + $document.off('mouseup', mouseup); + } + }; + }]); angular.module('docsTabsExample', []) - .directive('myTabs', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - controller: function($scope: any) { - var panes: any = $scope.panes = []; + .directive('myTabs', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + controller: function($scope: ng.IScope) { + var panes: any = $scope['panes'] = []; - $scope.select = function(pane: any) { - angular.forEach(panes, function(pane: any) { - pane.selected = false; - }); - pane.selected = true; - }; + $scope['select'] = function(pane: any) { + angular.forEach(panes, function(pane: any) { + pane.selected = false; + }); + pane.selected = true; + }; - this.addPane = function(pane: any) { - if (panes.length === 0) { - $scope.select(pane); - } - panes.push(pane); - }; - }, - templateUrl: 'my-tabs.html' - }; - }) - .directive('myPane', function() { - return { - require: '^myTabs', - restrict: 'E', - transclude: true, - scope: { - title: '@' - }, - link: function(scope, element, attrs, tabsCtrl) { - tabsCtrl.addPane(scope); - }, - templateUrl: 'my-pane.html' - }; - }); + this.addPane = function(pane: any) { + if (panes.length === 0) { + $scope['select'](pane); + } + panes.push(pane); + }; + }, + templateUrl: 'my-tabs.html' + }; + }) + .directive('myPane', function() { + return { + require: '^myTabs', + restrict: 'E', + transclude: true, + scope: { + title: '@' + }, + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { + tabsCtrl.addPane(scope); + }, + templateUrl: 'my-pane.html' + }; + }); diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index e447985fb..cacf7647b 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -312,10 +312,10 @@ declare module ng { } /////////////////////////////////////////////////////////////////////////// - // Scope - // see http://docs.angularjs.org/api/ng.$rootScope.Scope + // Scope and RootScope + // see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and http://docs.angularjs.org/api/ng.$rootScope /////////////////////////////////////////////////////////////////////////// - interface IScope { + interface IRootScopeService { $apply(): any; $apply(exp: string): any; $apply(exp: (scope: IScope) => any): any; @@ -352,6 +352,7 @@ declare module ng { $parent: IScope; $root: IRootScopeService; + this: IRootScopeService; $id: string; @@ -360,6 +361,10 @@ declare module ng { $$phase: any; } + interface IScope extends IRootScopeService { + [index: string]: any; + } + interface IAngularEvent { targetScope: IScope; currentScope: IScope; @@ -962,12 +967,6 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface ITemplateCacheService extends ICacheObject {} - /////////////////////////////////////////////////////////////////////////// - // RootScopeService - // see http://docs.angularjs.org/api/ng.$rootScope - /////////////////////////////////////////////////////////////////////////// - interface IRootScopeService extends IScope {} - /////////////////////////////////////////////////////////////////////////// // SCEService // see http://docs.angularjs.org/api/ng.$sce @@ -1031,22 +1030,34 @@ declare module ng { (...args: any[]): IDirective; } - - interface IDirective{ - compile?: - (templateElement: IAugmentedJQuery, - templateAttributes: IAttributes, - transclude: ITranscludeFunction - ) => any; - controller?: any; - controllerAs?: string; - link?: - (scope: IScope, + interface IDirectiveLinkFn { + ( + scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes, controller: any, transclude: ITranscludeFunction - ) => void; + ): void; + } + + interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; + } + + interface IDirectiveCompileFn { + ( + templateElement: IAugmentedJQuery, + templateAttributes: IAttributes, + transclude: ITranscludeFunction + ): IDirectivePrePost; + } + + interface IDirective { + compile?: IDirectiveCompileFn; + controller?: any; + controllerAs?: string; + link?: IDirectiveLinkFn; name?: string; priority?: number; replace?: boolean; diff --git a/d3/d3.d.ts b/d3/d3.d.ts old mode 100755 new mode 100644 index 8f66f47a6..2229fa8a4 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -848,14 +848,18 @@ declare module D3 { values(): Array; entries(): Array; forEach(func: (key: string, value: any) => void ): void; + empty(): boolean; + size(): number; } - export interface Set{ + export interface Set { has(value: any): boolean; - add(value: any): any; + add(value: T): T; remove(value: any): boolean; values(): Array; forEach(func: (value: any) => void ): void; + empty(): boolean; + size(): number; } export interface Random { @@ -1492,7 +1496,7 @@ declare module D3 { /** * increase lightness by some exponential factor (gamma) */ - brighter(k: number): Color; + brighter(k?: number): Color; /** * decrease lightness by some exponential factor (gamma) */ @@ -2518,21 +2522,23 @@ declare module D3 { threshold(): ThresholdScale; } - export interface Scale { + export interface GenericScale { (value: any): any; domain: { - (values: any[]): Scale; + (values: any[]): S; (): any[]; }; range: { - (values: any[]): Scale; + (values: any[]): S; (): any[]; }; invertExtent?(y: any): any[]; - copy(): Scale; + copy(): S; } - export interface QuantitativeScale extends Scale { + export interface Scale extends GenericScale { } + + export interface GenericQuantitativeScale extends GenericScale { /** * Get the range value corresponding to a given domain value. * @@ -2546,47 +2552,17 @@ declare module D3 { */ invert(value: number): number; /** - * Get or set the scale's input domain. - */ - domain: { - /** - * Set the scale's input domain. - * - * @param value The input domain - */ - (values: any[]): QuantitativeScale; - /** - * Get the scale's input domain. - */ - (): any[]; - }; - /** - * get or set the scale's output range. - */ - range: { - /** - * Set the scale's output range. - * - * @param value The output range. - */ - (values: any[]): QuantitativeScale; - /** - * Get the scale's output range. - */ - (): any[]; - }; - /** * Set the scale's output range, and enable rounding. * * @param value The output range. */ - rangeRound: (values: any[]) => QuantitativeScale; + rangeRound: (values: any[]) => S; /** * get or set the scale's output interpolator. */ interpolate: { (): D3.Transition.Interpolate; - (factory: D3.Transition.Interpolate): QuantitativeScale; + (factory: D3.Transition.Interpolate): S; }; /** * enable or disable clamping of the output range. @@ -2595,14 +2571,14 @@ declare module D3 { */ clamp: { (): boolean; - (clamp: boolean): QuantitativeScale; + (clamp: boolean): S; } /** * extend the scale domain to nice round numbers. * * @param count Optional number of ticks to exactly fit the domain */ - nice(count?: number): QuantitativeScale; + nice(count?: number): S; /** * get representative values from the input domain. * @@ -2615,22 +2591,13 @@ declare module D3 { * @param count Aproximate representative values to return */ tickFormat(count: number, format?: string): (n: number) => string; - /** - * create a new scale from an existing scale.. - */ - copy(): QuantitativeScale; } - export interface LinearScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface QuantitativeScale extends GenericQuantitativeScale { } - export interface IdentityScale extends Scale { + export interface LinearScale extends GenericQuantitativeScale { } + + export interface IdentityScale extends GenericScale { /** * Get the range value corresponding to a given domain value. * @@ -2657,132 +2624,31 @@ declare module D3 { tickFormat(count: number): (n: number) => string; } - export interface SqrtScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface SqrtScale extends GenericQuantitativeScale { } - export interface PowScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface PowScale extends GenericQuantitativeScale { } - export interface LogScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface LogScale extends GenericQuantitativeScale { } - export interface OrdinalScale extends Scale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: any): any; - /** - * Get or set the scale's input domain. - */ - domain: { - /** - * Set the scale's input domain. - * - * @param value The input domain - */ - (values: any[]): OrdinalScale; - /** - * Get the scale's input domain. - */ - (): any[]; - }; - /** - * get or set the scale's output range. - */ - range: { - /** - * Set the scale's output range. - * - * @param value The output range. - */ - (values: any[]): OrdinalScale; - /** - * Get the scale's output range. - */ - (): any[]; - }; + export interface OrdinalScale extends GenericScale { rangePoints(interval: any[], padding?: number): OrdinalScale; rangeBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; rangeRoundBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; rangeBand(): number; rangeExtent(): any[]; - /** - * create a new scale from an existing scale.. - */ - copy(): OrdinalScale; } - export interface QuantizeScale extends Scale { - (value: any): any; - domain: { - (values: number[]): QuantizeScale; - (): any[]; - }; - range: { - (values: any[]): QuantizeScale; - (): any[]; - }; - copy(): QuantizeScale; - } + export interface QuantizeScale extends GenericScale { } - export interface ThresholdScale extends Scale { - (value: any): any; - domain: { - (values: number[]): ThresholdScale; - (): any[]; - }; - range: { - (values: any[]): ThresholdScale; - (): any[]; - }; - copy(): ThresholdScale; - } + export interface ThresholdScale extends GenericScale { } - export interface QuantileScale extends Scale { - (value: any): any; - domain: { - (values: number[]): QuantileScale; - (): any[]; - }; - range: { - (values: any[]): QuantileScale; - (): any[]; - }; + export interface QuantileScale extends GenericScale { quantiles(): any[]; - copy(): QuantileScale; } - export interface TimeScale extends Scale { + export interface TimeScale extends GenericScale { (value: Date): number; invert(value: number): Date; - domain: { - (values: any[]): TimeScale; - (): any[]; - }; - range: { - (values: any[]): TimeScale; - (): any[]; - }; rangeRound: (values: any[]) => TimeScale; interpolate: { (): D3.Transition.Interpolate; @@ -2794,7 +2660,6 @@ declare module D3 { (range: D3.Time.Range, count: number): any[]; }; tickFormat(count: number): (n: number) => string; - copy(): TimeScale; nice(count?: number): TimeScale; } } @@ -3488,3 +3353,7 @@ declare module D3 { } declare var d3: D3.Base; + +declare module "d3" { + export = d3; +} diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index b18b17e96..5a5df2fa0 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -1,161 +1,173 @@ // Type definitions for express-validator // Project: https://github.com/ctavan/express-validator -// Definitions by: Nathan Ridley +// Definitions by: Nathan Ridley , Jonathan Häberle // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module ExpressValidator { - export interface ValidationError { - msg: string; - param: string; - } +/// - export interface RequestValidation { - check(field: string, message: string): Validator; - assert(field: string, message: string): Validator; - sanitize(field: string): Sanitizer; - onValidationError(func: (msg: string) => void): void; - } - - export interface Validator { - /** - * Alias for regex() - */ - is(): Validator; - /** - * Alias for notRegex() - */ - not(): Validator; - isEmail(): Validator; - /** - * Accepts http, https, ftp - */ - isUrl(): Validator; - /** - * Combines isIPv4 and isIPv6 - */ - isIP(): Validator; - isIPv4(): Validator; - isIPv6(): Validator; - isAlpha(): Validator; - isAlphanumeric(): Validator; - isNumeric(): Validator; - isHexadecimal(): Validator; - /** - * Accepts valid hexcolors with or without # prefix - */ - isHexColor(): Validator; - /** - * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't - */ - isInt(): Validator; - isLowercase(): Validator; - isUppercase(): Validator; - isDecimal(): Validator; - /** - * Alias for isDecimal - */ - isFloat(): Validator; - /** - * Check if length is 0 - */ - notNull(): Validator; - isNull(): Validator; - /** - * Not just whitespace (input.trim().length !== 0) - */ - notEmpty(): Validator; - equals(equals: any): Validator; - contains(str: string): Validator; - notContains(str: string): Validator; - /** - * Usage: regex(/[a-z]/i) or regex('[a-z]','i') - */ - regex(pattern: string, modifiers: string): Validator; - notRegex(pattern: string, modifiers: string): Validator; - /** - * max is optional - */ - len(min: number, max?: number): Validator; - /** - * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier - */ - isUUID(version: number): Validator; - /** - * Alias for isUUID(3) - */ - isUUIDv3(): Validator; - /** - * Alias for isUUID(4) - */ - isUUIDv4(): Validator; - /** - * Alias for isUUID(5) - */ - isUUIDv5(): Validator; - /** - * Uses Date.parse() - regex is probably a better choice - */ - isDate(): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isAfter(date: Date): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isBefore(date: Date): Validator; - isIn(options: string): Validator; - isIn(options: string[]): Validator; - notIn(options: string): Validator; - notIn(options: string[]): Validator; - max(val: string): Validator; - min(val: string): Validator; - /** - * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats - */ - isCreditCard(): Validator; - } - - interface Sanitizer { - /** - * Trim optional `chars`, default is to trim whitespace (\r\n\t ) - */ - trim(...chars: string[]): Sanitizer; - ltrim(...chars: string[]): Sanitizer; - rtrim(...chars: string[]): Sanitizer; - ifNull(replace: any): Sanitizer; - toFloat(): Sanitizer; - toInt(): Sanitizer; - /** - * True unless str = '0', 'false', or str.length == 0 - */ - toBoolean(): Sanitizer; - /** - * False unless str = '1' or 'true' - */ - toBooleanStrict(): Sanitizer; - /** - * Decode HTML entities - */ - entityDecode(): Sanitizer; - entityEncode(): Sanitizer; - /** - * Escape &, <, >, and " - */ - escape(): Sanitizer; - /** - * Remove common XSS attack vectors from user-supplied HTML - */ - xss(): Sanitizer; - /** - * Remove common XSS attack vectors from images - */ - xss(fromImages: boolean): Sanitizer; - } -} - -declare function ExpressValidator(): void; declare module "express-validator" { - export = ExpressValidator; + import express = require('express'); + + module ExpressValidator { + + export interface ValidationError { + msg: string; + param: string; + } + + export interface RequestValidation { + check(field:string, message:string): Validator; + assert(field:string, message:string): Validator; + sanitize(field:string): Sanitizer; + onValidationError(func:(msg:string) => void): void; + validationErrors() : any; + } + + export interface Validator { + /** + * Alias for regex() + */ + is(): Validator; + /** + * Alias for notRegex() + */ + not(): Validator; + isEmail(): Validator; + /** + * Accepts http, https, ftp + */ + isUrl(): Validator; + /** + * Combines isIPv4 and isIPv6 + */ + isIP(): Validator; + isIPv4(): Validator; + isIPv6(): Validator; + isAlpha(): Validator; + isAlphanumeric(): Validator; + isNumeric(): Validator; + isHexadecimal(): Validator; + /** + * Accepts valid hexcolors with or without # prefix + */ + isHexColor(): Validator; + /** + * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't + */ + isInt(): Validator; + isLowercase(): Validator; + isUppercase(): Validator; + isDecimal(): Validator; + /** + * Alias for isDecimal + */ + isFloat(): Validator; + /** + * Check if length is 0 + */ + notNull(): Validator; + isNull(): Validator; + /** + * Not just whitespace (input.trim().length !== 0) + */ + notEmpty(): Validator; + equals(equals:any): Validator; + contains(str:string): Validator; + notContains(str:string): Validator; + /** + * Usage: regex(/[a-z]/i) or regex('[a-z]','i') + */ + regex(pattern:string, modifiers:string): Validator; + notRegex(pattern:string, modifiers:string): Validator; + /** + * max is optional + */ + len(min:number, max?:number): Validator; + /** + * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier + */ + isUUID(version:number): Validator; + /** + * Alias for isUUID(3) + */ + isUUIDv3(): Validator; + /** + * Alias for isUUID(4) + */ + isUUIDv4(): Validator; + /** + * Alias for isUUID(5) + */ + isUUIDv5(): Validator; + /** + * Uses Date.parse() - regex is probably a better choice + */ + isDate(): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isAfter(date:Date): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isBefore(date:Date): Validator; + isIn(options:string): Validator; + isIn(options:string[]): Validator; + notIn(options:string): Validator; + notIn(options:string[]): Validator; + max(val:string): Validator; + min(val:string): Validator; + /** + * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats + */ + isCreditCard(): Validator; + } + + interface Sanitizer { + /** + * Trim optional `chars`, default is to trim whitespace (\r\n\t ) + */ + trim(...chars:string[]): Sanitizer; + ltrim(...chars:string[]): Sanitizer; + rtrim(...chars:string[]): Sanitizer; + ifNull(replace:any): Sanitizer; + toFloat(): Sanitizer; + toInt(): Sanitizer; + /** + * True unless str = '0', 'false', or str.length == 0 + */ + toBoolean(): Sanitizer; + /** + * False unless str = '1' or 'true' + */ + toBooleanStrict(): Sanitizer; + /** + * Decode HTML entities + */ + entityDecode(): Sanitizer; + entityEncode(): Sanitizer; + /** + * Escape &, <, >, and " + */ + escape(): Sanitizer; + /** + * Remove common XSS attack vectors from user-supplied HTML + */ + xss(): Sanitizer; + /** + * Remove common XSS attack vectors from images + */ + xss(fromImages:boolean): Sanitizer; + } + } + + /** + * + * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options + */ + function ExpressValidator(middlewareOptions?:any):express.RequestHandler; + + + export = ExpressValidator; } diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index eec70c8f6..cfca6c481 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -335,6 +335,7 @@ declare module fabric { drawBorders(context: CanvasRenderingContext2D): IObject; drawCorners(context: CanvasRenderingContext2D): IObject; get (property: string): any; + getBoundingRect(): {left:number; top:number; width:number; height:number}; getBoundingRectHeight(): number; getBoundingRectWidth(): number; getSvgStyles(): string; diff --git a/htmlparser2/htmlparser2-tests.ts b/htmlparser2/htmlparser2-tests.ts new file mode 100644 index 000000000..53f6ee2aa --- /dev/null +++ b/htmlparser2/htmlparser2-tests.ts @@ -0,0 +1,24 @@ +/// +/** + * Created by staticfunction on 8/4/14. + */ +import htmlparser = require("htmlparser2"); + +var parser = new htmlparser.Parser({ + onopentag: (name:string, attribs:{[s:string]:string}) => { + if(name === "script" && attribs['type'] === "text/javascript"){ + console.log("JS! Hooray!"); + } + }, + ontext: (text: string) => { + console.log("-->", text); + }, + onclosetag: (tagname:string) => { + if(tagname === "script"){ + console.log("That's it?!"); + } + } +}); + +parser.write("Xyz "); +parser.end(); diff --git a/htmlparser2/htmlparser2.d.ts b/htmlparser2/htmlparser2.d.ts new file mode 100644 index 000000000..77fb0b983 --- /dev/null +++ b/htmlparser2/htmlparser2.d.ts @@ -0,0 +1,89 @@ +// Type definitions for htmlparser2 v3.7.x +// Project: https://github.com/fb55/htmlparser2/ +// Definitions by: James Roland Cabresos +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "htmlparser2" { + + export interface Handler { + onopentag?:(name:string, attribs:{[type:string]: string}) => void; + onopentagname?:(name:string) => void; + onattribute?:(name:string, value:string) => void; + ontext?:(text:string) => void; + onclosetag?: (text:string) => void; + onprocessinginstruction?:(name:string, data:string) => void; + oncomment?:(data:string) => void; + oncommentend?:() => void; + oncdatastart?:() => void; + oncdataend?:() => void; + onerror?:(error:Error) => void; + onreset?:() => void; + onend?:() => void; + } + + export interface Options { + + /*** + * Indicates whether special tags (